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 ADIDEBUG   0
 
#define KDEBUG   2
 
#define ENTER_USE_MEMMOVE
 
#define pDivComp_EQUAL   2
 
#define pDivComp_LESS   1
 
#define pDivComp_GREATER   -1
 
#define pDivComp_INCOMP   0
 
#define REDTAIL_CANONICALIZE   100
 

Functions

static poly redMora (poly h, int maxIndex, kStrategy strat)
 
static poly redBba (poly h, int maxIndex, kStrategy strat)
 
static int pDivCompRing (poly p, poly q)
 
static int pDivComp (poly p, poly q)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext)
 
void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void cancelunit (LObject *L, BOOLEAN inNF)
 
void HEckeTest (poly pp, kStrategy strat)
 
static intset initec (const int maxnr)
 
static unsigned long * initsevS (const int maxnr)
 
static int * initS_2_R (const int maxnr)
 
static void enlargeT (TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
 
void cleanT (kStrategy strat)
 
static void enlargeL (LSet *L, int *length, const int incr)
 
void initPairtest (kStrategy strat)
 
BOOLEAN isInPairsetL (int length, poly p1, poly p2, int *k, kStrategy strat)
 
BOOLEAN isInPairsetB (poly q, int *k, kStrategy strat)
 
int kFindInT (poly p, TSet T, int tlength)
 returns index of p in TSet, or -1 if not found More...
 
int kFindInT (poly p, kStrategy strat)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
void initEcartPairBba (LObject *Lp, poly, poly, int, int)
 
void initEcartPairMora (LObject *Lp, poly, poly, int ecartF, int ecartG)
 
static BOOLEAN sugarDivisibleBy (int ecart1, int ecart2)
 
void enterOnePairRing (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
BOOLEAN enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static BOOLEAN p_HasNotCF_Lift (poly p1, poly p2, const ring r)
 p_HasNotCF for the IDLIFT case: ignore component More...
 
void enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSig (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSpecial (int i, poly p, int ecart, kStrategy strat, int atR=-1)
 
void kMergeBintoL (kStrategy strat)
 
void kMergeBintoLSba (kStrategy strat)
 
void chainCritNormal (poly p, int ecart, kStrategy strat)
 
void chainCritOpt_1 (poly, int, kStrategy strat)
 
void chainCritSig (poly p, int, kStrategy strat)
 
void chainCritPart (poly p, int ecart, kStrategy strat)
 
void initenterpairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void 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 posInLRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInSyz (const kStrategy strat, poly sig)
 
int posInLF5C (const LSet, const int, LObject *, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL11Ring (const LSet set, const int length, LObject *p, const kStrategy strat)
 
int posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy strat)
 
int getIndexRng (long coeff)
 
int posInLrg0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110 (const LSet set, const int length, LObject *p, const kStrategy)
 
int 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 enterT_strong (LObject &p, kStrategy strat, int atT)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void initHilbCrit (ideal, ideal, intvec **hilb, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
BOOLEAN kPosInLDependsOnLength (int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
 
void initBuchMoraPos (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT)
 
BOOLEAN newHEdge (kStrategy strat)
 
BOOLEAN kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
 
BOOLEAN kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
 
poly preIntegerCheck (ideal FOrig, ideal Q)
 used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMon (LObject *h, kStrategy strat)
 used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void finalReduceByMon (kStrategy strat)
 used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output More...
 
BOOLEAN kStratChangeTailRing (kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
 
void kStratInitChangeTailRing (kStrategy strat)
 
ring sbaRing (kStrategy strat, const ring r, BOOLEAN, int)
 
int posInT_EcartFDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_FDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_pLength (const TSet set, const int length, LObject &p)
 
int redFirst (LObject *h, kStrategy strat)
 
int redEcart (LObject *h, kStrategy strat)
 
void enterSMora (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSMoraNF (LObject &p, int atS, kStrategy strat, int atR=-1)
 
char * showOption ()
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject H, kStrategy strat)
 
void updateSShift (kStrategy strat, int uptodeg, int lV)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
 
void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
 
void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int, int lV)
 
void enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
 
void initenterpairsShift (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterTShift (LObject p, kStrategy strat, int atT, int uptodeg, int lV)
 
poly redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 

Variables

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

Macro Definition Documentation

#define ADIDEBUG   0

Definition at line 14 of file kutil.cc.

#define ENTER_USE_MEMMOVE

Definition at line 44 of file kutil.cc.

#define KDEBUG   2

Definition at line 29 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 5802 of file kutil.cc.

5803 {
5804  poly p1 = pOne();
5805  poly p2 = pOne();
5806  for (int ii=strat->sl; ii>start; ii--)
5807  {
5808  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
5809  {
5810  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
5811  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
5812  if (!(pLmCmp(p1,p2) == 1))
5813  {
5814  pDelete(&p1);
5815  pDelete(&p2);
5816  return TRUE;
5817  }
5818  }
5819  }
5820  pDelete(&p1);
5821  pDelete(&p2);
5822  return FALSE;
5823 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:144
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:1711
LObject P
Definition: kutil.h:298
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
#define pDelete(p_ptr)
Definition: polys.h:157
int sl
Definition: kutil.h:346
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1354
polyrec * poly
Definition: hilb.h:10
BOOLEAN arriRewCriterionPre ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int   
)

Definition at line 5825 of file kutil.cc.

5826 {
5827  int found = -1;
5828  for (int i=strat->Bl; i>-1; i--) {
5829  if (pLmEqual(strat->B[i].sig,sig)) {
5830  found = i;
5831  break;
5832  }
5833  }
5834  if (found != -1) {
5835  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1) {
5836  deleteInL(strat->B,&strat->Bl,found,strat);
5837  } else {
5838  return TRUE;
5839  }
5840  }
5841  poly p1 = pOne();
5842  poly p2 = pOne();
5843  for (int ii=strat->sl; ii>-1; ii--)
5844  {
5845  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
5846  {
5847  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
5848  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
5849  if (!(pLmCmp(p1,p2) == 1))
5850  {
5851  pDelete(&p1);
5852  pDelete(&p2);
5853  return TRUE;
5854  }
5855  }
5856  }
5857  pDelete(&p1);
5858  pDelete(&p2);
5859  return FALSE;
5860 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:144
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:1711
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
LSet B
Definition: kutil.h:324
#define pDelete(p_ptr)
Definition: polys.h:157
int sl
Definition: kutil.h:346
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1354
polyrec * poly
Definition: hilb.h:10
#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  #if ADIDEBUG
341  printf("\n cancelunit\n");
342  pWrite(p);
343  #endif
344 #ifdef HAVE_RINGS
345  // Leading coef have to be a unit
346  // example 2x+4x2 should be simplified to 2x*(1+2x)
347  // and 2 is not a unit in Z
348  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
349 #endif
350 
351  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
352 
353 // for(i=r->N;i>0;i--)
354 // {
355 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
356 // }
357  h = pNext(p);
358 
359  loop
360  {
361  if (h==NULL)
362  {
363  p_Delete(&pNext(p), r);
364  if (!inNF)
365  {
366  number eins;
367 #ifdef HAVE_RINGS
368  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
369  eins = nCopy(lc);
370  else
371 #endif
372  eins=nInit(1);
373  if (L->p != NULL)
374  {
375  pSetCoeff(L->p,eins);
376  if (L->t_p != NULL)
377  pSetCoeff0(L->t_p,eins);
378  }
379  else
380  pSetCoeff(L->t_p,eins);
381  /* p and t_p share the same coeff, if both are !=NULL */
382  /* p==NULL==t_p cannot happen here */
383  }
384  L->ecart = 0;
385  L->length = 1;
386  //if (L->pLength > 0)
387  L->pLength = 1;
388  L->max = NULL;
389 
390  if (L->t_p != NULL && pNext(L->t_p) != NULL)
391  p_Delete(&pNext(L->t_p),r);
392  if (L->p != NULL && pNext(L->p) != NULL)
393  pNext(L->p) = NULL;
394 
395  return;
396  }
397  i = 0;
398  loop
399  {
400  i++;
401  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
402  if (i == r->N) break; // does divide, try next monom
403  }
404  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
405  #ifdef HAVE_RINGS
406  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
407  // domains), no zerodivisor test needed CAUTION
408  #if ADIDEBUG
409  pWrite(h);
410  #endif
411  if (rField_is_Ring(r) && !n_DivBy(pGetCoeff(h),lc,r->cf))
412  {
413  #if ADIDEBUG
414  printf("\nDoes not divide\n");
415  #endif
416  return;
417  }
418  #if ADIDEBUG
419  printf("\nDivides. Go On\n");
420  #endif
421  #endif
422  pIter(h);
423  }
424 }
return
Definition: syzextra.cc:280
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
void pWrite(poly p)
Definition: polys.h:279
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:464
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:776
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:849
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define TEST_OPT_CANCELUNIT
Definition: options.h:122
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1207
void cancelunit1 ( LObject p,
int *  suc,
int  index,
kStrategy  strat 
)

Definition at line 7189 of file kutil.cc.

7190 {
7191  int k;
7192  poly r,h,h1,q;
7193 
7194  if (!pIsVector((*p).p) && ((*p).ecart != 0))
7195  {
7196 #ifdef HAVE_RINGS
7197  // Leading coef have to be a unit: no
7198  // example 2x+4x2 should be simplified to 2x*(1+2x)
7199  // and 2 is not a unit in Z
7200  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
7201 #endif
7202  k = 0;
7203  h1 = r = pCopy((*p).p);
7204  h =pNext(r);
7205  loop
7206  {
7207  if (h==NULL)
7208  {
7209  pDelete(&r);
7210  pDelete(&(pNext((*p).p)));
7211  (*p).ecart = 0;
7212  (*p).length = 1;
7213  (*p).pLength = 1;
7214  (*suc)=0;
7215  return;
7216  }
7217  if (!pDivisibleBy(r,h))
7218  {
7219  q=redBba1(h,index ,strat);
7220  if (q != h)
7221  {
7222  k++;
7223  pDelete(&h);
7224  pNext(h1) = h = q;
7225  }
7226  else
7227  {
7228  pDelete(&r);
7229  return;
7230  }
7231  }
7232  else
7233  {
7234  h1 = h;
7235  pIter(h);
7236  }
7237  if (k > 10)
7238  {
7239  pDelete(&r);
7240  return;
7241  }
7242  }
7243  }
7244 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7172
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:126
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define pIsVector(p)
Definition: polys.h:221
void chainCritNormal ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2447 of file kutil.cc.

2448 {
2449  int i,j,l;
2450 
2451  /*
2452  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2453  *In this case all elements in B such
2454  *that their lcm is divisible by the leading term of S[i] can be canceled
2455  */
2456  if (strat->pairtest!=NULL)
2457  {
2458  {
2459  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2460  for (j=0; j<=strat->sl; j++)
2461  {
2462  if (strat->pairtest[j])
2463  {
2464  for (i=strat->Bl; i>=0; i--)
2465  {
2466  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
2467  {
2468  deleteInL(strat->B,&strat->Bl,i,strat);
2469  strat->c3++;
2470  }
2471  }
2472  }
2473  }
2474  }
2475  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2476  strat->pairtest=NULL;
2477  }
2478  if (strat->Gebauer || strat->fromT)
2479  {
2480  if (strat->sugarCrit)
2481  {
2482  /*
2483  *suppose L[j] == (s,r) and p/lcm(s,r)
2484  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2485  *and in case the sugar is o.k. then L[j] can be canceled
2486  */
2487  for (j=strat->Ll; j>=0; j--)
2488  {
2489  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
2490  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2491  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2492  {
2493  if (strat->L[j].p == strat->tail)
2494  {
2495  deleteInL(strat->L,&strat->Ll,j,strat);
2496  strat->c3++;
2497  }
2498  }
2499  }
2500  /*
2501  *this is GEBAUER-MOELLER:
2502  *in B all elements with the same lcm except the "best"
2503  *(i.e. the last one in B with this property) will be canceled
2504  */
2505  j = strat->Bl;
2506  loop /*cannot be changed into a for !!! */
2507  {
2508  if (j <= 0) break;
2509  i = j-1;
2510  loop
2511  {
2512  if (i < 0) break;
2513  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2514  {
2515  strat->c3++;
2516  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
2517  {
2518  deleteInL(strat->B,&strat->Bl,i,strat);
2519  j--;
2520  }
2521  else
2522  {
2523  deleteInL(strat->B,&strat->Bl,j,strat);
2524  break;
2525  }
2526  }
2527  i--;
2528  }
2529  j--;
2530  }
2531  }
2532  else /*sugarCrit*/
2533  {
2534  /*
2535  *suppose L[j] == (s,r) and p/lcm(s,r)
2536  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2537  *and in case the sugar is o.k. then L[j] can be canceled
2538  */
2539  for (j=strat->Ll; j>=0; j--)
2540  {
2541  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2542  {
2543  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2544  {
2545  deleteInL(strat->L,&strat->Ll,j,strat);
2546  strat->c3++;
2547  }
2548  }
2549  }
2550  /*
2551  *this is GEBAUER-MOELLER:
2552  *in B all elements with the same lcm except the "best"
2553  *(i.e. the last one in B with this property) will be canceled
2554  */
2555  j = strat->Bl;
2556  loop /*cannot be changed into a for !!! */
2557  {
2558  if (j <= 0) break;
2559  for(i=j-1; i>=0; i--)
2560  {
2561  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2562  {
2563  strat->c3++;
2564  deleteInL(strat->B,&strat->Bl,i,strat);
2565  j--;
2566  }
2567  }
2568  j--;
2569  }
2570  }
2571  /*
2572  *the elements of B enter L
2573  */
2574  kMergeBintoL(strat);
2575  }
2576  else
2577  {
2578  for (j=strat->Ll; j>=0; j--)
2579  {
2580  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2581  {
2582  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2583  {
2584  deleteInL(strat->L,&strat->Ll,j,strat);
2585  strat->c3++;
2586  }
2587  }
2588  }
2589  /*
2590  *this is our MODIFICATION of GEBAUER-MOELLER:
2591  *First the elements of B enter L,
2592  *then we fix a lcm and the "best" element in L
2593  *(i.e the last in L with this lcm and of type (s,p))
2594  *and cancel all the other elements of type (r,p) with this lcm
2595  *except the case the element (s,r) has also the same lcm
2596  *and is on the worst position with respect to (s,p) and (r,p)
2597  */
2598  /*
2599  *B enters to L/their order with respect to B is permutated for elements
2600  *B[i].p with the same leading term
2601  */
2602  kMergeBintoL(strat);
2603  j = strat->Ll;
2604  loop /*cannot be changed into a for !!! */
2605  {
2606  if (j <= 0)
2607  {
2608  /*now L[0] cannot be canceled any more and the tail can be removed*/
2609  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2610  break;
2611  }
2612  if (strat->L[j].p2 == p)
2613  {
2614  i = j-1;
2615  loop
2616  {
2617  if (i < 0) break;
2618  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2619  {
2620  /*L[i] could be canceled but we search for a better one to cancel*/
2621  strat->c3++;
2622  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2623  && (pNext(strat->L[l].p) == strat->tail)
2624  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2625  && pDivisibleBy(p,strat->L[l].lcm))
2626  {
2627  /*
2628  *"NOT equal(...)" because in case of "equal" the element L[l]
2629  *is "older" and has to be from theoretical point of view behind
2630  *L[i], but we do not want to reorder L
2631  */
2632  strat->L[i].p2 = strat->tail;
2633  /*
2634  *L[l] will be canceled, we cannot cancel L[i] later on,
2635  *so we mark it with "tail"
2636  */
2637  deleteInL(strat->L,&strat->Ll,l,strat);
2638  i--;
2639  }
2640  else
2641  {
2642  deleteInL(strat->L,&strat->Ll,i,strat);
2643  }
2644  j--;
2645  }
2646  i--;
2647  }
2648  }
2649  else if (strat->L[j].p2 == strat->tail)
2650  {
2651  /*now L[j] cannot be canceled any more and the tail can be removed*/
2652  strat->L[j].p2 = p;
2653  }
2654  j--;
2655  }
2656  }
2657 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:369
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:581
BOOLEAN Gebauer
Definition: kutil.h:368
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:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:126
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 2662 of file kutil.cc.

2663 {
2664  if (strat->pairtest!=NULL)
2665  {
2666  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2667  strat->pairtest=NULL;
2668  }
2669  /*
2670  *the elements of B enter L
2671  */
2672  kMergeBintoL(strat);
2673 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
int BOOLEAN
Definition: auxiliary.h:131
void chainCritPart ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2737 of file kutil.cc.

2738 {
2739  int i,j,l;
2740 
2741  /*
2742  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2743  *In this case all elements in B such
2744  *that their lcm is divisible by the leading term of S[i] can be canceled
2745  */
2746  if (strat->pairtest!=NULL)
2747  {
2748  {
2749  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2750  for (j=0; j<=strat->sl; j++)
2751  {
2752  if (strat->pairtest[j])
2753  {
2754  for (i=strat->Bl; i>=0; i--)
2755  {
2756  if (_p_LmDivisibleByPart(strat->S[j],currRing,
2757  strat->B[i].lcm,currRing,
2758  currRing->real_var_start,currRing->real_var_end))
2759  {
2760  if(TEST_OPT_DEBUG)
2761  {
2762  Print("chain-crit-part: S[%d]=",j);
2763  p_wrp(strat->S[j],currRing);
2764  Print(" divide B[%d].lcm=",i);
2765  p_wrp(strat->B[i].lcm,currRing);
2766  PrintLn();
2767  }
2768  deleteInL(strat->B,&strat->Bl,i,strat);
2769  strat->c3++;
2770  }
2771  }
2772  }
2773  }
2774  }
2775  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2776  strat->pairtest=NULL;
2777  }
2778  if (strat->Gebauer || strat->fromT)
2779  {
2780  if (strat->sugarCrit)
2781  {
2782  /*
2783  *suppose L[j] == (s,r) and p/lcm(s,r)
2784  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2785  *and in case the sugar is o.k. then L[j] can be canceled
2786  */
2787  for (j=strat->Ll; j>=0; j--)
2788  {
2789  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
2790  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2791  && pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2792  {
2793  if (strat->L[j].p == strat->tail)
2794  {
2795  if(TEST_OPT_DEBUG)
2796  {
2797  PrintS("chain-crit-part: pCompareChainPart p=");
2798  p_wrp(p,currRing);
2799  Print(" delete L[%d]",j);
2800  p_wrp(strat->L[j].lcm,currRing);
2801  PrintLn();
2802  }
2803  deleteInL(strat->L,&strat->Ll,j,strat);
2804  strat->c3++;
2805  }
2806  }
2807  }
2808  /*
2809  *this is GEBAUER-MOELLER:
2810  *in B all elements with the same lcm except the "best"
2811  *(i.e. the last one in B with this property) will be canceled
2812  */
2813  j = strat->Bl;
2814  loop /*cannot be changed into a for !!! */
2815  {
2816  if (j <= 0) break;
2817  i = j-1;
2818  loop
2819  {
2820  if (i < 0) break;
2821  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2822  {
2823  strat->c3++;
2824  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
2825  {
2826  if(TEST_OPT_DEBUG)
2827  {
2828  Print("chain-crit-part: sugar B[%d].lcm=",j);
2829  p_wrp(strat->B[j].lcm,currRing);
2830  Print(" delete B[%d]",i);
2831  p_wrp(strat->B[i].lcm,currRing);
2832  PrintLn();
2833  }
2834  deleteInL(strat->B,&strat->Bl,i,strat);
2835  j--;
2836  }
2837  else
2838  {
2839  if(TEST_OPT_DEBUG)
2840  {
2841  Print("chain-crit-part: sugar B[%d].lcm=",i);
2842  p_wrp(strat->B[i].lcm,currRing);
2843  Print(" delete B[%d]",j);
2844  p_wrp(strat->B[j].lcm,currRing);
2845  PrintLn();
2846  }
2847  deleteInL(strat->B,&strat->Bl,j,strat);
2848  break;
2849  }
2850  }
2851  i--;
2852  }
2853  j--;
2854  }
2855  }
2856  else /*sugarCrit*/
2857  {
2858  /*
2859  *suppose L[j] == (s,r) and p/lcm(s,r)
2860  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2861  *and in case the sugar is o.k. then L[j] can be canceled
2862  */
2863  for (j=strat->Ll; j>=0; j--)
2864  {
2865  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2866  {
2867  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2868  {
2869  if(TEST_OPT_DEBUG)
2870  {
2871  PrintS("chain-crit-part: sugar:pCompareChainPart p=");
2872  p_wrp(p,currRing);
2873  Print(" delete L[%d]",j);
2874  p_wrp(strat->L[j].lcm,currRing);
2875  PrintLn();
2876  }
2877  deleteInL(strat->L,&strat->Ll,j,strat);
2878  strat->c3++;
2879  }
2880  }
2881  }
2882  /*
2883  *this is GEBAUER-MOELLER:
2884  *in B all elements with the same lcm except the "best"
2885  *(i.e. the last one in B with this property) will be canceled
2886  */
2887  j = strat->Bl;
2888  loop /*cannot be changed into a for !!! */
2889  {
2890  if (j <= 0) break;
2891  for(i=j-1; i>=0; i--)
2892  {
2893  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2894  {
2895  if(TEST_OPT_DEBUG)
2896  {
2897  Print("chain-crit-part: equal lcm B[%d].lcm=",j);
2898  p_wrp(strat->B[j].lcm,currRing);
2899  Print(" delete B[%d]\n",i);
2900  }
2901  strat->c3++;
2902  deleteInL(strat->B,&strat->Bl,i,strat);
2903  j--;
2904  }
2905  }
2906  j--;
2907  }
2908  }
2909  /*
2910  *the elements of B enter L
2911  */
2912  kMergeBintoL(strat);
2913  }
2914  else
2915  {
2916  for (j=strat->Ll; j>=0; j--)
2917  {
2918  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2919  {
2920  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2921  {
2922  if(TEST_OPT_DEBUG)
2923  {
2924  PrintS("chain-crit-part: pCompareChainPart p=");
2925  p_wrp(p,currRing);
2926  Print(" delete L[%d]",j);
2927  p_wrp(strat->L[j].lcm,currRing);
2928  PrintLn();
2929  }
2930  deleteInL(strat->L,&strat->Ll,j,strat);
2931  strat->c3++;
2932  }
2933  }
2934  }
2935  /*
2936  *this is our MODIFICATION of GEBAUER-MOELLER:
2937  *First the elements of B enter L,
2938  *then we fix a lcm and the "best" element in L
2939  *(i.e the last in L with this lcm and of type (s,p))
2940  *and cancel all the other elements of type (r,p) with this lcm
2941  *except the case the element (s,r) has also the same lcm
2942  *and is on the worst position with respect to (s,p) and (r,p)
2943  */
2944  /*
2945  *B enters to L/their order with respect to B is permutated for elements
2946  *B[i].p with the same leading term
2947  */
2948  kMergeBintoL(strat);
2949  j = strat->Ll;
2950  loop /*cannot be changed into a for !!! */
2951  {
2952  if (j <= 0)
2953  {
2954  /*now L[0] cannot be canceled any more and the tail can be removed*/
2955  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2956  break;
2957  }
2958  if (strat->L[j].p2 == p)
2959  {
2960  i = j-1;
2961  loop
2962  {
2963  if (i < 0) break;
2964  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2965  {
2966  /*L[i] could be canceled but we search for a better one to cancel*/
2967  strat->c3++;
2968  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2969  && (pNext(strat->L[l].p) == strat->tail)
2970  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2972  strat->L[l].lcm,currRing,
2973  currRing->real_var_start, currRing->real_var_end))
2974 
2975  {
2976  /*
2977  *"NOT equal(...)" because in case of "equal" the element L[l]
2978  *is "older" and has to be from theoretical point of view behind
2979  *L[i], but we do not want to reorder L
2980  */
2981  strat->L[i].p2 = strat->tail;
2982  /*
2983  *L[l] will be canceled, we cannot cancel L[i] later on,
2984  *so we mark it with "tail"
2985  */
2986  if(TEST_OPT_DEBUG)
2987  {
2988  PrintS("chain-crit-part: divisible_by p=");
2989  p_wrp(p,currRing);
2990  Print(" delete L[%d]",l);
2991  p_wrp(strat->L[l].lcm,currRing);
2992  PrintLn();
2993  }
2994  deleteInL(strat->L,&strat->Ll,l,strat);
2995  i--;
2996  }
2997  else
2998  {
2999  if(TEST_OPT_DEBUG)
3000  {
3001  PrintS("chain-crit-part: divisible_by(2) p=");
3002  p_wrp(p,currRing);
3003  Print(" delete L[%d]",i);
3004  p_wrp(strat->L[i].lcm,currRing);
3005  PrintLn();
3006  }
3007  deleteInL(strat->L,&strat->Ll,i,strat);
3008  }
3009  j--;
3010  }
3011  i--;
3012  }
3013  }
3014  else if (strat->L[j].p2 == strat->tail)
3015  {
3016  /*now L[j] cannot be canceled any more and the tail can be removed*/
3017  strat->L[j].p2 = p;
3018  }
3019  j--;
3020  }
3021  }
3022 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define TEST_OPT_DEBUG
Definition: options.h:103
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:369
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:581
BOOLEAN Gebauer
Definition: kutil.h:368
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
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:1636
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
#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 3162 of file kutil.cc.

3163 {
3164  int i,j,l;
3165  /*
3166  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3167  *In this case all elements in B such
3168  *that their lcm is divisible by the leading term of S[i] can be canceled
3169  */
3170  if (strat->pairtest!=NULL)
3171  {
3172  {
3173  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3174  for (j=0; j<=strat->sl; j++)
3175  {
3176  if (strat->pairtest[j])
3177  {
3178  for (i=strat->Bl; i>=0; i--)
3179  {
3180  if (pDivisibleBy(strat->S[j],strat->B[i].lcm) && n_DivBy(strat->B[i].lcm->coef, strat->S[j]->coef,currRing))
3181  {
3182 #ifdef KDEBUG
3183  if (TEST_OPT_DEBUG)
3184  {
3185  PrintS("--- chain criterion func chainCritRing type 1\n");
3186  PrintS("strat->S[j]:");
3187  wrp(strat->S[j]);
3188  PrintS(" strat->B[i].lcm:");
3189  wrp(strat->B[i].lcm);PrintLn();
3190  pWrite(strat->B[i].p);
3191  pWrite(strat->B[i].p1);
3192  pWrite(strat->B[i].p2);
3193  wrp(strat->B[i].lcm);
3194  PrintLn();
3195  }
3196 #endif
3197  #if ADIDEBUG
3198  printf("\nChainCrit1\n");
3199  pWrite(strat->B[i].p);
3200  pWrite(strat->B[i].p1);
3201  pWrite(strat->B[i].p2);
3202  #endif
3203  deleteInL(strat->B,&strat->Bl,i,strat);
3204  strat->c3++;
3205  }
3206  }
3207  }
3208  }
3209  }
3210  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3211  strat->pairtest=NULL;
3212  }
3213  assume(!(strat->Gebauer || strat->fromT));
3214  for (j=strat->Ll; j>=0; j--)
3215  {
3216  if ((strat->L[j].lcm != NULL) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(p), currRing->cf))
3217  {
3218  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3219  {
3220  if ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3221  {
3222  #if ADIDEBUG
3223  printf("\nChainCrit2\n");
3224  pWrite(strat->L[j].p);
3225  pWrite(strat->L[j].p1);
3226  pWrite(strat->L[j].p2);
3227  #endif
3228  deleteInL(strat->L,&strat->Ll,j,strat);
3229  strat->c3++;
3230 #ifdef KDEBUG
3231  if (TEST_OPT_DEBUG)
3232  {
3233  PrintS("--- chain criterion func chainCritRing type 2\n");
3234  PrintS("strat->L[j].p:");
3235  wrp(strat->L[j].p);
3236  PrintS(" p:");
3237  wrp(p);
3238  PrintLn();
3239  }
3240 #endif
3241  }
3242  }
3243  }
3244  }
3245  /*
3246  *this is our MODIFICATION of GEBAUER-MOELLER:
3247  *First the elements of B enter L,
3248  *then we fix a lcm and the "best" element in L
3249  *(i.e the last in L with this lcm and of type (s,p))
3250  *and cancel all the other elements of type (r,p) with this lcm
3251  *except the case the element (s,r) has also the same lcm
3252  *and is on the worst position with respect to (s,p) and (r,p)
3253  */
3254  /*
3255  *B enters to L/their order with respect to B is permutated for elements
3256  *B[i].p with the same leading term
3257  */
3258  kMergeBintoL(strat);
3259  j = strat->Ll;
3260  loop /*cannot be changed into a for !!! */
3261  {
3262  if (j <= 0)
3263  {
3264  /*now L[0] cannot be canceled any more and the tail can be removed*/
3265  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3266  break;
3267  }
3268  if (strat->L[j].p2 == p) // Was the element added from B?
3269  {
3270  i = j-1;
3271  loop
3272  {
3273  if (i < 0) break;
3274  // Element is from B and has the same lcm as L[j]
3275  if ((strat->L[i].p2 == p) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(strat->L[i].lcm), currRing->cf)
3276  && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3277  {
3278  /*L[i] could be canceled but we search for a better one to cancel*/
3279  strat->c3++;
3280 #ifdef KDEBUG
3281  if (TEST_OPT_DEBUG)
3282  {
3283  PrintS("--- chain criterion func chainCritRing type 3\n");
3284  PrintS("strat->L[j].lcm:");
3285  wrp(strat->L[j].lcm);
3286  PrintS(" strat->L[i].lcm:");
3287  wrp(strat->L[i].lcm);
3288  PrintLn();
3289  }
3290 #endif
3291  #if ADIDEBUG
3292  printf("\nChainCrit3\n");
3293  pWrite(strat->L[j].p);
3294  pWrite(strat->L[j].p1);
3295  pWrite(strat->L[j].p2);
3296  #endif
3297  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3298  && (pNext(strat->L[l].p) == strat->tail)
3299  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3300  && pDivisibleBy(p,strat->L[l].lcm))
3301  {
3302  /*
3303  *"NOT equal(...)" because in case of "equal" the element L[l]
3304  *is "older" and has to be from theoretical point of view behind
3305  *L[i], but we do not want to reorder L
3306  */
3307  strat->L[i].p2 = strat->tail;
3308  /*
3309  *L[l] will be canceled, we cannot cancel L[i] later on,
3310  *so we mark it with "tail"
3311  */
3312  deleteInL(strat->L,&strat->Ll,l,strat);
3313  i--;
3314  }
3315  else
3316  {
3317  deleteInL(strat->L,&strat->Ll,i,strat);
3318  }
3319  j--;
3320  }
3321  i--;
3322  }
3323  }
3324  else if (strat->L[j].p2 == strat->tail)
3325  {
3326  /*now L[j] cannot be canceled any more and the tail can be removed*/
3327  strat->L[j].p2 = p;
3328  }
3329  j--;
3330  }
3331 }
void PrintLn()
Definition: reporter.cc:327
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
void pWrite(poly p)
Definition: polys.h:279
#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:1049
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:369
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:581
BOOLEAN Gebauer
Definition: kutil.h:368
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:776
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:332
polyset S
Definition: kutil.h:302
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:126
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
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 2678 of file kutil.cc.

2679 {
2680  int i,j,l;
2681  kMergeBintoLSba(strat);
2682  j = strat->Ll;
2683  loop /*cannot be changed into a for !!! */
2684  {
2685  if (j <= 0)
2686  {
2687  /*now L[0] cannot be canceled any more and the tail can be removed*/
2688  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2689  break;
2690  }
2691  if (strat->L[j].p2 == p)
2692  {
2693  i = j-1;
2694  loop
2695  {
2696  if (i < 0) break;
2697  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2698  {
2699  /*L[i] could be canceled but we search for a better one to cancel*/
2700  strat->c3++;
2701  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2702  && (pNext(strat->L[l].p) == strat->tail)
2703  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2704  && pDivisibleBy(p,strat->L[l].lcm))
2705  {
2706  /*
2707  *"NOT equal(...)" because in case of "equal" the element L[l]
2708  *is "older" and has to be from theoretical point of view behind
2709  *L[i], but we do not want to reorder L
2710  */
2711  strat->L[i].p2 = strat->tail;
2712  /*
2713  *L[l] will be canceled, we cannot cancel L[i] later on,
2714  *so we mark it with "tail"
2715  */
2716  deleteInL(strat->L,&strat->Ll,l,strat);
2717  i--;
2718  }
2719  else
2720  {
2721  deleteInL(strat->L,&strat->Ll,i,strat);
2722  }
2723  j--;
2724  }
2725  i--;
2726  }
2727  }
2728  else if (strat->L[j].p2 == strat->tail)
2729  {
2730  /*now L[j] cannot be canceled any more and the tail can be removed*/
2731  strat->L[j].p2 = p;
2732  }
2733  j--;
2734  }
2735 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:581
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:2424
LSet L
Definition: kutil.h:323
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h: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 505 of file kutil.cc.

506 {
507  int i,j;
508  poly p;
509  assume(currRing == strat->tailRing || strat->tailRing != NULL);
510 
511  pShallowCopyDeleteProc p_shallow_copy_delete =
512  (strat->tailRing != currRing ?
514  NULL);
515 
516  for (j=0; j<=strat->tl; j++)
517  {
518  p = strat->T[j].p;
519  strat->T[j].p=NULL;
520  if (strat->T[j].max != NULL)
521  {
522  p_LmFree(strat->T[j].max, strat->tailRing);
523  }
524  i = -1;
525  loop
526  {
527  i++;
528  if (i>strat->sl)
529  {
530  if (strat->T[j].t_p != NULL)
531  {
532  p_Delete(&(strat->T[j].t_p), strat->tailRing);
533  p_LmFree(p, currRing);
534  }
535  else
536  pDelete(&p);
537  break;
538  }
539  if (p == strat->S[i])
540  {
541  if (strat->T[j].t_p != NULL)
542  {
543  assume(p_shallow_copy_delete != NULL);
544  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
545  currRing->PolyBin);
546  p_LmFree(strat->T[j].t_p, strat->tailRing);
547  }
548  break;
549  }
550  }
551  }
552  strat->tl=-1;
553 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:348
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:849
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10
void clearSbatch ( poly  h,
int  k,
int  pos,
kStrategy  strat 
)

Definition at line 3874 of file kutil.cc.

3875 {
3876  int j = pos;
3877  if ( (!strat->fromT)
3878  && ((strat->syzComp==0)
3879  ||(pGetComp(h)<=strat->syzComp)
3880  ))
3881  {
3882  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3883  unsigned long h_sev = pGetShortExpVector(h);
3884  loop
3885  {
3886  if (j > k) break;
3887  clearS(h,h_sev, &j,&k,strat);
3888  j++;
3889  }
3890  // Print("end clearS sl=%d\n",strat->sl);
3891  }
3892 }
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
BOOLEAN fromT
Definition: kutil.h:369
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:1141
static Poly * h
Definition: janet.cc:978
void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 8797 of file kutil.cc.

8798 {
8799  int i;
8800  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
8801  LObject L;
8802 
8803 #ifdef KDEBUG
8804  // need to set this: during tailreductions of T[i], T[i].max is out of
8805  // sync
8806  sloppy_max = TRUE;
8807 #endif
8808 
8809  strat->noTailReduction = FALSE;
8810  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
8811  if (TEST_OPT_PROT)
8812  {
8813  PrintLn();
8814 // if (timerv) writeTime("standard base computed:");
8815  }
8816  if (TEST_OPT_PROT)
8817  {
8818  Print("(S:%d)",strat->sl);mflush();
8819  }
8820  for (i=strat->sl; i>=low; i--)
8821  {
8822  int end_pos=strat->sl;
8823  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
8824  if (strat->ak==0) end_pos=i-1;
8825  TObject* T_j = strat->s_2_t(i);
8826  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
8827  {
8828  L = *T_j;
8829  #ifdef KDEBUG
8830  if (TEST_OPT_DEBUG)
8831  {
8832  Print("test S[%d]:",i);
8833  p_wrp(L.p,currRing,strat->tailRing);
8834  PrintLn();
8835  }
8836  #endif
8838  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
8839  else
8840  strat->S[i] = redtail(&L, strat->sl, strat);
8841  #ifdef KDEBUG
8842  if (TEST_OPT_DEBUG)
8843  {
8844  Print("to (tailR) S[%d]:",i);
8845  p_wrp(strat->S[i],currRing,strat->tailRing);
8846  PrintLn();
8847  }
8848  #endif
8849 
8850  if (strat->redTailChange && strat->tailRing != currRing)
8851  {
8852  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
8853  if (pNext(T_j->p) != NULL)
8854  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
8855  else
8856  T_j->max = NULL;
8857  }
8859  T_j->pCleardenom();
8860  }
8861  else
8862  {
8863  assume(currRing == strat->tailRing);
8864  #ifdef KDEBUG
8865  if (TEST_OPT_DEBUG)
8866  {
8867  Print("test S[%d]:",i);
8868  p_wrp(strat->S[i],currRing,strat->tailRing);
8869  PrintLn();
8870  }
8871  #endif
8873  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
8874  else
8875  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
8877  {
8878  if (TEST_OPT_CONTENTSB)
8879  {
8880  number n;
8881  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8882  if (!nIsOne(n))
8883  {
8885  denom->n=nInvers(n);
8886  denom->next=DENOMINATOR_LIST;
8887  DENOMINATOR_LIST=denom;
8888  }
8889  nDelete(&n);
8890  }
8891  else
8892  {
8893  //pContent(strat->S[i]);
8894  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8895  }
8896  }
8897  #ifdef KDEBUG
8898  if (TEST_OPT_DEBUG)
8899  {
8900  Print("to (-tailR) S[%d]:",i);
8901  p_wrp(strat->S[i],currRing,strat->tailRing);
8902  PrintLn();
8903  }
8904  #endif
8905  }
8906  if (TEST_OPT_PROT)
8907  PrintS("-");
8908  }
8909  if (TEST_OPT_PROT) PrintLn();
8910 #ifdef KDEBUG
8911  sloppy_max = FALSE;
8912 #endif
8913 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#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:351
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6047
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
#define mflush()
Definition: reporter.h:55
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2837
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:317
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
ring tailRing
Definition: kutil.h:341
denominator_list next
Definition: kutil.h:67
#define pNext(p)
Definition: monomials.h:43
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:346
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2707
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
ideal createG0 ( )

Definition at line 3683 of file kutil.cc.

3684 {
3685  // Initialize
3686  long exp[50]; // The exponent of \hat{X} (basepoint)
3687  long cexp[50]; // The current exponent for iterating over all
3688  long ind[50]; // The power of 2 in the i-th component of exp
3689  long cind[50]; // analog for cexp
3690  long mult[50]; // How to multiply the elements of G
3691  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3692  long habsind = 0; // The abs. index of the coefficient of h
3693  long step[50]; // The last increases
3694  for (int i = 1; i <= currRing->N; i++)
3695  {
3696  exp[i] = 0;
3697  cexp[i] = exp[i];
3698  ind[i] = 0;
3699  step[i] = 500000;
3700  cind[i] = ind[i];
3701  }
3702  long bound = currRing->ch;
3703  step[1] = 500000;
3704 #ifdef OLI_DEBUG
3705  PrintS("-------------\npoly :");
3706 // wrp(p);
3707  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3708  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3709  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3710  Print("bound : %d\n", bound);
3711  Print("cind : %d\n", cabsind);
3712 #endif
3713  if (cabsind == 0)
3714  {
3715  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3716  {
3717  return idInit(1, 1);
3718  }
3719  }
3720  ideal G0 = idInit(1, 1);
3721  // Now the whole simplex
3722  do
3723  {
3724  // Build s-polynomial
3725  // 2**ind-def * mult * g - exp-def * h
3726  poly t_p;
3727  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
3728 #ifdef OLI_DEBUG
3729  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3730  Print("zPoly : ");
3731  wrp(zeroPoly);
3732  Print("\n");
3733 #endif
3734  // Add to ideal
3735  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
3736  IDELEMS(G0) += 1;
3737  G0->m[IDELEMS(G0) - 1] = zeroPoly;
3738  }
3739  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3740  idSkipZeroes(G0);
3741  return G0;
3742 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:3554
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:3488
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
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:649
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3551
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
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:499
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:471
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1524
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:204
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:623
P bucket
Definition: myNF.cc:79
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1473
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:849
BOOLEAN kHEdgeFound
Definition: kutil.h:366
BOOLEAN LDegLast
Definition: kutil.h:375
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
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:60
return P p
Definition: myNF.cc:203
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
int l
Definition: cfEzgcd.cc:94
void deleteInL ( LSet  set,
int *  length,
int  j,
kStrategy  strat 
)

Definition at line 1049 of file kutil.cc.

1050 {
1051  if (set[j].lcm!=NULL)
1052  {
1053 #ifdef HAVE_RINGS
1054  if (pGetCoeff(set[j].lcm) != NULL)
1055  pLmDelete(set[j].lcm);
1056  else
1057 #endif
1058  pLmFree(set[j].lcm);
1059  }
1060  if (set[j].sig!=NULL)
1061  {
1062 #ifdef HAVE_RINGS
1063  if (pGetCoeff(set[j].sig) != NULL)
1064  pLmDelete(set[j].sig);
1065  else
1066 #endif
1067  pLmFree(set[j].sig);
1068  }
1069  if (set[j].p!=NULL)
1070  {
1071  if (pNext(set[j].p) == strat->tail)
1072  {
1073 #ifdef HAVE_RINGS
1074  if (pGetCoeff(set[j].p) != NULL)
1075  pLmDelete(set[j].p);
1076  else
1077 #endif
1078  pLmFree(set[j].p);
1079  /*- tail belongs to several int spolys -*/
1080  }
1081  else
1082  {
1083  // search p in T, if it is there, do not delete it
1084  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1085  {
1086  // assure that for global orderings kFindInT fails
1087  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1088  set[j].Delete();
1089  }
1090  }
1091  }
1092  if (*length > 0 && j < *length)
1093  {
1094 #ifdef ENTER_USE_MEMMOVE
1095  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1096 #else
1097  int i;
1098  for (i=j; i < (*length); i++)
1099  set[i] = set[i+1];
1100 #endif
1101  }
1102 #ifdef KDEBUG
1103  memset(&(set[*length]),0,sizeof(LObject));
1104 #endif
1105  (*length)--;
1106 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:617
#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:332
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 942 of file kutil.cc.

943 {
944 #ifdef ENTER_USE_MEMMOVE
945  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
946  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
947  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
948  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
949 #else
950  int j;
951  for (j=i; j<strat->sl; j++)
952  {
953  strat->S[j] = strat->S[j+1];
954  strat->ecartS[j] = strat->ecartS[j+1];
955  strat->sevS[j] = strat->sevS[j+1];
956  strat->S_2_R[j] = strat->S_2_R[j+1];
957  }
958 #endif
959  if (strat->lenS!=NULL)
960  {
961 #ifdef ENTER_USE_MEMMOVE
962  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
963 #else
964  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
965 #endif
966  }
967  if (strat->lenSw!=NULL)
968  {
969 #ifdef ENTER_USE_MEMMOVE
970  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
971 #else
972  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
973 #endif
974  }
975  if (strat->fromQ!=NULL)
976  {
977 #ifdef ENTER_USE_MEMMOVE
978  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
979 #else
980  for (j=i; j<strat->sl; j++)
981  {
982  strat->fromQ[j] = strat->fromQ[j+1];
983  }
984 #endif
985  }
986  strat->S[strat->sl] = NULL;
987  strat->sl--;
988 }
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 994 of file kutil.cc.

995 {
996 #ifdef ENTER_USE_MEMMOVE
997  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
998  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
999  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1000  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1001  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1002  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1003 #else
1004  int j;
1005  for (j=i; j<strat->sl; j++)
1006  {
1007  strat->S[j] = strat->S[j+1];
1008  strat->sig[j] = strat->sig[j+1];
1009  strat->ecartS[j] = strat->ecartS[j+1];
1010  strat->sevS[j] = strat->sevS[j+1];
1011  strat->sevSig[j] = strat->sevSig[j+1];
1012  strat->S_2_R[j] = strat->S_2_R[j+1];
1013  }
1014 #endif
1015  if (strat->lenS!=NULL)
1016  {
1017 #ifdef ENTER_USE_MEMMOVE
1018  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1019 #else
1020  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1021 #endif
1022  }
1023  if (strat->lenSw!=NULL)
1024  {
1025 #ifdef ENTER_USE_MEMMOVE
1026  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1027 #else
1028  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1029 #endif
1030  }
1031  if (strat->fromQ!=NULL)
1032  {
1033 #ifdef ENTER_USE_MEMMOVE
1034  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1035 #else
1036  for (j=i; j<strat->sl; j++)
1037  {
1038  strat->fromQ[j] = strat->fromQ[j+1];
1039  }
1040 #endif
1041  }
1042  strat->S[strat->sl] = NULL;
1043  strat->sl--;
1044 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
static void enlargeL ( LSet L,
int *  length,
const int  incr 
)
inlinestatic

Definition at line 562 of file kutil.cc.

563 {
564  assume((*L)!=NULL);
565  assume(((*length)+incr)>0);
566 
567  *L = (LSet)omReallocSize((*L),(*length)*sizeof(LObject),
568  ((*length)+incr)*sizeof(LObject));
569  (*length) += incr;
570 }
class sLObject LObject
Definition: kutil.h:60
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
LObject * LSet
Definition: kutil.h:62
#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 484 of file kutil.cc.

486 {
487  assume(T!=NULL);
488  assume(sevT!=NULL);
489  assume(R!=NULL);
490  assume((length+incr) > 0);
491 
492  int i;
493  T = (TSet)omRealloc0Size(T, length*sizeof(TObject),
494  (length+incr)*sizeof(TObject));
495 
496  sevT = (unsigned long*) omReallocSize(sevT, length*sizeof(long*),
497  (length+incr)*sizeof(long*));
498 
499  R = (TObject**)omRealloc0Size(R,length*sizeof(TObject*),
500  (length+incr)*sizeof(TObject*));
501  for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
502  length += incr;
503 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
TObject * TSet
Definition: kutil.h:61
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:59
void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 3780 of file kutil.cc.

3781 {
3782  if (nIsOne(pGetCoeff(h))) return;
3783  number gcd;
3784  bool go = false;
3785  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
3786  {
3787  gcd = n_Ann(pGetCoeff(h),currRing->cf);
3788  go = true;
3789  }
3790  else
3791  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
3792  if (go || !nIsOne(gcd))
3793  {
3794  poly p = h->next;
3795  if (!go)
3796  {
3797  number tmp = gcd;
3798  gcd = n_Ann(gcd,currRing->cf);
3799  nDelete(&tmp);
3800  }
3801  p_Test(p,strat->tailRing);
3802  p = pp_Mult_nn(p, gcd, strat->tailRing);
3803  nDelete(&gcd);
3804 
3805  if (p != NULL)
3806  {
3807  if (TEST_OPT_PROT)
3808  {
3809  PrintS("Z");
3810  }
3811 #ifdef KDEBUG
3812  if (TEST_OPT_DEBUG)
3813  {
3814  PrintS("--- create zero spoly: ");
3815  p_wrp(h,currRing,strat->tailRing);
3816  PrintS(" ---> ");
3817  }
3818 #endif
3819  poly tmp = pInit();
3820  pSetCoeff0(tmp, pGetCoeff(p));
3821  for (int i = 1; i <= rVar(currRing); i++)
3822  {
3823  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
3824  }
3826  {
3827  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
3828  }
3829  p_Setm(tmp, currRing);
3830  p = p_LmFreeAndNext(p, strat->tailRing);
3831  pNext(tmp) = p;
3832  LObject h;
3833  h.Init();
3834  h.p = tmp;
3835  h.tailRing = strat->tailRing;
3836  int posx;
3837  if (h.p!=NULL)
3838  {
3840  {
3841  //pContent(h.p);
3842  h.pCleardenom(); // also does a pContent
3843  }
3844  else
3845  {
3846  h.pNorm();
3847  }
3848  strat->initEcart(&h);
3849  if (strat->Ll==-1)
3850  posx =0;
3851  else
3852  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
3853  h.sev = pGetShortExpVector(h.p);
3854  if (strat->tailRing != currRing)
3855  {
3856  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
3857  }
3858 #ifdef KDEBUG
3859  if (TEST_OPT_DEBUG)
3860  {
3861  p_wrp(tmp,currRing,strat->tailRing);
3862  PrintLn();
3863  }
3864 #endif
3865  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
3866  }
3867  }
3868  }
3869  nDelete(&gcd);
3870 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:687
void PrintLn()
Definition: reporter.cc:327
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:928
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:537
#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:1111
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:702
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:901
#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:464
#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 &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:776
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:698
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
void enterL ( LSet set,
int *  length,
int *  LSetmax,
LObject  p,
int  at 
)

Definition at line 1111 of file kutil.cc.

1112 {
1113  // this should be corrected
1114  assume(p.FDeg == p.pFDeg());
1115 
1116  if ((*length)>=0)
1117  {
1118  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1119  if (at <= (*length))
1120 #ifdef ENTER_USE_MEMMOVE
1121  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1122 #else
1123  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1124 #endif
1125  }
1126  else at = 0;
1127  (*set)[at] = p;
1128  (*length)++;
1129 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:30
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:562
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:44
void enterOnePairLift ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1837 of file kutil.cc.

1838 {
1839  assume(ALLOW_PROD_CRIT(strat));
1841  assume(strat->syzComp==1);
1842  assume(i<=strat->sl);
1843 
1844  int l,j,compare;
1845  LObject Lp;
1846  Lp.i_r = -1;
1847 
1848 #ifdef KDEBUG
1849  Lp.ecart=0; Lp.length=0;
1850 #endif
1851  /*- computes the lcm(s[i],p) -*/
1852  Lp.lcm = pInit();
1853 
1854  pLcm(p,strat->S[i],Lp.lcm);
1855  pSetm(Lp.lcm);
1856 
1857  if (strat->sugarCrit)
1858  {
1859  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1860  && p_HasNotCF_Lift(p,strat->S[i],currRing))
1861  {
1862  /*
1863  *the product criterion has applied for (s,p),
1864  *i.e. lcm(s,p)=product of the leading terms of s and p.
1865  *Suppose (s,r) is in L and the leading term
1866  *of p divides lcm(s,r)
1867  *(==> the leading term of p divides the leading term of r)
1868  *but the leading term of s does not divide the leading term of r
1869  *(notice that tis condition is automatically satisfied if r is still
1870  *in S), then (s,r) can be cancelled.
1871  *This should be done here because the
1872  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1873  *
1874  *Moreover, skipping (s,r) holds also for the noncommutative case.
1875  */
1876  strat->cp++;
1877  pLmFree(Lp.lcm);
1878  Lp.lcm=NULL;
1879  return;
1880  }
1881  else
1882  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1883  if (strat->fromT && (strat->ecartS[i]>ecart))
1884  {
1885  pLmFree(Lp.lcm);
1886  Lp.lcm=NULL;
1887  return;
1888  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1889  }
1890  /*
1891  *the set B collects the pairs of type (S[j],p)
1892  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1893  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1894  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1895  */
1896  {
1897  j = strat->Bl;
1898  loop
1899  {
1900  if (j < 0) break;
1901  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1902  if ((compare==1)
1903  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1904  {
1905  strat->c3++;
1906  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1907  {
1908  pLmFree(Lp.lcm);
1909  return;
1910  }
1911  break;
1912  }
1913  else
1914  if ((compare ==-1)
1915  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1916  {
1917  deleteInL(strat->B,&strat->Bl,j,strat);
1918  strat->c3++;
1919  }
1920  j--;
1921  }
1922  }
1923  }
1924  else /*sugarcrit*/
1925  {
1926  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1927  p_HasNotCF_Lift(p,strat->S[i],currRing))
1928  {
1929  /*
1930  *the product criterion has applied for (s,p),
1931  *i.e. lcm(s,p)=product of the leading terms of s and p.
1932  *Suppose (s,r) is in L and the leading term
1933  *of p devides lcm(s,r)
1934  *(==> the leading term of p devides the leading term of r)
1935  *but the leading term of s does not devide the leading term of r
1936  *(notice that tis condition is automatically satisfied if r is still
1937  *in S), then (s,r) can be canceled.
1938  *This should be done here because the
1939  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1940  */
1941  strat->cp++;
1942  pLmFree(Lp.lcm);
1943  Lp.lcm=NULL;
1944  return;
1945  }
1946  if (strat->fromT && (strat->ecartS[i]>ecart))
1947  {
1948  pLmFree(Lp.lcm);
1949  Lp.lcm=NULL;
1950  return;
1951  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1952  }
1953  /*
1954  *the set B collects the pairs of type (S[j],p)
1955  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1956  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1957  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1958  */
1959  for(j = strat->Bl;j>=0;j--)
1960  {
1961  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1962  if (compare==1)
1963  {
1964  strat->c3++;
1965  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1966  {
1967  pLmFree(Lp.lcm);
1968  return;
1969  }
1970  break;
1971  }
1972  else
1973  if (compare ==-1)
1974  {
1975  deleteInL(strat->B,&strat->Bl,j,strat);
1976  strat->c3++;
1977  }
1978  }
1979  }
1980  /*
1981  *the pair (S[i],p) enters B if the spoly != 0
1982  */
1983  /*- compute the short s-polynomial -*/
1984  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1985  pNorm(p);
1986 
1987  if ((strat->S[i]==NULL) || (p==NULL))
1988  return;
1989 
1990  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1991  Lp.p=NULL;
1992  else
1993  {
1995  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1996  }
1997  if (Lp.p == NULL)
1998  {
1999  /*- the case that the s-poly is 0 -*/
2000  if (strat->pairtest==NULL) initPairtest(strat);
2001  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2002  strat->pairtest[strat->sl+1] = TRUE;
2003  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2004  /*
2005  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2006  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2007  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2008  *term of p devides the lcm(s,r)
2009  *(this canceling should be done here because
2010  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2011  *the first case is handeled in chainCrit
2012  */
2013  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2014  }
2015  else
2016  {
2017  /*- the pair (S[i],p) enters B -*/
2018  Lp.p1 = strat->S[i];
2019  Lp.p2 = p;
2020 
2021  pNext(Lp.p) = strat->tail; // !!!
2022 
2023  if (atR >= 0)
2024  {
2025  Lp.i_r1 = strat->S_2_R[i];
2026  Lp.i_r2 = atR;
2027  }
2028  else
2029  {
2030  Lp.i_r1 = -1;
2031  Lp.i_r2 = -1;
2032  }
2033  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2034 
2036  {
2037  nDelete(&(Lp.p->coef));
2038  }
2039 
2040  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2041  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2042  }
2043 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:241
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case: ignore component
Definition: kutil.cc:1820
#define TRUE
Definition: auxiliary.h:144
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:572
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h: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
int sl
Definition: kutil.h:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:385
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
int l
Definition: cfEzgcd.cc:94
void enterOnePairManyShifts ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  ,
int  uptodeg,
int  lV 
)

Definition at line 10260 of file kutil.cc.

10261 {
10262  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
10263 
10266 
10267  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
10268  /* that is create the pairs (f, s \dot g) */
10269 
10270  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
10271 
10272  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
10273  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
10274 
10275  /* determine how many elements we have to insert for a given s[i] */
10276  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
10277  /* hence, a total number of elt's to add is: */
10278  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
10279  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
10280 
10281 #ifdef KDEBUG
10282  if (TEST_OPT_DEBUG)
10283  {
10284  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
10285  }
10286 #endif
10287 
10288  assume(i<=strat->sl); // from OnePair
10289 
10290  /* these vars hold for all shifts of s[i] */
10291  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
10292 
10293  int qfromQ;
10294  if (strat->fromQ != NULL)
10295  {
10296  qfromQ = strat->fromQ[i];
10297  }
10298  else
10299  {
10300  qfromQ = -1;
10301  }
10302 
10303  int j;
10304 
10305  poly q/*, s*/;
10306 
10307  // for the 0th shift: insert the orig. pair
10308  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
10309 
10310  for (j=1; j<= toInsert; j++)
10311  {
10312  // q = pLPshift(strat->S[i],j,uptodeg,lV);
10313  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
10314  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
10315  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
10316  // pNext(q) = s; // in tailRing
10317  /* here we need to call enterOnePair with two polys ... */
10318 
10319 #ifdef KDEBUG
10320  if (TEST_OPT_DEBUG)
10321  {
10322  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
10323  }
10324 #endif
10325  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
10326  }
10327 }
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:10398
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
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
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
void enterOnePairNormal ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1532 of file kutil.cc.

1533 {
1534  assume(i<=strat->sl);
1535 
1536  int l,j,compare;
1537  LObject Lp;
1538  Lp.i_r = -1;
1539 
1540 #ifdef KDEBUG
1541  Lp.ecart=0; Lp.length=0;
1542 #endif
1543  /*- computes the lcm(s[i],p) -*/
1544  Lp.lcm = pInit();
1545 
1546 #ifndef HAVE_RATGRING
1547  pLcm(p,strat->S[i],Lp.lcm);
1548 #elif defined(HAVE_RATGRING)
1549  if (rIsRatGRing(currRing))
1550  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1551  else
1552  pLcm(p,strat->S[i],Lp.lcm);
1553 #endif
1554  pSetm(Lp.lcm);
1555 
1556 
1557  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1558  {
1559  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1560  && pHasNotCF(p,strat->S[i]))
1561  {
1562  /*
1563  *the product criterion has applied for (s,p),
1564  *i.e. lcm(s,p)=product of the leading terms of s and p.
1565  *Suppose (s,r) is in L and the leading term
1566  *of p divides lcm(s,r)
1567  *(==> the leading term of p divides the leading term of r)
1568  *but the leading term of s does not divide the leading term of r
1569  *(notice that tis condition is automatically satisfied if r is still
1570  *in S), then (s,r) can be cancelled.
1571  *This should be done here because the
1572  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1573  *
1574  *Moreover, skipping (s,r) holds also for the noncommutative case.
1575  */
1576  strat->cp++;
1577  pLmFree(Lp.lcm);
1578  Lp.lcm=NULL;
1579  return;
1580  }
1581  else
1582  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1583  if (strat->fromT && (strat->ecartS[i]>ecart))
1584  {
1585  pLmFree(Lp.lcm);
1586  Lp.lcm=NULL;
1587  return;
1588  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1589  }
1590  /*
1591  *the set B collects the pairs of type (S[j],p)
1592  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1593  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1594  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1595  */
1596  {
1597  j = strat->Bl;
1598  loop
1599  {
1600  if (j < 0) break;
1601  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1602  if ((compare==1)
1603  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1604  {
1605  strat->c3++;
1606  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1607  {
1608  pLmFree(Lp.lcm);
1609  return;
1610  }
1611  break;
1612  }
1613  else
1614  if ((compare ==-1)
1615  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1616  {
1617  deleteInL(strat->B,&strat->Bl,j,strat);
1618  strat->c3++;
1619  }
1620  j--;
1621  }
1622  }
1623  }
1624  else /*sugarcrit*/
1625  {
1626  if (ALLOW_PROD_CRIT(strat))
1627  {
1628  // if currRing->nc_type!=quasi (or skew)
1629  // TODO: enable productCrit for super commutative algebras...
1630  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1631  pHasNotCF(p,strat->S[i]))
1632  {
1633  /*
1634  *the product criterion has applied for (s,p),
1635  *i.e. lcm(s,p)=product of the leading terms of s and p.
1636  *Suppose (s,r) is in L and the leading term
1637  *of p devides lcm(s,r)
1638  *(==> the leading term of p devides the leading term of r)
1639  *but the leading term of s does not devide the leading term of r
1640  *(notice that tis condition is automatically satisfied if r is still
1641  *in S), then (s,r) can be canceled.
1642  *This should be done here because the
1643  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1644  */
1645  strat->cp++;
1646  pLmFree(Lp.lcm);
1647  Lp.lcm=NULL;
1648  return;
1649  }
1650  if (strat->fromT && (strat->ecartS[i]>ecart))
1651  {
1652  pLmFree(Lp.lcm);
1653  Lp.lcm=NULL;
1654  return;
1655  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1656  }
1657  /*
1658  *the set B collects the pairs of type (S[j],p)
1659  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1660  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1661  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1662  */
1663  for(j = strat->Bl;j>=0;j--)
1664  {
1665  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1666  if (compare==1)
1667  {
1668  strat->c3++;
1669  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1670  {
1671  pLmFree(Lp.lcm);
1672  return;
1673  }
1674  break;
1675  }
1676  else
1677  if (compare ==-1)
1678  {
1679  deleteInL(strat->B,&strat->Bl,j,strat);
1680  strat->c3++;
1681  }
1682  }
1683  }
1684  }
1685  /*
1686  *the pair (S[i],p) enters B if the spoly != 0
1687  */
1688  /*- compute the short s-polynomial -*/
1689  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1690  pNorm(p);
1691 
1692  if ((strat->S[i]==NULL) || (p==NULL))
1693  return;
1694 
1695  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1696  Lp.p=NULL;
1697  else
1698  {
1699  #ifdef HAVE_PLURAL
1700  if ( rIsPluralRing(currRing) )
1701  {
1702  if(pHasNotCF(p, strat->S[i]))
1703  {
1704  if(ncRingType(currRing) == nc_lie)
1705  {
1706  // generalized prod-crit for lie-type
1707  strat->cp++;
1708  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
1709  }
1710  else
1711  if( ALLOW_PROD_CRIT(strat) )
1712  {
1713  // product criterion for homogeneous case in SCA
1714  strat->cp++;
1715  Lp.p = NULL;
1716  }
1717  else
1718  {
1719  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1720  nc_CreateShortSpoly(strat->S[i], p, currRing);
1721 
1722  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1723  pNext(Lp.p) = strat->tail; // !!!
1724  }
1725  }
1726  else
1727  {
1728  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1729  nc_CreateShortSpoly(strat->S[i], p, currRing);
1730 
1731  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1732  pNext(Lp.p) = strat->tail; // !!!
1733 
1734  }
1735 
1736 
1737 #if MYTEST
1738  if (TEST_OPT_DEBUG)
1739  {
1740  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1741  PrintS("p: "); pWrite(p);
1742  PrintS("SPoly: "); pWrite(Lp.p);
1743  }
1744 #endif
1745 
1746  }
1747  else
1748  #endif
1749  {
1751  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1752 #if MYTEST
1753  if (TEST_OPT_DEBUG)
1754  {
1755  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1756  PrintS("p: "); pWrite(p);
1757  PrintS("commutative SPoly: "); pWrite(Lp.p);
1758  }
1759 #endif
1760 
1761  }
1762  }
1763  if (Lp.p == NULL)
1764  {
1765  /*- the case that the s-poly is 0 -*/
1766  if (strat->pairtest==NULL) initPairtest(strat);
1767  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
1768  strat->pairtest[strat->sl+1] = TRUE;
1769  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
1770  /*
1771  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
1772  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
1773  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
1774  *term of p devides the lcm(s,r)
1775  *(this canceling should be done here because
1776  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
1777  *the first case is handeled in chainCrit
1778  */
1779  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
1780  }
1781  else
1782  {
1783  /*- the pair (S[i],p) enters B -*/
1784  Lp.p1 = strat->S[i];
1785  Lp.p2 = p;
1786 
1787  if (
1789 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
1790  )
1791  {
1792  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1793  pNext(Lp.p) = strat->tail; // !!!
1794  }
1795 
1796  if (atR >= 0)
1797  {
1798  Lp.i_r1 = strat->S_2_R[i];
1799  Lp.i_r2 = atR;
1800  }
1801  else
1802  {
1803  Lp.i_r1 = -1;
1804  Lp.i_r2 = -1;
1805  }
1806  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
1807 
1809  {
1810  if (!rIsPluralRing(currRing))
1811  nDelete(&(Lp.p->coef));
1812  }
1813 
1814  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
1815  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
1816  }
1817 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2308
#define pSetm(p)
Definition: polys.h:241
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:372
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#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:283
void pWrite(poly p)
Definition: polys.h:279
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1939
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
intset fromQ
Definition: kutil.h:317
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:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:572
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h: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:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:385
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
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 1177 of file kutil.cc.

1178 {
1179  assume(atR >= 0);
1180  assume(i<=strat->sl);
1181  assume(p!=NULL);
1182  int l,j,compare,compareCoeff;
1183  LObject h;
1184 
1185 #ifdef KDEBUG
1186  h.ecart=0; h.length=0;
1187 #endif
1188  /*- computes the lcm(s[i],p) -*/
1189  h.lcm = pInit();
1190  pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
1191  if (nIsZero(pGetCoeff(h.lcm)))
1192  {
1193  strat->cp++;
1194  pLmDelete(h.lcm);
1195  return;
1196  }
1197  // basic chain criterion
1198  pLcm(p,strat->S[i],h.lcm);
1199  pSetm(h.lcm);
1200  /*
1201  *the set B collects the pairs of type (S[j],p)
1202  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
1203  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1204  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1205  */
1206 
1207  for(j = strat->Bl;j>=0;j--)
1208  {
1209  compare=pDivCompRing(strat->B[j].lcm,h.lcm);
1210  compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
1211  #if ADIDEBUG
1212  printf("\nChainCrit in enteronepairring\n");
1213  printf("\nB[j]\n");
1214  pWrite(strat->B[j].p);
1215  pWrite(strat->B[j].p1);
1216  pWrite(strat->B[j].p2);
1217  pWrite(strat->B[j].lcm);
1218  printf("\nh - neue Paar\n");
1219  pWrite(h.p);
1220  pWrite(p);
1221  pWrite(strat->S[i]);
1222  pWrite(h.lcm);
1223  printf("\ncompare = %i\ncompareCoeff = %i\n",compare,compareCoeff);
1224  #endif
1225  if(compare == pDivComp_EQUAL)
1226  {
1227  //They have the same LM
1228  if(compareCoeff == pDivComp_LESS)
1229  {
1230  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1231  {
1232  #if ADIDEBUG
1233  printf("\nGelöscht h\n");
1234  #endif
1235  strat->c3++;
1236  pLmDelete(h.lcm);
1237  return;
1238  }
1239  break;
1240  }
1241  if(compareCoeff == pDivComp_GREATER)
1242  {
1243  #if ADIDEBUG
1244  printf("\nGelöscht: B[j]\n");
1245  #endif
1246  deleteInL(strat->B,&strat->Bl,j,strat);
1247  strat->c3++;
1248  }
1249  if(compareCoeff == pDivComp_EQUAL)
1250  {
1251  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1252  {
1253  #if ADIDEBUG
1254  printf("\nGelöscht h\n");
1255  #endif
1256  strat->c3++;
1257  pLmDelete(h.lcm);
1258  return;
1259  }
1260  break;
1261  }
1262  }
1263  if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
1264  {
1265  if(compare == pDivComp_LESS)
1266  {
1267  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1268  {
1269  #if ADIDEBUG
1270  printf("\nGelöscht h\n");
1271  #endif
1272  strat->c3++;
1273  pLmDelete(h.lcm);
1274  return;
1275  }
1276  break;
1277  }
1278  if(compare == pDivComp_GREATER)
1279  {
1280  #if ADIDEBUG
1281  printf("\nGelöscht: B[j]\n");
1282  #endif
1283  deleteInL(strat->B,&strat->Bl,j,strat);
1284  strat->c3++;
1285  }
1286  }
1287  }
1288  number s, t;
1289  poly m1, m2, gcd = NULL;
1290  #if ADIDEBUG
1291  printf("\nTrying to add spair S[%i] und p\n",i);pWrite(strat->S[i]);pWrite(p);
1292  #endif
1293  s = pGetCoeff(strat->S[i]);
1294  t = pGetCoeff(p);
1295  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
1296  ksCheckCoeff(&s, &t, currRing->cf);
1297  pSetCoeff0(m1, s);
1298  pSetCoeff0(m2, t);
1299  m2 = pNeg(m2);
1300  p_Test(m1,strat->tailRing);
1301  p_Test(m2,strat->tailRing);
1302  poly si = pCopy(strat->S[i]);
1303  poly pm1 = pp_Mult_mm(pNext(p), m1, strat->tailRing);
1304  poly sim2 = pp_Mult_mm(pNext(si), m2, strat->tailRing);
1305  pDelete(&si);
1306  if(sim2 == NULL)
1307  {
1308  pDelete(&m1);
1309  pDelete(&m2);
1310  if(pm1 == NULL)
1311  {
1312  if(h.lcm != NULL)
1313  pDelete(&h.lcm);
1314  h.Clear();
1315  if (strat->pairtest==NULL) initPairtest(strat);
1316  strat->pairtest[i] = TRUE;
1317  strat->pairtest[strat->sl+1] = TRUE;
1318  return;
1319  }
1320  else
1321  {
1322  gcd = pm1;
1323  pm1 = NULL;
1324  }
1325  }
1326  else
1327  {
1328  if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
1329  {
1330  p_SetCompP(sim2, pGetComp(p), strat->tailRing);
1331  pSetmComp(sim2);
1332  }
1333  //p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
1334  gcd = p_Add_q(pm1, sim2, strat->tailRing);
1335  }
1336  p_Test(gcd, strat->tailRing);
1337  //p_LmDelete(m1, strat->tailRing);
1338  //p_LmDelete(m2, strat->tailRing);
1339 #ifdef KDEBUG
1340  if (TEST_OPT_DEBUG)
1341  {
1342  wrp(gcd);
1343  PrintLn();
1344  }
1345 #endif
1346  h.p = gcd;
1347  h.i_r = -1;
1348  if(h.p == NULL)
1349  {
1350  if (strat->pairtest==NULL) initPairtest(strat);
1351  strat->pairtest[i] = TRUE;
1352  strat->pairtest[strat->sl+1] = TRUE;
1353  return;
1354  }
1355  h.tailRing = strat->tailRing;
1356  int posx;
1357  //h.pCleardenom();
1358  //pSetm(h.p);
1359  #if ADIDEBUG
1360  printf("\nThis is afterwards:\n");
1361  pWrite(h.p);
1362  #endif
1363  h.i_r1 = -1;h.i_r2 = -1;
1364  strat->initEcart(&h);
1365  #if 1
1366  h.p2 = strat->S[i];
1367  h.p1 = p;
1368  #endif
1369  #if 1
1370  if (atR >= 0)
1371  {
1372  h.i_r1 = atR;
1373  h.i_r2 = strat->S_2_R[i];
1374  }
1375  #endif
1376  if (strat->Bl==-1)
1377  posx =0;
1378  else
1379  posx = strat->posInL(strat->B,strat->Bl,&h,strat);
1380  h.sev = pGetShortExpVector(h.p);
1381  if (currRing!=strat->tailRing)
1382  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1383  #if ADIDEBUG
1384  printf("\nThis s-poly was added to B:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);printf("\ni_r1 = %i, i_r2 = %i\n",h.i_r1, h.i_r2);pWrite(strat->T[h.i_r1].p);pWrite(strat->T[h.i_r2].p);
1385  #endif
1386  enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
1387  kTest_TS(strat);
1388 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
const CanonicalForm int s
Definition: facAbsFact.cc:55
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:960
#define pSetm(p)
Definition: polys.h:241
#define pDivComp_LESS
Definition: kutil.cc:133
void PrintLn()
Definition: reporter.cc:327
#define pDivComp_EQUAL
Definition: kutil.cc:132
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
int ksCheckCoeff(number *a, number *b)
#define pNeg(p)
Definition: polys.h:169
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:963
#define TRUE
Definition: auxiliary.h:144
#define pLcm(a, b, m)
Definition: polys.h:266
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:1111
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:901
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
#define kTest_TS(A)
Definition: kutil.h:620
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition: coeffs.h:523
polyset S
Definition: kutil.h:302
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:713
int cp
Definition: kutil.h:345
#define p_Test(p, r)
Definition: p_polys.h:160
void initPairtest(kStrategy strat)
Definition: kutil.cc:572
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:157
#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:346
TSet T
Definition: kutil.h:322
void wrp(poly p)
Definition: polys.h:281
#define pDivComp_GREATER
Definition: kutil.cc:134
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void enterOnePairSelfShifts ( poly  qq,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  ,
int  uptodeg,
int  lV 
)

Definition at line 10335 of file kutil.cc.

10336 {
10337 
10338  /* format: p,qq are in LObject form: lm in CR, tail in TR */
10339  /* for true self pairs qq ==p */
10340  /* we test both qq and p */
10342  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
10345 
10346  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
10347 
10348  // int j = 0;
10349  int j = 1;
10350 
10351  /* for such self pairs start with 1, not with 0 */
10352  if (qq == p) j=1;
10353 
10354  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
10355  /* that is create the pairs (f, s \dot g) */
10356 
10357  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
10358 
10359 #ifdef KDEBUG
10360  if (TEST_OPT_DEBUG)
10361  {
10362  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
10363  }
10364 #endif
10365 
10366  poly q;
10367 
10368  /* these vars hold for all shifts of s[i] */
10369  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
10370  int qfromQ = 0; // strat->fromQ[i];
10371 
10372  for (; j<= toInsert; j++)
10373  {
10374  // q = pLPshift(strat->S[i],j,uptodeg,lV);
10375  /* we increase shifts by one; must delete q there*/
10376  // q = qq; q = pMoveCurrTail2poly(q,strat);
10377  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
10378  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
10379  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
10380  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
10381  // pNext(q) = s; // in tailRing
10382  /* here we need to call enterOnePair with two polys ... */
10383 #ifdef KDEBUG
10384  if (TEST_OPT_DEBUG)
10385  {
10386  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
10387  }
10388 #endif
10389  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
10390  }
10391 }
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:10398
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
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
#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 p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
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 10398 of file kutil.cc.

10399 {
10400 
10401  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
10402 
10403  /* check this Formats: */
10405  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
10408 
10409 #ifdef KDEBUG
10410  if (TEST_OPT_DEBUG)
10411  {
10412 // PrintS("enterOnePairShift(q,p) invoked with q = ");
10413 // wrp(q); // wrp(pHead(q));
10414 // PrintS(", p = ");
10415 // wrp(p); //wrp(pHead(p));
10416 // PrintLn();
10417  }
10418 #endif
10419 
10420  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
10421 
10422  int qfromQ = qisFromQ;
10423 
10424  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
10425 
10426  int l,j,compare;
10427  LObject Lp;
10428  Lp.i_r = -1;
10429 
10430 #ifdef KDEBUG
10431  Lp.ecart=0; Lp.length=0;
10432 #endif
10433  /*- computes the lcm(s[i],p) -*/
10434  Lp.lcm = pInit();
10435 
10436  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
10437  pSetm(Lp.lcm);
10438 
10439  /* apply the V criterion */
10440  if (!isInV(Lp.lcm, lV))
10441  {
10442 #ifdef KDEBUG
10443  if (TEST_OPT_DEBUG)
10444  {
10445  PrintS("V crit applied to q = ");
10446  wrp(q); // wrp(pHead(q));
10447  PrintS(", p = ");
10448  wrp(p); //wrp(pHead(p));
10449  PrintLn();
10450  }
10451 #endif
10452  pLmFree(Lp.lcm);
10453  Lp.lcm=NULL;
10454  /* + counter for applying the V criterion */
10455  strat->cv++;
10456  return;
10457  }
10458 
10459  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
10460  {
10461  if((!((ecartq>0)&&(ecart>0)))
10462  && pHasNotCF(p,q))
10463  {
10464  /*
10465  *the product criterion has applied for (s,p),
10466  *i.e. lcm(s,p)=product of the leading terms of s and p.
10467  *Suppose (s,r) is in L and the leading term
10468  *of p divides lcm(s,r)
10469  *(==> the leading term of p divides the leading term of r)
10470  *but the leading term of s does not divide the leading term of r
10471  *(notice that this condition is automatically satisfied if r is still
10472  *in S), then (s,r) can be cancelled.
10473  *This should be done here because the
10474  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
10475  *
10476  *Moreover, skipping (s,r) holds also for the noncommutative case.
10477  */
10478  strat->cp++;
10479  pLmFree(Lp.lcm);
10480  Lp.lcm=NULL;
10481  return;
10482  }
10483  else
10484  Lp.ecart = si_max(ecart,ecartq);
10485  if (strat->fromT && (ecartq>ecart))
10486  {
10487  pLmFree(Lp.lcm);
10488  Lp.lcm=NULL;
10489  return;
10490  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
10491  }
10492  /*
10493  *the set B collects the pairs of type (S[j],p)
10494  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
10495  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
10496  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
10497  */
10498  {
10499  j = strat->Bl;
10500  loop
10501  {
10502  if (j < 0) break;
10503  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
10504  if ((compare==1)
10505  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
10506  {
10507  strat->c3++;
10508  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
10509  {
10510  pLmFree(Lp.lcm);
10511  return;
10512  }
10513  break;
10514  }
10515  else
10516  if ((compare ==-1)
10517  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
10518  {
10519  deleteInL(strat->B,&strat->Bl,j,strat);
10520  strat->c3++;
10521  }
10522  j--;
10523  }
10524  }
10525  }
10526  else /*sugarcrit*/
10527  {
10528  if (ALLOW_PROD_CRIT(strat))
10529  {
10530  // if currRing->nc_type!=quasi (or skew)
10531  // TODO: enable productCrit for super commutative algebras...
10532  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
10533  pHasNotCF(p,q))
10534  {
10535  /*
10536  *the product criterion has applied for (s,p),
10537  *i.e. lcm(s,p)=product of the leading terms of s and p.
10538  *Suppose (s,r) is in L and the leading term
10539  *of p devides lcm(s,r)
10540  *(==> the leading term of p devides the leading term of r)
10541  *but the leading term of s does not devide the leading term of r
10542  *(notice that tis condition is automatically satisfied if r is still
10543  *in S), then (s,r) can be canceled.
10544  *This should be done here because the
10545  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
10546  */
10547  strat->cp++;
10548  pLmFree(Lp.lcm);
10549  Lp.lcm=NULL;
10550  return;
10551  }
10552  if (strat->fromT && (ecartq>ecart))
10553  {
10554  pLmFree(Lp.lcm);
10555  Lp.lcm=NULL;
10556  return;
10557  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
10558  }
10559  /*
10560  *the set B collects the pairs of type (S[j],p)
10561  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
10562  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
10563  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
10564  */
10565  for(j = strat->Bl;j>=0;j--)
10566  {
10567  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
10568  if (compare==1)
10569  {
10570  strat->c3++;
10571  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
10572  {
10573  pLmFree(Lp.lcm);
10574  return;
10575  }
10576  break;
10577  }
10578  else
10579  if (compare ==-1)
10580  {
10581  deleteInL(strat->B,&strat->Bl,j,strat);
10582  strat->c3++;
10583  }
10584  }
10585  }
10586  }
10587  /*
10588  *the pair (S[i],p) enters B if the spoly != 0
10589  */
10590  /*- compute the short s-polynomial -*/
10591  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
10592  pNorm(p);
10593  if ((q==NULL) || (p==NULL))
10594  return;
10595  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
10596  Lp.p=NULL;
10597  else
10598  {
10599 // if ( rIsPluralRing(currRing) )
10600 // {
10601 // if(pHasNotCF(p, q))
10602 // {
10603 // if(ncRingType(currRing) == nc_lie)
10604 // {
10605 // // generalized prod-crit for lie-type
10606 // strat->cp++;
10607 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
10608 // }
10609 // else
10610 // if( ALLOW_PROD_CRIT(strat) )
10611 // {
10612 // // product criterion for homogeneous case in SCA
10613 // strat->cp++;
10614 // Lp.p = NULL;
10615 // }
10616 // else
10617 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
10618 // }
10619 // else Lp.p = nc_CreateSpoly(q,p,currRing);
10620 // }
10621 // else
10622 // {
10623 
10624  /* ksCreateShortSpoly needs two Lobject-kind presentations */
10625  /* p is already in this form, so convert q */
10626  // q = pMove2CurrTail(q, strat);
10627  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
10628  // }
10629  }
10630  if (Lp.p == NULL)
10631  {
10632  /*- the case that the s-poly is 0 -*/
10633  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
10634 // if (strat->pairtest==NULL) initPairtest(strat);
10635 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
10636 // strat->pairtest[strat->sl+1] = TRUE;
10637  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
10638  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
10639  /*
10640  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
10641  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
10642  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
10643  *term of p devides the lcm(s,r)
10644  *(this canceling should be done here because
10645  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
10646  *the first case is handeled in chainCrit
10647  */
10648  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
10649  }
10650  else
10651  {
10652  /*- the pair (S[i],p) enters B -*/
10653  /* both of them should have their LM in currRing and TAIL in tailring */
10654  Lp.p1 = q; // already in the needed form
10655  Lp.p2 = p; // already in the needed form
10656 
10657  if ( !rIsPluralRing(currRing) )
10658  pNext(Lp.p) = strat->tail;
10659 
10660  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
10661  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
10662  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
10663  {
10664  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
10665  Lp.i_r2 = atR;
10666  }
10667  else
10668  {
10669  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
10670  Lp.i_r1 = -1;
10671  Lp.i_r2 = -1;
10672  }
10673  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
10674 
10676  {
10677  if (!rIsPluralRing(currRing))
10678  nDelete(&(Lp.p->coef));
10679  }
10680 
10681  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
10682  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
10683  }
10684 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:241
void PrintLn()
Definition: reporter.cc:327
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:617
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
int cv
Definition: kutil.h:359
int Bl
Definition: kutil.h:350
#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:283
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
intset fromQ
Definition: kutil.h:317
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:378
poly tail
Definition: kutil.h:332
BOOLEAN sugarCrit
Definition: kutil.h:367
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h: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:385
void wrp(poly p)
Definition: polys.h:281
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
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 2053 of file kutil.cc.

2055 {
2056  assume(i<=strat->sl);
2057 
2058  int l;
2059  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2060  // the corresponding signatures for criteria checks
2061  LObject Lp;
2062  poly pSigMult = p_Copy(pSig,currRing);
2063  poly sSigMult = p_Copy(strat->sig[i],currRing);
2064  unsigned long pSigMultNegSev,sSigMultNegSev;
2065  Lp.i_r = -1;
2066 
2067 #ifdef KDEBUG
2068  Lp.ecart=0; Lp.length=0;
2069 #endif
2070  /*- computes the lcm(s[i],p) -*/
2071  Lp.lcm = pInit();
2072  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2073 #ifndef HAVE_RATGRING
2074  pLcm(p,strat->S[i],Lp.lcm);
2075 #elif defined(HAVE_RATGRING)
2076  // if (rIsRatGRing(currRing))
2077  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2078 #endif
2079  pSetm(Lp.lcm);
2080 
2081  // set coeffs of multipliers m1 and m2
2082  pSetCoeff0(m1, nInit(1));
2083  pSetCoeff0(m2, nInit(1));
2084 //#if 1
2085 #ifdef DEBUGF5
2086  Print("P1 ");
2087  pWrite(pHead(p));
2088  Print("P2 ");
2089  pWrite(pHead(strat->S[i]));
2090  Print("M1 ");
2091  pWrite(m1);
2092  Print("M2 ");
2093  pWrite(m2);
2094 #endif
2095  // get multiplied signatures for testing
2096  pSigMult = currRing->p_Procs->pp_Mult_mm(pSigMult,m1,currRing);
2097  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2098  sSigMult = currRing->p_Procs->pp_Mult_mm(sSigMult,m2,currRing);
2099  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2100 
2101 //#if 1
2102 #ifdef DEBUGF5
2103  Print("----------------\n");
2104  pWrite(pSigMult);
2105  pWrite(sSigMult);
2106  Print("----------------\n");
2107  Lp.checked = 0;
2108 #endif
2109  int sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2110 //#if 1
2111 #if DEBUGF5
2112  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2113  pWrite(pSigMult);
2114  pWrite(sSigMult);
2115 #endif
2116  if(sigCmp==0)
2117  {
2118  // printf("!!!! EQUAL SIGS !!!!\n");
2119  // pSig = sSig, delete element due to Rewritten Criterion
2120  pDelete(&pSigMult);
2121  pDelete(&sSigMult);
2122  #ifdef HAVE_RINGS
2123  if (rField_is_Ring(currRing))
2124  pLmDelete(Lp.lcm);
2125  else
2126  #endif
2127  pLmFree(Lp.lcm);
2128  Lp.lcm=NULL;
2129  pDelete (&m1);
2130  pDelete (&m2);
2131  return;
2132  }
2133  // testing by syzCrit = F5 Criterion
2134  // testing by rewCrit1 = Rewritten Criterion
2135  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2136  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2137  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2138  || strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2139  )
2140  {
2141  pDelete(&pSigMult);
2142  pDelete(&sSigMult);
2143  #ifdef HAVE_RINGS
2144  if (rField_is_Ring(currRing))
2145  pLmDelete(Lp.lcm);
2146  else
2147  #endif
2148  pLmFree(Lp.lcm);
2149  Lp.lcm=NULL;
2150  pDelete (&m1);
2151  pDelete (&m2);
2152  return;
2153  }
2154  /*
2155  *the pair (S[i],p) enters B if the spoly != 0
2156  */
2157  /*- compute the short s-polynomial -*/
2158  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2159  pNorm(p);
2160 
2161  if ((strat->S[i]==NULL) || (p==NULL))
2162  return;
2163 
2164  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2165  Lp.p=NULL;
2166  else
2167  {
2168  #ifdef HAVE_PLURAL
2169  if ( rIsPluralRing(currRing) )
2170  {
2171  if(pHasNotCF(p, strat->S[i]))
2172  {
2173  if(ncRingType(currRing) == nc_lie)
2174  {
2175  // generalized prod-crit for lie-type
2176  strat->cp++;
2177  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2178  }
2179  else
2180  if( ALLOW_PROD_CRIT(strat) )
2181  {
2182  // product criterion for homogeneous case in SCA
2183  strat->cp++;
2184  Lp.p = NULL;
2185  }
2186  else
2187  {
2188  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2189  nc_CreateShortSpoly(strat->S[i], p, currRing);
2190 
2191  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2192  pNext(Lp.p) = strat->tail; // !!!
2193  }
2194  }
2195  else
2196  {
2197  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2198  nc_CreateShortSpoly(strat->S[i], p, currRing);
2199 
2200  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2201  pNext(Lp.p) = strat->tail; // !!!
2202 
2203  }
2204 
2205 
2206 #if MYTEST
2207  if (TEST_OPT_DEBUG)
2208  {
2209  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
2210  PrintS("p: "); pWrite(p);
2211  PrintS("SPoly: "); pWrite(Lp.p);
2212  }
2213 #endif
2214 
2215  }
2216  else
2217  #endif
2218  {
2220  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2221 #if MYTEST
2222  if (TEST_OPT_DEBUG)
2223  {
2224  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
2225  PrintS("p: "); pWrite(p);
2226  PrintS("commutative SPoly: "); pWrite(Lp.p);
2227  }
2228 #endif
2229 
2230  }
2231  }
2232  // store from which element this pair comes from for further tests
2233  //Lp.from = strat->sl+1;
2234  if(sigCmp==currRing->OrdSgn)
2235  {
2236  // pSig > sSig
2237  pDelete (&sSigMult);
2238  Lp.sig = pSigMult;
2239  Lp.sevSig = ~pSigMultNegSev;
2240  }
2241  else
2242  {
2243  // pSig < sSig
2244  pDelete (&pSigMult);
2245  Lp.sig = sSigMult;
2246  Lp.sevSig = ~sSigMultNegSev;
2247  }
2248  if (Lp.p == NULL)
2249  {
2250  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2251  int pos = posInSyz(strat, Lp.sig);
2252  enterSyz(Lp, strat, pos);
2253  }
2254  else
2255  {
2256  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
2257  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1)) {
2258  pLmFree(Lp.lcm);
2259  pDelete(&Lp.sig);
2260  Lp.lcm=NULL;
2261  pDelete (&m1);
2262  pDelete (&m2);
2263  return;
2264  }
2265  // in any case Lp is checked up to the next strat->P which is added
2266  // to S right after this critical pair creation.
2267  // NOTE: this even holds if the 2nd generator gives the bigger signature
2268  // moreover, this improves rewCriterion,
2269  // i.e. strat->checked > strat->from if and only if the 2nd generator
2270  // gives the bigger signature.
2271  Lp.checked = strat->sl+1;
2272  // at this point it is clear that the pair will be added to L, since it has
2273  // passed all tests up to now
2274 
2275  // adds buchberger's first criterion
2276  if (pLmCmp(m2,pHead(p)) == 0) {
2277  Lp.prod_crit = TRUE; // Product Criterion
2278 #if 0
2279  int pos = posInSyz(strat, Lp.sig);
2280  enterSyz(Lp, strat, pos);
2281  Lp.lcm=NULL;
2282  pDelete (&m1);
2283  pDelete (&m2);
2284  return;
2285 #endif
2286  }
2287  pDelete (&m1);
2288  pDelete (&m2);
2289 #if DEBUGF5
2290  PrintS("SIGNATURE OF PAIR: ");
2291  pWrite(Lp.sig);
2292 #endif
2293  /*- the pair (S[i],p) enters B -*/
2294  Lp.p1 = strat->S[i];
2295  Lp.p2 = p;
2296 
2297  if (
2299 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2300  )
2301  {
2302  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2303  pNext(Lp.p) = strat->tail; // !!!
2304  }
2305 
2306  if (atR >= 0)
2307  {
2308  Lp.i_r1 = strat->S_2_R[i];
2309  Lp.i_r2 = atR;
2310  }
2311  else
2312  {
2313  Lp.i_r1 = -1;
2314  Lp.i_r2 = -1;
2315  }
2316  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2317 
2319  {
2320  if (!rIsPluralRing(currRing))
2321  nDelete(&(Lp.p->coef));
2322  }
2323 
2324  l = strat->posInLSba(strat->B,strat->Bl,&Lp,strat);
2325  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2326  }
2327 }
polyset sig
Definition: kutil.h:304
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2308
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:960
#define pSetm(p)
Definition: polys.h: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:289
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int Bl
Definition: kutil.h:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h: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:291
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void pWrite(poly p)
Definition: polys.h:279
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1939
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
int Bmax
Definition: kutil.h:350
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:810
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
intset fromQ
Definition: kutil.h:317
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1473
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4586
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:5041
ring tailRing
Definition: kutil.h:341
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:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:385
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:8003
#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 2333 of file kutil.cc.

2334 {
2335  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
2336  if(pHasNotCF(p,strat->S[i]))
2337  {
2338  //PrintS("prod-crit\n");
2339  if(ALLOW_PROD_CRIT(strat))
2340  {
2341  //PrintS("prod-crit\n");
2342  strat->cp++;
2343  return;
2344  }
2345  }
2346 
2347  int l,j,compare;
2348  LObject Lp;
2349  Lp.i_r = -1;
2350 
2351  Lp.lcm = pInit();
2352  pLcm(p,strat->S[i],Lp.lcm);
2353  pSetm(Lp.lcm);
2354  /*- compute the short s-polynomial -*/
2355 
2356  #ifdef HAVE_PLURAL
2357  if (rIsPluralRing(currRing))
2358  {
2359  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
2360  }
2361  else
2362  #endif
2363  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
2364 
2365  if (Lp.p == NULL)
2366  {
2367  //PrintS("short spoly==NULL\n");
2368  pLmFree(Lp.lcm);
2369  }
2370  else
2371  {
2372  /*- the pair (S[i],p) enters L -*/
2373  Lp.p1 = strat->S[i];
2374  Lp.p2 = p;
2375  if (atR >= 0)
2376  {
2377  Lp.i_r1 = strat->S_2_R[i];
2378  Lp.i_r2 = atR;
2379  }
2380  else
2381  {
2382  Lp.i_r1 = -1;
2383  Lp.i_r2 = -1;
2384  }
2385  assume(pNext(Lp.p) == NULL);
2386  pNext(Lp.p) = strat->tail;
2387  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2389  {
2390  nDelete(&(Lp.p->coef));
2391  }
2392  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
2393  //Print("-> L[%d]\n",l);
2394  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
2395  }
2396 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:241
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
#define pHasNotCF(p1, p2)
Definition: polys.h: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:283
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1939
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
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
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:385
int l
Definition: cfEzgcd.cc:94
BOOLEAN enterOneStrongPoly ( int  i,
poly  p,
int  ,
int  ,
kStrategy  strat,
int  atR,
bool  enterTstrong 
)

Definition at line 1395 of file kutil.cc.

1396 {
1397  number d, s, t;
1398  assume(atR >= 0);
1399  poly m1, m2, gcd,si;
1400  if(!enterTstrong)
1401  {
1402  assume(i<=strat->sl);
1403  si = strat->S[i];
1404  }
1405  else
1406  {
1407  assume(i<=strat->tl);
1408  si = strat->T[i].p;
1409  }
1410  //printf("\n--------------------------------\n");
1411  //pWrite(p);pWrite(si);
1412  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1413 
1414  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1415  {
1416  nDelete(&d);
1417  nDelete(&s);
1418  nDelete(&t);
1419  return FALSE;
1420  }
1421 
1422  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1423  //p_Test(m1,strat->tailRing);
1424  //p_Test(m2,strat->tailRing);
1425  /*if(!enterTstrong)
1426  {
1427  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1428  {
1429  memset(&(strat->P), 0, sizeof(strat->P));
1430  kStratChangeTailRing(strat);
1431  strat->P = *(strat->R[atR]);
1432  p_LmFree(m1, strat->tailRing);
1433  p_LmFree(m2, strat->tailRing);
1434  p_LmFree(gcd, currRing);
1435  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1436  }
1437  }*/
1438  pSetCoeff0(m1, s);
1439  pSetCoeff0(m2, t);
1440  pSetCoeff0(gcd, d);
1441  p_Test(m1,strat->tailRing);
1442  p_Test(m2,strat->tailRing);
1443  //printf("\n===================================\n");
1444  //pWrite(m1);pWrite(m2);pWrite(gcd);
1445 #ifdef KDEBUG
1446  if (TEST_OPT_DEBUG)
1447  {
1448  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1449  PrintS("m1 = ");
1450  p_wrp(m1, strat->tailRing);
1451  PrintS(" ; m2 = ");
1452  p_wrp(m2, strat->tailRing);
1453  PrintS(" ; gcd = ");
1454  wrp(gcd);
1455  PrintS("\n--- create strong gcd poly: ");
1456  Print("\n p: %d", i);
1457  wrp(p);
1458  Print("\n strat->S[%d]: ", i);
1459  wrp(si);
1460  PrintS(" ---> ");
1461  }
1462 #endif
1463 
1464  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1465  p_LmDelete(m1, strat->tailRing);
1466  p_LmDelete(m2, strat->tailRing);
1467 #ifdef KDEBUG
1468  if (TEST_OPT_DEBUG)
1469  {
1470  wrp(gcd);
1471  PrintLn();
1472  }
1473 #endif
1474 
1475  LObject h;
1476  h.p = gcd;
1477  h.tailRing = strat->tailRing;
1478  int posx;
1479  h.pCleardenom();
1480  strat->initEcart(&h);
1481  h.sev = pGetShortExpVector(h.p);
1482  h.i_r1 = -1;h.i_r2 = -1;
1483  if (currRing!=strat->tailRing)
1484  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1485  if(!enterTstrong)
1486  {
1487  #if 1
1488  h.p1 = p;h.p2 = strat->S[i];
1489  #endif
1490  if (atR >= 0)
1491  {
1492  h.i_r2 = strat->S_2_R[i];
1493  h.i_r1 = atR;
1494  }
1495  else
1496  {
1497  h.i_r1 = -1;
1498  h.i_r2 = -1;
1499  }
1500  if (strat->Ll==-1)
1501  posx =0;
1502  else
1503  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1504  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1505  }
1506  else
1507  {
1508  if(h.IsNull()) return FALSE;
1509  //int red_result;
1510  //reduzieren ist teur!!!
1511  //if(strat->L != NULL)
1512  //red_result = strat->red(&h,strat);
1513  if(!h.IsNull())
1514  {
1515  enterT(h, strat,-1);
1516  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1517  //strat->enterS(h,pos,strat,-1);
1518  }
1519  }
1520  //#if 1
1521  #if ADIDEBUG
1522  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1523  #endif
1524  return TRUE;
1525 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
const CanonicalForm int s
Definition: facAbsFact.cc:55
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:963
#define TRUE
Definition: auxiliary.h:144
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:1111
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:901
#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
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:694
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1003
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
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 3370 of file kutil.cc.

3371 {
3372  int l,j,compare,compareCoeff;
3373  LObject Lp;
3374 
3375 #ifdef KDEBUG
3376  Lp.ecart=0; Lp.length=0;
3377 #endif
3378  /*- computes the lcm(s[i],p) -*/
3379  Lp.lcm = pInit();
3380 
3381  pLcm(p,f,Lp.lcm);
3382  pSetm(Lp.lcm);
3383  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
3384  assume(!strat->sugarCrit);
3385  assume(!strat->fromT);
3386  /*
3387  *the set B collects the pairs of type (S[j],p)
3388  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
3389  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
3390  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
3391  */
3392  for(j = strat->Bl;j>=0;j--)
3393  {
3394  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
3395  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
3396  if (compareCoeff == 0 || compare == compareCoeff)
3397  {
3398  if (compare == 1)
3399  {
3400  strat->c3++;
3401  pLmDelete(Lp.lcm);
3402  return;
3403  }
3404  else
3405  if (compare == -1)
3406  {
3407  deleteInL(strat->B,&strat->Bl,j,strat);
3408  strat->c3++;
3409  }
3410  }
3411  if (compare == pDivComp_EQUAL)
3412  {
3413  // Add hint for same LM and direction of LC (later) (TODO Oliver)
3414  if (compareCoeff == 1)
3415  {
3416  strat->c3++;
3417  pLmDelete(Lp.lcm);
3418  return;
3419  }
3420  else
3421  if (compareCoeff == -1)
3422  {
3423  deleteInL(strat->B,&strat->Bl,j,strat);
3424  strat->c3++;
3425  }
3426  }
3427  }
3428  /*
3429  *the pair (S[i],p) enters B if the spoly != 0
3430  */
3431  /*- compute the short s-polynomial -*/
3432  if ((f==NULL) || (p==NULL)) return;
3433  pNorm(p);
3434  {
3435  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
3436  }
3437  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
3438  {
3439  /*- the case that the s-poly is 0 -*/
3440 // if (strat->pairtest==NULL) initPairtest(strat);
3441 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
3442 // strat->pairtest[strat->sl+1] = TRUE;
3443  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
3444  /*
3445  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
3446  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
3447  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
3448  *term of p devides the lcm(s,r)
3449  *(this canceling should be done here because
3450  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
3451  *the first case is handeled in chainCrit
3452  */
3453  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
3454  }
3455  else
3456  {
3457  /*- the pair (S[i],p) enters B -*/
3458  Lp.p1 = f;
3459  Lp.p2 = p;
3460 
3461  pNext(Lp.p) = strat->tail;
3462 
3463  LObject tmp_h(f, currRing, strat->tailRing);
3464  tmp_h.SetShortExpVector();
3465  strat->initEcart(&tmp_h);
3466  tmp_h.sev = pGetShortExpVector(tmp_h.p);
3467  tmp_h.t_p = t_p;
3468 
3469  enterT(tmp_h, strat, strat->tl + 1);
3470 
3471  if (atR >= 0)
3472  {
3473  Lp.i_r2 = atR;
3474  Lp.i_r1 = strat->tl;
3475  }
3476 
3477  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
3478  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
3479  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
3480  }
3481 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:241
#define pDivComp_EQUAL
Definition: kutil.cc:132
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
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:566
int Bmax
Definition: kutil.h:350
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
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
FILE * f
Definition: checklibs.c:7
poly tail
Definition: kutil.h:332
BOOLEAN sugarCrit
Definition: kutil.h:367
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h: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 3984 of file kutil.cc.

3985 {
3986  int j=pos;
3987 
3988 #ifdef HAVE_RINGS
3990 #endif
3991  //#if ADIDEBUG
3992  #if 0
3993  Print("\n Vor initenterpairs: The new pair list L -- after superenterpairs in loop\n");
3994  for(int iii=0;iii<=strat->Ll;iii++)
3995  {
3996  printf("\n L[%d]:\n",iii);
3997  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3998  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3999  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
4000  }
4001  #endif
4002 
4003  initenterpairs(h,k,ecart,0,strat, atR);
4004 
4005  //#if ADIDEBUG
4006  #if 0
4007  Print("\n Nach initenterpairs: The new pair list L -- after superenterpairs in loop \n");
4008  for(int iii=0;iii<=strat->Ll;iii++)
4009  {
4010  printf("\n L[%d]:\n",iii);
4011  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
4012  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
4013  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
4014  }
4015  #endif
4016 
4017  if ( (!strat->fromT)
4018  && ((strat->syzComp==0)
4019  ||(pGetComp(h)<=strat->syzComp)))
4020  {
4021  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4022  unsigned long h_sev = pGetShortExpVector(h);
4023  loop
4024  {
4025  if (j > k) break;
4026  clearS(h,h_sev, &j,&k,strat);
4027  j++;
4028  }
4029  //Print("end clearS sl=%d\n",strat->sl);
4030  }
4031  // PrintS("end enterpairs\n");
4032 }
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3028
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:369
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
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
ring tailRing
Definition: kutil.h:341
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1141
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
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 10692 of file kutil.cc.

10693 {
10694  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
10695  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
10696  int j=pos;
10697 
10698 #ifdef HAVE_RINGS
10700 #endif
10701  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
10702  if ( (!strat->fromT)
10703  && ((strat->syzComp==0)
10704  ||(pGetComp(h)<=strat->syzComp)))
10705  {
10706  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
10707  unsigned long h_sev = pGetShortExpVector(h);
10708  loop
10709  {
10710  if (j > k) break;
10711  clearS(h,h_sev, &j,&k,strat);
10712  j++;
10713  }
10714  //Print("end clearS sl=%d\n",strat->sl);
10715  }
10716  // PrintS("end enterpairs\n");
10717 }
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
Definition: kutil.cc:10726
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:369
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:434
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1141
static Poly * h
Definition: janet.cc:978
void enterpairsSig ( poly  h,
poly  hSig,
int  hFrom,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR 
)

Definition at line 4040 of file kutil.cc.

4041 {
4042 int j=pos;
4043 
4044 #ifdef HAVE_RINGS
4046 #endif
4047 
4048 initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4049 if ( (!strat->fromT)
4050 && ((strat->syzComp==0)
4051  ||(pGetComp(h)<=strat->syzComp)))
4052 {
4053  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4054  unsigned long h_sev = pGetShortExpVector(h);
4055  loop
4056  {
4057  if (j > k) break;
4058  clearS(h,h_sev, &j,&k,strat);
4059  j++;
4060  }
4061  //Print("end clearS sl=%d\n",strat->sl);
4062 }
4063 // PrintS("end enterpairs\n");
4064 }
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3097
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:369
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:434
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1141
static Poly * h
Definition: janet.cc:978
void enterpairsSpecial ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4070 of file kutil.cc.

4071 {
4072  int j;
4073  const int iCompH = pGetComp(h);
4074 
4075 #ifdef HAVE_RINGS
4076  if (rField_is_Ring(currRing))
4077  {
4078  for (j=0; j<=k; j++)
4079  {
4080  const int iCompSj = pGetComp(strat->S[j]);
4081  if ((iCompH==iCompSj)
4082  //|| (0==iCompH) // can only happen,if iCompSj==0
4083  || (0==iCompSj))
4084  {
4085  enterOnePairRing(j,h,ecart,FALSE,strat, atR);
4086  }
4087  }
4088  kMergeBintoL(strat);
4089  }
4090  else
4091 #endif
4092  for (j=0; j<=k; j++)
4093  {
4094  const int iCompSj = pGetComp(strat->S[j]);
4095  if ((iCompH==iCompSj)
4096  //|| (0==iCompH) // can only happen,if iCompSj==0
4097  || (0==iCompSj))
4098  {
4099  enterOnePairSpecial(j,h,ecart,strat, atR);
4100  }
4101  }
4102 
4103  if (strat->noClearS) return;
4104 
4105 // #ifdef HAVE_PLURAL
4106 /*
4107  if (rIsPluralRing(currRing))
4108  {
4109  j=pos;
4110  loop
4111  {
4112  if (j > k) break;
4113 
4114  if (pLmDivisibleBy(h, strat->S[j]))
4115  {
4116  deleteInS(j, strat);
4117  j--;
4118  k--;
4119  }
4120 
4121  j++;
4122  }
4123  }
4124  else
4125 */
4126 // #endif // ??? Why was the following cancelation disabled for non-commutative rings?
4127  {
4128  j=pos;
4129  loop
4130  {
4131  unsigned long h_sev = pGetShortExpVector(h);
4132  if (j > k) break;
4133  clearS(h,h_sev,&j,&k,strat);
4134  j++;
4135  }
4136  }
4137 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
char noClearS
Definition: kutil.h:392
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:2333
#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:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1177
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1141
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
static Poly * h
Definition: janet.cc:978
void enterSBba ( LObject p,
int  atS,
kStrategy  strat,
int  atR 
)

Definition at line 7573 of file kutil.cc.

7574 {
7575  strat->news = TRUE;
7576  /*- puts p to the standardbasis s at position at -*/
7577  if (strat->sl == IDELEMS(strat->Shdl)-1)
7578  {
7579  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7580  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7581  (IDELEMS(strat->Shdl)+setmaxTinc)
7582  *sizeof(unsigned long));
7583  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7584  IDELEMS(strat->Shdl)*sizeof(int),
7585  (IDELEMS(strat->Shdl)+setmaxTinc)
7586  *sizeof(int));
7587  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7588  IDELEMS(strat->Shdl)*sizeof(int),
7589  (IDELEMS(strat->Shdl)+setmaxTinc)
7590  *sizeof(int));
7591  if (strat->lenS!=NULL)
7592  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7593  IDELEMS(strat->Shdl)*sizeof(int),
7594  (IDELEMS(strat->Shdl)+setmaxTinc)
7595  *sizeof(int));
7596  if (strat->lenSw!=NULL)
7597  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7598  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7599  (IDELEMS(strat->Shdl)+setmaxTinc)
7600  *sizeof(wlen_type));
7601  if (strat->fromQ!=NULL)
7602  {
7603  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7604  IDELEMS(strat->Shdl)*sizeof(int),
7605  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7606  }
7607  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7608  IDELEMS(strat->Shdl)+=setmaxTinc;
7609  strat->Shdl->m=strat->S;
7610  }
7611  if (atS <= strat->sl)
7612  {
7613 #ifdef ENTER_USE_MEMMOVE
7614 // #if 0
7615  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7616  (strat->sl - atS + 1)*sizeof(poly));
7617  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7618  (strat->sl - atS + 1)*sizeof(int));
7619  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7620  (strat->sl - atS + 1)*sizeof(unsigned long));
7621  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7622  (strat->sl - atS + 1)*sizeof(int));
7623  if (strat->lenS!=NULL)
7624  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7625  (strat->sl - atS + 1)*sizeof(int));
7626  if (strat->lenSw!=NULL)
7627  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7628  (strat->sl - atS + 1)*sizeof(wlen_type));
7629 #else
7630  for (i=strat->sl+1; i>=atS+1; i--)
7631  {
7632  strat->S[i] = strat->S[i-1];
7633  strat->ecartS[i] = strat->ecartS[i-1];
7634  strat->sevS[i] = strat->sevS[i-1];
7635  strat->S_2_R[i] = strat->S_2_R[i-1];
7636  }
7637  if (strat->lenS!=NULL)
7638  for (i=strat->sl+1; i>=atS+1; i--)
7639  strat->lenS[i] = strat->lenS[i-1];
7640  if (strat->lenSw!=NULL)
7641  for (i=strat->sl+1; i>=atS+1; i--)
7642  strat->lenSw[i] = strat->lenSw[i-1];
7643 #endif
7644  }
7645  if (strat->fromQ!=NULL)
7646  {
7647 #ifdef ENTER_USE_MEMMOVE
7648  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7649  (strat->sl - atS + 1)*sizeof(int));
7650 #else
7651  for (i=strat->sl+1; i>=atS+1; i--)
7652  {
7653  strat->fromQ[i] = strat->fromQ[i-1];
7654  }
7655 #endif
7656  strat->fromQ[atS]=0;
7657  }
7658 
7659  /*- save result -*/
7660  strat->S[atS] = p.p;
7661  if (strat->honey) strat->ecartS[atS] = p.ecart;
7662  if (p.sev == 0)
7663  p.sev = pGetShortExpVector(p.p);
7664  else
7665  assume(p.sev == pGetShortExpVector(p.p));
7666  strat->sevS[atS] = p.sev;
7667  strat->ecartS[atS] = p.ecart;
7668  strat->S_2_R[atS] = atR;
7669  strat->sl++;
7670 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:367
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:390
#define TRUE
Definition: auxiliary.h:144
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3551
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
void enterSMora ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1321 of file kstd1.cc.

1322 {
1323  enterSBba(p, atS, strat, atR);
1324  #ifdef KDEBUG
1325  if (TEST_OPT_DEBUG)
1326  {
1327  Print("new s%d:",atS);
1328  p_wrp(p.p,currRing,strat->tailRing);
1329  PrintLn();
1330  }
1331  #endif
1332  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1333  if (strat->kHEdgeFound)
1334  {
1335  if (newHEdge(strat))
1336  {
1337  firstUpdate(strat);
1338  if (TEST_OPT_FINDET)
1339  return;
1340 
1341  /*- cuts elements in L above noether and reorders L -*/
1342  updateLHC(strat);
1343  /*- reorders L with respect to posInL -*/
1344  reorderL(strat);
1345  }
1346  }
1347  else if (strat->kNoether!=NULL)
1348  strat->kHEdgeFound = TRUE;
1349  else if (TEST_OPT_FASTHC)
1350  {
1351  if (strat->posInLOldFlag)
1352  {
1353  missingAxis(&strat->lastAxis,strat);
1354  if (strat->lastAxis)
1355  {
1356  strat->posInLOld = strat->posInL;
1357  strat->posInLOldFlag = FALSE;
1358  strat->posInL = posInL10;
1359  strat->posInLDependsOnLength = TRUE;
1360  updateL(strat);
1361  reorderL(strat);
1362  }
1363  }
1364  else if (strat->lastAxis)
1365  updateL(strat);
1366  }
1367 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_DEBUG
Definition: options.h:103
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:436
void updateL(kStrategy strat)
Definition: kstd1.cc:1079
int lastAxis
Definition: kutil.h:354
#define TEST_OPT_FINDET
Definition: options.h:106
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:965
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:1153
void reorderL(kStrategy strat)
Definition: kstd1.cc:907
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
BOOLEAN kHEdgeFound
Definition: kutil.h:366
#define NULL
Definition: omList.c:10
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1250
ring tailRing
Definition: kutil.h:341
BOOLEAN posInLOldFlag
Definition: kutil.h:372
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8920
#define TEST_OPT_FASTHC
Definition: options.h:104
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1046
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7573
void enterSMoraNF ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1375 of file kstd1.cc.

1376 {
1377  enterSBba(p, atS, strat, atR);
1378  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1379  if (strat->kHEdgeFound)
1380  newHEdge(strat);
1381  else if (strat->kNoether!=NULL)
1382  strat->kHEdgeFound = TRUE;
1383 }
return P p
Definition: myNF.cc:203
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:144
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:436
BOOLEAN kHEdgeFound
Definition: kutil.h:366
#define NULL
Definition: omList.c:10
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8920
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7573
void enterSSba ( LObject p,
int  atS,
kStrategy  strat,
int  atR 
)

Definition at line 7676 of file kutil.cc.

7677 {
7678  strat->news = TRUE;
7679  /*- puts p to the standardbasis s at position at -*/
7680  if (strat->sl == IDELEMS(strat->Shdl)-1)
7681  {
7682  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7683  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7684  (IDELEMS(strat->Shdl)+setmaxTinc)
7685  *sizeof(unsigned long));
7686  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
7687  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7688  (IDELEMS(strat->Shdl)+setmaxTinc)
7689  *sizeof(unsigned long));
7690  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7691  IDELEMS(strat->Shdl)*sizeof(int),
7692  (IDELEMS(strat->Shdl)+setmaxTinc)
7693  *sizeof(int));
7694  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7695  IDELEMS(strat->Shdl)*sizeof(int),
7696  (IDELEMS(strat->Shdl)+setmaxTinc)
7697  *sizeof(int));
7698  if (strat->lenS!=NULL)
7699  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7700  IDELEMS(strat->Shdl)*sizeof(int),
7701  (IDELEMS(strat->Shdl)+setmaxTinc)
7702  *sizeof(int));
7703  if (strat->lenSw!=NULL)
7704  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7705  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7706  (IDELEMS(strat->Shdl)+setmaxTinc)
7707  *sizeof(wlen_type));
7708  if (strat->fromQ!=NULL)
7709  {
7710  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7711  IDELEMS(strat->Shdl)*sizeof(int),
7712  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7713  }
7714  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7715  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
7716  IDELEMS(strat->Shdl)+=setmaxTinc;
7717  strat->Shdl->m=strat->S;
7718  }
7719  // in a signature-based algorithm the following situation will never
7720  // appear due to the fact that the critical pairs are already sorted
7721  // by increasing signature.
7722  if (atS <= strat->sl)
7723  {
7724 #ifdef ENTER_USE_MEMMOVE
7725 // #if 0
7726  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7727  (strat->sl - atS + 1)*sizeof(poly));
7728  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7729  (strat->sl - atS + 1)*sizeof(int));
7730  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7731  (strat->sl - atS + 1)*sizeof(unsigned long));
7732  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7733  (strat->sl - atS + 1)*sizeof(int));
7734  if (strat->lenS!=NULL)
7735  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7736  (strat->sl - atS + 1)*sizeof(int));
7737  if (strat->lenSw!=NULL)
7738  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7739  (strat->sl - atS + 1)*sizeof(wlen_type));
7740 #else
7741  for (i=strat->sl+1; i>=atS+1; i--)
7742  {
7743  strat->S[i] = strat->S[i-1];
7744  strat->ecartS[i] = strat->ecartS[i-1];
7745  strat->sevS[i] = strat->sevS[i-1];
7746  strat->S_2_R[i] = strat->S_2_R[i-1];
7747  }
7748  if (strat->lenS!=NULL)
7749  for (i=strat->sl+1; i>=atS+1; i--)
7750  strat->lenS[i] = strat->lenS[i-1];
7751  if (strat->lenSw!=NULL)
7752  for (i=strat->sl+1; i>=atS+1; i--)
7753  strat->lenSw[i] = strat->lenSw[i-1];
7754 #endif
7755  }
7756  if (strat->fromQ!=NULL)
7757  {
7758 #ifdef ENTER_USE_MEMMOVE
7759  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7760  (strat->sl - atS + 1)*sizeof(int));
7761 #else
7762  for (i=strat->sl+1; i>=atS+1; i--)
7763  {
7764  strat->fromQ[i] = strat->fromQ[i-1];
7765  }
7766 #endif
7767  strat->fromQ[atS]=0;
7768  }
7769 
7770  /*- save result -*/
7771  strat->S[atS] = p.p;
7772  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
7773  if (strat->honey) strat->ecartS[atS] = p.ecart;
7774  if (p.sev == 0)
7775  p.sev = pGetShortExpVector(p.p);
7776  else
7777  assume(p.sev == pGetShortExpVector(p.p));
7778  strat->sevS[atS] = p.sev;
7779  // during the interreduction process of a signature-based algorithm we do not
7780  // compute the signature at this point, but when the whole interreduction
7781  // process finishes, i.e. f5c terminates!
7782  if (p.sig != NULL)
7783  {
7784  if (p.sevSig == 0)
7785  p.sevSig = pGetShortExpVector(p.sig);
7786  else
7787  assume(p.sevSig == pGetShortExpVector(p.sig));
7788  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
7789  }
7790  strat->ecartS[atS] = p.ecart;
7791  strat->S_2_R[atS] = atR;
7792  strat->sl++;
7793 #ifdef DEBUGF5
7794  int k;
7795  Print("--- LIST S: %d ---\n",strat->sl);
7796  for(k=0;k<=strat->sl;k++)
7797  {
7798  pWrite(strat->sig[k]);
7799  }
7800  Print("--- LIST S END ---\n");
7801 #endif
7802 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:367
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:390
#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
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3551
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
void enterSyz ( LObject p,
kStrategy  strat,
int  atT 
)

Definition at line 8003 of file kutil.cc.

8004 {
8005  int i;
8006  strat->newt = TRUE;
8007  if (strat->syzl == strat->syzmax-1)
8008  {
8009  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
8010  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
8011  (strat->syzmax)*sizeof(unsigned long),
8012  ((strat->syzmax)+setmaxTinc)
8013  *sizeof(unsigned long));
8014  strat->syzmax += setmaxTinc;
8015  }
8016  if (atT < strat->syzl)
8017  {
8018 #ifdef ENTER_USE_MEMMOVE
8019  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
8020  (strat->syzl-atT+1)*sizeof(poly));
8021  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
8022  (strat->syzl-atT+1)*sizeof(unsigned long));
8023 #endif
8024  for (i=strat->syzl; i>=atT+1; i--)
8025  {
8026 #ifndef ENTER_USE_MEMMOVE
8027  strat->syz[i] = strat->syz[i-1];
8028  strat->sevSyz[i] = strat->sevSyz[i-1];
8029 #endif
8030  }
8031  }
8032  //i = strat->syzl;
8033  i = atT;
8034  strat->syz[atT] = p.sig;
8035  strat->sevSyz[atT] = p.sevSig;
8036  strat->syzl++;
8037 #if F5DEBUG
8038  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
8039  pWrite(strat->syz[atT]);
8040 #endif
8041  // recheck pairs in strat->L with new rule and delete correspondingly
8042  int cc = strat->Ll;
8043  while (cc>-1)
8044  {
8045  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
8046  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing))
8047  {
8048  deleteInL(strat->L,&strat->Ll,cc,strat);
8049  }
8050  cc--;
8051  }
8052 //#if 1
8053 #ifdef DEBUGF5
8054  PrintS("--- Syzygies ---\n");
8055  Print("syzl %d\n",strat->syzl);
8056  Print("syzmax %d\n",strat->syzmax);
8057  PrintS("--------------------------------\n");
8058  for(i=0;i<=strat->syzl-1;i++)
8059  {
8060  Print("%d - ",i);
8061  pWrite(strat->syz[i]);
8062  }
8063  PrintS("--------------------------------\n");
8064 #endif
8065 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:391
#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:1049
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:1711
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:323
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3551
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
polyrec * poly
Definition: hilb.h:10
int syzl
Definition: kutil.h:347
void enterT ( LObject p,
kStrategy  strat,
int  atT 
)

Definition at line 7807 of file kutil.cc.

7808 {
7809  int i;
7810 
7811  pp_Test(p.p, currRing, p.tailRing);
7812  assume(strat->tailRing == p.tailRing);
7813  // redMoraNF complains about this -- but, we don't really
7814  // neeed this so far
7815  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7816  assume(p.FDeg == p.pFDeg());
7817  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7818 
7819 #ifdef KDEBUG
7820  // do not put an LObject twice into T:
7821  for(i=strat->tl;i>=0;i--)
7822  {
7823  if (p.p==strat->T[i].p)
7824  {
7825  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7826  return;
7827  }
7828  }
7829 #endif
7830 
7831 #ifdef HAVE_TAIL_RING
7832  if (currRing!=strat->tailRing)
7833  {
7834  p.t_p=p.GetLmTailRing();
7835  }
7836 #endif
7837  strat->newt = TRUE;
7838  if (atT < 0)
7839  atT = strat->posInT(strat->T, strat->tl, p);
7840  if (strat->tl == strat->tmax-1)
7841  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7842  if (atT <= strat->tl)
7843  {
7844 #ifdef ENTER_USE_MEMMOVE
7845  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7846  (strat->tl-atT+1)*sizeof(TObject));
7847  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7848  (strat->tl-atT+1)*sizeof(unsigned long));
7849 #endif
7850  for (i=strat->tl+1; i>=atT+1; i--)
7851  {
7852 #ifndef ENTER_USE_MEMMOVE
7853  strat->T[i] = strat->T[i-1];
7854  strat->sevT[i] = strat->sevT[i-1];
7855 #endif
7856  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7857  }
7858  }
7859 
7860  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7861  {
7863  (strat->tailRing != NULL ?
7864  strat->tailRing : currRing),
7865  strat->tailBin);
7866  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7867  }
7868  strat->T[atT] = (TObject) p;
7869  #if ADIDEBUG
7870  printf("\nenterT: add in position %i\n",atT);
7871  pWrite(p.p);
7872  #endif
7873  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
7874 
7875  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7876  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7877  else
7878  strat->T[atT].max = NULL;
7879 
7880  strat->tl++;
7881  strat->R[strat->tl] = &(strat->T[atT]);
7882  strat->T[atT].i_r = strat->tl;
7883  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7884  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7885  kTest_T(&(strat->T[atT]));
7886 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:391
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:279
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:484
#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:875
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:338
int tmax
Definition: kutil.h:348
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:322
#define kTest_T(T)
Definition: kutil.h:621
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
void enterT_strong ( LObject p,
kStrategy  strat,
int  atT 
)

Definition at line 7891 of file kutil.cc.

7892 {
7893  int i;
7894 
7895  pp_Test(p.p, currRing, p.tailRing);
7896  assume(strat->tailRing == p.tailRing);
7897  // redMoraNF complains about this -- but, we don't really
7898  // neeed this so far
7899  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7900  assume(p.FDeg == p.pFDeg());
7901  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7902 
7903 #ifdef KDEBUG
7904  // do not put an LObject twice into T:
7905  for(i=strat->tl;i>=0;i--)
7906  {
7907  if (p.p==strat->T[i].p)
7908  {
7909  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7910  return;
7911  }
7912  }
7913 #endif
7914 
7915 #ifdef HAVE_TAIL_RING
7916  if (currRing!=strat->tailRing)
7917  {
7918  p.t_p=p.GetLmTailRing();
7919  }
7920 #endif
7921  strat->newt = TRUE;
7922  if (atT < 0)
7923  atT = strat->posInT(strat->T, strat->tl, p);
7924  if (strat->tl == strat->tmax-1)
7925  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7926  if (atT <= strat->tl)
7927  {
7928 #ifdef ENTER_USE_MEMMOVE
7929  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7930  (strat->tl-atT+1)*sizeof(TObject));
7931  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7932  (strat->tl-atT+1)*sizeof(unsigned long));
7933 #endif
7934  for (i=strat->tl+1; i>=atT+1; i--)
7935  {
7936 #ifndef ENTER_USE_MEMMOVE
7937  strat->T[i] = strat->T[i-1];
7938  strat->sevT[i] = strat->sevT[i-1];
7939 #endif
7940  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7941  }
7942  }
7943 
7944  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7945  {
7947  (strat->tailRing != NULL ?
7948  strat->tailRing : currRing),
7949  strat->tailBin);
7950  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7951  }
7952  strat->T[atT] = (TObject) p;
7953  #if ADIDEBUG
7954  printf("\nenterT_strong: add in position %i\n",atT);
7955  pWrite(p.p);
7956  #endif
7957  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
7958 
7959  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7960  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7961  else
7962  strat->T[atT].max = NULL;
7963 
7964  strat->tl++;
7965  strat->R[strat->tl] = &(strat->T[atT]);
7966  strat->T[atT].i_r = strat->tl;
7967  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7968  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7969  #if 1
7970  #ifdef HAVE_RINGS
7972  {
7973  #if ADIDEBUG
7974  printf("\nDas ist p:\n");pWrite(p.p);
7975  #endif
7976  for(i=strat->tl;i>=0;i--)
7977  {
7978  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
7979  {
7980  #if ADIDEBUG
7981  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
7982  #endif
7983  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
7984  }
7985  }
7986  }
7987  /*
7988  printf("\nThis is T:\n");
7989  for(i=strat->tl;i>=0;i--)
7990  {
7991  pWrite(strat->T[i].p);
7992  }
7993  //getchar();*/
7994  #endif
7995  #endif
7996  kTest_T(&(strat->T[atT]));
7997 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:391
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:279
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:484
#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:875
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:338
int tmax
Definition: kutil.h:348
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1395
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:322
#define kTest_T(T)
Definition: kutil.h:621
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
void enterTShift ( LObject  p,
kStrategy  strat,
int  atT,
int  uptodeg,
int  lV 
)

Definition at line 10799 of file kutil.cc.

10800 {
10801  /* determine how many elements we have to insert */
10802  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
10803  /* hence, a total number of elt's to add is: */
10804  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
10805 
10806  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
10807 
10808 #ifdef PDEBUG
10809  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
10810 #endif
10811  int i;
10812 
10813  if (atT < 0)
10814  atT = strat->posInT(strat->T, strat->tl, p);
10815 
10816  /* can call enterT in a sequence, e.g. */
10817 
10818  /* shift0 = it's our model for further shifts */
10819  enterT(p,strat,atT);
10820  LObject qq;
10821  for (i=1; i<=toInsert; i++) // toIns - 1?
10822  {
10823  qq = p; //qq.Copy();
10824  qq.p = NULL;
10825  qq.max = NULL;
10826  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
10827  qq.GetP();
10828  // update q.sev
10829  qq.sev = pGetShortExpVector(qq.p);
10830  /* enter it into T, first el't is with the shift 0 */
10831  // compute the position for qq
10832  atT = strat->posInT(strat->T, strat->tl, qq);
10833  enterT(qq,strat,atT);
10834  }
10835 /* Q: what to do with this one in the orig enterT ? */
10836 /* strat->R[strat->tl] = &(strat->T[atT]); */
10837 /* Solution: it is done by enterT each time separately */
10838 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:348
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:810
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
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:341
TSet T
Definition: kutil.h:322
void exitBuchMora ( kStrategy  strat)

Definition at line 8415 of file kutil.cc.

8416 {
8417  /*- release temp data -*/
8418  cleanT(strat);
8419  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8420  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8421  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8422  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8423  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8424  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8425  /*- set L: should be empty -*/
8426  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8427  /*- set B: should be empty -*/
8428  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8429  pLmDelete(&strat->tail);
8430  strat->syzComp=0;
8431 }
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:350
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:505
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
unsigned long * sevS
Definition: kutil.h:318
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59
void exitSba ( kStrategy  strat)

Definition at line 8610 of file kutil.cc.

8611 {
8612  /*- release temp data -*/
8613  cleanT(strat);
8614  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8615  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8616  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8617  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8618  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8619  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8620  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
8621  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8622  if (strat->sbaOrder == 1)
8623  {
8624  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8625  }
8626  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8627  /*- set L: should be empty -*/
8628  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8629  /*- set B: should be empty -*/
8630  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8631  /*- set sig: no need for the signatures anymore -*/
8632  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
8633  pLmDelete(&strat->tail);
8634  strat->syzComp=0;
8635 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int syzComp
Definition: kutil.h:352
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:350
unsigned sbaOrder
Definition: kutil.h:312
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:505
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
int syzidxmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59
intset syzIdx
Definition: kutil.h:309
BOOLEAN faugereRewCriterion ( poly  sig,
unsigned long  not_sevSig,
poly  ,
kStrategy  strat,
int  start = 0 
)

Definition at line 5746 of file kutil.cc.

5747 {
5748  //printf("Faugere Rewritten Criterion\n");
5749 //#if 1
5750 #ifdef DEBUGF5
5751  PrintS("rewritten criterion checks: ");
5752  pWrite(sig);
5753 #endif
5754  for(int k = strat->sl; k>=start; k--)
5755  {
5756 //#if 1
5757 #ifdef DEBUGF5
5758  Print("checking with: ");
5759  pWrite(strat->sig[k]);
5760  pWrite(pHead(strat->S[k]));
5761 #endif
5762  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
5763  {
5764 //#if 1
5765 #ifdef DEBUGF5
5766  PrintS("DELETE!\n");
5767 #endif
5768  return TRUE;
5769  }
5770  //k--;
5771  }
5772 #ifdef DEBUGF5
5773  Print("ALL ELEMENTS OF S\n----------------------------------------\n");
5774  for(int kk = 0; kk<strat->sl+1; kk++)
5775  {
5776  pWrite(pHead(strat->S[kk]));
5777  }
5778  Print("------------------------------\n");
5779 #endif
5780  return FALSE;
5781 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#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:1711
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:302
int sl
Definition: kutil.h:346
void finalReduceByMon ( kStrategy  strat)

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

Definition at line 9290 of file kutil.cc.

9291 {
9292  if(!nCoeff_is_Ring_Z(currRing->cf))
9293  return;
9294  poly p,pp;
9295  for(int j = 0; j<=strat->sl; j++)
9296  {
9297  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
9298  {
9299  for(int i = 0; i<=strat->sl; i++)
9300  {
9301  if((i != j) && (strat->S[i] != NULL))
9302  {
9303  p = strat->S[i];
9304  if(pLmDivisibleBy(strat->S[j], p))
9305  {
9306  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
9307  p_SetCoeff(p,dummy,currRing);
9308  }
9309  pp = pNext(p);
9310  if((pp == NULL) && (nIsZero(p->coef)))
9311  {
9312  deleteInS(i, strat);
9313  }
9314  else
9315  {
9316  while(pp != NULL)
9317  {
9318  if(pLmDivisibleBy(strat->S[j], pp))
9319  {
9320  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
9321  p_SetCoeff(pp,dummy,currRing);
9322  if(nIsZero(pp->coef))
9323  {
9324  pLmDelete(&pNext(p));
9325  pp = pNext(p);
9326  }
9327  else
9328  {
9329  p = pp;
9330  pp = pNext(p);
9331  }
9332  }
9333  else
9334  {
9335  p = pp;
9336  pp = pNext(p);
9337  }
9338  }
9339  }
9340  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
9341  {
9342  if(pNext(strat->S[i]) == NULL)
9343  strat->S[i]=NULL;
9344  else
9345  strat->S[i]=pNext(strat->S[i]);
9346  }
9347  }
9348  }
9349  //idPrint(strat->Shdl);
9350  }
9351  }
9352  //idSkipZeroes(strat->Shdl);
9353 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:629
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:755
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
int getIndexRng ( long  coeff)
inline

Definition at line 5322 of file kutil.cc.

5323 {
5324  if (coeff == 0) return -1;
5325  long tmp = coeff;
5326  int ind = 0;
5327  while (tmp % 2 == 0)
5328  {
5329  tmp = tmp / 2;
5330  ind++;
5331  }
5332  return ind;
5333 }
void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 436 of file kutil.cc.

437 {
438  int j,/*k,*/p;
439 
440  strat->kHEdgeFound=FALSE;
441  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
442  {
443  return;
444  }
445  if (strat->ak > 1) /*we are in the module case*/
446  {
447  return; // until ....
448  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
449  // return FALSE;
450  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
451  // return FALSE;
452  }
453  // k = 0;
454  p=pIsPurePower(pp);
455  if (p!=0) strat->NotUsedAxis[p] = FALSE;
456  /*- the leading term of pp is a power of the p-th variable -*/
457  for (j=(currRing->N);j>0; j--)
458  {
459  if (strat->NotUsedAxis[j])
460  {
461  return;
462  }
463  }
464  strat->kHEdgeFound=TRUE;
465 }
#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:330
#define TRUE
Definition: auxiliary.h:144
int ak
Definition: kutil.h:351
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 rHasMixedOrdering(const ring r)
Definition: ring.h:751
BOOLEAN kHEdgeFound
Definition: kutil.h:366
long ind2 ( long  arg)

Definition at line 3335 of file kutil.cc.

3336 {
3337  long ind = 0;
3338  if (arg <= 0) return 0;
3339  while (arg%2 == 0)
3340  {
3341  arg = arg / 2;
3342  ind++;
3343  }
3344  return ind;
3345 }
long ind_fact_2 ( long  arg)

Definition at line 3347 of file kutil.cc.

3348 {
3349  long ind = 0;
3350  if (arg <= 0) return 0;
3351  if (arg%2 == 1) { arg--; }
3352  while (arg > 0)
3353  {
3354  ind += ind2(arg);
3355  arg = arg - 2;
3356  }
3357  return ind;
3358 }
long ind2(long arg)
Definition: kutil.cc:3335
void initBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 8334 of file kutil.cc.

8335 {
8336  strat->interpt = BTEST1(OPT_INTERRUPT);
8337  strat->kHEdge=NULL;
8339  /*- creating temp data structures------------------- -*/
8340  strat->cp = 0;
8341  strat->c3 = 0;
8342  strat->tail = pInit();
8343  /*- set s -*/
8344  strat->sl = -1;
8345  /*- set L -*/
8346  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8347  strat->Ll = -1;
8348  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8349  /*- set B -*/
8350  strat->Bmax = setmaxL;
8351  strat->Bl = -1;
8352  strat->B = initL();
8353  /*- set T -*/
8354  strat->tl = -1;
8355  strat->tmax = setmaxT;
8356  strat->T = initT();
8357  strat->R = initR();
8358  strat->sevT = initsevT();
8359  /*- init local data struct.---------------------------------------- -*/
8360  strat->P.ecart=0;
8361  strat->P.length=0;
8362  strat->P.pLength=0;
8364  {
8365  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8366  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8367  }
8368  #ifdef HAVE_RINGS
8370  {
8371  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8372  }
8373  else
8374  #endif
8375  {
8376  if(TEST_OPT_SB_1)
8377  {
8378  int i;
8379  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8380  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8381  {
8382  P->m[i-strat->newIdeal] = F->m[i];
8383  F->m[i] = NULL;
8384  }
8385  initSSpecial(F,Q,P,strat);
8386  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8387  {
8388  F->m[i] = P->m[i-strat->newIdeal];
8389  P->m[i-strat->newIdeal] = NULL;
8390  }
8391  idDelete(&P);
8392  }
8393 
8394  else
8395  {
8396  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8397  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8398  }
8399  }
8400  strat->fromT = FALSE;
8402  if ((!TEST_OPT_SB_1)
8403  #ifdef HAVE_RINGS
8404  || (rField_is_Ring(currRing))
8405  #endif
8406  )
8407  {
8408  updateS(TRUE,strat);
8409  }
8410  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8411  strat->fromQ=NULL;
8412  assume(kTest_TS(strat));
8413 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6482
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
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:369
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6882
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:366
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7341
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:411
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void initBuchMoraCrit ( kStrategy  strat)

Definition at line 8088 of file kutil.cc.

8089 {
8091  strat->chainCrit=chainCritNormal;
8092  if (TEST_OPT_SB_1)
8093  strat->chainCrit=chainCritOpt_1;
8094 #ifdef HAVE_RINGS
8095  if (rField_is_Ring(currRing))
8096  {
8098  strat->chainCrit=chainCritRing;
8099  }
8100 #endif
8101 #ifdef HAVE_RATGRING
8102  if (rIsRatGRing(currRing))
8103  {
8104  strat->chainCrit=chainCritPart;
8105  /* enterOnePairNormal get rational part in it */
8106  }
8107 #endif
8108  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
8109  && (!rIsPluralRing(currRing)))
8111 
8112 
8113  strat->sugarCrit = TEST_OPT_SUGARCRIT;
8114  strat->Gebauer = strat->homog || strat->sugarCrit;
8115  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
8116  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
8117  strat->pairtest = NULL;
8118  /* alway use tailreduction, except:
8119  * - in local rings, - in lex order case, -in ring over extensions */
8121  //if(rHasMixedOrdering(currRing)==2)
8122  //{
8123  // strat->noTailReduction =TRUE;
8124  //}
8125 
8126 #ifdef HAVE_PLURAL
8127  // and r is plural_ring
8128  // hence this holds for r a rational_plural_ring
8129  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
8130  { //or it has non-quasi-comm type... later
8131  strat->sugarCrit = FALSE;
8132  strat->Gebauer = FALSE;
8133  strat->honey = FALSE;
8134  }
8135 #endif
8136 
8137 #ifdef HAVE_RINGS
8138  // Coefficient ring?
8139  if (rField_is_Ring(currRing))
8140  {
8141  strat->sugarCrit = FALSE;
8142  strat->Gebauer = FALSE ;
8143  strat->honey = FALSE;
8144  }
8145 #endif
8146  #ifdef KDEBUG
8147  if (TEST_OPT_DEBUG)
8148  {
8149  if (strat->homog) PrintS("ideal/module is homogeneous\n");
8150  else PrintS("ideal/module is not homogeneous\n");
8151  }
8152  #endif
8153 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:367
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2447
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:372
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:364
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1532
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:286
BOOLEAN homog
Definition: kutil.h:362
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3162
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:368
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:367
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
#define TEST_OPT_SB_1
Definition: options.h:113
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1177
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2662
void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1837
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2737
void initBuchMoraPos ( kStrategy  strat)

Definition at line 8240 of file kutil.cc.

8241 {
8243  {
8244  if (strat->honey)
8245  {
8246  strat->posInL = posInL15;
8247  // ok -- here is the deal: from my experiments for Singular-2-0
8248  // I conclude that that posInT_EcartpLength is the best of
8249  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8250  // see the table at the end of this file
8251  if (TEST_OPT_OLDSTD)
8252  strat->posInT = posInT15;
8253  else
8254  strat->posInT = posInT_EcartpLength;
8255  }
8256  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8257  {
8258  strat->posInL = posInL11;
8259  strat->posInT = posInT11;
8260  }
8261  else if (TEST_OPT_INTSTRATEGY)
8262  {
8263  strat->posInL = posInL11;
8264  strat->posInT = posInT11;
8265  }
8266  else
8267  {
8268  strat->posInL = posInL0;
8269  strat->posInT = posInT0;
8270  }
8271  //if (strat->minim>0) strat->posInL =posInLSpecial;
8272  if (strat->homog)
8273  {
8274  strat->posInL = posInL110;
8275  strat->posInT = posInT110;
8276  }
8277  }
8278  else
8279  {
8280  if (strat->homog)
8281  {
8282  strat->posInL = posInL11;
8283  strat->posInT = posInT11;
8284  }
8285  else
8286  {
8287  if ((currRing->order[0]==ringorder_c)
8288  ||(currRing->order[0]==ringorder_C))
8289  {
8290  strat->posInL = posInL17_c;
8291  strat->posInT = posInT17_c;
8292  }
8293  else
8294  {
8295  strat->posInL = posInL17;
8296  strat->posInT = posInT17;
8297  }
8298  }
8299  }
8300  if (strat->minim>0) strat->posInL =posInLSpecial;
8301  // for further tests only
8302  if ((BTEST1(11)) || (BTEST1(12)))
8303  strat->posInL = posInL11;
8304  else if ((BTEST1(13)) || (BTEST1(14)))
8305  strat->posInL = posInL13;
8306  else if ((BTEST1(15)) || (BTEST1(16)))
8307  strat->posInL = posInL15;
8308  else if ((BTEST1(17)) || (BTEST1(18)))
8309  strat->posInL = posInL17;
8310  if (BTEST1(11))
8311  strat->posInT = posInT11;
8312  else if (BTEST1(13))
8313  strat->posInT = posInT13;
8314  else if (BTEST1(15))
8315  strat->posInT = posInT15;
8316  else if ((BTEST1(17)))
8317  strat->posInT = posInT17;
8318  else if ((BTEST1(19)))
8319  strat->posInT = posInT19;
8320  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8321  strat->posInT = posInT1;
8322 #ifdef HAVE_RINGS
8323  if (rField_is_Ring(currRing))
8324  {
8325  strat->posInL = posInL11Ring;
8326  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8327  strat->posInL = posInL11Ringls;
8328  strat->posInT = posInT11;
8329  }
8330 #endif
8332 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5081
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5558
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5227
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4313
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5500
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5465
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4618
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5419
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4302
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:8228
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:4371
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4740
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5139
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4905
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5606
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4676
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4504
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4862
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4805
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4579
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4550
void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 10176 of file kutil.cc.

10177 {
10178  strat->interpt = BTEST1(OPT_INTERRUPT);
10179  strat->kHEdge=NULL;
10181  /*- creating temp data structures------------------- -*/
10182  strat->cp = 0;
10183  strat->c3 = 0;
10184  strat->cv = 0;
10185  strat->tail = pInit();
10186  /*- set s -*/
10187  strat->sl = -1;
10188  /*- set L -*/
10189  strat->Lmax = setmaxL;
10190  strat->Ll = -1;
10191  strat->L = initL();
10192  /*- set B -*/
10193  strat->Bmax = setmaxL;
10194  strat->Bl = -1;
10195  strat->B = initL();
10196  /*- set T -*/
10197  strat->tl = -1;
10198  strat->tmax = setmaxT;
10199  strat->T = initT();
10200  strat->R = initR();
10201  strat->sevT = initsevT();
10202  /*- init local data struct.---------------------------------------- -*/
10203  strat->P.ecart=0;
10204  strat->P.length=0;
10206  {
10207  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10208  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10209  }
10210  #ifdef HAVE_RINGS
10212  {
10213  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10214  }
10215  #endif
10216  {
10217  if(TEST_OPT_SB_1)
10218  {
10219  int i;
10220  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10221  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10222  {
10223  P->m[i-strat->newIdeal] = F->m[i];
10224  F->m[i] = NULL;
10225  }
10226  initSSpecial(F,Q,P,strat);
10227  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10228  {
10229  F->m[i] = P->m[i-strat->newIdeal];
10230  P->m[i-strat->newIdeal] = NULL;
10231  }
10232  idDelete(&P);
10233  }
10234  else
10235  {
10236  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10237  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10238  }
10239  }
10240  strat->fromT = FALSE;
10241  if (!TEST_OPT_SB_1)
10242  {
10243  /* the only change: we do not fill the set T*/
10244  #ifdef HAVE_RINGS
10245  if(!rField_is_Ring(currRing))
10246  #endif
10247  updateS(FALSE,strat);
10248  }
10249  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10250  strat->fromQ=NULL;
10251  /* more changes: fill the set T with all the shifts of elts of S*/
10252  /* is done by other procedure */
10253 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:359
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6482
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
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:369
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6882
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:366
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7341
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:411
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
static intset initec ( const int  maxnr)
inlinestatic

Definition at line 470 of file kutil.cc.

471 {
472  return (intset)omAlloc(maxnr*sizeof(int));
473 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * intset
Definition: kutil.h:55
void initEcartBBA ( TObject h)

Definition at line 1143 of file kutil.cc.

1144 {
1145  h->FDeg = h->pFDeg();
1146  (*h).ecart = 0;
1147  h->length=h->pLength=pLength(h->p);
1148 }
static int pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978
void initEcartNormal ( TObject h)

Definition at line 1135 of file kutil.cc.

1136 {
1137  h->FDeg = h->pFDeg();
1138  h->ecart = h->pLDeg() - h->FDeg;
1139  // h->length is set by h->pLDeg
1140  h->length=h->pLength=pLength(h->p);
1141 }
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 1150 of file kutil.cc.

1151 {
1152  Lp->FDeg = Lp->pFDeg();
1153  (*Lp).ecart = 0;
1154  (*Lp).length = 0;
1155 }
void initEcartPairMora ( LObject Lp,
poly  ,
poly  ,
int  ecartF,
int  ecartG 
)

Definition at line 1157 of file kutil.cc.

1158 {
1159  Lp->FDeg = Lp->pFDeg();
1160  (*Lp).ecart = si_max(ecartF,ecartG);
1161  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1162  (*Lp).length = 0;
1163 }
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:375
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 3028 of file kutil.cc.

3029 {
3030 
3031  if ((strat->syzComp==0)
3032  || (pGetComp(h)<=strat->syzComp))
3033  {
3034  int j;
3035  BOOLEAN new_pair=FALSE;
3036 
3037  if (pGetComp(h)==0)
3038  {
3039  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3040  if ((isFromQ)&&(strat->fromQ!=NULL))
3041  {
3042  for (j=0; j<=k; j++)
3043  {
3044  if (!strat->fromQ[j])
3045  {
3046  new_pair=TRUE;
3047  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3048  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3049  }
3050  }
3051  }
3052  else
3053  {
3054  new_pair=TRUE;
3055  for (j=0; j<=k; j++)
3056  {
3057  #if ADIDEBUG
3058  PrintS("\n Trying to add spoly : \n");
3059  PrintS(" ");p_Write(h, strat->tailRing);
3060  PrintS(" ");p_Write(strat->S[j],strat->tailRing);
3061  #endif
3062  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3063  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3064  }
3065  }
3066  }
3067  else
3068  {
3069  for (j=0; j<=k; j++)
3070  {
3071  if ((pGetComp(h)==pGetComp(strat->S[j]))
3072  || (pGetComp(strat->S[j])==0))
3073  {
3074  new_pair=TRUE;
3075  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3076  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3077  }
3078  }
3079  }
3080  if (new_pair)
3081  {
3082  #ifdef HAVE_RATGRING
3083  if (currRing->real_var_start>0)
3084  chainCritPart(h,ecart,strat);
3085  else
3086  #endif
3087  strat->chainCrit(h,ecart,strat);
3088  }
3089  kMergeBintoL(strat);
3090  }
3091 }
int syzComp
Definition: kutil.h:352
#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:286
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2737
void initenterpairsShift ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 10726 of file kutil.cc.

10727 {
10728  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
10729  // atR = -1;
10730  if ((strat->syzComp==0)
10731  || (pGetComp(h)<=strat->syzComp))
10732  {
10733  int j;
10734  BOOLEAN new_pair=FALSE;
10735 
10736  if (pGetComp(h)==0)
10737  {
10738  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
10739  if ((isFromQ)&&(strat->fromQ!=NULL))
10740  {
10741  for (j=0; j<=k; j++)
10742  {
10743  if (!strat->fromQ[j])
10744  {
10745  new_pair=TRUE;
10746  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
10747  // other side pairs:
10748  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
10749  //Print("j:%d, Ll:%d\n",j,strat->Ll);
10750  }
10751  }
10752  }
10753  else
10754  {
10755  new_pair=TRUE;
10756  for (j=0; j<=k; j++)
10757  {
10758  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
10759  // other side pairs
10760  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
10761  }
10762  /* HERE we put (h, s*h) pairs */
10763  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
10764  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
10765  }
10766  }
10767  else
10768  {
10769  for (j=0; j<=k; j++)
10770  {
10771  if ((pGetComp(h)==pGetComp(strat->S[j]))
10772  || (pGetComp(strat->S[j])==0))
10773  {
10774  new_pair=TRUE;
10775  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
10776  // other side pairs
10777  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
10778  //Print("j:%d, Ll:%d\n",j,strat->Ll);
10779  }
10780  }
10781  /* HERE we put (h, s*h) pairs */
10782  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
10783  }
10784 
10785  if (new_pair)
10786  {
10787  strat->chainCrit(h,ecart,strat);
10788  }
10789 
10790  }
10791 }
int syzComp
Definition: kutil.h:352
#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:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:10260
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:10335
void initenterpairsSig ( poly  h,
poly  hSig,
int  hFrom,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3097 of file kutil.cc.

3098 {
3099 
3100  if ((strat->syzComp==0)
3101  || (pGetComp(h)<=strat->syzComp))
3102  {
3103  int j;
3104  BOOLEAN new_pair=FALSE;
3105 
3106  if (pGetComp(h)==0)
3107  {
3108  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3109  if ((isFromQ)&&(strat->fromQ!=NULL))
3110  {
3111  for (j=0; j<=k; j++)
3112  {
3113  if (!strat->fromQ[j])
3114  {
3115  new_pair=TRUE;
3116  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3117  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3118  }
3119  }
3120  }
3121  else
3122  {
3123  new_pair=TRUE;
3124  for (j=0; j<=k; j++)
3125  {
3126  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3127  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3128  }
3129  }
3130  }
3131  else
3132  {
3133  for (j=0; j<=k; j++)
3134  {
3135  if ((pGetComp(h)==pGetComp(strat->S[j]))
3136  || (pGetComp(strat->S[j])==0))
3137  {
3138  new_pair=TRUE;
3139  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3140  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3141  }
3142  }
3143  }
3144 
3145  if (new_pair)
3146  {
3147 #ifdef HAVE_RATGRING
3148  if (currRing->real_var_start>0)
3149  chainCritPart(h,ecart,strat);
3150  else
3151 #endif
3152  strat->chainCrit(h,ecart,strat);
3153  }
3154  }
3155 }
int syzComp
Definition: kutil.h:352
#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:2053
#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:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2737
void initenterstrongPairs ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3749 of file kutil.cc.

3750 {
3751  const int iCompH = pGetComp(h);
3752  if (!nIsOne(pGetCoeff(h)))
3753  {
3754  int j;
3755 
3756  for (j=0; j<=k; j++)
3757  {
3758  // Print("j:%d, Ll:%d\n",j,strat->Ll);
3759 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
3760 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
3761  if (((iCompH == pGetComp(strat->S[j]))
3762  || (0 == pGetComp(strat->S[j])))
3763  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
3764  {
3765  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
3766  }
3767  }
3768  }
3769 /*
3770 ring r=256,(x,y,z),dp;
3771 ideal I=12xz-133y, 2xy-z;
3772 */
3773 }
int syzComp
Definition: kutil.h:352
#define FALSE
Definition: auxiliary.h:140
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
polyset S
Definition: kutil.h:302
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1395
static Poly * h
Definition: janet.cc:978
void initenterzeropairsRing ( poly  p,
int  ecart,
kStrategy  strat,
int  atR 
)

Definition at line 3617 of file kutil.cc.

3618 {
3619  // Initialize
3620  long exp[50]; // The exponent of \hat{X} (basepoint)
3621  long cexp[50]; // The current exponent for iterating over all
3622  long ind[50]; // The power of 2 in the i-th component of exp
3623  long cind[50]; // analog for cexp
3624  long mult[50]; // How to multiply the elements of G
3625  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3626  long habsind = 0; // The abs. index of the coefficient of h
3627  long step[50]; // The last increases
3628  for (int i = 1; i <= currRing->N; i++)
3629  {
3630  exp[i] = p_GetExp(p, i, currRing);
3631  if (exp[i] & 1 != 0)
3632  {
3633  exp[i] = exp[i] - 1;
3634  mult[i] = 1;
3635  }
3636  cexp[i] = exp[i];
3637  ind[i] = ind_fact_2(exp[i]);
3638  cabsind += ind[i];
3639  cind[i] = ind[i];
3640  step[i] = 500000;
3641  }
3642  step[1] = 500000;
3643  habsind = ind2(n_Int(pGetCoeff(p), currRing->cf);
3644  long bound = currRing->ch - habsind;
3645 #ifdef OLI_DEBUG
3646  PrintS("-------------\npoly :");
3647  wrp(p);
3648  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3649  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3650  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3651  Print("bound : %d\n", bound);
3652  Print("cind : %d\n", cabsind);
3653 #endif
3654  if (cabsind == 0)
3655  {
3656  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3657  {
3658  return;
3659  }
3660  }
3661  // Now the whole simplex
3662  do
3663  {
3664  // Build s-polynomial
3665  // 2**ind-def * mult * g - exp-def * h
3666  poly t_p;
3667  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, strat->tailRing);
3668 #ifdef OLI_DEBUG
3669  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3670  Print("zPoly : ");
3671  wrp(zeroPoly);
3672  Print("\n");
3673 #endif
3674  enterOneZeroPairRing(zeroPoly, t_p, p, ecart, strat, atR);
3675  }
3676  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3677 }
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:3554
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:3488
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:548
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
void enterOneZeroPairRing(poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:3370
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:3347
ring tailRing
Definition: kutil.h:341
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:3335
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
void initHilbCrit ( ideal  ,
ideal  ,
intvec **  hilb,
kStrategy  strat 
)

Definition at line 8068 of file kutil.cc.

8069 {
8070 
8071  //if the ordering is local, then hilb criterion
8072  //can be used also if the ideal is not homogenous
8074  #ifdef HAVE_RINGS
8075  {
8077  *hilb=NULL;
8078  else
8079  return;
8080  }
8081 #endif
8082  if (strat->homog!=isHomog)
8083  {
8084  *hilb=NULL;
8085  }
8086 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
#define FALSE
Definition: auxiliary.h:140
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:362
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:751
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
void initPairtest ( kStrategy  strat)

Definition at line 572 of file kutil.cc.

573 {
574  strat->pairtest = (BOOLEAN *)omAlloc0((strat->sl+2)*sizeof(BOOLEAN));
575 }
BOOLEAN * pairtest
Definition: kutil.h:331
int sl
Definition: kutil.h:346
int BOOLEAN
Definition: auxiliary.h:131
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void initS ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6379 of file kutil.cc.

6380 {
6381  int i,pos;
6382 
6383  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6384  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6385  strat->ecartS=initec(i);
6386  strat->sevS=initsevS(i);
6387  strat->S_2_R=initS_2_R(i);
6388  strat->fromQ=NULL;
6389  strat->Shdl=idInit(i,F->rank);
6390  strat->S=strat->Shdl->m;
6391  /*- put polys into S -*/
6392  if (Q!=NULL)
6393  {
6394  strat->fromQ=initec(i);
6395  memset(strat->fromQ,0,i*sizeof(int));
6396  for (i=0; i<IDELEMS(Q); i++)
6397  {
6398  if (Q->m[i]!=NULL)
6399  {
6400  LObject h;
6401  h.p = pCopy(Q->m[i]);
6403  {
6404  //pContent(h.p);
6405  h.pCleardenom(); // also does a pContent
6406  }
6407  else
6408  {
6409  h.pNorm();
6410  }
6412  {
6413  deleteHC(&h, strat);
6414  }
6415  if (h.p!=NULL)
6416  {
6417  strat->initEcart(&h);
6418  if (strat->sl==-1)
6419  pos =0;
6420  else
6421  {
6422  pos = posInS(strat,strat->sl,h.p,h.ecart);
6423  }
6424  h.sev = pGetShortExpVector(h.p);
6425  strat->enterS(h,pos,strat,-1);
6426  strat->fromQ[pos]=1;
6427  }
6428  }
6429  }
6430  }
6431  for (i=0; i<IDELEMS(F); i++)
6432  {
6433  if (F->m[i]!=NULL)
6434  {
6435  LObject h;
6436  h.p = pCopy(F->m[i]);
6438  {
6439  /*#ifdef HAVE_RINGS
6440  if (rField_is_Ring(currRing))
6441  {
6442  h.pCleardenom();
6443  }
6444  else
6445  #endif*/
6446  cancelunit(&h); /*- tries to cancel a unit -*/
6447  deleteHC(&h, strat);
6448  }
6449  if (h.p!=NULL)
6450  // do not rely on the input being a SB!
6451  {
6453  {
6454  //pContent(h.p);
6455  h.pCleardenom(); // also does a pContent
6456  }
6457  else
6458  {
6459  h.pNorm();
6460  }
6461  strat->initEcart(&h);
6462  if (strat->sl==-1)
6463  pos =0;
6464  else
6465  pos = posInS(strat,strat->sl,h.p,h.ecart);
6466  h.sev = pGetShortExpVector(h.p);
6467  strat->enterS(h,pos,strat,-1);
6468  }
6469  }
6470  }
6471  /*- test, if a unit is in F -*/
6472  if ((strat->sl>=0)
6473 #ifdef HAVE_RINGS
6474  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
6475 #endif
6476  && pIsConstant(strat->S[0]))
6477  {
6478  while (strat->sl>0) deleteInS(strat->sl,strat);
6479  }
6480 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
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:475
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static int* initS_2_R ( const int  maxnr)
inlinestatic

Definition at line 479 of file kutil.cc.

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

Definition at line 8531 of file kutil.cc.

8532 {
8533  strat->interpt = BTEST1(OPT_INTERRUPT);
8534  strat->kHEdge=NULL;
8536  /*- creating temp data structures------------------- -*/
8537  strat->cp = 0;
8538  strat->c3 = 0;
8539  strat->tail = pInit();
8540  /*- set s -*/
8541  strat->sl = -1;
8542  /*- set ps -*/
8543  strat->syzl = -1;
8544  /*- set L -*/
8545  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8546  strat->Ll = -1;
8547  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8548  /*- set B -*/
8549  strat->Bmax = setmaxL;
8550  strat->Bl = -1;
8551  strat->B = initL();
8552  /*- set T -*/
8553  strat->tl = -1;
8554  strat->tmax = setmaxT;
8555  strat->T = initT();
8556  strat->R = initR();
8557  strat->sevT = initsevT();
8558  /*- init local data struct.---------------------------------------- -*/
8559  strat->P.ecart=0;
8560  strat->P.length=0;
8562  {
8563  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8564  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8565  }
8566  #ifdef HAVE_RINGS
8568  {
8569  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8570  }
8571  else
8572  #endif
8573  {
8574  if(TEST_OPT_SB_1)
8575  {
8576  int i;
8577  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8578  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8579  {
8580  P->m[i-strat->newIdeal] = F->m[i];
8581  F->m[i] = NULL;
8582  }
8583  initSSpecialSba(F,Q,P,strat);
8584  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8585  {
8586  F->m[i] = P->m[i-strat->newIdeal];
8587  P->m[i-strat->newIdeal] = NULL;
8588  }
8589  idDelete(&P);
8590  }
8591  else
8592  {
8593  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8594  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8595  }
8596  }
8597  strat->fromT = FALSE;
8598  if (!TEST_OPT_SB_1)
8599  {
8600  #ifdef HAVE_RINGS
8601  if(!rField_is_Ring(currRing))
8602  #endif
8603  updateS(TRUE,strat);
8604  }
8605  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8606  //strat->fromQ=NULL;
8607  assume(kTest_TS(strat));
8608 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int c3
Definition: kutil.h:345
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:7027
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6581
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
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:369
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:366
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7341
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:411
int newIdeal
Definition: kutil.h:355
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:347
void initSbaCrit ( kStrategy  strat)

Definition at line 8155 of file kutil.cc.

8156 {
8157  //strat->enterOnePair=enterOnePairNormal;
8159  //strat->chainCrit=chainCritNormal;
8160  strat->chainCrit = chainCritSig;
8161  /******************************************
8162  * rewCrit1 and rewCrit2 are already set in
8163  * kSba() in kstd1.cc
8164  *****************************************/
8165  //strat->rewCrit1 = faugereRewCriterion;
8166  if (strat->sbaOrder == 1)
8167  {
8168  strat->syzCrit = syzCriterionInc;
8169  }
8170  else
8171  {
8172  strat->syzCrit = syzCriterion;
8173  }
8174 #ifdef HAVE_RINGS
8175  if (rField_is_Ring(currRing))
8176  {
8178  strat->chainCrit=chainCritRing;
8179  }
8180 #endif
8181 #ifdef HAVE_RATGRING
8182  if (rIsRatGRing(currRing))
8183  {
8184  strat->chainCrit=chainCritPart;
8185  /* enterOnePairNormal get rational part in it */
8186  }
8187 #endif
8188 
8189  strat->sugarCrit = TEST_OPT_SUGARCRIT;
8190  strat->Gebauer = strat->homog || strat->sugarCrit;
8191  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
8192  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
8193  strat->pairtest = NULL;
8194  /* alway use tailreduction, except:
8195  * - in local rings, - in lex order case, -in ring over extensions */
8198 
8199 #ifdef HAVE_PLURAL
8200  // and r is plural_ring
8201  // hence this holds for r a rational_plural_ring
8202  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
8203  { //or it has non-quasi-comm type... later
8204  strat->sugarCrit = FALSE;
8205  strat->Gebauer = FALSE;
8206  strat->honey = FALSE;
8207  }
8208 #endif
8209 
8210 #ifdef HAVE_RINGS
8211  // Coefficient ring?
8212  if (rField_is_Ring(currRing))
8213  {
8214  strat->sugarCrit = FALSE;
8215  strat->Gebauer = FALSE ;
8216  strat->honey = FALSE;
8217  }
8218 #endif
8219  #ifdef KDEBUG
8220  if (TEST_OPT_DEBUG)
8221  {
8222  if (strat->homog) PrintS("ideal/module is homogeneous\n");
8223  else PrintS("ideal/module is not homogeneous\n");
8224  }
8225  #endif
8226 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:367
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:372
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:364
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_DEBUG
Definition: options.h:103
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:2678
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1532
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
BOOLEAN homog
Definition: kutil.h:362
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3162
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:368
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
unsigned sbaOrder
Definition: kutil.h:312
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:367
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:751
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5672
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5704
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1177
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2737
void initSbaPos ( kStrategy  strat)

Definition at line 8433 of file kutil.cc.

8434 {
8436  {
8437  if (strat->honey)
8438  {
8439  strat->posInL = posInL15;
8440  // ok -- here is the deal: from my experiments for Singular-2-0
8441  // I conclude that that posInT_EcartpLength is the best of
8442  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8443  // see the table at the end of this file
8444  if (TEST_OPT_OLDSTD)
8445  strat->posInT = posInT15;
8446  else
8447  strat->posInT = posInT_EcartpLength;
8448  }
8449  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8450  {
8451  strat->posInL = posInL11;
8452  strat->posInT = posInT11;
8453  }
8454  else if (TEST_OPT_INTSTRATEGY)
8455  {
8456  strat->posInL = posInL11;
8457  strat->posInT = posInT11;
8458  }
8459  else
8460  {
8461  strat->posInL = posInL0;
8462  strat->posInT = posInT0;
8463  }
8464  //if (strat->minim>0) strat->posInL =posInLSpecial;
8465  if (strat->homog)
8466  {
8467  strat->posInL = posInL110;
8468  strat->posInT = posInT110;
8469  }
8470  }
8471  else
8472  {
8473  if (strat->homog)
8474  {
8475  strat->posInL = posInL11;
8476  strat->posInT = posInT11;
8477  }
8478  else
8479  {
8480  if ((currRing->order[0]==ringorder_c)
8481  ||(currRing->order[0]==ringorder_C))
8482  {
8483  strat->posInL = posInL17_c;
8484  strat->posInT = posInT17_c;
8485  }
8486  else
8487  {
8488  strat->posInL = posInL17;
8489  strat->posInT = posInT17;
8490  }
8491  }
8492  }
8493  if (strat->minim>0) strat->posInL =posInLSpecial;
8494  // for further tests only
8495  if ((BTEST1(11)) || (BTEST1(12)))
8496  strat->posInL = posInL11;
8497  else if ((BTEST1(13)) || (BTEST1(14)))
8498  strat->posInL = posInL13;
8499  else if ((BTEST1(15)) || (BTEST1(16)))
8500  strat->posInL = posInL15;
8501  else if ((BTEST1(17)) || (BTEST1(18)))
8502  strat->posInL = posInL17;
8503  if (BTEST1(11))
8504  strat->posInT = posInT11;
8505  else if (BTEST1(13))
8506  strat->posInT = posInT13;
8507  else if (BTEST1(15))
8508  strat->posInT = posInT15;
8509  else if ((BTEST1(17)))
8510  strat->posInT = posInT17;
8511  else if ((BTEST1(19)))
8512  strat->posInT = posInT19;
8513  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8514  strat->posInT = posInT1;
8515 #ifdef HAVE_RINGS
8516  if (rField_is_Ring(currRing))
8517  {
8518  strat->posInL = posInL11Ring;
8519  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8520  strat->posInL = posInL11Ringls;
8521  strat->posInT = posInT11;
8522  }
8523 #endif
8524  strat->posInLDependsOnLength = FALSE;
8525  strat->posInLSba = posInLSig;
8526  //strat->posInL = posInLSig;
8527  strat->posInL = posInLF5C;
8528  //strat->posInT = posInTSig;
8529 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5081
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5558
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5227
#define FALSE
Definition: auxiliary.h:140
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4313
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5500
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5465
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:5069
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4618
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5419
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4302
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4936
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:4371
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4740
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5139
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4905
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5606
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4676
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4504
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4862
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4805
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4579
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4550
static unsigned long* initsevS ( const int  maxnr)
inlinestatic

Definition at line 475 of file kutil.cc.

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

Definition at line 6482 of file kutil.cc.

6483 {
6484  int i,pos;
6485 
6486  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6487  else i=setmaxT;
6488  strat->ecartS=initec(i);
6489  strat->sevS=initsevS(i);
6490  strat->S_2_R=initS_2_R(i);
6491  strat->fromQ=NULL;
6492  strat->Shdl=idInit(i,F->rank);
6493  strat->S=strat->Shdl->m;
6494  /*- put polys into S -*/
6495  if (Q!=NULL)
6496  {
6497  strat->fromQ=initec(i);
6498  memset(strat->fromQ,0,i*sizeof(int));
6499  for (i=0; i<IDELEMS(Q); i++)
6500  {
6501  if (Q->m[i]!=NULL)
6502  {
6503  LObject h;
6504  h.p = pCopy(Q->m[i]);
6506  {
6507  deleteHC(&h,strat);
6508  }
6510  {
6511  //pContent(h.p);
6512  h.pCleardenom(); // also does a pContent
6513  }
6514  else
6515  {
6516  h.pNorm();
6517  }
6518  if (h.p!=NULL)
6519  {
6520  strat->initEcart(&h);
6521  if (strat->sl==-1)
6522  pos =0;
6523  else
6524  {
6525  pos = posInS(strat,strat->sl,h.p,h.ecart);
6526  }
6527  h.sev = pGetShortExpVector(h.p);
6528  strat->enterS(h,pos,strat,-1);
6529  strat->fromQ[pos]=1;
6530  }
6531  }
6532  }
6533  }
6534  for (i=0; i<IDELEMS(F); i++)
6535  {
6536  if (F->m[i]!=NULL)
6537  {
6538  LObject h;
6539  h.p = pCopy(F->m[i]);
6540  if (h.p!=NULL)
6541  {
6543  {
6544  cancelunit(&h); /*- tries to cancel a unit -*/
6545  deleteHC(&h, strat);
6546  }
6547  if (h.p!=NULL)
6548  {
6550  {
6551  //pContent(h.p);
6552  h.pCleardenom(); // also does a pContent
6553  }
6554  else
6555  {
6556  h.pNorm();
6557  }
6558  strat->initEcart(&h);
6559  if (strat->Ll==-1)
6560  pos =0;
6561  else
6562  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
6563  h.sev = pGetShortExpVector(h.p);
6564  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6565  }
6566  }
6567  }
6568  }
6569  /*- test, if a unit is in F -*/
6570 
6571  if ((strat->Ll>=0)
6572 #ifdef HAVE_RINGS
6573  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6574 #endif
6575  && pIsConstant(strat->L[strat->Ll].p))
6576  {
6577  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6578  }
6579 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
#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:475
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSLSba ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6581 of file kutil.cc.

6582 {
6583  int i,pos;
6584  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6585  else i=setmaxT;
6586  strat->ecartS = initec(i);
6587  strat->sevS = initsevS(i);
6588  strat->sevSig = initsevS(i);
6589  strat->S_2_R = initS_2_R(i);
6590  strat->fromQ = NULL;
6591  strat->Shdl = idInit(i,F->rank);
6592  strat->S = strat->Shdl->m;
6593  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
6594  if (strat->sbaOrder != 1)
6595  {
6596  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
6597  strat->sevSyz = initsevS(i);
6598  strat->syzmax = i;
6599  strat->syzl = 0;
6600  }
6601  /*- put polys into S -*/
6602  if (Q!=NULL)
6603  {
6604  strat->fromQ=initec(i);
6605  memset(strat->fromQ,0,i*sizeof(int));
6606  for (i=0; i<IDELEMS(Q); i++)
6607  {
6608  if (Q->m[i]!=NULL)
6609  {
6610  LObject h;
6611  h.p = pCopy(Q->m[i]);
6613  {
6614  deleteHC(&h,strat);
6615  }
6617  {
6618  //pContent(h.p);
6619  h.pCleardenom(); // also does a pContent
6620  }
6621  else
6622  {
6623  h.pNorm();
6624  }
6625  if (h.p!=NULL)
6626  {
6627  strat->initEcart(&h);
6628  if (strat->sl==-1)
6629  pos =0;
6630  else
6631  {
6632  pos = posInS(strat,strat->sl,h.p,h.ecart);
6633  }
6634  h.sev = pGetShortExpVector(h.p);
6635  strat->enterS(h,pos,strat,-1);
6636  strat->fromQ[pos]=1;
6637  }
6638  }
6639  }
6640  }
6641  for (i=0; i<IDELEMS(F); i++)
6642  {
6643  if (F->m[i]!=NULL)
6644  {
6645  LObject h;
6646  h.p = pCopy(F->m[i]);
6647  h.sig = pOne();
6648  //h.sig = pInit();
6649  //p_SetCoeff(h.sig,nInit(1),currRing);
6650  p_SetComp(h.sig,i+1,currRing);
6651  // if we are working with the Schreyer order we generate it
6652  // by multiplying the initial signatures with the leading monomial
6653  // of the corresponding initial polynomials generating the ideal
6654  // => we can keep the underlying monomial order and get a Schreyer
6655  // order without any bigger overhead
6656  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
6657  {
6658  p_ExpVectorAdd (h.sig,F->m[i],currRing);
6659  }
6660  h.sevSig = pGetShortExpVector(h.sig);
6661 #ifdef DEBUGF5
6662  pWrite(h.p);
6663  pWrite(h.sig);
6664 #endif
6665  if (h.p!=NULL)
6666  {
6668  {
6669  cancelunit(&h); /*- tries to cancel a unit -*/
6670  deleteHC(&h, strat);
6671  }
6672  if (h.p!=NULL)
6673  {
6675  {
6676  //pContent(h.p);
6677  h.pCleardenom(); // also does a pContent
6678  }
6679  else
6680  {
6681  h.pNorm();
6682  }
6683  strat->initEcart(&h);
6684  if (strat->Ll==-1)
6685  pos =0;
6686  else
6687  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
6688  h.sev = pGetShortExpVector(h.p);
6689  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6690  }
6691  }
6692  /*
6693  if (strat->sbaOrder != 1)
6694  {
6695  for(j=0;j<i;j++)
6696  {
6697  strat->syz[ctr] = pCopy(F->m[j]);
6698  p_SetCompP(strat->syz[ctr],i+1,currRing);
6699  // add LM(F->m[i]) to the signature to get a Schreyer order
6700  // without changing the underlying polynomial ring at all
6701  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
6702  // since p_Add_q() destroys all input
6703  // data we need to recreate help
6704  // each time
6705  poly help = pCopy(F->m[i]);
6706  p_SetCompP(help,j+1,currRing);
6707  pWrite(strat->syz[ctr]);
6708  pWrite(help);
6709  printf("%d\n",pLmCmp(strat->syz[ctr],help));
6710  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
6711  printf("%d. SYZ ",ctr);
6712  pWrite(strat->syz[ctr]);
6713  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
6714  ctr++;
6715  }
6716  strat->syzl = ps;
6717  }
6718  */
6719  }
6720  }
6721  /*- test, if a unit is in F -*/
6722 
6723  if ((strat->Ll>=0)
6724 #ifdef HAVE_RINGS
6725  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6726 #endif
6727  && pIsConstant(strat->L[strat->Ll].p))
6728  {
6729  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6730  }
6731 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
int syzmax
Definition: kutil.h:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
void pWrite(poly p)
Definition: polys.h: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:1111
#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:475
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
unsigned sbaOrder
Definition: kutil.h:312
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:1340
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:347
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSSpecial ( ideal  F,
ideal  Q,
ideal  P,
kStrategy  strat 
)

Definition at line 6882 of file kutil.cc.

6883 {
6884  int i,pos;
6885 
6886  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6887  else i=setmaxT;
6888  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
6889  strat->ecartS=initec(i);
6890  strat->sevS=initsevS(i);
6891  strat->S_2_R=initS_2_R(i);
6892  strat->fromQ=NULL;
6893  strat->Shdl=idInit(i,F->rank);
6894  strat->S=strat->Shdl->m;
6895 
6896  /*- put polys into S -*/
6897  if (Q!=NULL)
6898  {
6899  strat->fromQ=initec(i);
6900  memset(strat->fromQ,0,i*sizeof(int));
6901  for (i=0; i<IDELEMS(Q); i++)
6902  {
6903  if (Q->m[i]!=NULL)
6904  {
6905  LObject h;
6906  h.p = pCopy(Q->m[i]);
6907  //if (TEST_OPT_INTSTRATEGY)
6908  //{
6909  // //pContent(h.p);
6910  // h.pCleardenom(); // also does a pContent
6911  //}
6912  //else
6913  //{
6914  // h.pNorm();
6915  //}
6917  {
6918  deleteHC(&h,strat);
6919  }
6920  if (h.p!=NULL)
6921  {
6922  strat->initEcart(&h);
6923  if (strat->sl==-1)
6924  pos =0;
6925  else
6926  {
6927  pos = posInS(strat,strat->sl,h.p,h.ecart);
6928  }
6929  h.sev = pGetShortExpVector(h.p);
6930  strat->enterS(h,pos,strat, strat->tl+1);
6931  enterT(h, strat);
6932  strat->fromQ[pos]=1;
6933  }
6934  }
6935  }
6936  }
6937  /*- put polys into S -*/
6938  for (i=0; i<IDELEMS(F); i++)
6939  {
6940  if (F->m[i]!=NULL)
6941  {
6942  LObject h;
6943  h.p = pCopy(F->m[i]);
6945  {
6946  deleteHC(&h,strat);
6947  }
6948  else
6949  {
6950  h.p=redtailBba(h.p,strat->sl,strat);
6951  }
6952  if (h.p!=NULL)
6953  {
6954  strat->initEcart(&h);
6955  if (strat->sl==-1)
6956  pos =0;
6957  else
6958  pos = posInS(strat,strat->sl,h.p,h.ecart);
6959  h.sev = pGetShortExpVector(h.p);
6960  strat->enterS(h,pos,strat, strat->tl+1);
6961  enterT(h,strat);
6962  }
6963  }
6964  }
6965  for (i=0; i<IDELEMS(P); i++)
6966  {
6967  if (P->m[i]!=NULL)
6968  {
6969  LObject h;
6970  h.p=pCopy(P->m[i]);
6972  {
6973  h.pCleardenom();
6974  }
6975  else
6976  {
6977  h.pNorm();
6978  }
6979  if(strat->sl>=0)
6980  {
6982  {
6983  h.p=redBba(h.p,strat->sl,strat);
6984  if (h.p!=NULL)
6985  {
6986  h.p=redtailBba(h.p,strat->sl,strat);
6987  }
6988  }
6989  else
6990  {
6991  h.p=redMora(h.p,strat->sl,strat);
6992  }
6993  if(h.p!=NULL)
6994  {
6995  strat->initEcart(&h);
6997  {
6998  h.pCleardenom();
6999  }
7000  else
7001  {
7002  h.is_normalized = 0;
7003  h.pNorm();
7004  }
7005  h.sev = pGetShortExpVector(h.p);
7006  h.SetpFDeg();
7007  pos = posInS(strat,strat->sl,h.p,h.ecart);
7008  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
7009  strat->enterS(h,pos,strat, strat->tl+1);
7010  enterT(h,strat);
7011  }
7012  }
7013  else
7014  {
7015  h.sev = pGetShortExpVector(h.p);
7016  strat->initEcart(&h);
7017  strat->enterS(h,0,strat, strat->tl+1);
7018  enterT(h,strat);
7019  }
7020  }
7021  }
7022 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4070
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6047
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7277
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7300
kBucketDestroy & P
Definition: myNF.cc:191
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSSpecialSba ( ideal  F,
ideal  Q,
ideal  P,
kStrategy  strat 
)

Definition at line 7027 of file kutil.cc.

7028 {
7029  int i,pos;
7030 
7031  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7032  else i=setmaxT;
7033  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
7034  strat->sevS=initsevS(i);
7035  strat->sevSig=initsevS(i);
7036  strat->S_2_R=initS_2_R(i);
7037  strat->fromQ=NULL;
7038  strat->Shdl=idInit(i,F->rank);
7039  strat->S=strat->Shdl->m;
7040  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
7041  /*- put polys into S -*/
7042  if (Q!=NULL)
7043  {
7044  strat->fromQ=initec(i);
7045  memset(strat->fromQ,0,i*sizeof(int));
7046  for (i=0; i<IDELEMS(Q); i++)
7047  {
7048  if (Q->m[i]!=NULL)
7049  {
7050  LObject h;
7051  h.p = pCopy(Q->m[i]);
7052  //if (TEST_OPT_INTSTRATEGY)
7053  //{
7054  // //pContent(h.p);
7055  // h.pCleardenom(); // also does a pContent
7056  //}
7057  //else
7058  //{
7059  // h.pNorm();
7060  //}
7062  {
7063  deleteHC(&h,strat);
7064  }
7065  if (h.p!=NULL)
7066  {
7067  strat->initEcart(&h);
7068  if (strat->sl==-1)
7069  pos =0;
7070  else
7071  {
7072  pos = posInS(strat,strat->sl,h.p,h.ecart);
7073  }
7074  h.sev = pGetShortExpVector(h.p);
7075  strat->enterS(h,pos,strat, strat->tl+1);
7076  enterT(h, strat);
7077  strat->fromQ[pos]=1;
7078  }
7079  }
7080  }
7081  }
7082  /*- put polys into S -*/
7083  for (i=0; i<IDELEMS(F); i++)
7084  {
7085  if (F->m[i]!=NULL)
7086  {
7087  LObject h;
7088  h.p = pCopy(F->m[i]);
7090  {
7091  deleteHC(&h,strat);
7092  }
7093  else
7094  {
7095  h.p=redtailBba(h.p,strat->sl,strat);
7096  }
7097  if (h.p!=NULL)
7098  {
7099  strat->initEcart(&h);
7100  if (strat->sl==-1)
7101  pos =0;
7102  else
7103  pos = posInS(strat,strat->sl,h.p,h.ecart);
7104  h.sev = pGetShortExpVector(h.p);
7105  strat->enterS(h,pos,strat, strat->tl+1);
7106  enterT(h,strat);
7107  }
7108  }
7109  }
7110  for (i=0; i<IDELEMS(P); i++)
7111  {
7112  if (P->m[i]!=NULL)
7113  {
7114  LObject h;
7115  h.p=pCopy(P->m[i]);
7117  {
7118  h.pCleardenom();
7119  }
7120  else
7121  {
7122  h.pNorm();
7123  }
7124  if(strat->sl>=0)
7125  {
7127  {
7128  h.p=redBba(h.p,strat->sl,strat);
7129  if (h.p!=NULL)
7130  {
7131  h.p=redtailBba(h.p,strat->sl,strat);
7132  }
7133  }
7134  else
7135  {
7136  h.p=redMora(h.p,strat->sl,strat);
7137  }
7138  if(h.p!=NULL)
7139  {
7140  strat->initEcart(&h);
7142  {
7143  h.pCleardenom();
7144  }
7145  else
7146  {
7147  h.is_normalized = 0;
7148  h.pNorm();
7149  }
7150  h.sev = pGetShortExpVector(h.p);
7151  h.SetpFDeg();
7152  pos = posInS(strat,strat->sl,h.p,h.ecart);
7153  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
7154  strat->enterS(h,pos,strat, strat->tl+1);
7155  enterT(h,strat);
7156  }
7157  }
7158  else
7159  {
7160  h.sev = pGetShortExpVector(h.p);
7161  strat->initEcart(&h);
7162  strat->enterS(h,0,strat, strat->tl+1);
7163  enterT(h,strat);
7164  }
7165  }
7166  }
7167 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4070
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6047
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7277
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7300
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSyzRules ( kStrategy  strat)

Definition at line 6733 of file kutil.cc.

6734 {
6735  if( strat->S[0] )
6736  {
6737  if( strat->S[1] )
6738  {
6739  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
6740  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
6741  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
6742  }
6743  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
6744  /************************************************************
6745  * computing the length of the syzygy array needed
6746  ***********************************************************/
6747  for(i=1; i<=strat->sl; i++)
6748  {
6749  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6750  {
6751  ps += i;
6752  }
6753  }
6754  ps += strat->sl+1;
6755  //comp = pGetComp (strat->P.sig);
6756  comp = strat->currIdx;
6757  strat->syzIdx = initec(comp);
6758  strat->sevSyz = initsevS(ps);
6759  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
6760  strat->syzmax = ps;
6761  strat->syzl = 0;
6762  strat->syzidxmax = comp;
6763 #if defined(DEBUGF5) || defined(DEBUGF51)
6764  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
6765 #endif
6766  i = 1;
6767  j = 0;
6768  /************************************************************
6769  * generating the leading terms of the principal syzygies
6770  ***********************************************************/
6771  while (i <= strat->sl)
6772  {
6773  /**********************************************************
6774  * principal syzygies start with component index 2
6775  * the array syzIdx starts with index 0
6776  * => the rules for a signature with component comp start
6777  * at strat->syz[strat->syzIdx[comp-2]] !
6778  *********************************************************/
6779  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6780  {
6781  comp = pGetComp(strat->sig[i]);
6782  comp_old = pGetComp(strat->sig[i-1]);
6783  diff = comp - comp_old - 1;
6784  // diff should be zero, but sometimes also the initial generating
6785  // elements of the input ideal reduce to zero. then there is an
6786  // index-gap between the signatures. for these inbetween signatures we
6787  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6788  // in the following.
6789  // doing this, we keep the relation "j = comp - 2" alive, which makes
6790  // jumps way easier when checking criteria
6791  while (diff>0)
6792  {
6793  strat->syzIdx[j] = 0;
6794  diff--;
6795  j++;
6796  }
6797  strat->syzIdx[j] = ctr;
6798  j++;
6799  LObject Q;
6800  int pos;
6801  for (k = 0; k<i; k++)
6802  {
6803  Q.sig = pOne();
6804  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6805  p_SetCompP (Q.sig, comp, currRing);
6806  poly q = p_One(currRing);
6807  p_ExpVectorCopy(q,strat->S[i],currRing);
6808  q = p_Neg (q, currRing);
6809  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6810  Q.sig = p_Add_q (Q.sig, q, currRing);
6811  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6812  pos = posInSyz(strat, Q.sig);
6813  enterSyz(Q, strat, pos);
6814  ctr++;
6815  }
6816  }
6817  i++;
6818  }
6819  /**************************************************************
6820  * add syzygies for upcoming first element of new iteration step
6821  **************************************************************/
6822  comp = strat->currIdx;
6823  comp_old = pGetComp(strat->sig[i-1]);
6824  diff = comp - comp_old - 1;
6825  // diff should be zero, but sometimes also the initial generating
6826  // elements of the input ideal reduce to zero. then there is an
6827  // index-gap between the signatures. for these inbetween signatures we
6828  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6829  // in the following.
6830  // doing this, we keep the relation "j = comp - 2" alive, which makes
6831  // jumps way easier when checking criteria
6832  while (diff>0)
6833  {
6834  strat->syzIdx[j] = 0;
6835  diff--;
6836  j++;
6837  }
6838  strat->syzIdx[j] = ctr;
6839  LObject Q;
6840  int pos;
6841  for (k = 0; k<strat->sl+1; k++)
6842  {
6843  Q.sig = pOne();
6844  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6845  p_SetCompP (Q.sig, comp, currRing);
6846  poly q = p_One(currRing);
6847  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
6848  q = p_Neg (q, currRing);
6849  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6850  Q.sig = p_Add_q (Q.sig, q, currRing);
6851  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6852  pos = posInSyz(strat, Q.sig);
6853  enterSyz(Q, strat, pos);
6854  ctr++;
6855  }
6856 //#if 1
6857 #ifdef DEBUGF5
6858  PrintS("Principal syzygies:\n");
6859  Print("syzl %d\n",strat->syzl);
6860  Print("syzmax %d\n",strat->syzmax);
6861  Print("ps %d\n",ps);
6862  PrintS("--------------------------------\n");
6863  for(i=0;i<=strat->syzl-1;i++)
6864  {
6865  Print("%d - ",i);
6866  pWrite(strat->syz[i]);
6867  }
6868  for(i=0;i<strat->currIdx;i++)
6869  {
6870  Print("%d - %d\n",i,strat->syzIdx[i]);
6871  }
6872  PrintS("--------------------------------\n");
6873 #endif
6874  }
6875 }
polyset sig
Definition: kutil.h:304
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
#define p_GetComp(p, r)
Definition: monomials.h:72
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
#define omAlloc(size)
Definition: omAllocDecl.h:210
int currIdx
Definition: kutil.h:313
#define pGetComp(p)
Component.
Definition: polys.h:37
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1242
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:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4586
LSet L
Definition: kutil.h:323
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:5041
int syzidxmax
Definition: kutil.h:347
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1019
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
int syzl
Definition: kutil.h:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:8003
intset syzIdx
Definition: kutil.h:309
BOOLEAN isInPairsetB ( poly  q,
int *  k,
kStrategy  strat 
)

Definition at line 602 of file kutil.cc.

603 {
604  LObject *p=&(strat->B[strat->Bl]);
605 
606  *k = strat->Bl;
607  loop
608  {
609  if ((*k) < 0) return FALSE;
610  if (q == (*p).p1)
611  return TRUE;
612  (*k)--;
613  p--;
614  }
615 }
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:144
int k
Definition: cfEzgcd.cc:93
LSet B
Definition: kutil.h:324
BOOLEAN isInPairsetL ( int  length,
poly  p1,
poly  p2,
int *  k,
kStrategy  strat 
)

Definition at line 581 of file kutil.cc.

582 {
583  LObject *p=&(strat->L[length]);
584 
585  *k = length;
586  loop
587  {
588  if ((*k) < 0) return FALSE;
589  if (((p1 == (*p).p1) && (p2 == (*p).p2))
590  || ((p1 == (*p).p2) && (p2 == (*p).p1)))
591  return TRUE;
592  (*k)--;
593  p--;
594  }
595 }
class sLObject LObject
Definition: kutil.h:60
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:323
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
BOOLEAN kCheckSpolyCreation ( LObject L,
kStrategy  strat,
poly m1,
poly m2 
)

Definition at line 8990 of file kutil.cc.

8991 {
8992  if (strat->overflow) return FALSE;
8993  assume(L->p1 != NULL && L->p2 != NULL);
8994  // shift changes: from 0 to -1
8995  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
8996  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
8997  assume(strat->tailRing != currRing);
8998 
8999  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
9000  return FALSE;
9001  // shift changes: extra case inserted
9002  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
9003  {
9004  return TRUE;
9005  }
9006  poly p1_max = (strat->R[L->i_r1])->max;
9007  poly p2_max = (strat->R[L->i_r2])->max;
9008 
9009  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
9010  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
9011  {
9012  p_LmFree(m1, strat->tailRing);
9013  p_LmFree(m2, strat->tailRing);
9014  m1 = NULL;
9015  m2 = NULL;
9016  return FALSE;
9017  }
9018  return TRUE;
9019 }
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:960
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1822
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:394
polyrec * poly
Definition: hilb.h:10
BOOLEAN kCheckStrongCreation ( int  atR,
poly  m1,
int  atS,
poly  m2,
kStrategy  strat 
)

Definition at line 9028 of file kutil.cc.

9029 {
9030  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
9031  //assume(strat->tailRing != currRing);
9032 
9033  poly p1_max = (strat->R[atR])->max;
9034  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
9035 
9036  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
9037  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
9038  {
9039  return FALSE;
9040  }
9041  return TRUE;
9042 }
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:340
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1822
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
poly kCreateZeroPoly ( long  exp[],
long  cabsind,
poly t_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 3554 of file kutil.cc.

3555 {
3556 
3557  poly zeroPoly = NULL;
3558 
3559  number tmp1;
3560  poly tmp2, tmp3;
3561 
3562  if (cabsind == -1)
3563  {
3564  cabsind = 0;
3565  for (int i = 1; i <= leadRing->N; i++)
3566  {
3567  cabsind += ind_fact_2(exp[i]);
3568  }
3569 // Print("cabsind: %d\n", cabsind);
3570  }
3571  if (cabsind < leadRing->ch)
3572  {
3573  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
3574  }
3575  else
3576  {
3577  zeroPoly = p_ISet(1, tailRing);
3578  }
3579  for (int i = 1; i <= leadRing->N; i++)
3580  {
3581  for (long j = 1; j <= exp[i]; j++)
3582  {
3583  tmp1 = nInit(j);
3584  tmp2 = p_ISet(1, tailRing);
3585  p_SetExp(tmp2, i, 1, tailRing);
3586  p_Setm(tmp2, tailRing);
3587  if (nIsZero(tmp1))
3588  { // should nowbe obsolet, test ! TODO OLIVER
3589  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
3590  }
3591  else
3592  {
3593  tmp3 = p_NSet(nCopy(tmp1), tailRing);
3594  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
3595  }
3596  }
3597  }
3598  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
3599  for (int i = 1; i <= leadRing->N; i++)
3600  {
3601  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
3602  }
3603  p_Setm(tmp2, leadRing);
3604  *t_p = zeroPoly;
3605  zeroPoly = pNext(zeroPoly);
3606  pNext(*t_p) = NULL;
3607  pNext(tmp2) = zeroPoly;
3608  return tmp2;
3609 }
#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:3362
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:3347
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
p exp[i]
Definition: DebugPrint.cc:39
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:883
#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:1026
void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 9903 of file kutil.cc.

9904 {
9905  PrintS("red: ");
9906  if (strat->red==redFirst) PrintS("redFirst\n");
9907  else if (strat->red==redHoney) PrintS("redHoney\n");
9908  else if (strat->red==redEcart) PrintS("redEcart\n");
9909  else if (strat->red==redHomog) PrintS("redHomog\n");
9910  else Print("%p\n",(void*)strat->red);
9911  PrintS("posInT: ");
9912  if (strat->posInT==posInT0) PrintS("posInT0\n");
9913  else if (strat->posInT==posInT1) PrintS("posInT1\n");
9914  else if (strat->posInT==posInT11) PrintS("posInT11\n");
9915  else if (strat->posInT==posInT110) PrintS("posInT110\n");
9916  else if (strat->posInT==posInT13) PrintS("posInT13\n");
9917  else if (strat->posInT==posInT15) PrintS("posInT15\n");
9918  else if (strat->posInT==posInT17) PrintS("posInT17\n");
9919  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
9920  else if (strat->posInT==posInT19) PrintS("posInT19\n");
9921  else if (strat->posInT==posInT2) PrintS("posInT2\n");
9922 #ifdef HAVE_MORE_POS_IN_T
9923  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
9924  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
9925  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
9926 #endif
9927  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
9928  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
9929  else Print("%p\n",(void*)strat->posInT);
9930  PrintS("posInL: ");
9931  if (strat->posInL==posInL0) PrintS("posInL0\n");
9932  else if (strat->posInL==posInL10) PrintS("posInL10\n");
9933  else if (strat->posInL==posInL11) PrintS("posInL11\n");
9934  else if (strat->posInL==posInL110) PrintS("posInL110\n");
9935  else if (strat->posInL==posInL13) PrintS("posInL13\n");
9936  else if (strat->posInL==posInL15) PrintS("posInL15\n");
9937  else if (strat->posInL==posInL17) PrintS("posInL17\n");
9938  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
9939  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
9940  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
9941  else Print("%p\n",(void*)strat->posInL);
9942  PrintS("enterS: ");
9943  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
9944  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
9945  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
9946  else Print("%p\n",(void*)strat->enterS);
9947  PrintS("initEcart: ");
9948  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
9949  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
9950  else Print("%p\n",(void*)strat->initEcart);
9951  PrintS("initEcartPair: ");
9952  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
9953  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
9954  else Print("%p\n",(void*)strat->initEcartPair);
9955  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
9956  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
9957  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
9958  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
9959  PrintS("chainCrit: ");
9960  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
9961  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
9962  else Print("%p\n",(void*)strat->chainCrit);
9963  Print("posInLDependsOnLength=%d\n",
9964  strat->posInLDependsOnLength);
9965  PrintS(showOption());PrintLn();
9966  PrintS("LDeg: ");
9967  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9968  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9969  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
9970  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9971  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9972  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9973  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9974  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9975  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9976  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9977  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9978  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9979  else Print("? (%lx)", (long)currRing->pLDeg);
9980  PrintS(" / ");
9981  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9982  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9983  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
9984  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9985  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9986  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9987  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9988  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9989  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9990  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9991  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9992  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9993  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
9994  PrintLn();
9995  PrintS("currRing->pFDeg: ");
9996  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
9997  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
9998  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
9999  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
10000  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
10001  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
10002  else Print("? (%lx)", (long)currRing->pFDeg);
10003  PrintLn();
10004  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
10005  if(TEST_OPT_DEGBOUND)
10006  Print(" degBound: %d\n", Kstd1_deg);
10007 
10008  if( ecartWeights != NULL )
10009  {
10010  PrintS("ecartWeights: ");
10011  for (int i = rVar(currRing); i > 0; i--)
10012  Print("%hd ", ecartWeights[i]);
10013  PrintLn();
10015  }
10016 
10017 #ifndef SING_NDEBUG
10019 #endif
10020 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1150
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5081
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9869
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4428
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5558
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1321
void PrintLn()
Definition: reporter.cc:327
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4341
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc: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:368
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4313
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2447
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5335
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5500
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5465
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:537
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:1436
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:721
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:4618
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:519
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5419
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4302
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1117
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4371
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4740
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1157
BOOLEAN Gebauer
Definition: kutil.h:368
#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:1143
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2212
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4905
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5606
void rDebugPrint(const ring r)
Definition: ring.cc:4035
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:4676
BOOLEAN sugarCrit
Definition: kutil.h:367
int Kstd1_deg
Definition: kutil.cc:228
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1375
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9778
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc: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:179
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4504
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2662
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:613
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4862
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:373
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4805
void initEcartNormal(TObject *h)
Definition: kutil.cc:1135
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9832
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4579
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1046
int LazyDegree
Definition: kutil.h:351
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4550
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7573
TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart 
)

Definition at line 5868 of file kutil.cc.

5870 {
5871  int j = 0;
5872  const unsigned long not_sev = ~L->sev;
5873  const unsigned long* sev = strat->sevS;
5874  poly p;
5875  ring r;
5876  L->GetLm(p, r);
5877 
5878  assume(~not_sev == p_GetShortExpVector(p, r));
5879 
5880  if (r == currRing)
5881  {
5882  loop
5883  {
5884  if (j > pos) return NULL;
5885 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5886  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
5887  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5888  {
5889 #ifdef HAVE_RINGS
5890  if(rField_is_Ring(r))
5891  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5892  break;}
5893  else
5894 #endif
5895  break;
5896  }
5897 #else
5898  if (!(sev[j] & not_sev) &&
5899  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
5900  p_LmDivisibleBy(strat->S[j], p, r))
5901  {
5902 #ifdef HAVE_RINGS
5903  if(rField_is_Ring(r))
5904  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5905  break;}
5906  else
5907 #endif
5908  break;
5909  }
5910 
5911 #endif
5912  j++;
5913  }
5914  // if called from NF, T objects do not exist:
5915  if (strat->tl < 0 || strat->S_2_R[j] == -1)
5916  {
5917  T->Set(strat->S[j], r, strat->tailRing);
5918  return T;
5919  }
5920  else
5921  {
5922 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
5923 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
5924 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
5925  return strat->S_2_T(j);
5926  }
5927  }
5928  else
5929  {
5930  TObject* t;
5931  loop
5932  {
5933  if (j > pos) return NULL;
5934  assume(strat->S_2_R[j] != -1);
5935 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5936  t = strat->S_2_T(j);
5937  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
5938  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
5939  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5940  {
5941 #ifdef HAVE_RINGS
5942  if(rField_is_Ring(r))
5943  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5944  return t;}
5945  else
5946 #endif
5947  return t;
5948  }
5949 #else
5950  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5951  {
5952  t = strat->S_2_T(j);
5953  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
5954  if (p_LmDivisibleBy(t->t_p, p, r))
5955  {
5956 #ifdef HAVE_RINGS
5957  if(rField_is_Ring(r))
5958  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5959  return t;}
5960  else
5961 #endif
5962  return t;
5963  }
5964  }
5965 #endif
5966  j++;
5967  }
5968  }
5969 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:348
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc: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
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:776
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1711
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1677
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4586
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
unsigned long * sevS
Definition: kutil.h:318
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
class sTObject TObject
Definition: kutil.h:59
int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 617 of file kutil.cc.

618 {
619  int i;
620 
621  for (i=0; i<=tlength; i++)
622  {
623  if (T[i].p == p) return i;
624  }
625  return -1;
626 }
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 628 of file kutil.cc.

629 {
630  int i;
631  do
632  {
633  i = kFindInT(p, strat->T, strat->tl);
634  if (i >= 0) return i;
635  strat = strat->next;
636  }
637  while (strat != NULL);
638  return -1;
639 }
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:617
int tl
Definition: kutil.h:348
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
TSet T
Definition: kutil.h:322
kStrategy next
Definition: kutil.h:273
void kMergeBintoL ( kStrategy  strat)

Definition at line 2401 of file kutil.cc.

2402 {
2403  int j=strat->Ll+strat->Bl+1;
2404  if (j>strat->Lmax)
2405  {
2406  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
2407  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
2408  j*sizeof(LObject));
2409  strat->Lmax=j;
2410  }
2411  j = strat->Ll;
2412  int i;
2413  for (i=strat->Bl; i>=0; i--)
2414  {
2415  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
2416  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
2417  }
2418  strat->Bl = -1;
2419 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int Bl
Definition: kutil.h:350
#define setmaxLinc
Definition: kutil.h:30
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
int j
Definition: myNF.cc:70
LObject * LSet
Definition: kutil.h:62
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
void kMergeBintoLSba ( kStrategy  strat)

Definition at line 2424 of file kutil.cc.

2425 {
2426  int j=strat->Ll+strat->Bl+1;
2427  if (j>strat->Lmax)
2428  {
2429  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
2430  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
2431  j*sizeof(LObject));
2432  strat->Lmax=j;
2433  }
2434  j = strat->Ll;
2435  int i;
2436  for (i=strat->Bl; i>=0; i--)
2437  {
2438  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
2439  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
2440  }
2441  strat->Bl = -1;
2442 }
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int Bl
Definition: kutil.h:350
#define setmaxLinc
Definition: kutil.h:30
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
int j
Definition: myNF.cc:70
LObject * LSet
Definition: kutil.h:62
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN kPosInLDependsOnLength ( int(*)(const LSet set, const int length, LObject *L, const kStrategy strat pos_in_l)

Definition at line 8228 of file kutil.cc.

8231 {
8232  if (pos_in_l == posInL110 ||
8233  pos_in_l == posInL10 ||
8234  pos_in_l == posInLRing)
8235  return TRUE;
8236 
8237  return FALSE;
8238 }
#define FALSE
Definition: auxiliary.h:140
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4960
#define TRUE
Definition: auxiliary.h:144
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5419
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1046
BOOLEAN kStratChangeTailRing ( kStrategy  strat,
LObject L,
TObject T,
unsigned long  expbound 
)

Definition at line 9357 of file kutil.cc.

9358 {
9359  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
9360  /* initial setup or extending */
9361 
9362  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
9363  if (expbound >= currRing->bitmask) return FALSE;
9364  strat->overflow=FALSE;
9365  ring new_tailRing = rModifyRing(currRing,
9366  // Hmmm .. the condition pFDeg == p_Deg
9367  // might be too strong
9368 #ifdef HAVE_RINGS
9369  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver
9370 #else
9371  (strat->homog && currRing->pFDeg == p_Deg), // omit_degree
9372 #endif
9373  (strat->ak==0), // omit_comp if the input is an ideal
9374  expbound); // exp_limit
9375 
9376  if (new_tailRing == currRing) return TRUE;
9377 
9378  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
9379  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
9380 
9381  if (currRing->pFDeg != currRing->pFDegOrig)
9382  {
9383  new_tailRing->pFDeg = currRing->pFDeg;
9384  new_tailRing->pLDeg = currRing->pLDeg;
9385  }
9386 
9387  if (TEST_OPT_PROT)
9388  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
9389  kTest_TS(strat);
9390  assume(new_tailRing != strat->tailRing);
9391  pShallowCopyDeleteProc p_shallow_copy_delete
9392  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
9393 
9394  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
9395 
9396  int i;
9397  for (i=0; i<=strat->tl; i++)
9398  {
9399  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
9400  p_shallow_copy_delete);
9401  }
9402  for (i=0; i<=strat->Ll; i++)
9403  {
9404  assume(strat->L[i].p != NULL);
9405  if (pNext(strat->L[i].p) != strat->tail)
9406  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9407  }
9408  if ((strat->P.t_p != NULL) ||
9409  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
9410  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9411 
9412  if ((L != NULL) && (L->tailRing != new_tailRing))
9413  {
9414  if (L->i_r < 0)
9415  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9416  else
9417  {
9418  assume(L->i_r <= strat->tl);
9419  TObject* t_l = strat->R[L->i_r];
9420  assume(t_l != NULL);
9421  L->tailRing = new_tailRing;
9422  L->p = t_l->p;
9423  L->t_p = t_l->t_p;
9424  L->max = t_l->max;
9425  }
9426  }
9427 
9428  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
9429  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
9430 
9431  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
9432  if (strat->tailRing != currRing)
9433  rKillModifiedRing(strat->tailRing);
9434 
9435  strat->tailRing = new_tailRing;
9436  strat->tailBin = new_tailBin;
9437  strat->p_shallow_copy_delete
9438  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
9439 
9440  if (strat->kHEdge != NULL)
9441  {
9442  if (strat->t_kHEdge != NULL)
9443  p_LmFree(strat->t_kHEdge, strat->tailRing);
9444  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
9445  }
9446 
9447  if (strat->kNoether != NULL)
9448  {
9449  if (strat->t_kNoether != NULL)
9450  p_LmFree(strat->t_kNoether, strat->tailRing);
9452  new_tailRing);
9453  }
9454  kTest_TS(strat);
9455  if (TEST_OPT_PROT)
9456  PrintS("]");
9457  return TRUE;
9458 }
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
Definition: omBin.c:396
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:325
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2596
#define TRUE
Definition: auxiliary.h:144
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
int ak
Definition: kutil.h:351
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc: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:901
BOOLEAN homog
Definition: kutil.h:362
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:327
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
omBin tailBin
Definition: kutil.h:343
char overflow
Definition: kutil.h:394
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2962
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:59
void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 9460 of file kutil.cc.

9461 {
9462  unsigned long l = 0;
9463  int i;
9464  long e;
9465 
9466  assume(strat->tailRing == currRing);
9467 
9468  for (i=0; i<= strat->Ll; i++)
9469  {
9470  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
9471  }
9472  for (i=0; i<=strat->tl; i++)
9473  {
9474  // Hmm ... this we could do in one Step
9475  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
9476  }
9477  if (rField_is_Ring(currRing))
9478  {
9479  l *= 2;
9480  }
9481  e = p_GetMaxExp(l, currRing);
9482  if (e <= 1) e = 2;
9483 
9484  kStratChangeTailRing(strat, NULL, NULL, e);
9485 }
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:349
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:348
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
int l
Definition: cfEzgcd.cc:94
void message ( int  i,
int *  reduc,
int *  olddeg,
kStrategy  strat,
int  red_result 
)

Definition at line 6274 of file kutil.cc.

6275 {
6276  if (i != *olddeg)
6277  {
6278  Print("%d",i);
6279  *olddeg = i;
6280  }
6281  if (TEST_OPT_OLDSTD)
6282  {
6283  if (strat->Ll != *reduc)
6284  {
6285  if (strat->Ll != *reduc-1)
6286  Print("(%d)",strat->Ll+1);
6287  else
6288  PrintS("-");
6289  *reduc = strat->Ll;
6290  }
6291  else
6292  PrintS(".");
6293  mflush();
6294  }
6295  else
6296  {
6297  if (red_result == 0)
6298  PrintS("-");
6299  else if (red_result < 0)
6300  PrintS(".");
6301  if ((red_result > 0) || ((strat->Ll % 100)==99))
6302  {
6303  if (strat->Ll != *reduc && strat->Ll > 0)
6304  {
6305  Print("(%d)",strat->Ll+1);
6306  *reduc = strat->Ll;
6307  }
6308  }
6309  }
6310 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:349
#define mflush()
Definition: reporter.h:55
#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 6315 of file kutil.cc.

6316 {
6317  //PrintS("\nUsage/Allocation of temporary storage:\n");
6318  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
6319  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
6320  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
6321  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
6322  /* in usual case strat->cv is 0, it gets changed only in shift routines */
6323  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
6324  /*mflush();*/
6325 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:345
int cv
Definition: kutil.h:359
int cp
Definition: kutil.h:345
BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 8920 of file kutil.cc.

8921 {
8922  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
8923  return FALSE;
8924  int i,j;
8925  poly newNoether;
8926 
8927 #if 0
8928  if (currRing->weight_all_1)
8929  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8930  else
8931  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8932 #else
8933  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8934 #endif
8935  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
8936  if (strat->tailRing != currRing)
8937  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
8938  /* compare old and new noether*/
8939  newNoether = pLmInit(strat->kHEdge);
8940  j = p_FDeg(newNoether,currRing);
8941 /* #ifdef HAVE_RINGS
8942  if (!rField_is_Ring(currRing))
8943  #endif */
8944  for (i=1; i<=(currRing->N); i++)
8945  {
8946  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
8947  }
8948  pSetm(newNoether);
8949  if (j < strat->HCord) /*- statistics -*/
8950  {
8951  if (TEST_OPT_PROT)
8952  {
8953  Print("H(%d)",j);
8954  mflush();
8955  }
8956  strat->HCord=j;
8957  #ifdef KDEBUG
8958  if (TEST_OPT_DEBUG)
8959  {
8960  Print("H(%d):",j);
8961  wrp(strat->kHEdge);
8962  PrintLn();
8963  }
8964  #endif
8965  }
8966  if (pCmp(strat->kNoether,newNoether)!=1)
8967  {
8968  pDelete(&strat->kNoether);
8969  strat->kNoether=newNoether;
8970  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
8971  if (strat->tailRing != currRing)
8972  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
8973 
8974  return TRUE;
8975  }
8976  #ifdef HAVE_RINGS
8977  if (rField_is_Ring(currRing))
8978  pLmDelete(newNoether);
8979  else
8980  #endif
8981  pLmFree(newNoether);
8982  return FALSE;
8983 }
#define pSetm(p)
Definition: polys.h:241
int HCord
Definition: kutil.cc:227
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:325
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:326
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:144
int ak
Definition: kutil.h:351
#define TEST_OPT_DEBUG
Definition: options.h:103
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
int HCord
Definition: kutil.h:353
#define mflush()
Definition: reporter.h:55
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:901
int j
Definition: myNF.cc:70
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:751
poly t_kHEdge
Definition: kutil.h:327
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
#define pDelete(p_ptr)
Definition: polys.h: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
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
int nextZeroSimplexExponent ( long  exp[],
long  ind[],
long  cexp[],
long  cind[],
long *  cabsind,
long  step[],
long  bound,
long  N 
)

Definition at line 3488 of file kutil.cc.

3490 {
3491  long add = ind2(cexp[1] + 2);
3492  if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
3493  {
3494  cexp[1] += 2;
3495  cind[1] += add;
3496  *cabsind += add;
3497  }
3498  else
3499  {
3500  // cabsind >= habsind
3501  if (N == 1) return 0;
3502  int i = 1;
3503  while (exp[i] == cexp[i] && i <= N) i++;
3504  cexp[i] = exp[i];
3505  *cabsind -= cind[i];
3506  cind[i] = ind[i];
3507  step[i] = 500000;
3508  *cabsind += cind[i];
3509  // Print("in: %d\n", *cabsind);
3510  i += 1;
3511  if (i > N) return 0;
3512  do
3513  {
3514  step[1] = 500000;
3515  for (int j = i + 1; j <= N; j++)
3516  {
3517  if (step[1] > step[j]) step[1] = step[j];
3518  }
3519  add = ind2(cexp[i] + 2);
3520  if (*cabsind - step[1] + add >= bound)
3521  {
3522  cexp[i] = exp[i];
3523  *cabsind -= cind[i];
3524  cind[i] = ind[i];
3525  *cabsind += cind[i];
3526  step[i] = 500000;
3527  i += 1;
3528  if (i > N) return 0;
3529  }
3530  else step[1] = -1;
3531  } while (step[1] != -1);
3532  step[1] = 500000;
3533  cexp[i] += 2;
3534  cind[i] += add;
3535  *cabsind += add;
3536  if (add < step[i]) step[i] = add;
3537  for (i = 2; i <= N; i++)
3538  {
3539  if (step[1] > step[i]) step[1] = step[i];
3540  }
3541  }
3542  return 1;
3543 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
static unsigned add[]
Definition: misc_ip.cc:83
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:3335
static BOOLEAN p_HasNotCF_Lift ( poly  p1,
poly  p2,
const ring  r 
)
static

p_HasNotCF for the IDLIFT case: ignore component

Definition at line 1820 of file kutil.cc.

1821 {
1822  int i = rVar(r);
1823  loop
1824  {
1825  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1826  return FALSE;
1827  i--;
1828  if (i == 0)
1829  return TRUE;
1830  }
1831 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:537
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 10055 of file kutil.cc.

10056 {
10057  /* restores a poly in currRing from LObject */
10058  LObject h = H;
10059  h.Copy();
10060  poly p;
10061  if (h.p == NULL)
10062  {
10063  if (h.t_p != NULL)
10064  {
10065  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
10066  return(p);
10067  }
10068  else
10069  {
10070  /* h.tp == NULL -> the object is NULL */
10071  return(NULL);
10072  }
10073  }
10074  /* we're here if h.p != NULL */
10075  if (h.t_p == NULL)
10076  {
10077  /* then h.p is the whole poly in currRing */
10078  p = h.p;
10079  return(p);
10080  }
10081  /* we're here if h.p != NULL and h.t_p != NULL */
10082  // clean h.p, get poly from t_p
10083  pNext(h.p)=NULL;
10084  pDelete(&h.p);
10085  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
10086  /* dest. ring: */ currRing);
10087  // no need to clean h: we re-used the polys
10088  return(p);
10089 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
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<q w.r.t monomial ordering
Definition: polys.h:105
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:372
#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:1636
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
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 10024 of file kutil.cc.

10025 {
10026  /* assume: p is completely in currRing */
10027  /* produces an object with LM in curring
10028  and TAIL in tailring */
10029  if (pNext(p)!=NULL)
10030  {
10031  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
10032  }
10033  return(p);
10034 }
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 10038 of file kutil.cc.

10039 {
10040  /* assume: p has LM in curring and TAIL in tailring */
10041  /* convert it to complete currRing */
10042 
10043  /* check that LM is in currRing */
10045 
10046  if (pNext(p)!=NULL)
10047  {
10048  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
10049  }
10050  return(p);
10051 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
int posInL0 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4905 of file kutil.cc.

4907 {
4908  if (length<0) return 0;
4909 
4910  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
4911  return length+1;
4912 
4913  int i;
4914  int an = 0;
4915  int en= length;
4916  loop
4917  {
4918  if (an >= en-1)
4919  {
4920  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
4921  return an;
4922  }
4923  i=(an+en) / 2;
4924  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
4925  else en=i;
4926  /*aend. fuer lazy == in !=- machen */
4927  }
4928 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL11 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 5081 of file kutil.cc.

5100 {
5101  if (length<0) return 0;
5102 
5103  int o = p->GetpFDeg();
5104  int op = set[length].GetpFDeg();
5105 
5106  if ((op > o)
5107  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5108  return length+1;
5109  int i;
5110  int an = 0;
5111  int en= length;
5112  loop
5113  {
5114  if (an >= en-1)
5115  {
5116  op = set[an].GetpFDeg();
5117  if ((op > o)
5118  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5119  return en;
5120  return an;
5121  }
5122  i=(an+en) / 2;
5123  op = set[i].GetpFDeg();
5124  if ((op > o)
5125  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5126  an=i;
5127  else
5128  en=i;
5129  }
5130 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL110 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 5419 of file kutil.cc.

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

Definition at line 5139 of file kutil.cc.

5141 {
5142  if (length < 0) return 0;
5143  int an,en,i;
5144  an = 0;
5145  en = length+1;
5146  #if 0
5147  printf("\n----------------------\n");
5148  for(i=0;i<=length;i++)
5149  pWrite(set[i].p);
5150  printf("\n----------------------\n");
5151  #endif
5152  loop
5153  {
5154  if (an >= en-1)
5155  {
5156  if(an == en)
5157  return en;
5158  if (pLmCmp(set[an].p, p->p) == 1)
5159  return en;
5160  if (pLmCmp(set[an].p, p->p) == -1)
5161  return an;
5162  if (pLmCmp(set[an].p, p->p) == 0)
5163  {
5164  number lcset,lcp;
5165  lcset = pGetCoeff(set[an].p);
5166  lcp = pGetCoeff(p->p);
5167  if(!nGreaterZero(lcset))
5168  {
5169  set[an].p=p_Neg(set[an].p,currRing);
5170  if (set[an].t_p!=NULL)
5171  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
5172  lcset=pGetCoeff(set[an].p);
5173  }
5174  if(!nGreaterZero(lcp))
5175  {
5176  p->p=p_Neg(p->p,currRing);
5177  if (p->t_p!=NULL)
5178  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5179  lcp=pGetCoeff(p->p);
5180  }
5181  if(nGreater(lcset, lcp))
5182  {
5183  return en;
5184  }
5185  else
5186  {
5187  return an;
5188  }
5189  }
5190  }
5191  i=(an+en) / 2;
5192  if (pLmCmp(set[i].p, p->p) == 1)
5193  an=i;
5194  if (pLmCmp(set[i].p, p->p) == -1)
5195  en=i;
5196  if (pLmCmp(set[i].p, p->p) == 0)
5197  {
5198  number lcset,lcp;
5199  lcset = pGetCoeff(set[i].p);
5200  lcp = pGetCoeff(p->p);
5201  if(!nGreaterZero(lcset))
5202  {
5203  set[i].p=p_Neg(set[i].p,currRing);
5204  if (set[i].t_p!=NULL)
5205  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
5206  lcset=pGetCoeff(set[i].p);
5207  }
5208  if(!nGreaterZero(lcp))
5209  {
5210  p->p=p_Neg(p->p,currRing);
5211  if (p->t_p!=NULL)
5212  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5213  lcp=pGetCoeff(p->p);
5214  }
5215  if(nGreater(lcset, lcp))
5216  {
5217  an = i;
5218  }
5219  else
5220  {
5221  en = i;
5222  }
5223  }
5224  }
5225 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
void pWrite(poly p)
Definition: polys.h:279
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
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1019
#define nGreater(a, b)
Definition: numbers.h:28
int posInL11Ringls ( const LSet  set,
const int  length,
LObject p,
const kStrategy  strat 
)

Definition at line 5227 of file kutil.cc.

5229 {
5230  if (length < 0) return 0;
5231  int an,en,i;
5232  an = 0;
5233  en = length+1;
5234  #if 0
5235  printf("\n----------------------\n");
5236  for(i=0;i<=length;i++)
5237  pWrite(set[i].p);
5238  printf("\n----------------------\n");
5239  #endif
5240  loop
5241  {
5242  if (an >= en-1)
5243  {
5244  if(an == en)
5245  return en;
5246  if (set[an].FDeg > p->FDeg)
5247  return en;
5248  if (set[an].FDeg < p->FDeg)
5249  return an;
5250  if (set[an].FDeg == p->FDeg)
5251  {
5252  number lcset,lcp;
5253  lcset = pGetCoeff(set[an].p);
5254  lcp = pGetCoeff(p->p);
5255  if(!nGreaterZero(lcset))
5256  {
5257  set[an].p=p_Neg(set[an].p,currRing);
5258  if (set[an].t_p!=NULL)
5259  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
5260  lcset=pGetCoeff(set[an].p);
5261  }
5262  if(!nGreaterZero(lcp))
5263  {
5264  p->p=p_Neg(p->p,currRing);
5265  if (p->t_p!=NULL)
5266  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5267  lcp=pGetCoeff(p->p);
5268  }
5269  if(nGreater(lcset, lcp))
5270  {
5271  return en;
5272  }
5273  else
5274  {
5275  return an;
5276  }
5277  }
5278  }
5279  i=(an+en) / 2;
5280  if (set[i].FDeg > p->FDeg)
5281  an=i;
5282  if (set[i].FDeg < p->FDeg)
5283  en=i;
5284  if (set[i].FDeg == p->FDeg)
5285  {
5286  number lcset,lcp;
5287  lcset = pGetCoeff(set[i].p);
5288  lcp = pGetCoeff(p->p);
5289  if(!nGreaterZero(lcset))
5290  {
5291  set[i].p=p_Neg(set[i].p,currRing);
5292  if (set[i].t_p!=NULL)
5293  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
5294  lcset=pGetCoeff(set[i].p);
5295  }
5296  if(!nGreaterZero(lcp))
5297  {
5298  p->p=p_Neg(p->p,currRing);
5299  if (p->t_p!=NULL)
5300  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5301  lcp=pGetCoeff(p->p);
5302  }
5303  if(nGreater(lcset, lcp))
5304  {
5305  an = i;
5306  }
5307  else
5308  {
5309  en = i;
5310  }
5311  }
5312  }
5313 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
void pWrite(poly p)
Definition: polys.h:279
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
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1019
#define nGreater(a, b)
Definition: numbers.h:28
int posInL13 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 5465 of file kutil.cc.

5467 {
5468  if (length<0) return 0;
5469 
5470  int o = p->GetpFDeg();
5471 
5472  if (set[length].GetpFDeg() > o)
5473  return length+1;
5474 
5475  int i;
5476  int an = 0;
5477  int en= length;
5478  loop
5479  {
5480  if (an >= en-1)
5481  {
5482  if (set[an].GetpFDeg() >= o)
5483  return en;
5484  return an;
5485  }
5486  i=(an+en) / 2;
5487  if (set[i].GetpFDeg() >= o)
5488  an=i;
5489  else
5490  en=i;
5491  }
5492 }
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 5500 of file kutil.cc.

5520 {
5521  if (length<0) return 0;
5522 
5523  int o = p->GetpFDeg() + p->ecart;
5524  int op = set[length].GetpFDeg() + set[length].ecart;
5525 
5526  if ((op > o)
5527  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5528  return length+1;
5529  int i;
5530  int an = 0;
5531  int en= length;
5532  loop
5533  {
5534  if (an >= en-1)
5535  {
5536  op = set[an].GetpFDeg() + set[an].ecart;
5537  if ((op > o)
5538  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5539  return en;
5540  return an;
5541  }
5542  i=(an+en) / 2;
5543  op = set[i].GetpFDeg() + set[i].ecart;
5544  if ((op > o)
5545  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5546  an=i;
5547  else
5548  en=i;
5549  }
5550 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL17 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 5558 of file kutil.cc.

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

Definition at line 5606 of file kutil.cc.

5608 {
5609  if (length<0) return 0;
5610 
5611  int cc = (-1+2*currRing->order[0]==ringorder_c);
5612  /* cc==1 for (c,..), cc==-1 for (C,..) */
5613  unsigned long c = pGetComp(p->p)*cc;
5614  int o = p->GetpFDeg() + p->ecart;
5615 
5616  if (pGetComp(set[length].p)*cc > c)
5617  return length+1;
5618  if (pGetComp(set[length].p)*cc == c)
5619  {
5620  if ((set[length].GetpFDeg() + set[length].ecart > o)
5621  || ((set[length].GetpFDeg() + set[length].ecart == o)
5622  && (set[length].ecart > p->ecart))
5623  || ((set[length].GetpFDeg() + set[length].ecart == o)
5624  && (set[length].ecart == p->ecart)
5625  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5626  return length+1;
5627  }
5628  int i;
5629  int an = 0;
5630  int en= length;
5631  loop
5632  {
5633  if (an >= en-1)
5634  {
5635  if (pGetComp(set[an].p)*cc > c)
5636  return en;
5637  if (pGetComp(set[an].p)*cc == c)
5638  {
5639  if ((set[an].GetpFDeg() + set[an].ecart > o)
5640  || ((set[an].GetpFDeg() + set[an].ecart == o)
5641  && (set[an].ecart > p->ecart))
5642  || ((set[an].GetpFDeg() + set[an].ecart == o)
5643  && (set[an].ecart == p->ecart)
5644  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5645  return en;
5646  }
5647  return an;
5648  }
5649  i=(an+en) / 2;
5650  if (pGetComp(set[i].p)*cc > c)
5651  an=i;
5652  else if (pGetComp(set[i].p)*cc == c)
5653  {
5654  if ((set[i].GetpFDeg() + set[i].ecart > o)
5655  || ((set[i].GetpFDeg() + set[i].ecart == o)
5656  && (set[i].ecart > p->ecart))
5657  || ((set[i].GetpFDeg() +set[i].ecart == o)
5658  && (set[i].ecart == p->ecart)
5659  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5660  an=i;
5661  else
5662  en=i;
5663  }
5664  else
5665  en=i;
5666  }
5667 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInLF5C ( const LSet  ,
const int  ,
LObject ,
const kStrategy  strat 
)

Definition at line 5069 of file kutil.cc.

5071 {
5072  return strat->Ll+1;
5073 }
int Ll
Definition: kutil.h:349
int posInLrg0 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 5335 of file kutil.cc.

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

Definition at line 4960 of file kutil.cc.

4962 {
4963  if (length < 0) return 0;
4964  if (set[length].FDeg > p->FDeg)
4965  return length+1;
4966  if (set[length].FDeg == p->FDeg)
4967  if(set[length].GetpLength() > p->GetpLength())
4968  return length+1;
4969  int i;
4970  int an = 0;
4971  int en= length+1;
4972  loop
4973  {
4974  if (an >= en-1)
4975  {
4976  if(an == en)
4977  return en;
4978  if (set[an].FDeg > p->FDeg)
4979  return en;
4980  if(set[an].FDeg == p->FDeg)
4981  {
4982  if(set[an].GetpLength() > p->GetpLength())
4983  {return en;}
4984  else
4985  {
4986  if(set[an].GetpLength() == p->GetpLength())
4987  {
4988  if(nGreater(set[an].p->coef, p->p->coef))
4989  {
4990  return en;
4991  }
4992  else
4993  {
4994  return an;
4995  }
4996  }
4997  else
4998  {
4999  return an;
5000  }
5001  }
5002  }
5003  else
5004  {return an;}
5005  }
5006  i=(an+en) / 2;
5007  if (set[i].FDeg > p->FDeg)
5008  an=i;
5009  else
5010  {
5011  if(set[i].FDeg == p->FDeg)
5012  {
5013  if(set[i].GetpLength() > p->GetpLength())
5014  an=i;
5015  else
5016  {
5017  if(set[i].GetpLength() == p->GetpLength())
5018  {
5019  if(nGreater(set[i].p->coef, p->p->coef))
5020  {
5021  an = i;
5022  }
5023  else
5024  {
5025  en = i;
5026  }
5027  }
5028  else
5029  {
5030  en=i;
5031  }
5032  }
5033  }
5034  else
5035  en=i;
5036  }
5037  }
5038 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28
int posInLSig ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4936 of file kutil.cc.

4938 {
4939 if (length<0) return 0;
4940 if (pLmCmp(set[length].sig,p->sig)== currRing->OrdSgn)
4941  return length+1;
4942 
4943 int i;
4944 int an = 0;
4945 int en= length;
4946 loop
4947 {
4948  if (an >= en-1)
4949  {
4950  if (pLmCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
4951  return an;
4952  }
4953  i=(an+en) / 2;
4954  if (pLmCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
4955  else en=i;
4956  /*aend. fuer lazy == in !=- machen */
4957 }
4958 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInLSpecial ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4862 of file kutil.cc.

4864 {
4865  if (length<0) return 0;
4866 
4867  int d=p->GetpFDeg();
4868  int op=set[length].GetpFDeg();
4869 
4870  if ((op > d)
4871  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
4872  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
4873  return length+1;
4874 
4875  int i;
4876  int an = 0;
4877  int en= length;
4878  loop
4879  {
4880  if (an >= en-1)
4881  {
4882  op=set[an].GetpFDeg();
4883  if ((op > d)
4884  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
4885  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
4886  return en;
4887  return an;
4888  }
4889  i=(an+en) / 2;
4890  op=set[i].GetpFDeg();
4891  if ((op>d)
4892  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
4893  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
4894  an=i;
4895  else
4896  en=i;
4897  }
4898 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc: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 4197 of file kutil.cc.

4199 {
4200  if(length==-1) return 0;
4201  polyset set=strat->S;
4202  int i;
4203  int an = 0;
4204  int en = length;
4205  int cmp_int = currRing->OrdSgn;
4207 #ifdef HAVE_PLURAL
4208  && (currRing->real_var_start==0)
4209 #endif
4210 #if 0
4211  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
4212 #endif
4213  )
4214  {
4215  int o=p_Deg(p,currRing);
4216  int oo=p_Deg(set[length],currRing);
4217 
4218  if ((oo<o)
4219  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
4220  return length+1;
4221 
4222  loop
4223  {
4224  if (an >= en-1)
4225  {
4226  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
4227  {
4228  return an;
4229  }
4230  return en;
4231  }
4232  i=(an+en) / 2;
4233  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
4234  else an=i;
4235  }
4236  }
4237  else
4238  {
4239 #ifdef HAVE_RINGS
4240  if (rField_is_Ring(currRing))
4241  {
4242  if (pLmCmp(set[length],p)== -cmp_int)
4243  return length+1;
4244  int cmp;
4245  loop
4246  {
4247  if (an >= en-1)
4248  {
4249  cmp = pLmCmp(set[an],p);
4250  if (cmp == cmp_int) return an;
4251  if (cmp == -cmp_int) return en;
4252  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
4253  return an;
4254  }
4255  i = (an+en) / 2;
4256  cmp = pLmCmp(set[i],p);
4257  if (cmp == cmp_int) en = i;
4258  else if (cmp == -cmp_int) an = i;
4259  else
4260  {
4261  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
4262  else en = i;
4263  }
4264  }
4265  }
4266  else
4267 #endif
4268  if (pLmCmp(set[length],p)== -cmp_int)
4269  return length+1;
4270 
4271  loop
4272  {
4273  if (an >= en-1)
4274  {
4275  if (pLmCmp(set[an],p) == cmp_int) return an;
4276  if (pLmCmp(set[an],p) == -cmp_int) return en;
4277  if ((cmp_int!=1)
4278  && ((strat->ecartS[an])>ecart_p))
4279  return an;
4280  return en;
4281  }
4282  i=(an+en) / 2;
4283  if (pLmCmp(set[i],p) == cmp_int) en=i;
4284  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
4285  else
4286  {
4287  if ((cmp_int!=1)
4288  &&((strat->ecartS[i])<ecart_p))
4289  en=i;
4290  else
4291  an=i;
4292  }
4293  }
4294  }
4295 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc: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 &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:776
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:751
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
poly * polyset
Definition: hutil.h:15
int posInSyz ( const kStrategy  strat,
poly  sig 
)

Definition at line 5041 of file kutil.cc.

5042 {
5043 if (strat->syzl==0) return 0;
5044 if (pLmCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
5045  return strat->syzl;
5046 int i;
5047 int an = 0;
5048 int en= strat->syzl-1;
5049 loop
5050 {
5051  if (an >= en-1)
5052  {
5053  if (pLmCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
5054  return an;
5055  }
5056  i=(an+en) / 2;
5057  if (pLmCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
5058  else en=i;
5059  /*aend. fuer lazy == in !=- machen */
5060 }
5061 }
loop
Definition: myNF.cc:98
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
int posInT0 ( const TSet  ,
const int  length,
LObject  
)

Definition at line 4302 of file kutil.cc.

4303 {
4304  return (length+1);
4305 }
int posInT1 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4313 of file kutil.cc.

4314 {
4315  if (length==-1) return 0;
4316 
4317  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
4318 
4319  int i;
4320  int an = 0;
4321  int en= length;
4322 
4323  loop
4324  {
4325  if (an >= en-1)
4326  {
4327  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
4328  return en;
4329  }
4330  i=(an+en) / 2;
4331  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
4332  else an=i;
4333  }
4334 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT11 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4371 of file kutil.cc.

4389 {
4390  if (length==-1) return 0;
4391 
4392  int o = p.GetpFDeg();
4393  int op = set[length].GetpFDeg();
4394 
4395  if ((op < o)
4396  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4397  return length+1;
4398 
4399  int i;
4400  int an = 0;
4401  int en= length;
4402 
4403  loop
4404  {
4405  if (an >= en-1)
4406  {
4407  op= set[an].GetpFDeg();
4408  if ((op > o)
4409  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4410  return an;
4411  return en;
4412  }
4413  i=(an+en) / 2;
4414  op = set[i].GetpFDeg();
4415  if (( op > o)
4416  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4417  en=i;
4418  else
4419  an=i;
4420  }
4421 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT110 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4504 of file kutil.cc.

4505 {
4506  p.GetpLength();
4507  if (length==-1) return 0;
4508 
4509  int o = p.GetpFDeg();
4510  int op = set[length].GetpFDeg();
4511 
4512  if (( op < o)
4513  || (( op == o) && (set[length].length<p.length))
4514  || (( op == o) && (set[length].length == p.length)
4515  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4516  return length+1;
4517 
4518  int i;
4519  int an = 0;
4520  int en= length;
4521  loop
4522  {
4523  if (an >= en-1)
4524  {
4525  op = set[an].GetpFDeg();
4526  if (( op > o)
4527  || (( op == o) && (set[an].length > p.length))
4528  || (( op == o) && (set[an].length == p.length)
4529  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4530  return an;
4531  return en;
4532  }
4533  i=(an+en) / 2;
4534  op = set[i].GetpFDeg();
4535  if (( op > o)
4536  || (( op == o) && (set[i].length > p.length))
4537  || (( op == o) && (set[i].length == p.length)
4538  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4539  en=i;
4540  else
4541  an=i;
4542  }
4543 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT13 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4550 of file kutil.cc.

4551 {
4552  if (length==-1) return 0;
4553 
4554  int o = p.GetpFDeg();
4555 
4556  if (set[length].GetpFDeg() <= o)
4557  return length+1;
4558 
4559  int i;
4560  int an = 0;
4561  int en= length;
4562  loop
4563  {
4564  if (an >= en-1)
4565  {
4566  if (set[an].GetpFDeg() > o)
4567  return an;
4568  return en;
4569  }
4570  i=(an+en) / 2;
4571  if (set[i].GetpFDeg() > o)
4572  en=i;
4573  else
4574  an=i;
4575  }
4576 }
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 4618 of file kutil.cc.

4637 {
4638  if (length==-1) return 0;
4639 
4640  int o = p.GetpFDeg() + p.ecart;
4641  int op = set[length].GetpFDeg()+set[length].ecart;
4642 
4643  if ((op < o)
4644  || ((op == o)
4645  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4646  return length+1;
4647 
4648  int i;
4649  int an = 0;
4650  int en= length;
4651  loop
4652  {
4653  if (an >= en-1)
4654  {
4655  op = set[an].GetpFDeg()+set[an].ecart;
4656  if (( op > o)
4657  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4658  return an;
4659  return en;
4660  }
4661  i=(an+en) / 2;
4662  op = set[i].GetpFDeg()+set[i].ecart;
4663  if (( op > o)
4664  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4665  en=i;
4666  else
4667  an=i;
4668  }
4669 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT17 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4676 of file kutil.cc.

4697 {
4698  if (length==-1) return 0;
4699 
4700  int o = p.GetpFDeg() + p.ecart;
4701  int op = set[length].GetpFDeg()+set[length].ecart;
4702 
4703  if ((op < o)
4704  || (( op == o) && (set[length].ecart > p.ecart))
4705  || (( op == o) && (set[length].ecart==p.ecart)
4706  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4707  return length+1;
4708 
4709  int i;
4710  int an = 0;
4711  int en= length;
4712  loop
4713  {
4714  if (an >= en-1)
4715  {
4716  op = set[an].GetpFDeg()+set[an].ecart;
4717  if (( op > o)
4718  || (( op == o) && (set[an].ecart < p.ecart))
4719  || (( op == o) && (set[an].ecart==p.ecart)
4720  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4721  return an;
4722  return en;
4723  }
4724  i=(an+en) / 2;
4725  op = set[i].GetpFDeg()+set[i].ecart;
4726  if ((op > o)
4727  || (( op == o) && (set[i].ecart < p.ecart))
4728  || (( op == o) && (set[i].ecart == p.ecart)
4729  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4730  en=i;
4731  else
4732  an=i;
4733  }
4734 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT17_c ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4740 of file kutil.cc.

4741 {
4742  if (length==-1) return 0;
4743 
4744  int cc = (-1+2*currRing->order[0]==ringorder_c);
4745  /* cc==1 for (c,..), cc==-1 for (C,..) */
4746  int o = p.GetpFDeg() + p.ecart;
4747  int c = pGetComp(p.p)*cc;
4748 
4749  if (pGetComp(set[length].p)*cc < c)
4750  return length+1;
4751  if (pGetComp(set[length].p)*cc == c)
4752  {
4753  int op = set[length].GetpFDeg()+set[length].ecart;
4754  if ((op < o)
4755  || ((op == o) && (set[length].ecart > p.ecart))
4756  || ((op == o) && (set[length].ecart==p.ecart)
4757  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4758  return length+1;
4759  }
4760 
4761  int i;
4762  int an = 0;
4763  int en= length;
4764  loop
4765  {
4766  if (an >= en-1)
4767  {
4768  if (pGetComp(set[an].p)*cc < c)
4769  return en;
4770  if (pGetComp(set[an].p)*cc == c)
4771  {
4772  int op = set[an].GetpFDeg()+set[an].ecart;
4773  if ((op > o)
4774  || ((op == o) && (set[an].ecart < p.ecart))
4775  || ((op == o) && (set[an].ecart==p.ecart)
4776  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4777  return an;
4778  }
4779  return en;
4780  }
4781  i=(an+en) / 2;
4782  if (pGetComp(set[i].p)*cc > c)
4783  en=i;
4784  else if (pGetComp(set[i].p)*cc == c)
4785  {
4786  int op = set[i].GetpFDeg()+set[i].ecart;
4787  if ((op > o)
4788  || ((op == o) && (set[i].ecart < p.ecart))
4789  || ((op == o) && (set[i].ecart == p.ecart)
4790  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4791  en=i;
4792  else
4793  an=i;
4794  }
4795  else
4796  an=i;
4797  }
4798 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT19 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4805 of file kutil.cc.

4806 {
4807  p.GetpLength();
4808  if (length==-1) return 0;
4809 
4810  int o = p.ecart;
4811  int op=p.GetpFDeg();
4812 
4813  if (set[length].ecart < o)
4814  return length+1;
4815  if (set[length].ecart == o)
4816  {
4817  int oo=set[length].GetpFDeg();
4818  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
4819  return length+1;
4820  }
4821 
4822  int i;
4823  int an = 0;
4824  int en= length;
4825  loop
4826  {
4827  if (an >= en-1)
4828  {
4829  if (set[an].ecart > o)
4830  return an;
4831  if (set[an].ecart == o)
4832  {
4833  int oo=set[an].GetpFDeg();
4834  if((oo > op)
4835  || ((oo==op) && (set[an].length > p.length)))
4836  return an;
4837  }
4838  return en;
4839  }
4840  i=(an+en) / 2;
4841  if (set[i].ecart > o)
4842  en=i;
4843  else if (set[i].ecart == o)
4844  {
4845  int oo=set[i].GetpFDeg();
4846  if ((oo > op)
4847  || ((oo == op) && (set[i].length > p.length)))
4848  en=i;
4849  else
4850  an=i;
4851  }
4852  else
4853  an=i;
4854  }
4855 }
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 4341 of file kutil.cc.

4342 {
4343  p.GetpLength();
4344  if (length==-1)
4345  return 0;
4346  if (set[length].length<p.length)
4347  return length+1;
4348 
4349  int i;
4350  int an = 0;
4351  int en= length;
4352 
4353  loop
4354  {
4355  if (an >= en-1)
4356  {
4357  if (set[an].length>p.length) return an;
4358  return en;
4359  }
4360  i=(an+en) / 2;
4361  if (set[i].length>p.length) en=i;
4362  else an=i;
4363  }
4364 }
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 9778 of file kutil.cc.

9779 {
9780 
9781  if (length==-1) return 0;
9782 
9783  int o = p.ecart;
9784  int op=p.GetpFDeg();
9785  int ol = p.GetpLength();
9786 
9787  if (set[length].ecart < o)
9788  return length+1;
9789  if (set[length].ecart == o)
9790  {
9791  int oo=set[length].GetpFDeg();
9792  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
9793  return length+1;
9794  }
9795 
9796  int i;
9797  int an = 0;
9798  int en= length;
9799  loop
9800  {
9801  if (an >= en-1)
9802  {
9803  if (set[an].ecart > o)
9804  return an;
9805  if (set[an].ecart == o)
9806  {
9807  int oo=set[an].GetpFDeg();
9808  if((oo > op)
9809  || ((oo==op) && (set[an].pLength > ol)))
9810  return an;
9811  }
9812  return en;
9813  }
9814  i=(an+en) / 2;
9815  if (set[i].ecart > o)
9816  en=i;
9817  else if (set[i].ecart == o)
9818  {
9819  int oo=set[i].GetpFDeg();
9820  if ((oo > op)
9821  || ((oo == op) && (set[i].pLength > ol)))
9822  en=i;
9823  else
9824  an=i;
9825  }
9826  else
9827  an=i;
9828  }
9829 }
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 4579 of file kutil.cc.

4580 {
4581  int ol = p.GetpLength();
4582  if (length==-1) return 0;
4583 
4584  int op=p.ecart;
4585 
4586  int oo=set[length].ecart;
4587  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
4588  return length+1;
4589 
4590  int i;
4591  int an = 0;
4592  int en= length;
4593  loop
4594  {
4595  if (an >= en-1)
4596  {
4597  int oo=set[an].ecart;
4598  if((oo > op)
4599  || ((oo==op) && (set[an].pLength > ol)))
4600  return an;
4601  return en;
4602  }
4603  i=(an+en) / 2;
4604  int oo=set[i].ecart;
4605  if ((oo > op)
4606  || ((oo == op) && (set[i].pLength > ol)))
4607  en=i;
4608  else
4609  an=i;
4610  }
4611 }
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 9832 of file kutil.cc.

9833 {
9834 
9835  if (length==-1) return 0;
9836 
9837  int op=p.GetpFDeg();
9838  int ol = p.GetpLength();
9839 
9840  int oo=set[length].GetpFDeg();
9841  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
9842  return length+1;
9843 
9844  int i;
9845  int an = 0;
9846  int en= length;
9847  loop
9848  {
9849  if (an >= en-1)
9850  {
9851  int oo=set[an].GetpFDeg();
9852  if((oo > op)
9853  || ((oo==op) && (set[an].pLength > ol)))
9854  return an;
9855  return en;
9856  }
9857  i=(an+en) / 2;
9858  int oo=set[i].GetpFDeg();
9859  if ((oo > op)
9860  || ((oo == op) && (set[i].pLength > ol)))
9861  en=i;
9862  else
9863  an=i;
9864  }
9865 }
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 9869 of file kutil.cc.

9870 {
9871  int ol = p.GetpLength();
9872  if (length==-1)
9873  return 0;
9874  if (set[length].length<p.length)
9875  return length+1;
9876 
9877  int i;
9878  int an = 0;
9879  int en= length;
9880 
9881  loop
9882  {
9883  if (an >= en-1)
9884  {
9885  if (set[an].pLength>ol) return an;
9886  return en;
9887  }
9888  i=(an+en) / 2;
9889  if (set[i].pLength>ol) en=i;
9890  else an=i;
9891  }
9892 }
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 4428 of file kutil.cc.

4429 {
4430  if (length==-1) return 0;
4431  int o = p.GetpFDeg();
4432  int op = set[length].GetpFDeg();
4433  int i;
4434  int an = 0;
4435  int en = length;
4436  int cmp_int = currRing->OrdSgn;
4437  if ((op < o) || (pLmCmp(set[length].p,p.p)== -cmp_int))
4438  return length+1;
4439  int cmp;
4440  loop
4441  {
4442  if (an >= en-1)
4443  {
4444  op = set[an].GetpFDeg();
4445  if (op > o) return an;
4446  if (op < 0) return en;
4447  cmp = pLmCmp(set[an].p,p.p);
4448  if (cmp == cmp_int) return an;
4449  if (cmp == -cmp_int) return en;
4450  if (nGreater(pGetCoeff(p.p), pGetCoeff(set[an].p))) return en;
4451  return an;
4452  }
4453  i = (an + en) / 2;
4454  op = set[i].GetpFDeg();
4455  if (op > o) en = i;
4456  else if (op < o) an = i;
4457  else
4458  {
4459  cmp = pLmCmp(set[i].p,p.p);
4460  if (cmp == cmp_int) en = i;
4461  else if (cmp == -cmp_int) an = i;
4462  else if (nGreater(pGetCoeff(p.p), pGetCoeff(set[i].p))) an = i;
4463  else en = i;
4464  }
4465  }
4466 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28
void postReduceByMon ( LObject h,
kStrategy  strat 
)

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

Definition at line 9221 of file kutil.cc.

9222 {
9223  if(!nCoeff_is_Ring_Z(currRing->cf))
9224  return;
9225  poly pH = h->GetP();
9226  poly p,pp;
9227  p = pH;
9228  bool deleted = FALSE, ok = FALSE;
9229  for(int i = 0; i<=strat->sl; i++)
9230  {
9231  p = pH;
9232  if(pNext(strat->S[i]) == NULL)
9233  {
9234  //pWrite(p);
9235  //pWrite(strat->S[i]);
9236  while(ok == FALSE)
9237  {
9238  if(pLmDivisibleBy(strat->S[i], p))
9239  {
9240  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
9241  p_SetCoeff(p,dummy,currRing);
9242  }
9243  if(nIsZero(p->coef))
9244  {
9245  pLmDelete(&p);
9246  deleted = TRUE;
9247  }
9248  else
9249  {
9250  ok = TRUE;
9251  }
9252  }
9253  pp = pNext(p);
9254  while(pp != NULL)
9255  {
9256  if(pLmDivisibleBy(strat->S[i], pp))
9257  {
9258  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
9259  p_SetCoeff(pp,dummy,currRing);
9260  if(nIsZero(pp->coef))
9261  {
9262  pLmDelete(&pNext(p));
9263  pp = pNext(p);
9264  deleted = TRUE;
9265  }
9266  else
9267  {
9268  p = pp;
9269  pp = pNext(p);
9270  }
9271  }
9272  else
9273  {
9274  p = pp;
9275  pp = pNext(p);
9276  }
9277  }
9278  }
9279  }
9280  h->SetLmCurrRing();
9281  if(deleted)
9282  strat->initEcart(h);
9283 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:629
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:755
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
poly preIntegerCheck ( ideal  FOrig,
ideal  Q 
)

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

Definition at line 9048 of file kutil.cc.

9049 {
9051  if(!nCoeff_is_Ring_Z(currRing->cf))
9052  return NULL;
9053  ideal F = idCopy(FOrig);
9054  idSkipZeroes(F);
9055  poly pmon;
9056  ring origR = currRing;
9057  ideal monred = idInit(1,1);
9058  for(int i=0; i<idElem(F); i++)
9059  {
9060  if(pNext(F->m[i]) == NULL)
9061  idInsertPoly(monred, F->m[i]);
9062  }
9063  int posconst = idPosConstant(F);
9064  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
9065  {
9066  pmon = pCopy(F->m[posconst]);
9067  idDelete(&F);
9068  idDelete(&monred);
9069  return pmon;
9070  }
9071  int idelemQ = 0;
9072  if(Q!=NULL)
9073  {
9074  idelemQ = IDELEMS(Q);
9075  for(int i=0; i<idelemQ; i++)
9076  {
9077  if(pNext(Q->m[i]) == NULL)
9078  idInsertPoly(monred, Q->m[i]);
9079  }
9080  idSkipZeroes(monred);
9081  posconst = idPosConstant(monred);
9082  //the constant, if found, will be from Q
9083  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
9084  {
9085  pmon = pCopy(monred->m[posconst]);
9086  idDelete(&F);
9087  idDelete(&monred);
9088  return pmon;
9089  }
9090  }
9091  ring QQ_ring = rCopy0(currRing,FALSE);
9092  nKillChar(QQ_ring->cf);
9093  QQ_ring->cf = nInitChar(n_Q, NULL);
9094  rComplete(QQ_ring,1);
9095  QQ_ring = rAssure_c_dp(QQ_ring);
9096  rChangeCurrRing(QQ_ring);
9097  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
9098  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
9099  for(int i = 0, j = 0; i<IDELEMS(F); i++)
9100  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
9101  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
9102  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
9103  ideal one = kStd(II, NULL, isNotHomog, NULL);
9104  idSkipZeroes(one);
9105  if(idIsConstant(one))
9106  {
9107  //one should be <1>
9108  for(int i = IDELEMS(II)-1; i>=0; i--)
9109  if(II->m[i] != NULL)
9110  II->m[i+1] = II->m[i];
9111  II->m[0] = pOne();
9112  ideal syz = idSyzygies(II, isNotHomog, NULL);
9113  poly integer = NULL;
9114  for(int i = IDELEMS(syz)-1;i>=0; i--)
9115  {
9116  if(pGetComp(syz->m[i]) == 1)
9117  {
9118  if(pIsConstant(syz->m[i]))
9119  {
9120  integer = pHead(syz->m[i]);
9121  pSetComp(integer, 0);
9122  break;
9123  }
9124  }
9125  }
9126  rChangeCurrRing(origR);
9127  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9128  pmon = prMapR(integer, nMap2, QQ_ring, origR);
9129  idDelete(&F);
9130  idDelete(&monred);
9131  idDelete(&II);
9132  idDelete(&one);
9133  idDelete(&syz);
9134  pDelete(&integer);
9135  rDelete(QQ_ring);
9136  return pmon;
9137  }
9138  else
9139  {
9140  if(idIs0(monred))
9141  {
9142  poly mindegmon = NULL;
9143  for(int i = 0; i<IDELEMS(one); i++)
9144  {
9145  if(pNext(one->m[i]) == NULL)
9146  {
9147  if(mindegmon == NULL)
9148  mindegmon = one->m[i];
9149  else
9150  {
9151  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
9152  mindegmon = one->m[i];
9153  }
9154  }
9155  }
9156  if(mindegmon != NULL)
9157  {
9158  for(int i = IDELEMS(II)-1; i>=0; i--)
9159  if(II->m[i] != NULL)
9160  II->m[i+1] = II->m[i];
9161  II->m[0] = mindegmon;
9162  ideal syz = idSyzygies(II, isNotHomog, NULL);
9163  bool found = FALSE;
9164  for(int i = IDELEMS(syz)-1;i>=0; i--)
9165  {
9166  if(pGetComp(syz->m[i]) == 1)
9167  {
9168  if(pIsConstant(syz->m[i]))
9169  {
9170  pSetCoeff(mindegmon, syz->m[i]->coef);
9171  found = TRUE;
9172  break;
9173  }
9174  }
9175  }
9176  idDelete(&syz);
9177  if (found == FALSE)
9178  {
9179  rChangeCurrRing(origR);
9180  idDelete(&F);
9181  idDelete(&monred);
9182  idDelete(&II);
9183  idDelete(&one);
9184  pDelete(&mindegmon);
9185  pDelete(&pmon);
9186  rDelete(QQ_ring);
9187  return NULL;
9188  }
9189  rChangeCurrRing(origR);
9190  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9191  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
9192  idDelete(&F);
9193  idDelete(&monred);
9194  idDelete(&II);
9195  idDelete(&one);
9196  idDelete(&syz);
9197  pDelete(&mindegmon);
9198  rDelete(QQ_ring);
9199  return pmon;
9200  }
9201  else
9202  rChangeCurrRing(origR);
9203  pDelete(&mindegmon);
9204  }
9205  else
9206  rChangeCurrRing(origR);
9207  }
9208  idDelete(&F);
9209  idDelete(&monred);
9210  idDelete(&II);
9211  idDelete(&one);
9212  pDelete(&pmon);
9213  rDelete(QQ_ring);
9214  return NULL;
9215 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:39
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define FALSE
Definition: auxiliary.h:140
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:755
#define TRUE
Definition: auxiliary.h:144
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2225
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4895
#define pGetComp(p)
Component.
Definition: polys.h:37
bool found
Definition: facFactorize.cc:56
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:47
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3436
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1318
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
#define pSetComp(p, v)
Definition: polys.h:38
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:722
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:73
void rChangeCurrRing(ring r)
Definition: polys.cc:14
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:557
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
#define idIsConstant(I)
Definition: ideals.h:53
static poly redBba ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 7277 of file kutil.cc.

7278 {
7279  int j = 0;
7280  unsigned long not_sev = ~ pGetShortExpVector(h);
7281 
7282  while (j <= maxIndex)
7283  {
7284  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
7285  {
7286  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
7287  if (h==NULL) return NULL;
7288  j = 0;
7289  not_sev = ~ pGetShortExpVector(h); }
7290  else j++;
7291  }
7292  return h;
7293 }
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:302
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1078
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
static poly redBba1 ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 7172 of file kutil.cc.

7173 {
7174  int j = 0;
7175  unsigned long not_sev = ~ pGetShortExpVector(h);
7176 
7177  while (j <= maxIndex)
7178  {
7179  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
7180  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
7181  else j++;
7182  }
7183  return h;
7184 }
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:302
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1088
unsigned long * sevS
Definition: kutil.h:318
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 179 of file kstd1.cc.

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

Definition at line 613 of file kstd1.cc.

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

Definition at line 7300 of file kutil.cc.

7301 {
7302  int j=0;
7303  int e,l;
7304  unsigned long not_sev = ~ pGetShortExpVector(h);
7305 
7306  if (maxIndex >= 0)
7307  {
7308  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
7309  do
7310  {
7311  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
7312  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
7313  {
7314 #ifdef KDEBUG
7315  if (TEST_OPT_DEBUG)
7316  {PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);}
7317 #endif
7318  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
7319 #ifdef KDEBUG
7320  if(TEST_OPT_DEBUG)
7321  {PrintS(")\nto "); wrp(h); PrintLn();}
7322 #endif
7323  // pDelete(&h);
7324  if (h == NULL) return NULL;
7325  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
7326  j = 0;
7327  not_sev = ~ pGetShortExpVector(h);
7328  }
7329  else j++;
7330  }
7331  while (j <= maxIndex);
7332  }
7333  return h;
7334 }
void PrintLn()
Definition: reporter.cc:327
#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:375
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:302
BOOLEAN kHEdgeFound
Definition: kutil.h:366
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1078
void wrp(poly p)
Definition: polys.h: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 5971 of file kutil.cc.

5972 {
5973  poly h, hn;
5974  strat->redTailChange=FALSE;
5975 
5976  L->GetP();
5977  poly p = L->p;
5978  if (strat->noTailReduction || pNext(p) == NULL)
5979  return p;
5980 
5981  LObject Ln(strat->tailRing);
5982  TObject* With;
5983  // placeholder in case strat->tl < 0
5984  TObject With_s(strat->tailRing);
5985  h = p;
5986  hn = pNext(h);
5987  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
5988  long e;
5989  int l;
5990  BOOLEAN save_HE=strat->kHEdgeFound;
5991  strat->kHEdgeFound |=
5992  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
5993 
5994  while(hn != NULL)
5995  {
5996  op = strat->tailRing->pFDeg(hn, strat->tailRing);
5997  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
5998  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
5999  loop
6000  {
6001  Ln.Set(hn, strat->tailRing);
6002  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
6003  if (strat->kHEdgeFound)
6004  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6005  else
6006  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
6007  if (With == NULL) break;
6008  With->length=0;
6009  With->pLength=0;
6010  strat->redTailChange=TRUE;
6011  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
6012  {
6013  // reducing the tail would violate the exp bound
6014  if (kStratChangeTailRing(strat, L))
6015  {
6016  strat->kHEdgeFound = save_HE;
6017  return redtail(L, pos, strat);
6018  }
6019  else
6020  return NULL;
6021  }
6022  hn = pNext(h);
6023  if (hn == NULL) goto all_done;
6024  op = strat->tailRing->pFDeg(hn, strat->tailRing);
6025  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
6026  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
6027  }
6028  h = hn;
6029  hn = pNext(h);
6030  }
6031 
6032  all_done:
6033  if (strat->redTailChange)
6034  {
6035  L->pLength = 0;
6036  }
6037  strat->kHEdgeFound = save_HE;
6038  return p;
6039 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define TRUE
Definition: auxiliary.h:144
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
int Kstd1_deg
Definition: kutil.cc:228
BOOLEAN kHEdgeFound
Definition: kutil.h:366
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4586
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:389
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:59
poly redtail ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 6041 of file kutil.cc.

6042 {
6043  LObject L(p, currRing);
6044  return redtail(&L, pos, strat);
6045 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly redtailBba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 6047 of file kutil.cc.

6048 {
6049 #define REDTAIL_CANONICALIZE 100
6050  strat->redTailChange=FALSE;
6051  if (strat->noTailReduction) return L->GetLmCurrRing();
6052  poly h, p;
6053  p = h = L->GetLmTailRing();
6054  if ((h==NULL) || (pNext(h)==NULL))
6055  return L->GetLmCurrRing();
6056 
6057  TObject* With;
6058  // placeholder in case strat->tl < 0
6059  TObject With_s(strat->tailRing);
6060 
6061  LObject Ln(pNext(h), strat->tailRing);
6062  Ln.pLength = L->GetpLength() - 1;
6063 
6064  pNext(h) = NULL;
6065  if (L->p != NULL) pNext(L->p) = NULL;
6066  L->pLength = 1;
6067 
6068  Ln.PrepareRed(strat->use_buckets);
6069 
6070  int cnt=REDTAIL_CANONICALIZE;
6071  while(!Ln.IsNull())
6072  {
6073  loop
6074  {
6075  if (TEST_OPT_IDLIFT)
6076  {
6077  if (Ln.p!=NULL)
6078  {
6079  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
6080  }
6081  else
6082  {
6083  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
6084  }
6085  }
6086  Ln.SetShortExpVector();
6087  if (withT)
6088  {
6089  int j;
6090  j = kFindDivisibleByInT(strat, &Ln);
6091  if (j < 0) break;
6092  With = &(strat->T[j]);
6093  }
6094  else
6095  {
6096  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6097  if (With == NULL) break;
6098  }
6099  cnt--;
6100  if (cnt==0)
6101  {
6103  /*poly tmp=*/Ln.CanonicalizeP();
6104  if (normalize)
6105  {
6106  Ln.Normalize();
6107  //pNormalize(tmp);
6108  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
6109  }
6110  }
6111  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
6112  {
6113  With->pNorm();
6114  }
6115  strat->redTailChange=TRUE;
6116  if (ksReducePolyTail(L, With, &Ln))
6117  {
6118  // reducing the tail would violate the exp bound
6119  // set a flag and hope for a retry (in bba)
6120  strat->completeReduce_retry=TRUE;
6121  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6122  do
6123  {
6124  pNext(h) = Ln.LmExtractAndIter();
6125  pIter(h);
6126  L->pLength++;
6127  } while (!Ln.IsNull());
6128  goto all_done;
6129  }
6130  if (Ln.IsNull()) goto all_done;
6131  if (! withT) With_s.Init(currRing);
6132  }
6133  pNext(h) = Ln.LmExtractAndIter();
6134  pIter(h);
6135  pNormalize(h);
6136  L->pLength++;
6137  }
6138 
6139  all_done:
6140  Ln.Delete();
6141  if (L->p != NULL) pNext(L->p) = pNext(p);
6142 
6143  if (strat->redTailChange)
6144  {
6145  L->length = 0;
6146  L->pLength = 0;
6147  }
6148 
6149  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6150  //L->Normalize(); // HANNES: should have a test
6151  kTest_L(L);
6152  return L->GetLmCurrRing();
6153 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:393
#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
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:623
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:373
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:104
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
poly redtailBba_Z ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 6156 of file kutil.cc.

6158 {
6159  strat->redTailChange=FALSE;
6160  if (strat->noTailReduction) return L->GetLmCurrRing();
6161  poly h, p;
6162  p = h = L->GetLmTailRing();
6163  if ((h==NULL) || (pNext(h)==NULL))
6164  return L->GetLmCurrRing();
6165 
6166  TObject* With;
6167  // placeholder in case strat->tl < 0
6168  TObject With_s(strat->tailRing);
6169 
6170  LObject Ln(pNext(h), strat->tailRing);
6171  Ln.pLength = L->GetpLength() - 1;
6172 
6173  pNext(h) = NULL;
6174  if (L->p != NULL) pNext(L->p) = NULL;
6175  L->pLength = 1;
6176 
6177  Ln.PrepareRed(strat->use_buckets);
6178 
6179  int cnt=REDTAIL_CANONICALIZE;
6180  while(!Ln.IsNull())
6181  {
6182  loop
6183  {
6184  Ln.SetShortExpVector();
6185  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6186  if (With == NULL) break;
6187  cnt--;
6188  if (cnt==0)
6189  {
6191  /*poly tmp=*/Ln.CanonicalizeP();
6192  }
6193  // we are in Z, do not call pNorm
6194  strat->redTailChange=TRUE;
6195  // test divisibility of coefs:
6196  poly p_Ln=Ln.GetLmCurrRing();
6197  poly p_With=With->GetLmCurrRing();
6198  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
6199  if (!nIsZero(z))
6200  {
6201  // subtract z*Ln, add z.Ln to L
6202  poly m=pHead(p_Ln);
6203  pSetCoeff(m,z);
6204  poly mm=pHead(m);
6205  pNext(h) = m;
6206  pIter(h);
6207  L->pLength++;
6208  mm=pNeg(mm);
6209  if (Ln.bucket!=NULL)
6210  {
6211  int dummy=1;
6212  kBucket_Add_q(Ln.bucket,mm,&dummy);
6213  }
6214  else
6215  {
6216  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
6217  Ln.GetP();
6218  if (Ln.p!=NULL)
6219  {
6220  Ln.p=pAdd(Ln.p,mm);
6221  if (Ln.t_p!=NULL)
6222  {
6223  pNext(Ln.t_p)=NULL;
6224  p_LmDelete(Ln.t_p,strat->tailRing);
6225  }
6226  }
6227  }
6228  }
6229  else
6230  nDelete(&z);
6231 
6232  if (ksReducePolyTail(L, With, &Ln))
6233  {
6234  // reducing the tail would violate the exp bound
6235  // set a flag and hope for a retry (in bba)
6236  strat->completeReduce_retry=TRUE;
6237  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6238  do
6239  {
6240  pNext(h) = Ln.LmExtractAndIter();
6241  pIter(h);
6242  L->pLength++;
6243  } while (!Ln.IsNull());
6244  goto all_done;
6245  }
6246  if (Ln.IsNull()) goto all_done;
6247  With_s.Init(currRing);
6248  }
6249  pNext(h) = Ln.LmExtractAndIter();
6250  pIter(h);
6251  pNormalize(h);
6252  L->pLength++;
6253  }
6254 
6255  all_done:
6256  Ln.Delete();
6257  if (L->p != NULL) pNext(L->p) = pNext(p);
6258 
6259  if (strat->redTailChange)
6260  {
6261  L->length = 0;
6262  }
6263 
6264  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6265  //L->Normalize(); // HANNES: should have a test
6266  kTest_L(L);
6267  return L->GetLmCurrRing();
6268 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:629
#define pAdd(p, q)
Definition: polys.h:174
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define pNeg(p)
Definition: polys.h: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:393
#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
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:623
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
BOOLEAN use_buckets
Definition: kutil.h:373
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:636
poly redtailBbaShift ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 10842 of file kutil.cc.

10843 {
10844  /* for the shift case need to run it with withT = TRUE */
10845  strat->redTailChange=FALSE;
10846  if (strat->noTailReduction) return L->GetLmCurrRing();
10847  poly h, p;
10848  p = h = L->GetLmTailRing();
10849  if ((h==NULL) || (pNext(h)==NULL))
10850  return L->GetLmCurrRing();
10851 
10852  TObject* With;
10853  // placeholder in case strat->tl < 0
10854  TObject With_s(strat->tailRing);
10855 
10856  LObject Ln(pNext(h), strat->tailRing);
10857  Ln.pLength = L->GetpLength() - 1;
10858 
10859  pNext(h) = NULL;
10860  if (L->p != NULL) pNext(L->p) = NULL;
10861  L->pLength = 1;
10862 
10863  Ln.PrepareRed(strat->use_buckets);
10864 
10865  while(!Ln.IsNull())
10866  {
10867  loop
10868  {
10869  Ln.SetShortExpVector();
10870  if (withT)
10871  {
10872  int j;
10873  j = kFindDivisibleByInT(strat, &Ln);
10874  if (j < 0) break;
10875  With = &(strat->T[j]);
10876  }
10877  else
10878  {
10879  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
10880  if (With == NULL) break;
10881  }
10882  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
10883  {
10884  With->pNorm();
10885  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
10886  }
10887  strat->redTailChange=TRUE;
10888  if (ksReducePolyTail(L, With, &Ln))
10889  {
10890  // reducing the tail would violate the exp bound
10891  // set a flag and hope for a retry (in bba)
10892  strat->completeReduce_retry=TRUE;
10893  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
10894  do
10895  {
10896  pNext(h) = Ln.LmExtractAndIter();
10897  pIter(h);
10898  L->pLength++;
10899  } while (!Ln.IsNull());
10900  goto all_done;
10901  }
10902  if (Ln.IsNull()) goto all_done;
10903  if (! withT) With_s.Init(currRing);
10904  }
10905  pNext(h) = Ln.LmExtractAndIter();
10906  pIter(h);
10907  L->pLength++;
10908  }
10909 
10910  all_done:
10911  Ln.Delete();
10912  if (L->p != NULL) pNext(L->p) = pNext(p);
10913 
10914  if (strat->redTailChange)
10915  {
10916  L->length = 0;
10917  }
10918  L->Normalize(); // HANNES: should have a test
10919  kTest_L(L);
10920  return L->GetLmCurrRing();
10921 }
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:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:393
#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
#define kTest_L(T)
Definition: kutil.h:623
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:373
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:104
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 4144 of file kutil.cc.

4145 {
4146  int i,j,at,ecart, s2r;
4147  int fq=0;
4148  unsigned long sev;
4149  poly p;
4150  int new_suc=strat->sl+1;
4151  i= *suc;
4152  if (i<0) i=0;
4153 
4154  for (; i<=strat->sl; i++)
4155  {
4156  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4157  if (at != i)
4158  {
4159  if (new_suc > at) new_suc = at;
4160  p = strat->S[i];
4161  ecart = strat->ecartS[i];
4162  sev = strat->sevS[i];
4163  s2r = strat->S_2_R[i];
4164  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
4165  for (j=i; j>=at+1; j--)
4166  {
4167  strat->S[j] = strat->S[j-1];
4168  strat->ecartS[j] = strat->ecartS[j-1];
4169  strat->sevS[j] = strat->sevS[j-1];
4170  strat->S_2_R[j] = strat->S_2_R[j-1];
4171  }
4172  strat->S[at] = p;
4173  strat->ecartS[at] = ecart;
4174  strat->sevS[at] = sev;
4175  strat->S_2_R[at] = s2r;
4176  if (strat->fromQ!=NULL)
4177  {
4178  for (j=i; j>=at+1; j--)
4179  {
4180  strat->fromQ[j] = strat->fromQ[j-1];
4181  }
4182  strat->fromQ[at]=fq;
4183  }
4184  }
4185  }
4186  if (new_suc <= strat->sl) *suc=new_suc;
4187  else *suc=-1;
4188 }
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ring sbaRing ( kStrategy  strat,
const ring  r,
BOOLEAN  ,
int   
)

Definition at line 9487 of file kutil.cc.

9488 {
9489  int n = rBlocks(r); // Including trailing zero!
9490  // if sbaOrder == 1 => use (C,monomial order from r)
9491  if (strat->sbaOrder == 1)
9492  {
9493  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
9494  {
9495  return r;
9496  }
9497  ring res = rCopy0(r, TRUE, FALSE);
9498  res->order = (int *)omAlloc0((n+1)*sizeof(int));
9499  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
9500  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
9501  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
9502  res->wvhdl = wvhdl;
9503  for (int i=1; i<n; i++)
9504  {
9505  res->order[i] = r->order[i-1];
9506  res->block0[i] = r->block0[i-1];
9507  res->block1[i] = r->block1[i-1];
9508  res->wvhdl[i] = r->wvhdl[i-1];
9509  }
9510 
9511  // new 1st block
9512  res->order[0] = ringorder_C; // Prefix
9513  // removes useless secondary component order if defined in old ring
9514  for (int i=rBlocks(res); i>0; --i) {
9515  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
9516  res->order[i] = 0;
9517  }
9518  }
9519  rComplete(res, 1);
9520 #ifdef HAVE_PLURAL
9521  if (rIsPluralRing(r))
9522  {
9523  if ( nc_rComplete(r, res, false) ) // no qideal!
9524  {
9525 #ifndef SING_NDEBUG
9526  WarnS("error in nc_rComplete");
9527 #endif
9528  // cleanup?
9529 
9530  // rDelete(res);
9531  // return r;
9532 
9533  // just go on..
9534  }
9535  }
9536 #endif
9537  strat->tailRing = res;
9538  return (res);
9539  }
9540  // if sbaOrder == 3 => degree - position - ring order
9541  if (strat->sbaOrder == 3)
9542  {
9543  ring res = rCopy0(r, TRUE, FALSE);
9544  res->order = (int *)omAlloc0((n+2)*sizeof(int));
9545  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
9546  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
9547  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
9548  res->wvhdl = wvhdl;
9549  for (int i=2; i<n+2; i++)
9550  {
9551  res->order[i] = r->order[i-2];
9552  res->block0[i] = r->block0[i-2];
9553  res->block1[i] = r->block1[i-2];
9554  res->wvhdl[i] = r->wvhdl[i-2];
9555  }
9556 
9557  // new 1st block
9558  res->order[0] = ringorder_a; // Prefix
9559  res->block0[0] = 1;
9560  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
9561  for (int i=0; i<res->N; ++i)
9562  res->wvhdl[0][i] = 1;
9563  res->block1[0] = si_min(res->N, rVar(res));
9564  // new 2nd block
9565  res->order[1] = ringorder_C; // Prefix
9566  res->wvhdl[1] = NULL;
9567  // removes useless secondary component order if defined in old ring
9568  for (int i=rBlocks(res); i>1; --i) {
9569  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
9570  res->order[i] = 0;
9571  }
9572  }
9573  rComplete(res, 1);
9574 #ifdef HAVE_PLURAL
9575  if (rIsPluralRing(r))
9576  {
9577  if ( nc_rComplete(r, res, false) ) // no qideal!
9578  {
9579 #ifndef SING_NDEBUG
9580  WarnS("error in nc_rComplete");
9581 #endif
9582  // cleanup?
9583 
9584  // rDelete(res);
9585  // return r;
9586 
9587  // just go on..
9588  }
9589  }
9590 #endif
9591  strat->tailRing = res;
9592  return (res);
9593  }
9594 
9595  // not sbaOrder == 1 => use Schreyer order
9596  // this is done by a trick when initializing the signatures
9597  // in initSLSba():
9598  // Instead of using the signature 1e_i for F->m[i], we start
9599  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
9600  // Schreyer order w.r.t. the underlying monomial order.
9601  // => we do not need to change the underlying polynomial ring at all!
9602 
9603  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
9604 
9605  /*
9606  else
9607  {
9608  ring res = rCopy0(r, FALSE, FALSE);
9609  // Create 2 more blocks for prefix/suffix:
9610  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
9611  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
9612  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
9613  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
9614 
9615  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
9616  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
9617 
9618  // new 1st block
9619  int j = 0;
9620  res->order[j] = ringorder_IS; // Prefix
9621  res->block0[j] = res->block1[j] = 0;
9622  // wvhdl[j] = NULL;
9623  j++;
9624 
9625  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
9626  {
9627  res->order [j] = r->order [i];
9628  res->block0[j] = r->block0[i];
9629  res->block1[j] = r->block1[i];
9630 
9631  if (r->wvhdl[i] != NULL)
9632  {
9633  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
9634  } // else wvhdl[j] = NULL;
9635  }
9636 
9637  // new last block
9638  res->order [j] = ringorder_IS; // Suffix
9639  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
9640  // wvhdl[j] = NULL;
9641  j++;
9642 
9643  // res->order [j] = 0; // The End!
9644  res->wvhdl = wvhdl;
9645 
9646  // j == the last zero block now!
9647  assume(j == (n+1));
9648  assume(res->order[0]==ringorder_IS);
9649  assume(res->order[j-1]==ringorder_IS);
9650  assume(res->order[j]==0);
9651 
9652  if (complete)
9653  {
9654  rComplete(res, 1);
9655 
9656 #ifdef HAVE_PLURAL
9657  if (rIsPluralRing(r))
9658  {
9659  if ( nc_rComplete(r, res, false) ) // no qideal!
9660  {
9661  }
9662  }
9663  assume(rIsPluralRing(r) == rIsPluralRing(res));
9664 #endif
9665 
9666 
9667 #ifdef HAVE_PLURAL
9668  ring old_ring = r;
9669 
9670 #endif
9671 
9672  if (r->qideal!=NULL)
9673  {
9674  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
9675 
9676  assume(idRankFreeModule(res->qideal, res) == 0);
9677 
9678 #ifdef HAVE_PLURAL
9679  if( rIsPluralRing(res) )
9680  if( nc_SetupQuotient(res, r, true) )
9681  {
9682  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
9683  }
9684 
9685 #endif
9686  assume(idRankFreeModule(res->qideal, res) == 0);
9687  }
9688 
9689 #ifdef HAVE_PLURAL
9690  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
9691  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
9692  assume(rIsSCA(res) == rIsSCA(old_ring));
9693  assume(ncRingType(res) == ncRingType(old_ring));
9694 #endif
9695  }
9696  strat->tailRing = res;
9697  return res;
9698  }
9699  */
9700 
9701  assume(FALSE);
9702  return(NULL);
9703 }
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:5531
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:537
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:513
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:3436
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1318
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define omAlloc0(size)
Definition: omAllocDecl.h:211
char* showOption ( )

Definition at line 721 of file misc_ip.cc.

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

Definition at line 1168 of file kutil.cc.

1169 {
1170  return (ecart1 <= ecart2);
1171 }
void superenterpairs ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR 
)

Definition at line 3900 of file kutil.cc.

3901 {
3902 #if ADIDEBUG
3903  PrintS("\nEnter superenterpairs\n");
3904  int iii = strat->Ll;
3905  printf("\nstrat->tl = %i\n",strat->tl);
3906 #endif
3908  // enter also zero divisor * poly, if this is non zero and of smaller degree
3909  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
3910 //#if ADIDEBUG
3911  #if 0
3912  if(iii==strat->Ll)
3913  {
3914  PrintS("\n enterExtendedSpoly has not changed the list L.\n");
3915  }
3916  else
3917  {
3918  PrintLn();
3919  PrintS("\n enterExtendedSpoly changed the list L:\n");
3920  for(iii=0;iii<=strat->Ll;iii++)
3921  {
3922  Print("\n L[%d]:\n",iii);
3923  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3924  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3925  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3926  }
3927  }
3928  printf("\nstrat->tl = %i\n",strat->tl);
3929  iii = strat->Ll;
3930 #endif
3931  initenterpairs(h, k, ecart, 0, strat, atR);
3932 //#if ADIDEBUG
3933  #if 0
3934  if(iii==strat->Ll)
3935  {
3936  PrintS("\n initenterpairs has not changed the list L.\n");
3937  }
3938  else
3939  {
3940  PrintS("\n initenterpairs changed the list L:\n");
3941  for(iii=0;iii<=strat->Ll;iii++)
3942  {
3943  Print("\n L[%d]:\n",iii);
3944  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3945  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3946  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3947  }
3948  }
3949  printf("\nstrat->tl = %i\n",strat->tl);
3950  iii = strat->Ll;
3951 #endif
3952  initenterstrongPairs(h, k, ecart, 0, strat, atR);
3953 //#if ADIDEBUG
3954  #if 0
3955  if(iii==strat->Ll)
3956  {
3957  PrintS("\n initenterstrongPairs has not changed the list L.\n");
3958  }
3959  else
3960  {
3961  PrintS("\n initenterstrongPairs changed the list L:\n");
3962  for(iii=0;iii<=strat->Ll;iii++)
3963  {
3964  Print("\n L[%d]:\n",iii);
3965  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3966  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3967  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3968  }
3969  }
3970  printf("\nstrat->tl = %i\n",strat->tl);
3971  PrintS("\nEnd of superenterpairs\n");
3972 #endif
3973  clearSbatch(h, k, pos, strat);
3974 #if ADIDEBUG
3975  printf("\nstrat->tl = %i\n",strat->tl);
3976 #endif
3977 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:3874
int Ll
Definition: kutil.h:349
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3028
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3749
int tl
Definition: kutil.h:348
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:437
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:3780
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:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
ring tailRing
Definition: kutil.h:341
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
static Poly * h
Definition: janet.cc:978
BOOLEAN syzCriterion ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5672 of file kutil.cc.

5673 {
5674 //#if 1
5675 #ifdef DEBUGF5
5676  Print("syzygy criterion checks: ");
5677  pWrite(sig);
5678 #endif
5679  for (int k=0; k<strat->syzl; k++)
5680  {
5681  //printf("-%d",k);
5682 //#if 1
5683 #ifdef DEBUGF5
5684  Print("checking with: %d / %d -- \n",k,strat->syzl);
5685  pWrite(pHead(strat->syz[k]));
5686 #endif
5687  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5688  {
5689 //#if 1
5690 #ifdef DEBUGF5
5691  PrintS("DELETE!\n");
5692 #endif
5693  //printf("- T -\n\n");
5694  return TRUE;
5695  }
5696  }
5697  //printf("- F -\n\n");
5698  return FALSE;
5699 }
#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:1711
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:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
BOOLEAN syzCriterionInc ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5704 of file kutil.cc.

5705 {
5706 //#if 1
5707 #ifdef DEBUGF5
5708  Print("--- syzygy criterion checks: ");
5709  pWrite(sig);
5710 #endif
5711  int comp = p_GetComp(sig, currRing);
5712  int min, max;
5713  if (comp<=1)
5714  return FALSE;
5715  else
5716  {
5717  min = strat->syzIdx[comp-2];
5718  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
5719  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
5720  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
5721  if (comp == strat->currIdx)
5722  {
5723  max = strat->syzl;
5724  }
5725  else
5726  {
5727  max = strat->syzIdx[comp-1];
5728  }
5729  for (int k=min; k<max; k++)
5730  {
5731 #ifdef F5DEBUG
5732  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
5733  Print("checking with: %d -- ",k);
5734  pWrite(pHead(strat->syz[k]));
5735 #endif
5736  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5737  return TRUE;
5738  }
5739  return FALSE;
5740  }
5741 }
#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
int currIdx
Definition: kutil.h:313
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc: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:1711
#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:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
intset syzIdx
Definition: kutil.h:309
long twoPow ( long  arg)

Definition at line 3362 of file kutil.cc.

3363 {
3364  return 1L << arg;
3365 }
void updateResult ( ideal  r,
ideal  Q,
kStrategy  strat 
)

Definition at line 8644 of file kutil.cc.

8645 {
8646  int l;
8647  if (strat->ak>0)
8648  {
8649  for (l=IDELEMS(r)-1;l>=0;l--)
8650  {
8651  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
8652  {
8653  pDelete(&r->m[l]); // and set it to NULL
8654  }
8655  }
8656  int q;
8657  poly p;
8658  for (l=IDELEMS(r)-1;l>=0;l--)
8659  {
8660  if ((r->m[l]!=NULL)
8661  //&& (strat->syzComp>0)
8662  //&& (pGetComp(r->m[l])<=strat->syzComp)
8663  )
8664  {
8665  for(q=IDELEMS(Q)-1; q>=0;q--)
8666  {
8667  if ((Q->m[q]!=NULL)
8668  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
8669  {
8670  #if HAVE_RINGS
8671  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8672  #endif
8673  {
8674  if (TEST_OPT_REDSB)
8675  {
8676  p=r->m[l];
8677  r->m[l]=kNF(Q,NULL,p);
8678  pDelete(&p);
8679  }
8680  else
8681  {
8682  pDelete(&r->m[l]); // and set it to NULL
8683  }
8684  break;
8685  }
8686  }
8687  }
8688  }
8689  }
8690  }
8691  else
8692  {
8693  int q;
8694  poly p;
8695  BOOLEAN reduction_found=FALSE;
8696  if (!rField_is_Ring(currRing))
8697  {
8698  for (l=IDELEMS(r)-1;l>=0;l--)
8699  {
8700  if (r->m[l]!=NULL)
8701  {
8702  for(q=IDELEMS(Q)-1; q>=0;q--)
8703  {
8704  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
8705  {
8706  if (TEST_OPT_REDSB)
8707  {
8708  p=r->m[l];
8709  r->m[l]=kNF(Q,NULL,p);
8710  pDelete(&p);
8711  reduction_found=TRUE;
8712  }
8713  else
8714  {
8715  pDelete(&r->m[l]); // and set it to NULL
8716  }
8717  break;
8718  }
8719  }
8720  }
8721  }
8722  }
8723  #ifdef HAVE_RINGS
8724  //Also need divisibility of the leading coefficients
8725  else
8726  {
8727  for (l=IDELEMS(r)-1;l>=0;l--)
8728  {
8729  if (r->m[l]!=NULL)
8730  {
8731  for(q=IDELEMS(Q)-1; q>=0;q--)
8732  {
8733  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8734  {
8735  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
8736  {
8737  if (TEST_OPT_REDSB)
8738  {
8739  p=r->m[l];
8740  r->m[l]=kNF(Q,NULL,p);
8741  pDelete(&p);
8742  reduction_found=TRUE;
8743  }
8744  else
8745  {
8746  pDelete(&r->m[l]); // and set it to NULL
8747  }
8748  break;
8749  }
8750  }
8751  }
8752  }
8753  }
8754  }
8755  #endif
8756  if (/*TEST_OPT_REDSB &&*/ reduction_found)
8757  {
8758  for (l=IDELEMS(r)-1;l>=0;l--)
8759  {
8760  if (r->m[l]!=NULL)
8761  {
8762  for(q=IDELEMS(r)-1;q>=0;q--)
8763  {
8764  if ((l!=q)
8765  && (r->m[q]!=NULL)
8766  &&(pLmDivisibleBy(r->m[l],r->m[q]))
8767  #if HAVE_RINGS
8768  && (!rField_is_Ring(currRing) ||
8769  n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8770  #endif
8771  )
8772  {
8773  //If they are equal then take the one with the smallest length
8774  if(pLmDivisibleBy(r->m[q],r->m[l])
8775  #ifdef HAVE_RINGS
8776  && ((rField_is_Ring(currRing)
8777  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8778  || !(rField_is_Ring(currRing)))
8779  #endif
8780  && (pLength(r->m[q]) < pLength(r->m[l]) ||
8781  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
8782  {
8783  pDelete(&r->m[l]);
8784  break;
8785  }
8786  else
8787  pDelete(&r->m[q]);
8788  }
8789  }
8790  }
8791  }
8792  }
8793  }
8794  idSkipZeroes(r);
8795 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2819
#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:351
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
#define nGreaterZero(n)
Definition: numbers.h:27
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:776
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#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
polyrec * poly
Definition: hilb.h:10
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 7341 of file kutil.cc.

7342 {
7343  LObject h;
7344  int i, suc=0;
7345  poly redSi=NULL;
7346  BOOLEAN change,any_change;
7347 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
7348 // for (i=0; i<=(strat->sl); i++)
7349 // {
7350 // Print("s%d:",i);
7351 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
7352 // pWrite(strat->S[i]);
7353 // }
7354 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
7355  any_change=FALSE;
7357  {
7358  while (suc != -1)
7359  {
7360  i=suc+1;
7361  while (i<=strat->sl)
7362  {
7363  change=FALSE;
7364  #ifdef HAVE_RINGS
7366  any_change = FALSE;
7367  #endif
7368  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
7369  {
7370  redSi = pHead(strat->S[i]);
7371  strat->S[i] = redBba(strat->S[i],i-1,strat);
7372  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
7373  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
7374  if (pCmp(redSi,strat->S[i])!=0)
7375  {
7376  change=TRUE;
7377  any_change=TRUE;
7378  #ifdef KDEBUG
7379  if (TEST_OPT_DEBUG)
7380  {
7381  PrintS("reduce:");
7382  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
7383  }
7384  #endif
7385  if (TEST_OPT_PROT)
7386  {
7387  if (strat->S[i]==NULL)
7388  PrintS("V");
7389  else
7390  PrintS("v");
7391  mflush();
7392  }
7393  }
7394  pLmDelete(&redSi);
7395  if (strat->S[i]==NULL)
7396  {
7397  deleteInS(i,strat);
7398  i--;
7399  }
7400  else if (change)
7401  {
7403  {
7404  if (TEST_OPT_CONTENTSB)
7405  {
7406  number n;
7407  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
7408  if (!nIsOne(n))
7409  {
7411  denom->n=nInvers(n);
7412  denom->next=DENOMINATOR_LIST;
7413  DENOMINATOR_LIST=denom;
7414  }
7415  nDelete(&n);
7416  }
7417  else
7418  {
7419  //pContent(strat->S[i]);
7420  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
7421  }
7422  }
7423  else
7424  {
7425  pNorm(strat->S[i]);
7426  }
7427  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
7428  }
7429  }
7430  i++;
7431  }
7432  if (any_change) reorderS(&suc,strat);
7433  else break;
7434  }
7435  if (toT)
7436  {
7437  for (i=0; i<=strat->sl; i++)
7438  {
7439  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7440  {
7441  h.p = redtailBba(strat->S[i],i-1,strat);
7443  {
7444  h.pCleardenom();// also does a pContent
7445  }
7446  }
7447  else
7448  {
7449  h.p = strat->S[i];
7450  }
7451  strat->initEcart(&h);
7452  if (strat->honey)
7453  {
7454  strat->ecartS[i] = h.ecart;
7455  }
7456  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
7457  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
7458  h.sev = strat->sevS[i];
7459  /*puts the elements of S also to T*/
7460  strat->initEcart(&h);
7461  enterT(h,strat);
7462  strat->S_2_R[i] = strat->tl;
7463  }
7464  }
7465  }
7466  else
7467  {
7468  while (suc != -1)
7469  {
7470  i=suc;
7471  while (i<=strat->sl)
7472  {
7473  change=FALSE;
7474  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
7475  {
7476  redSi=pHead((strat->S)[i]);
7477  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
7478  if ((strat->S)[i]==NULL)
7479  {
7480  deleteInS(i,strat);
7481  i--;
7482  }
7483  else if (pCmp((strat->S)[i],redSi)!=0)
7484  {
7485  any_change=TRUE;
7486  h.p = strat->S[i];
7487  strat->initEcart(&h);
7488  strat->ecartS[i] = h.ecart;
7490  {
7491  if (TEST_OPT_CONTENTSB)
7492  {
7493  number n;
7494  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
7495  if (!nIsOne(n))
7496  {
7498  denom->n=nInvers(n);
7499  denom->next=DENOMINATOR_LIST;
7500  DENOMINATOR_LIST=denom;
7501  }
7502  nDelete(&n);
7503  }
7504  else
7505  {
7506  //pContent(strat->S[i]);
7507  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
7508  }
7509  }
7510  else
7511  {
7512  pNorm(strat->S[i]); // == h.p
7513  }
7514  h.sev = pGetShortExpVector(h.p);
7515  strat->sevS[i] = h.sev;
7516  }
7517  pLmDelete(&redSi);
7518  kTest(strat);
7519  }
7520  i++;
7521  }
7522 #ifdef KDEBUG
7523  kTest(strat);
7524 #endif
7525  if (any_change) reorderS(&suc,strat);
7526  else { suc=-1; break; }
7527  if (h.p!=NULL)
7528  {
7529  if (!strat->kHEdgeFound)
7530  {
7531  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
7532  }
7533  if (strat->kHEdgeFound)
7534  newHEdge(strat);
7535  }
7536  }
7537  for (i=0; i<=strat->sl; i++)
7538  {
7539  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7540  {
7541  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
7542  strat->initEcart(&h);
7543  strat->ecartS[i] = h.ecart;
7544  h.sev = pGetShortExpVector(h.p);
7545  strat->sevS[i] = h.sev;
7546  }
7547  else
7548  {
7549  h.p = strat->S[i];
7550  h.ecart=strat->ecartS[i];
7551  h.sev = strat->sevS[i];
7552  h.length = h.pLength = pLength(h.p);
7553  }
7554  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7555  cancelunit1(&h,&suc,strat->sl,strat);
7556  h.SetpFDeg();
7557  /*puts the elements of S also to T*/
7558  enterT(h,strat);
7559  strat->S_2_R[i] = strat->tl;
7560  }
7561  if (suc!= -1) updateS(toT,strat);
7562  }
7563 #ifdef KDEBUG
7564  kTest(strat);
7565 #endif
7566 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:327
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:340
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:7189
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4144
#define TEST_OPT_CONTENTSB
Definition: options.h:121
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
#define kTest(A)
Definition: kutil.h:619
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6047
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:436
static int pLength(poly a)
Definition: p_polys.h:189
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7277
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
#define mflush()
Definition: reporter.h:55
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2837
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h: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:302
#define nDelete(n)
Definition: numbers.h:16
int int kStrategy strat
Definition: myNF.cc:68
#define nInvers(a)
Definition: numbers.h:33
BOOLEAN kHEdgeFound
Definition: kutil.h:366
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
denominator_list next
Definition: kutil.h:67
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7341
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7300
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8920
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
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:2707
void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 10148 of file kutil.cc.

10149 {
10150  /* to use after updateS(toT=FALSE,strat) */
10151  /* fills T with shifted elt's of S */
10152  int i;
10153  LObject h;
10154  int atT = -1; // or figure out smth better
10155  strat->tl = -1; // init
10156  for (i=0; i<=strat->sl; i++)
10157  {
10158  memset(&h,0,sizeof(h));
10159  h.p = strat->S[i]; // lm in currRing, tail in TR
10160  strat->initEcart(&h);
10161  h.sev = strat->sevS[i];
10162  h.t_p = NULL;
10163  h.GetTP(); // creates correct t_p
10164  /*puts the elements of S with their shifts to T*/
10165  // int atT, int uptodeg, int lV)
10166  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
10167  // need a small check for above; we insert >=1 elements
10168  // insert this check into kTest_TS ?
10169  enterTShift(h,strat,atT,uptodeg,lV);
10170  }
10171  /* what about setting strat->tl? */
10172 }
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:10799
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static Poly * h
Definition: janet.cc:978

Variable Documentation

denominator_list DENOMINATOR_LIST =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.