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

5807 {
5808  poly p1 = pOne();
5809  poly p2 = pOne();
5810  for (int ii=strat->sl; ii>start; ii--)
5811  {
5812  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
5813  {
5814  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
5815  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
5816  if (!(pLmCmp(p1,p2) == 1))
5817  {
5818  pDelete(&p1);
5819  pDelete(&p2);
5820  return TRUE;
5821  }
5822  }
5823  }
5824  pDelete(&p1);
5825  pDelete(&p2);
5826  return FALSE;
5827 }
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
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:1710
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:1353
polyrec * poly
Definition: hilb.h:10
BOOLEAN arriRewCriterionPre ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int   
)

Definition at line 5829 of file kutil.cc.

5830 {
5831  int found = -1;
5832  for (int i=strat->Bl; i>-1; i--) {
5833  if (pLmEqual(strat->B[i].sig,sig)) {
5834  found = i;
5835  break;
5836  }
5837  }
5838  if (found != -1) {
5839  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1) {
5840  deleteInL(strat->B,&strat->Bl,found,strat);
5841  } else {
5842  return TRUE;
5843  }
5844  }
5845  poly p1 = pOne();
5846  poly p2 = pOne();
5847  for (int ii=strat->sl; ii>-1; ii--)
5848  {
5849  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
5850  {
5851  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
5852  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
5853  if (!(pLmCmp(p1,p2) == 1))
5854  {
5855  pDelete(&p1);
5856  pDelete(&p2);
5857  return TRUE;
5858  }
5859  }
5860  }
5861  pDelete(&p1);
5862  pDelete(&p2);
5863  return FALSE;
5864 }
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
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:1053
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:1710
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:1353
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:465
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#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 7193 of file kutil.cc.

7194 {
7195  int k;
7196  poly r,h,h1,q;
7197 
7198  if (!pIsVector((*p).p) && ((*p).ecart != 0))
7199  {
7200 #ifdef HAVE_RINGS
7201  // Leading coef have to be a unit: no
7202  // example 2x+4x2 should be simplified to 2x*(1+2x)
7203  // and 2 is not a unit in Z
7204  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
7205 #endif
7206  k = 0;
7207  h1 = r = pCopy((*p).p);
7208  h =pNext(r);
7209  loop
7210  {
7211  if (h==NULL)
7212  {
7213  pDelete(&r);
7214  pDelete(&(pNext((*p).p)));
7215  (*p).ecart = 0;
7216  (*p).length = 1;
7217  (*p).pLength = 1;
7218  (*suc)=0;
7219  return;
7220  }
7221  if (!pDivisibleBy(r,h))
7222  {
7223  q=redBba1(h,index ,strat);
7224  if (q != h)
7225  {
7226  k++;
7227  pDelete(&h);
7228  pNext(h1) = h = q;
7229  }
7230  else
7231  {
7232  pDelete(&r);
7233  return;
7234  }
7235  }
7236  else
7237  {
7238  h1 = h;
7239  pIter(h);
7240  }
7241  if (k > 10)
7242  {
7243  pDelete(&r);
7244  return;
7245  }
7246  }
7247  }
7248 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7176
#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:597
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:126
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
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 2451 of file kutil.cc.

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

Definition at line 2666 of file kutil.cc.

2667 {
2668  if (strat->pairtest!=NULL)
2669  {
2670  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2671  strat->pairtest=NULL;
2672  }
2673  /*
2674  *the elements of B enter L
2675  */
2676  kMergeBintoL(strat);
2677 }
#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:2405
int BOOLEAN
Definition: auxiliary.h:131
void chainCritPart ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2741 of file kutil.cc.

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

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

2683 {
2684  int i,j,l;
2685  kMergeBintoLSba(strat);
2686  j = strat->Ll;
2687  loop /*cannot be changed into a for !!! */
2688  {
2689  if (j <= 0)
2690  {
2691  /*now L[0] cannot be canceled any more and the tail can be removed*/
2692  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2693  break;
2694  }
2695  if (strat->L[j].p2 == p)
2696  {
2697  i = j-1;
2698  loop
2699  {
2700  if (i < 0) break;
2701  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2702  {
2703  /*L[i] could be canceled but we search for a better one to cancel*/
2704  strat->c3++;
2705  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2706  && (pNext(strat->L[l].p) == strat->tail)
2707  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2708  && pDivisibleBy(p,strat->L[l].lcm))
2709  {
2710  /*
2711  *"NOT equal(...)" because in case of "equal" the element L[l]
2712  *is "older" and has to be from theoretical point of view behind
2713  *L[i], but we do not want to reorder L
2714  */
2715  strat->L[i].p2 = strat->tail;
2716  /*
2717  *L[l] will be canceled, we cannot cancel L[i] later on,
2718  *so we mark it with "tail"
2719  */
2720  deleteInL(strat->L,&strat->Ll,l,strat);
2721  i--;
2722  }
2723  else
2724  {
2725  deleteInL(strat->L,&strat->Ll,i,strat);
2726  }
2727  j--;
2728  }
2729  i--;
2730  }
2731  }
2732  else if (strat->L[j].p2 == strat->tail)
2733  {
2734  /*now L[j] cannot be canceled any more and the tail can be removed*/
2735  strat->L[j].p2 = p;
2736  }
2737  j--;
2738  }
2739 }
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:1053
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:2428
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:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#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:850
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h: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 3878 of file kutil.cc.

3879 {
3880  int j = pos;
3881  if ( (!strat->fromT)
3882  && ((strat->syzComp==0)
3883  ||(pGetComp(h)<=strat->syzComp)
3884  ))
3885  {
3886  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3887  unsigned long h_sev = pGetShortExpVector(h);
3888  loop
3889  {
3890  if (j > k) break;
3891  clearS(h,h_sev, &j,&k,strat);
3892  j++;
3893  }
3894  // Print("end clearS sl=%d\n",strat->sl);
3895  }
3896 }
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:1145
static Poly * h
Definition: janet.cc:978
void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 8801 of file kutil.cc.

8802 {
8803  int i;
8804  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
8805  LObject L;
8806 
8807 #ifdef KDEBUG
8808  // need to set this: during tailreductions of T[i], T[i].max is out of
8809  // sync
8810  sloppy_max = TRUE;
8811 #endif
8812 
8813  strat->noTailReduction = FALSE;
8814  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
8815  if (TEST_OPT_PROT)
8816  {
8817  PrintLn();
8818 // if (timerv) writeTime("standard base computed:");
8819  }
8820  if (TEST_OPT_PROT)
8821  {
8822  Print("(S:%d)",strat->sl);mflush();
8823  }
8824  for (i=strat->sl; i>=low; i--)
8825  {
8826  int end_pos=strat->sl;
8827  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
8828  if (strat->ak==0) end_pos=i-1;
8829  TObject* T_j = strat->s_2_t(i);
8830  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
8831  {
8832  L = *T_j;
8833  #ifdef KDEBUG
8834  if (TEST_OPT_DEBUG)
8835  {
8836  Print("test S[%d]:",i);
8837  p_wrp(L.p,currRing,strat->tailRing);
8838  PrintLn();
8839  }
8840  #endif
8842  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
8843  else
8844  strat->S[i] = redtail(&L, strat->sl, strat);
8845  #ifdef KDEBUG
8846  if (TEST_OPT_DEBUG)
8847  {
8848  Print("to (tailR) S[%d]:",i);
8849  p_wrp(strat->S[i],currRing,strat->tailRing);
8850  PrintLn();
8851  }
8852  #endif
8853 
8854  if (strat->redTailChange && strat->tailRing != currRing)
8855  {
8856  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
8857  if (pNext(T_j->p) != NULL)
8858  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
8859  else
8860  T_j->max = NULL;
8861  }
8863  T_j->pCleardenom();
8864  }
8865  else
8866  {
8867  assume(currRing == strat->tailRing);
8868  #ifdef KDEBUG
8869  if (TEST_OPT_DEBUG)
8870  {
8871  Print("test S[%d]:",i);
8872  p_wrp(strat->S[i],currRing,strat->tailRing);
8873  PrintLn();
8874  }
8875  #endif
8877  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
8878  else
8879  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
8881  {
8882  if (TEST_OPT_CONTENTSB)
8883  {
8884  number n;
8885  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8886  if (!nIsOne(n))
8887  {
8889  denom->n=nInvers(n);
8890  denom->next=DENOMINATOR_LIST;
8891  DENOMINATOR_LIST=denom;
8892  }
8893  nDelete(&n);
8894  }
8895  else
8896  {
8897  //pContent(strat->S[i]);
8898  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8899  }
8900  }
8901  #ifdef KDEBUG
8902  if (TEST_OPT_DEBUG)
8903  {
8904  Print("to (-tailR) S[%d]:",i);
8905  p_wrp(strat->S[i],currRing,strat->tailRing);
8906  PrintLn();
8907  }
8908  #endif
8909  }
8910  if (TEST_OPT_PROT)
8911  PrintS("-");
8912  }
8913  if (TEST_OPT_PROT) PrintLn();
8914 #ifdef KDEBUG
8915  sloppy_max = FALSE;
8916 #endif
8917 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5975
void PrintLn()
Definition: reporter.cc:322
#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
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
int ak
Definition: kutil.h:351
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6051
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
#define mflush()
Definition: reporter.h:55
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2826
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:752
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:2682
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 3687 of file kutil.cc.

3688 {
3689  // Initialize
3690  long exp[50]; // The exponent of \hat{X} (basepoint)
3691  long cexp[50]; // The current exponent for iterating over all
3692  long ind[50]; // The power of 2 in the i-th component of exp
3693  long cind[50]; // analog for cexp
3694  long mult[50]; // How to multiply the elements of G
3695  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3696  long habsind = 0; // The abs. index of the coefficient of h
3697  long step[50]; // The last increases
3698  for (int i = 1; i <= currRing->N; i++)
3699  {
3700  exp[i] = 0;
3701  cexp[i] = exp[i];
3702  ind[i] = 0;
3703  step[i] = 500000;
3704  cind[i] = ind[i];
3705  }
3706  long bound = currRing->ch;
3707  step[1] = 500000;
3708 #ifdef OLI_DEBUG
3709  PrintS("-------------\npoly :");
3710 // wrp(p);
3711  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3712  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3713  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3714  Print("bound : %d\n", bound);
3715  Print("cind : %d\n", cabsind);
3716 #endif
3717  if (cabsind == 0)
3718  {
3719  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3720  {
3721  return idInit(1, 1);
3722  }
3723  }
3724  ideal G0 = idInit(1, 1);
3725  // Now the whole simplex
3726  do
3727  {
3728  // Build s-polynomial
3729  // 2**ind-def * mult * g - exp-def * h
3730  poly t_p;
3731  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
3732 #ifdef OLI_DEBUG
3733  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3734  Print("zPoly : ");
3735  wrp(zeroPoly);
3736  Print("\n");
3737 #endif
3738  // Add to ideal
3739  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
3740  IDELEMS(G0) += 1;
3741  G0->m[IDELEMS(G0) - 1] = zeroPoly;
3742  }
3743  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3744  idSkipZeroes(G0);
3745  return G0;
3746 }
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:3558
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:3492
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:3540
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:1523
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:1472
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
int l
Definition: cfEzgcd.cc:94
void deleteInL ( LSet  set,
int *  length,
int  j,
kStrategy  strat 
)

Definition at line 1053 of file kutil.cc.

1054 {
1055  if (set[j].lcm!=NULL)
1056  {
1057 #ifdef HAVE_RINGS
1058  if (pGetCoeff(set[j].lcm) != NULL)
1059  pLmDelete(set[j].lcm);
1060  else
1061 #endif
1062  pLmFree(set[j].lcm);
1063  }
1064  if (set[j].sig!=NULL)
1065  {
1066 #ifdef HAVE_RINGS
1067  if (pGetCoeff(set[j].sig) != NULL)
1068  pLmDelete(set[j].sig);
1069  else
1070 #endif
1071  pLmFree(set[j].sig);
1072  }
1073  if (set[j].p!=NULL)
1074  {
1075  if (pNext(set[j].p) == strat->tail)
1076  {
1077 #ifdef HAVE_RINGS
1078  if (pGetCoeff(set[j].p) != NULL)
1079  pLmDelete(set[j].p);
1080  else
1081 #endif
1082  pLmFree(set[j].p);
1083  /*- tail belongs to several int spolys -*/
1084  }
1085  else
1086  {
1087  // search p in T, if it is there, do not delete it
1088  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1089  {
1090  // assure that for global orderings kFindInT fails
1091  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1092  set[j].Delete();
1093  }
1094  }
1095  }
1096  if (*length > 0 && j < *length)
1097  {
1098 #ifdef ENTER_USE_MEMMOVE
1099  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1100 #else
1101  int i;
1102  for (i=j; i < (*length); i++)
1103  set[i] = set[i+1];
1104 #endif
1105  }
1106 #ifdef KDEBUG
1107  memset(&(set[*length]),0,sizeof(LObject));
1108 #endif
1109  (*length)--;
1110 }
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:752
#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 946 of file kutil.cc.

947 {
948 #ifdef ENTER_USE_MEMMOVE
949  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
950  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
951  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
952  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
953 #else
954  int j;
955  for (j=i; j<strat->sl; j++)
956  {
957  strat->S[j] = strat->S[j+1];
958  strat->ecartS[j] = strat->ecartS[j+1];
959  strat->sevS[j] = strat->sevS[j+1];
960  strat->S_2_R[j] = strat->S_2_R[j+1];
961  }
962 #endif
963  if (strat->lenS!=NULL)
964  {
965 #ifdef ENTER_USE_MEMMOVE
966  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
967 #else
968  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
969 #endif
970  }
971  if (strat->lenSw!=NULL)
972  {
973 #ifdef ENTER_USE_MEMMOVE
974  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
975 #else
976  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
977 #endif
978  }
979  if (strat->fromQ!=NULL)
980  {
981 #ifdef ENTER_USE_MEMMOVE
982  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
983 #else
984  for (j=i; j<strat->sl; j++)
985  {
986  strat->fromQ[j] = strat->fromQ[j+1];
987  }
988 #endif
989  }
990  strat->S[strat->sl] = NULL;
991  strat->sl--;
992 }
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 998 of file kutil.cc.

999 {
1000 #ifdef ENTER_USE_MEMMOVE
1001  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1002  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1003  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1004  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1005  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1006  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1007 #else
1008  int j;
1009  for (j=i; j<strat->sl; j++)
1010  {
1011  strat->S[j] = strat->S[j+1];
1012  strat->sig[j] = strat->sig[j+1];
1013  strat->ecartS[j] = strat->ecartS[j+1];
1014  strat->sevS[j] = strat->sevS[j+1];
1015  strat->sevSig[j] = strat->sevSig[j+1];
1016  strat->S_2_R[j] = strat->S_2_R[j+1];
1017  }
1018 #endif
1019  if (strat->lenS!=NULL)
1020  {
1021 #ifdef ENTER_USE_MEMMOVE
1022  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1023 #else
1024  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1025 #endif
1026  }
1027  if (strat->lenSw!=NULL)
1028  {
1029 #ifdef ENTER_USE_MEMMOVE
1030  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1031 #else
1032  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1033 #endif
1034  }
1035  if (strat->fromQ!=NULL)
1036  {
1037 #ifdef ENTER_USE_MEMMOVE
1038  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1039 #else
1040  for (j=i; j<strat->sl; j++)
1041  {
1042  strat->fromQ[j] = strat->fromQ[j+1];
1043  }
1044 #endif
1045  }
1046  strat->S[strat->sl] = NULL;
1047  strat->sl--;
1048 }
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
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:59
void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 3784 of file kutil.cc.

3785 {
3786  if (nIsOne(pGetCoeff(h))) return;
3787  number gcd;
3788  bool go = false;
3789  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
3790  {
3791  gcd = n_Ann(pGetCoeff(h),currRing->cf);
3792  go = true;
3793  }
3794  else
3795  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
3796  if (go || !nIsOne(gcd))
3797  {
3798  poly p = h->next;
3799  if (!go)
3800  {
3801  number tmp = gcd;
3802  gcd = n_Ann(gcd,currRing->cf);
3803  nDelete(&tmp);
3804  }
3805  p_Test(p,strat->tailRing);
3806  p = pp_Mult_nn(p, gcd, strat->tailRing);
3807  nDelete(&gcd);
3808 
3809  if (p != NULL)
3810  {
3811  if (TEST_OPT_PROT)
3812  {
3813  PrintS("Z");
3814  }
3815 #ifdef KDEBUG
3816  if (TEST_OPT_DEBUG)
3817  {
3818  PrintS("--- create zero spoly: ");
3819  p_wrp(h,currRing,strat->tailRing);
3820  PrintS(" ---> ");
3821  }
3822 #endif
3823  poly tmp = pInit();
3824  pSetCoeff0(tmp, pGetCoeff(p));
3825  for (int i = 1; i <= rVar(currRing); i++)
3826  {
3827  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
3828  }
3830  {
3831  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
3832  }
3833  p_Setm(tmp, currRing);
3834  p = p_LmFreeAndNext(p, strat->tailRing);
3835  pNext(tmp) = p;
3836  LObject h;
3837  h.Init();
3838  h.p = tmp;
3839  h.tailRing = strat->tailRing;
3840  int posx;
3841  if (h.p!=NULL)
3842  {
3844  {
3845  //pContent(h.p);
3846  h.pCleardenom(); // also does a pContent
3847  }
3848  else
3849  {
3850  h.pNorm();
3851  }
3852  strat->initEcart(&h);
3853  if (strat->Ll==-1)
3854  posx =0;
3855  else
3856  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
3857  h.sev = pGetShortExpVector(h.p);
3858  if (strat->tailRing != currRing)
3859  {
3860  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
3861  }
3862 #ifdef KDEBUG
3863  if (TEST_OPT_DEBUG)
3864  {
3865  p_wrp(tmp,currRing,strat->tailRing);
3866  PrintLn();
3867  }
3868 #endif
3869  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
3870  }
3871  }
3872  }
3873  nDelete(&gcd);
3874 }
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 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:685
void PrintLn()
Definition: reporter.cc:322
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:236
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:927
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#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:1115
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:700
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:905
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:699
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
LSet L
Definition: kutil.h: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:436
#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 1115 of file kutil.cc.

1116 {
1117  // this should be corrected
1118  assume(p.FDeg == p.pFDeg());
1119 
1120  if ((*length)>=0)
1121  {
1122  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1123  if (at <= (*length))
1124 #ifdef ENTER_USE_MEMMOVE
1125  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1126 #else
1127  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1128 #endif
1129  }
1130  else at = 0;
1131  (*set)[at] = p;
1132  (*length)++;
1133 }
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 1841 of file kutil.cc.

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

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

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

1182 {
1183  assume(atR >= 0);
1184  assume(i<=strat->sl);
1185  assume(p!=NULL);
1186  int l,j,compare,compareCoeff;
1187  LObject h;
1188 
1189 #ifdef KDEBUG
1190  h.ecart=0; h.length=0;
1191 #endif
1192  /*- computes the lcm(s[i],p) -*/
1193  h.lcm = pInit();
1194  pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
1195  if (nIsZero(pGetCoeff(h.lcm)))
1196  {
1197  strat->cp++;
1198  pLmDelete(h.lcm);
1199  return;
1200  }
1201  // basic chain criterion
1202  pLcm(p,strat->S[i],h.lcm);
1203  pSetm(h.lcm);
1204  /*
1205  *the set B collects the pairs of type (S[j],p)
1206  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
1207  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1208  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1209  */
1210 
1211  for(j = strat->Bl;j>=0;j--)
1212  {
1213  compare=pDivCompRing(strat->B[j].lcm,h.lcm);
1214  compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
1215  #if ADIDEBUG
1216  printf("\nChainCrit in enteronepairring\n");
1217  printf("\nB[j]\n");
1218  pWrite(strat->B[j].p);
1219  pWrite(strat->B[j].p1);
1220  pWrite(strat->B[j].p2);
1221  pWrite(strat->B[j].lcm);
1222  printf("\nh - neue Paar\n");
1223  pWrite(h.p);
1224  pWrite(p);
1225  pWrite(strat->S[i]);
1226  pWrite(h.lcm);
1227  printf("\ncompare = %i\ncompareCoeff = %i\n",compare,compareCoeff);
1228  #endif
1229  if(compare == pDivComp_EQUAL)
1230  {
1231  //They have the same LM
1232  if(compareCoeff == pDivComp_LESS)
1233  {
1234  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1235  {
1236  #if ADIDEBUG
1237  printf("\nGelöscht h\n");
1238  #endif
1239  strat->c3++;
1240  pLmDelete(h.lcm);
1241  return;
1242  }
1243  break;
1244  }
1245  if(compareCoeff == pDivComp_GREATER)
1246  {
1247  #if ADIDEBUG
1248  printf("\nGelöscht: B[j]\n");
1249  #endif
1250  deleteInL(strat->B,&strat->Bl,j,strat);
1251  strat->c3++;
1252  }
1253  if(compareCoeff == pDivComp_EQUAL)
1254  {
1255  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1256  {
1257  #if ADIDEBUG
1258  printf("\nGelöscht h\n");
1259  #endif
1260  strat->c3++;
1261  pLmDelete(h.lcm);
1262  return;
1263  }
1264  break;
1265  }
1266  }
1267  if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
1268  {
1269  if(compare == pDivComp_LESS)
1270  {
1271  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1272  {
1273  #if ADIDEBUG
1274  printf("\nGelöscht h\n");
1275  #endif
1276  strat->c3++;
1277  pLmDelete(h.lcm);
1278  return;
1279  }
1280  break;
1281  }
1282  if(compare == pDivComp_GREATER)
1283  {
1284  #if ADIDEBUG
1285  printf("\nGelöscht: B[j]\n");
1286  #endif
1287  deleteInL(strat->B,&strat->Bl,j,strat);
1288  strat->c3++;
1289  }
1290  }
1291  }
1292  number s, t;
1293  poly m1, m2, gcd = NULL;
1294  #if ADIDEBUG
1295  printf("\nTrying to add spair S[%i] und p\n",i);pWrite(strat->S[i]);pWrite(p);
1296  #endif
1297  s = pGetCoeff(strat->S[i]);
1298  t = pGetCoeff(p);
1299  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
1300  ksCheckCoeff(&s, &t, currRing->cf);
1301  pSetCoeff0(m1, s);
1302  pSetCoeff0(m2, t);
1303  m2 = pNeg(m2);
1304  p_Test(m1,strat->tailRing);
1305  p_Test(m2,strat->tailRing);
1306  poly si = pCopy(strat->S[i]);
1307  poly pm1 = pp_Mult_mm(pNext(p), m1, strat->tailRing);
1308  poly sim2 = pp_Mult_mm(pNext(si), m2, strat->tailRing);
1309  pDelete(&si);
1310  if(sim2 == NULL)
1311  {
1312  pDelete(&m1);
1313  pDelete(&m2);
1314  if(pm1 == NULL)
1315  {
1316  if(h.lcm != NULL)
1317  pDelete(&h.lcm);
1318  h.Clear();
1319  if (strat->pairtest==NULL) initPairtest(strat);
1320  strat->pairtest[i] = TRUE;
1321  strat->pairtest[strat->sl+1] = TRUE;
1322  return;
1323  }
1324  else
1325  {
1326  gcd = pm1;
1327  pm1 = NULL;
1328  }
1329  }
1330  else
1331  {
1332  if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
1333  {
1334  p_SetCompP(sim2, pGetComp(p), strat->tailRing);
1335  pSetmComp(sim2);
1336  }
1337  //p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
1338  gcd = p_Add_q(pm1, sim2, strat->tailRing);
1339  }
1340  p_Test(gcd, strat->tailRing);
1341  //p_LmDelete(m1, strat->tailRing);
1342  //p_LmDelete(m2, strat->tailRing);
1343 #ifdef KDEBUG
1344  if (TEST_OPT_DEBUG)
1345  {
1346  wrp(gcd);
1347  PrintLn();
1348  }
1349 #endif
1350  h.p = gcd;
1351  h.i_r = -1;
1352  if(h.p == NULL)
1353  {
1354  if (strat->pairtest==NULL) initPairtest(strat);
1355  strat->pairtest[i] = TRUE;
1356  strat->pairtest[strat->sl+1] = TRUE;
1357  return;
1358  }
1359  h.tailRing = strat->tailRing;
1360  int posx;
1361  //h.pCleardenom();
1362  //pSetm(h.p);
1363  #if ADIDEBUG
1364  printf("\nThis is afterwards:\n");
1365  pWrite(h.p);
1366  #endif
1367  h.i_r1 = -1;h.i_r2 = -1;
1368  strat->initEcart(&h);
1369  #if 1
1370  h.p2 = strat->S[i];
1371  h.p1 = p;
1372  #endif
1373  #if 1
1374  if (atR >= 0)
1375  {
1376  h.i_r1 = atR;
1377  h.i_r2 = strat->S_2_R[i];
1378  }
1379  #endif
1380  if (strat->Bl==-1)
1381  posx =0;
1382  else
1383  posx = strat->posInL(strat->B,strat->Bl,&h,strat);
1384  h.sev = pGetShortExpVector(h.p);
1385  if (currRing!=strat->tailRing)
1386  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1387  #if ADIDEBUG
1388  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);
1389  #endif
1390  enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
1391  kTest_TS(strat);
1392 }
#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:964
#define pSetm(p)
Definition: polys.h:241
#define pDivComp_LESS
Definition: kutil.cc:133
void PrintLn()
Definition: reporter.cc:322
#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:962
#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:1115
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:1053
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:905
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:243
#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 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:711
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:884
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 10339 of file kutil.cc.

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

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

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

2338 {
2339  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
2340  if(pHasNotCF(p,strat->S[i]))
2341  {
2342  //PrintS("prod-crit\n");
2343  if(ALLOW_PROD_CRIT(strat))
2344  {
2345  //PrintS("prod-crit\n");
2346  strat->cp++;
2347  return;
2348  }
2349  }
2350 
2351  int l,j,compare;
2352  LObject Lp;
2353  Lp.i_r = -1;
2354 
2355  Lp.lcm = pInit();
2356  pLcm(p,strat->S[i],Lp.lcm);
2357  pSetm(Lp.lcm);
2358  /*- compute the short s-polynomial -*/
2359 
2360  #ifdef HAVE_PLURAL
2361  if (rIsPluralRing(currRing))
2362  {
2363  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
2364  }
2365  else
2366  #endif
2367  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
2368 
2369  if (Lp.p == NULL)
2370  {
2371  //PrintS("short spoly==NULL\n");
2372  pLmFree(Lp.lcm);
2373  }
2374  else
2375  {
2376  /*- the pair (S[i],p) enters L -*/
2377  Lp.p1 = strat->S[i];
2378  Lp.p2 = p;
2379  if (atR >= 0)
2380  {
2381  Lp.i_r1 = strat->S_2_R[i];
2382  Lp.i_r2 = atR;
2383  }
2384  else
2385  {
2386  Lp.i_r1 = -1;
2387  Lp.i_r2 = -1;
2388  }
2389  assume(pNext(Lp.p) == NULL);
2390  pNext(Lp.p) = strat->tail;
2391  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2393  {
2394  nDelete(&(Lp.p->coef));
2395  }
2396  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
2397  //Print("-> L[%d]\n",l);
2398  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
2399  }
2400 }
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:1115
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h: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 1399 of file kutil.cc.

1400 {
1401  number d, s, t;
1402  assume(atR >= 0);
1403  poly m1, m2, gcd,si;
1404  if(!enterTstrong)
1405  {
1406  assume(i<=strat->sl);
1407  si = strat->S[i];
1408  }
1409  else
1410  {
1411  assume(i<=strat->tl);
1412  si = strat->T[i].p;
1413  }
1414  //printf("\n--------------------------------\n");
1415  //pWrite(p);pWrite(si);
1416  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1417 
1418  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1419  {
1420  nDelete(&d);
1421  nDelete(&s);
1422  nDelete(&t);
1423  return FALSE;
1424  }
1425 
1426  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1427  //p_Test(m1,strat->tailRing);
1428  //p_Test(m2,strat->tailRing);
1429  /*if(!enterTstrong)
1430  {
1431  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1432  {
1433  memset(&(strat->P), 0, sizeof(strat->P));
1434  kStratChangeTailRing(strat);
1435  strat->P = *(strat->R[atR]);
1436  p_LmFree(m1, strat->tailRing);
1437  p_LmFree(m2, strat->tailRing);
1438  p_LmFree(gcd, currRing);
1439  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1440  }
1441  }*/
1442  pSetCoeff0(m1, s);
1443  pSetCoeff0(m2, t);
1444  pSetCoeff0(gcd, d);
1445  p_Test(m1,strat->tailRing);
1446  p_Test(m2,strat->tailRing);
1447  //printf("\n===================================\n");
1448  //pWrite(m1);pWrite(m2);pWrite(gcd);
1449 #ifdef KDEBUG
1450  if (TEST_OPT_DEBUG)
1451  {
1452  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1453  PrintS("m1 = ");
1454  p_wrp(m1, strat->tailRing);
1455  PrintS(" ; m2 = ");
1456  p_wrp(m2, strat->tailRing);
1457  PrintS(" ; gcd = ");
1458  wrp(gcd);
1459  PrintS("\n--- create strong gcd poly: ");
1460  Print("\n p: %d", i);
1461  wrp(p);
1462  Print("\n strat->S[%d]: ", i);
1463  wrp(si);
1464  PrintS(" ---> ");
1465  }
1466 #endif
1467 
1468  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1469  p_LmDelete(m1, strat->tailRing);
1470  p_LmDelete(m2, strat->tailRing);
1471 #ifdef KDEBUG
1472  if (TEST_OPT_DEBUG)
1473  {
1474  wrp(gcd);
1475  PrintLn();
1476  }
1477 #endif
1478 
1479  LObject h;
1480  h.p = gcd;
1481  h.tailRing = strat->tailRing;
1482  int posx;
1483  h.pCleardenom();
1484  strat->initEcart(&h);
1485  h.sev = pGetShortExpVector(h.p);
1486  h.i_r1 = -1;h.i_r2 = -1;
1487  if (currRing!=strat->tailRing)
1488  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1489  if(!enterTstrong)
1490  {
1491  #if 1
1492  h.p1 = p;h.p2 = strat->S[i];
1493  #endif
1494  if (atR >= 0)
1495  {
1496  h.i_r2 = strat->S_2_R[i];
1497  h.i_r1 = atR;
1498  }
1499  else
1500  {
1501  h.i_r1 = -1;
1502  h.i_r2 = -1;
1503  }
1504  if (strat->Ll==-1)
1505  posx =0;
1506  else
1507  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1508  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1509  }
1510  else
1511  {
1512  if(h.IsNull()) return FALSE;
1513  //int red_result;
1514  //reduzieren ist teur!!!
1515  //if(strat->L != NULL)
1516  //red_result = strat->red(&h,strat);
1517  if(!h.IsNull())
1518  {
1519  enterT(h, strat,-1);
1520  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1521  //strat->enterS(h,pos,strat,-1);
1522  }
1523  }
1524  //#if 1
1525  #if ADIDEBUG
1526  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1527  #endif
1528  return TRUE;
1529 }
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:322
#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:962
#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:1115
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:7811
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:905
#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:692
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:1007
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc: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:884
static Poly * h
Definition: janet.cc:978
void enterOneZeroPairRing ( poly  f,
poly  t_p,
poly  p,
int  ecart,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3374 of file kutil.cc.

3375 {
3376  int l,j,compare,compareCoeff;
3377  LObject Lp;
3378 
3379 #ifdef KDEBUG
3380  Lp.ecart=0; Lp.length=0;
3381 #endif
3382  /*- computes the lcm(s[i],p) -*/
3383  Lp.lcm = pInit();
3384 
3385  pLcm(p,f,Lp.lcm);
3386  pSetm(Lp.lcm);
3387  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
3388  assume(!strat->sugarCrit);
3389  assume(!strat->fromT);
3390  /*
3391  *the set B collects the pairs of type (S[j],p)
3392  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
3393  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
3394  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
3395  */
3396  for(j = strat->Bl;j>=0;j--)
3397  {
3398  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
3399  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
3400  if (compareCoeff == 0 || compare == compareCoeff)
3401  {
3402  if (compare == 1)
3403  {
3404  strat->c3++;
3405  pLmDelete(Lp.lcm);
3406  return;
3407  }
3408  else
3409  if (compare == -1)
3410  {
3411  deleteInL(strat->B,&strat->Bl,j,strat);
3412  strat->c3++;
3413  }
3414  }
3415  if (compare == pDivComp_EQUAL)
3416  {
3417  // Add hint for same LM and direction of LC (later) (TODO Oliver)
3418  if (compareCoeff == 1)
3419  {
3420  strat->c3++;
3421  pLmDelete(Lp.lcm);
3422  return;
3423  }
3424  else
3425  if (compareCoeff == -1)
3426  {
3427  deleteInL(strat->B,&strat->Bl,j,strat);
3428  strat->c3++;
3429  }
3430  }
3431  }
3432  /*
3433  *the pair (S[i],p) enters B if the spoly != 0
3434  */
3435  /*- compute the short s-polynomial -*/
3436  if ((f==NULL) || (p==NULL)) return;
3437  pNorm(p);
3438  {
3439  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
3440  }
3441  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
3442  {
3443  /*- the case that the s-poly is 0 -*/
3444 // if (strat->pairtest==NULL) initPairtest(strat);
3445 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
3446 // strat->pairtest[strat->sl+1] = TRUE;
3447  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
3448  /*
3449  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
3450  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
3451  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
3452  *term of p devides the lcm(s,r)
3453  *(this canceling should be done here because
3454  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
3455  *the first case is handeled in chainCrit
3456  */
3457  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
3458  }
3459  else
3460  {
3461  /*- the pair (S[i],p) enters B -*/
3462  Lp.p1 = f;
3463  Lp.p2 = p;
3464 
3465  pNext(Lp.p) = strat->tail;
3466 
3467  LObject tmp_h(f, currRing, strat->tailRing);
3468  tmp_h.SetShortExpVector();
3469  strat->initEcart(&tmp_h);
3470  tmp_h.sev = pGetShortExpVector(tmp_h.p);
3471  tmp_h.t_p = t_p;
3472 
3473  enterT(tmp_h, strat, strat->tl + 1);
3474 
3475  if (atR >= 0)
3476  {
3477  Lp.i_r2 = atR;
3478  Lp.i_r1 = strat->tl;
3479  }
3480 
3481  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
3482  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
3483  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
3484  }
3485 }
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:1115
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:7811
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1053
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 3988 of file kutil.cc.

3989 {
3990  int j=pos;
3991 
3992 #ifdef HAVE_RINGS
3994 #endif
3995  //#if ADIDEBUG
3996  #if 0
3997  Print("\n Vor initenterpairs: The new pair list L -- after superenterpairs in loop\n");
3998  for(int iii=0;iii<=strat->Ll;iii++)
3999  {
4000  printf("\n L[%d]:\n",iii);
4001  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
4002  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
4003  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
4004  }
4005  #endif
4006 
4007  initenterpairs(h,k,ecart,0,strat, atR);
4008 
4009  //#if ADIDEBUG
4010  #if 0
4011  Print("\n Nach initenterpairs: The new pair list L -- after superenterpairs in loop \n");
4012  for(int iii=0;iii<=strat->Ll;iii++)
4013  {
4014  printf("\n L[%d]:\n",iii);
4015  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
4016  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
4017  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
4018  }
4019  #endif
4020 
4021  if ( (!strat->fromT)
4022  && ((strat->syzComp==0)
4023  ||(pGetComp(h)<=strat->syzComp)))
4024  {
4025  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4026  unsigned long h_sev = pGetShortExpVector(h);
4027  loop
4028  {
4029  if (j > k) break;
4030  clearS(h,h_sev, &j,&k,strat);
4031  j++;
4032  }
4033  //Print("end clearS sl=%d\n",strat->sl);
4034  }
4035  // PrintS("end enterpairs\n");
4036 }
#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:3032
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:437
ring tailRing
Definition: kutil.h:341
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
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 10696 of file kutil.cc.

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

Definition at line 4044 of file kutil.cc.

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

Definition at line 4074 of file kutil.cc.

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

Definition at line 7577 of file kutil.cc.

7578 {
7579  strat->news = TRUE;
7580  /*- puts p to the standardbasis s at position at -*/
7581  if (strat->sl == IDELEMS(strat->Shdl)-1)
7582  {
7583  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7584  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7585  (IDELEMS(strat->Shdl)+setmaxTinc)
7586  *sizeof(unsigned long));
7587  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7588  IDELEMS(strat->Shdl)*sizeof(int),
7589  (IDELEMS(strat->Shdl)+setmaxTinc)
7590  *sizeof(int));
7591  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7592  IDELEMS(strat->Shdl)*sizeof(int),
7593  (IDELEMS(strat->Shdl)+setmaxTinc)
7594  *sizeof(int));
7595  if (strat->lenS!=NULL)
7596  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7597  IDELEMS(strat->Shdl)*sizeof(int),
7598  (IDELEMS(strat->Shdl)+setmaxTinc)
7599  *sizeof(int));
7600  if (strat->lenSw!=NULL)
7601  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7602  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7603  (IDELEMS(strat->Shdl)+setmaxTinc)
7604  *sizeof(wlen_type));
7605  if (strat->fromQ!=NULL)
7606  {
7607  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7608  IDELEMS(strat->Shdl)*sizeof(int),
7609  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7610  }
7611  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7612  IDELEMS(strat->Shdl)+=setmaxTinc;
7613  strat->Shdl->m=strat->S;
7614  }
7615  if (atS <= strat->sl)
7616  {
7617 #ifdef ENTER_USE_MEMMOVE
7618 // #if 0
7619  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7620  (strat->sl - atS + 1)*sizeof(poly));
7621  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7622  (strat->sl - atS + 1)*sizeof(int));
7623  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7624  (strat->sl - atS + 1)*sizeof(unsigned long));
7625  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7626  (strat->sl - atS + 1)*sizeof(int));
7627  if (strat->lenS!=NULL)
7628  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7629  (strat->sl - atS + 1)*sizeof(int));
7630  if (strat->lenSw!=NULL)
7631  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7632  (strat->sl - atS + 1)*sizeof(wlen_type));
7633 #else
7634  for (i=strat->sl+1; i>=atS+1; i--)
7635  {
7636  strat->S[i] = strat->S[i-1];
7637  strat->ecartS[i] = strat->ecartS[i-1];
7638  strat->sevS[i] = strat->sevS[i-1];
7639  strat->S_2_R[i] = strat->S_2_R[i-1];
7640  }
7641  if (strat->lenS!=NULL)
7642  for (i=strat->sl+1; i>=atS+1; i--)
7643  strat->lenS[i] = strat->lenS[i-1];
7644  if (strat->lenSw!=NULL)
7645  for (i=strat->sl+1; i>=atS+1; i--)
7646  strat->lenSw[i] = strat->lenSw[i-1];
7647 #endif
7648  }
7649  if (strat->fromQ!=NULL)
7650  {
7651 #ifdef ENTER_USE_MEMMOVE
7652  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7653  (strat->sl - atS + 1)*sizeof(int));
7654 #else
7655  for (i=strat->sl+1; i>=atS+1; i--)
7656  {
7657  strat->fromQ[i] = strat->fromQ[i-1];
7658  }
7659 #endif
7660  strat->fromQ[atS]=0;
7661  }
7662 
7663  /*- save result -*/
7664  strat->S[atS] = p.p;
7665  if (strat->honey) strat->ecartS[atS] = p.ecart;
7666  if (p.sev == 0)
7667  p.sev = pGetShortExpVector(p.p);
7668  else
7669  assume(p.sev == pGetShortExpVector(p.p));
7670  strat->sevS[atS] = p.sev;
7671  strat->ecartS[atS] = p.ecart;
7672  strat->S_2_R[atS] = atR;
7673  strat->sl++;
7674 }
#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:3540
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 1324 of file kstd1.cc.

1325 {
1326  enterSBba(p, atS, strat, atR);
1327  #ifdef KDEBUG
1328  if (TEST_OPT_DEBUG)
1329  {
1330  Print("new s%d:",atS);
1331  p_wrp(p.p,currRing,strat->tailRing);
1332  PrintLn();
1333  }
1334  #endif
1335  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1336  if (strat->kHEdgeFound)
1337  {
1338  if (newHEdge(strat))
1339  {
1340  firstUpdate(strat);
1341  if (TEST_OPT_FINDET)
1342  return;
1343 
1344  /*- cuts elements in L above noether and reorders L -*/
1345  updateLHC(strat);
1346  /*- reorders L with respect to posInL -*/
1347  reorderL(strat);
1348  }
1349  }
1350  else if (strat->kNoether!=NULL)
1351  strat->kHEdgeFound = TRUE;
1352  else if (TEST_OPT_FASTHC)
1353  {
1354  if (strat->posInLOldFlag)
1355  {
1356  missingAxis(&strat->lastAxis,strat);
1357  if (strat->lastAxis)
1358  {
1359  strat->posInLOld = strat->posInL;
1360  strat->posInLOldFlag = FALSE;
1361  strat->posInL = posInL10;
1362  strat->posInLDependsOnLength = TRUE;
1363  updateL(strat);
1364  reorderL(strat);
1365  }
1366  }
1367  else if (strat->lastAxis)
1368  updateL(strat);
1369  }
1370 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h: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:1247
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:8924
#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:7577
void enterSMoraNF ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1378 of file kstd1.cc.

1379 {
1380  enterSBba(p, atS, strat, atR);
1381  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1382  if (strat->kHEdgeFound)
1383  newHEdge(strat);
1384  else if (strat->kNoether!=NULL)
1385  strat->kHEdgeFound = TRUE;
1386 }
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:8924
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
void enterSSba ( LObject p,
int  atS,
kStrategy  strat,
int  atR 
)

Definition at line 7680 of file kutil.cc.

7681 {
7682  strat->news = TRUE;
7683  /*- puts p to the standardbasis s at position at -*/
7684  if (strat->sl == IDELEMS(strat->Shdl)-1)
7685  {
7686  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7687  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7688  (IDELEMS(strat->Shdl)+setmaxTinc)
7689  *sizeof(unsigned long));
7690  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
7691  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7692  (IDELEMS(strat->Shdl)+setmaxTinc)
7693  *sizeof(unsigned long));
7694  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7695  IDELEMS(strat->Shdl)*sizeof(int),
7696  (IDELEMS(strat->Shdl)+setmaxTinc)
7697  *sizeof(int));
7698  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7699  IDELEMS(strat->Shdl)*sizeof(int),
7700  (IDELEMS(strat->Shdl)+setmaxTinc)
7701  *sizeof(int));
7702  if (strat->lenS!=NULL)
7703  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7704  IDELEMS(strat->Shdl)*sizeof(int),
7705  (IDELEMS(strat->Shdl)+setmaxTinc)
7706  *sizeof(int));
7707  if (strat->lenSw!=NULL)
7708  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7709  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7710  (IDELEMS(strat->Shdl)+setmaxTinc)
7711  *sizeof(wlen_type));
7712  if (strat->fromQ!=NULL)
7713  {
7714  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7715  IDELEMS(strat->Shdl)*sizeof(int),
7716  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7717  }
7718  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7719  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
7720  IDELEMS(strat->Shdl)+=setmaxTinc;
7721  strat->Shdl->m=strat->S;
7722  }
7723  // in a signature-based algorithm the following situation will never
7724  // appear due to the fact that the critical pairs are already sorted
7725  // by increasing signature.
7726  if (atS <= strat->sl)
7727  {
7728 #ifdef ENTER_USE_MEMMOVE
7729 // #if 0
7730  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7731  (strat->sl - atS + 1)*sizeof(poly));
7732  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7733  (strat->sl - atS + 1)*sizeof(int));
7734  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7735  (strat->sl - atS + 1)*sizeof(unsigned long));
7736  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7737  (strat->sl - atS + 1)*sizeof(int));
7738  if (strat->lenS!=NULL)
7739  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7740  (strat->sl - atS + 1)*sizeof(int));
7741  if (strat->lenSw!=NULL)
7742  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7743  (strat->sl - atS + 1)*sizeof(wlen_type));
7744 #else
7745  for (i=strat->sl+1; i>=atS+1; i--)
7746  {
7747  strat->S[i] = strat->S[i-1];
7748  strat->ecartS[i] = strat->ecartS[i-1];
7749  strat->sevS[i] = strat->sevS[i-1];
7750  strat->S_2_R[i] = strat->S_2_R[i-1];
7751  }
7752  if (strat->lenS!=NULL)
7753  for (i=strat->sl+1; i>=atS+1; i--)
7754  strat->lenS[i] = strat->lenS[i-1];
7755  if (strat->lenSw!=NULL)
7756  for (i=strat->sl+1; i>=atS+1; i--)
7757  strat->lenSw[i] = strat->lenSw[i-1];
7758 #endif
7759  }
7760  if (strat->fromQ!=NULL)
7761  {
7762 #ifdef ENTER_USE_MEMMOVE
7763  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7764  (strat->sl - atS + 1)*sizeof(int));
7765 #else
7766  for (i=strat->sl+1; i>=atS+1; i--)
7767  {
7768  strat->fromQ[i] = strat->fromQ[i-1];
7769  }
7770 #endif
7771  strat->fromQ[atS]=0;
7772  }
7773 
7774  /*- save result -*/
7775  strat->S[atS] = p.p;
7776  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
7777  if (strat->honey) strat->ecartS[atS] = p.ecart;
7778  if (p.sev == 0)
7779  p.sev = pGetShortExpVector(p.p);
7780  else
7781  assume(p.sev == pGetShortExpVector(p.p));
7782  strat->sevS[atS] = p.sev;
7783  // during the interreduction process of a signature-based algorithm we do not
7784  // compute the signature at this point, but when the whole interreduction
7785  // process finishes, i.e. f5c terminates!
7786  if (p.sig != NULL)
7787  {
7788  if (p.sevSig == 0)
7789  p.sevSig = pGetShortExpVector(p.sig);
7790  else
7791  assume(p.sevSig == pGetShortExpVector(p.sig));
7792  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
7793  }
7794  strat->ecartS[atS] = p.ecart;
7795  strat->S_2_R[atS] = atR;
7796  strat->sl++;
7797 #ifdef DEBUGF5
7798  int k;
7799  Print("--- LIST S: %d ---\n",strat->sl);
7800  for(k=0;k<=strat->sl;k++)
7801  {
7802  pWrite(strat->sig[k]);
7803  }
7804  Print("--- LIST S END ---\n");
7805 #endif
7806 }
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:3540
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 8007 of file kutil.cc.

8008 {
8009  int i;
8010  strat->newt = TRUE;
8011  if (strat->syzl == strat->syzmax-1)
8012  {
8013  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
8014  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
8015  (strat->syzmax)*sizeof(unsigned long),
8016  ((strat->syzmax)+setmaxTinc)
8017  *sizeof(unsigned long));
8018  strat->syzmax += setmaxTinc;
8019  }
8020  if (atT < strat->syzl)
8021  {
8022 #ifdef ENTER_USE_MEMMOVE
8023  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
8024  (strat->syzl-atT+1)*sizeof(poly));
8025  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
8026  (strat->syzl-atT+1)*sizeof(unsigned long));
8027 #endif
8028  for (i=strat->syzl; i>=atT+1; i--)
8029  {
8030 #ifndef ENTER_USE_MEMMOVE
8031  strat->syz[i] = strat->syz[i-1];
8032  strat->sevSyz[i] = strat->sevSyz[i-1];
8033 #endif
8034  }
8035  }
8036  //i = strat->syzl;
8037  i = atT;
8038  strat->syz[atT] = p.sig;
8039  strat->sevSyz[atT] = p.sevSig;
8040  strat->syzl++;
8041 #if F5DEBUG
8042  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
8043  pWrite(strat->syz[atT]);
8044 #endif
8045  // recheck pairs in strat->L with new rule and delete correspondingly
8046  int cc = strat->Ll;
8047  while (cc>-1)
8048  {
8049  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
8050  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing))
8051  {
8052  deleteInL(strat->L,&strat->Ll,cc,strat);
8053  }
8054  cc--;
8055  }
8056 //#if 1
8057 #ifdef DEBUGF5
8058  PrintS("--- Syzygies ---\n");
8059  Print("syzl %d\n",strat->syzl);
8060  Print("syzmax %d\n",strat->syzmax);
8061  PrintS("--------------------------------\n");
8062  for(i=0;i<=strat->syzl-1;i++)
8063  {
8064  Print("%d - ",i);
8065  pWrite(strat->syz[i]);
8066  }
8067  PrintS("--------------------------------\n");
8068 #endif
8069 }
#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:1053
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:1710
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:3540
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 7811 of file kutil.cc.

7812 {
7813  int i;
7814 
7815  pp_Test(p.p, currRing, p.tailRing);
7816  assume(strat->tailRing == p.tailRing);
7817  // redMoraNF complains about this -- but, we don't really
7818  // neeed this so far
7819  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7820  assume(p.FDeg == p.pFDeg());
7821  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7822 
7823 #ifdef KDEBUG
7824  // do not put an LObject twice into T:
7825  for(i=strat->tl;i>=0;i--)
7826  {
7827  if (p.p==strat->T[i].p)
7828  {
7829  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7830  return;
7831  }
7832  }
7833 #endif
7834 
7835 #ifdef HAVE_TAIL_RING
7836  if (currRing!=strat->tailRing)
7837  {
7838  p.t_p=p.GetLmTailRing();
7839  }
7840 #endif
7841  strat->newt = TRUE;
7842  if (atT < 0)
7843  atT = strat->posInT(strat->T, strat->tl, p);
7844  if (strat->tl == strat->tmax-1)
7845  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7846  if (atT <= strat->tl)
7847  {
7848 #ifdef ENTER_USE_MEMMOVE
7849  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7850  (strat->tl-atT+1)*sizeof(TObject));
7851  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7852  (strat->tl-atT+1)*sizeof(unsigned long));
7853 #endif
7854  for (i=strat->tl+1; i>=atT+1; i--)
7855  {
7856 #ifndef ENTER_USE_MEMMOVE
7857  strat->T[i] = strat->T[i-1];
7858  strat->sevT[i] = strat->sevT[i-1];
7859 #endif
7860  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7861  }
7862  }
7863 
7864  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7865  {
7867  (strat->tailRing != NULL ?
7868  strat->tailRing : currRing),
7869  strat->tailBin);
7870  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7871  }
7872  strat->T[atT] = (TObject) p;
7873  #if ADIDEBUG
7874  printf("\nenterT: add in position %i\n",atT);
7875  pWrite(p.p);
7876  #endif
7877  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
7878 
7879  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7880  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7881  else
7882  strat->T[atT].max = NULL;
7883 
7884  strat->tl++;
7885  strat->R[strat->tl] = &(strat->T[atT]);
7886  strat->T[atT].i_r = strat->tl;
7887  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7888  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7889  kTest_T(&(strat->T[atT]));
7890 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
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:876
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 7895 of file kutil.cc.

7896 {
7897  int i;
7898 
7899  pp_Test(p.p, currRing, p.tailRing);
7900  assume(strat->tailRing == p.tailRing);
7901  // redMoraNF complains about this -- but, we don't really
7902  // neeed this so far
7903  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7904  assume(p.FDeg == p.pFDeg());
7905  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7906 
7907 #ifdef KDEBUG
7908  // do not put an LObject twice into T:
7909  for(i=strat->tl;i>=0;i--)
7910  {
7911  if (p.p==strat->T[i].p)
7912  {
7913  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7914  return;
7915  }
7916  }
7917 #endif
7918 
7919 #ifdef HAVE_TAIL_RING
7920  if (currRing!=strat->tailRing)
7921  {
7922  p.t_p=p.GetLmTailRing();
7923  }
7924 #endif
7925  strat->newt = TRUE;
7926  if (atT < 0)
7927  atT = strat->posInT(strat->T, strat->tl, p);
7928  if (strat->tl == strat->tmax-1)
7929  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7930  if (atT <= strat->tl)
7931  {
7932 #ifdef ENTER_USE_MEMMOVE
7933  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7934  (strat->tl-atT+1)*sizeof(TObject));
7935  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7936  (strat->tl-atT+1)*sizeof(unsigned long));
7937 #endif
7938  for (i=strat->tl+1; i>=atT+1; i--)
7939  {
7940 #ifndef ENTER_USE_MEMMOVE
7941  strat->T[i] = strat->T[i-1];
7942  strat->sevT[i] = strat->sevT[i-1];
7943 #endif
7944  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7945  }
7946  }
7947 
7948  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7949  {
7951  (strat->tailRing != NULL ?
7952  strat->tailRing : currRing),
7953  strat->tailBin);
7954  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7955  }
7956  strat->T[atT] = (TObject) p;
7957  #if ADIDEBUG
7958  printf("\nenterT_strong: add in position %i\n",atT);
7959  pWrite(p.p);
7960  #endif
7961  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
7962 
7963  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7964  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7965  else
7966  strat->T[atT].max = NULL;
7967 
7968  strat->tl++;
7969  strat->R[strat->tl] = &(strat->T[atT]);
7970  strat->T[atT].i_r = strat->tl;
7971  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7972  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7973  #if 1
7974  #ifdef HAVE_RINGS
7976  {
7977  #if ADIDEBUG
7978  printf("\nDas ist p:\n");pWrite(p.p);
7979  #endif
7980  for(i=strat->tl;i>=0;i--)
7981  {
7982  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
7983  {
7984  #if ADIDEBUG
7985  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
7986  #endif
7987  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
7988  }
7989  }
7990  }
7991  /*
7992  printf("\nThis is T:\n");
7993  for(i=strat->tl;i>=0;i--)
7994  {
7995  pWrite(strat->T[i].p);
7996  }
7997  //getchar();*/
7998  #endif
7999  #endif
8000  kTest_T(&(strat->T[atT]));
8001 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:714
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:876
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:437
#define NULL
Definition: omList.c:10
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1399
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 10803 of file kutil.cc.

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

8420 {
8421  /*- release temp data -*/
8422  cleanT(strat);
8423  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8424  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8425  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8426  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8427  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8428  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8429  /*- set L: should be empty -*/
8430  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8431  /*- set B: should be empty -*/
8432  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8433  pLmDelete(&strat->tail);
8434  strat->syzComp=0;
8435 }
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 8614 of file kutil.cc.

8615 {
8616  /*- release temp data -*/
8617  cleanT(strat);
8618  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8619  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8620  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8621  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8622  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8623  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8624  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
8625  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8626  if (strat->sbaOrder == 1)
8627  {
8628  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8629  }
8630  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8631  /*- set L: should be empty -*/
8632  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8633  /*- set B: should be empty -*/
8634  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8635  /*- set sig: no need for the signatures anymore -*/
8636  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
8637  pLmDelete(&strat->tail);
8638  strat->syzComp=0;
8639 }
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 5750 of file kutil.cc.

5751 {
5752  //printf("Faugere Rewritten Criterion\n");
5753 //#if 1
5754 #ifdef DEBUGF5
5755  PrintS("rewritten criterion checks: ");
5756  pWrite(sig);
5757 #endif
5758  for(int k = strat->sl; k>=start; k--)
5759  {
5760 //#if 1
5761 #ifdef DEBUGF5
5762  Print("checking with: ");
5763  pWrite(strat->sig[k]);
5764  pWrite(pHead(strat->S[k]));
5765 #endif
5766  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
5767  {
5768 //#if 1
5769 #ifdef DEBUGF5
5770  PrintS("DELETE!\n");
5771 #endif
5772  return TRUE;
5773  }
5774  //k--;
5775  }
5776 #ifdef DEBUGF5
5777  Print("ALL ELEMENTS OF S\n----------------------------------------\n");
5778  for(int kk = 0; kk<strat->sl+1; kk++)
5779  {
5780  pWrite(pHead(strat->S[kk]));
5781  }
5782  Print("------------------------------\n");
5783 #endif
5784  return FALSE;
5785 }
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:1710
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 9294 of file kutil.cc.

9295 {
9296  if(!nCoeff_is_Ring_Z(currRing->cf))
9297  return;
9298  poly p,pp;
9299  for(int j = 0; j<=strat->sl; j++)
9300  {
9301  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
9302  {
9303  for(int i = 0; i<=strat->sl; i++)
9304  {
9305  if((i != j) && (strat->S[i] != NULL))
9306  {
9307  p = strat->S[i];
9308  if(pLmDivisibleBy(strat->S[j], p))
9309  {
9310  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
9311  p_SetCoeff(p,dummy,currRing);
9312  }
9313  pp = pNext(p);
9314  if((pp == NULL) && (nIsZero(p->coef)))
9315  {
9316  deleteInS(i, strat);
9317  }
9318  else
9319  {
9320  while(pp != NULL)
9321  {
9322  if(pLmDivisibleBy(strat->S[j], pp))
9323  {
9324  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
9325  p_SetCoeff(pp,dummy,currRing);
9326  if(nIsZero(pp->coef))
9327  {
9328  pLmDelete(&pNext(p));
9329  pp = pNext(p);
9330  }
9331  else
9332  {
9333  p = pp;
9334  pp = pNext(p);
9335  }
9336  }
9337  else
9338  {
9339  p = pp;
9340  pp = pNext(p);
9341  }
9342  }
9343  }
9344  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
9345  {
9346  if(pNext(strat->S[i]) == NULL)
9347  strat->S[i]=NULL;
9348  else
9349  strat->S[i]=pNext(strat->S[i]);
9350  }
9351  }
9352  }
9353  //idPrint(strat->Shdl);
9354  }
9355  }
9356  //idSkipZeroes(strat->Shdl);
9357 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#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:946
#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:401
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 5326 of file kutil.cc.

5327 {
5328  if (coeff == 0) return -1;
5329  long tmp = coeff;
5330  int ind = 0;
5331  while (tmp % 2 == 0)
5332  {
5333  tmp = tmp / 2;
5334  ind++;
5335  }
5336  return ind;
5337 }
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:754
BOOLEAN kHEdgeFound
Definition: kutil.h:366
long ind2 ( long  arg)

Definition at line 3339 of file kutil.cc.

3340 {
3341  long ind = 0;
3342  if (arg <= 0) return 0;
3343  while (arg%2 == 0)
3344  {
3345  arg = arg / 2;
3346  ind++;
3347  }
3348  return ind;
3349 }
long ind_fact_2 ( long  arg)

Definition at line 3351 of file kutil.cc.

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

Definition at line 8338 of file kutil.cc.

8339 {
8340  strat->interpt = BTEST1(OPT_INTERRUPT);
8341  strat->kHEdge=NULL;
8343  /*- creating temp data structures------------------- -*/
8344  strat->cp = 0;
8345  strat->c3 = 0;
8346  strat->tail = pInit();
8347  /*- set s -*/
8348  strat->sl = -1;
8349  /*- set L -*/
8350  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8351  strat->Ll = -1;
8352  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8353  /*- set B -*/
8354  strat->Bmax = setmaxL;
8355  strat->Bl = -1;
8356  strat->B = initL();
8357  /*- set T -*/
8358  strat->tl = -1;
8359  strat->tmax = setmaxT;
8360  strat->T = initT();
8361  strat->R = initR();
8362  strat->sevT = initsevT();
8363  /*- init local data struct.---------------------------------------- -*/
8364  strat->P.ecart=0;
8365  strat->P.length=0;
8366  strat->P.pLength=0;
8368  {
8369  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8370  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8371  }
8372  #ifdef HAVE_RINGS
8374  {
8375  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8376  }
8377  else
8378  #endif
8379  {
8380  if(TEST_OPT_SB_1)
8381  {
8382  int i;
8383  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8384  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8385  {
8386  P->m[i-strat->newIdeal] = F->m[i];
8387  F->m[i] = NULL;
8388  }
8389  initSSpecial(F,Q,P,strat);
8390  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8391  {
8392  F->m[i] = P->m[i-strat->newIdeal];
8393  P->m[i-strat->newIdeal] = NULL;
8394  }
8395  idDelete(&P);
8396  }
8397 
8398  else
8399  {
8400  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8401  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8402  }
8403  }
8404  strat->fromT = FALSE;
8406  if ((!TEST_OPT_SB_1)
8407  #ifdef HAVE_RINGS
8408  || (rField_is_Ring(currRing))
8409  #endif
8410  )
8411  {
8412  updateS(TRUE,strat);
8413  }
8414  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8415  strat->fromQ=NULL;
8416  assume(kTest_TS(strat));
8417 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
#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
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:6486
#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:6886
#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:437
#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:752
#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:7345
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 idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void initBuchMoraCrit ( kStrategy  strat)

Definition at line 8092 of file kutil.cc.

8093 {
8095  strat->chainCrit=chainCritNormal;
8096  if (TEST_OPT_SB_1)
8097  strat->chainCrit=chainCritOpt_1;
8098 #ifdef HAVE_RINGS
8099  if (rField_is_Ring(currRing))
8100  {
8102  strat->chainCrit=chainCritRing;
8103  }
8104 #endif
8105 #ifdef HAVE_RATGRING
8106  if (rIsRatGRing(currRing))
8107  {
8108  strat->chainCrit=chainCritPart;
8109  /* enterOnePairNormal get rational part in it */
8110  }
8111 #endif
8112  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
8113  && (!rIsPluralRing(currRing)))
8115 
8116 
8117  strat->sugarCrit = TEST_OPT_SUGARCRIT;
8118  strat->Gebauer = strat->homog || strat->sugarCrit;
8119  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
8120  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
8121  strat->pairtest = NULL;
8122  /* alway use tailreduction, except:
8123  * - in local rings, - in lex order case, -in ring over extensions */
8125  //if(rHasMixedOrdering(currRing)==2)
8126  //{
8127  // strat->noTailReduction =TRUE;
8128  //}
8129 
8130 #ifdef HAVE_PLURAL
8131  // and r is plural_ring
8132  // hence this holds for r a rational_plural_ring
8133  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
8134  { //or it has non-quasi-comm type... later
8135  strat->sugarCrit = FALSE;
8136  strat->Gebauer = FALSE;
8137  strat->honey = FALSE;
8138  }
8139 #endif
8140 
8141 #ifdef HAVE_RINGS
8142  // Coefficient ring?
8143  if (rField_is_Ring(currRing))
8144  {
8145  strat->sugarCrit = FALSE;
8146  strat->Gebauer = FALSE ;
8147  strat->honey = FALSE;
8148  }
8149 #endif
8150  #ifdef KDEBUG
8151  if (TEST_OPT_DEBUG)
8152  {
8153  if (strat->homog) PrintS("ideal/module is homogeneous\n");
8154  else PrintS("ideal/module is not homogeneous\n");
8155  }
8156  #endif
8157 }
#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:2451
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:364
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1536
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:3166
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:368
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:437
#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:1181
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2666
void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1841
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2741
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
void initBuchMoraPos ( kStrategy  strat)

Definition at line 8244 of file kutil.cc.

8245 {
8247  {
8248  if (strat->honey)
8249  {
8250  strat->posInL = posInL15;
8251  // ok -- here is the deal: from my experiments for Singular-2-0
8252  // I conclude that that posInT_EcartpLength is the best of
8253  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8254  // see the table at the end of this file
8255  if (TEST_OPT_OLDSTD)
8256  strat->posInT = posInT15;
8257  else
8258  strat->posInT = posInT_EcartpLength;
8259  }
8260  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8261  {
8262  strat->posInL = posInL11;
8263  strat->posInT = posInT11;
8264  }
8265  else if (TEST_OPT_INTSTRATEGY)
8266  {
8267  strat->posInL = posInL11;
8268  strat->posInT = posInT11;
8269  }
8270  else
8271  {
8272  strat->posInL = posInL0;
8273  strat->posInT = posInT0;
8274  }
8275  //if (strat->minim>0) strat->posInL =posInLSpecial;
8276  if (strat->homog)
8277  {
8278  strat->posInL = posInL110;
8279  strat->posInT = posInT110;
8280  }
8281  }
8282  else
8283  {
8284  if (strat->homog)
8285  {
8286  strat->posInL = posInL11;
8287  strat->posInT = posInT11;
8288  }
8289  else
8290  {
8291  if ((currRing->order[0]==ringorder_c)
8292  ||(currRing->order[0]==ringorder_C))
8293  {
8294  strat->posInL = posInL17_c;
8295  strat->posInT = posInT17_c;
8296  }
8297  else
8298  {
8299  strat->posInL = posInL17;
8300  strat->posInT = posInT17;
8301  }
8302  }
8303  }
8304  if (strat->minim>0) strat->posInL =posInLSpecial;
8305  // for further tests only
8306  if ((BTEST1(11)) || (BTEST1(12)))
8307  strat->posInL = posInL11;
8308  else if ((BTEST1(13)) || (BTEST1(14)))
8309  strat->posInL = posInL13;
8310  else if ((BTEST1(15)) || (BTEST1(16)))
8311  strat->posInL = posInL15;
8312  else if ((BTEST1(17)) || (BTEST1(18)))
8313  strat->posInL = posInL17;
8314  if (BTEST1(11))
8315  strat->posInT = posInT11;
8316  else if (BTEST1(13))
8317  strat->posInT = posInT13;
8318  else if (BTEST1(15))
8319  strat->posInT = posInT15;
8320  else if ((BTEST1(17)))
8321  strat->posInT = posInT17;
8322  else if ((BTEST1(19)))
8323  strat->posInT = posInT19;
8324  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8325  strat->posInT = posInT1;
8326 #ifdef HAVE_RINGS
8327  if (rField_is_Ring(currRing))
8328  {
8329  strat->posInL = posInL11Ring;
8330  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8331  strat->posInL = posInL11Ringls;
8332  strat->posInT = posInT11;
8333  }
8334 #endif
8336 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5085
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:5562
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5231
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4317
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5504
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5469
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:4622
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:5423
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:8232
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:4375
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4744
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:5143
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4909
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5610
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4680
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4508
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4866
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4809
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4583
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4554
void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 10180 of file kutil.cc.

10181 {
10182  strat->interpt = BTEST1(OPT_INTERRUPT);
10183  strat->kHEdge=NULL;
10185  /*- creating temp data structures------------------- -*/
10186  strat->cp = 0;
10187  strat->c3 = 0;
10188  strat->cv = 0;
10189  strat->tail = pInit();
10190  /*- set s -*/
10191  strat->sl = -1;
10192  /*- set L -*/
10193  strat->Lmax = setmaxL;
10194  strat->Ll = -1;
10195  strat->L = initL();
10196  /*- set B -*/
10197  strat->Bmax = setmaxL;
10198  strat->Bl = -1;
10199  strat->B = initL();
10200  /*- set T -*/
10201  strat->tl = -1;
10202  strat->tmax = setmaxT;
10203  strat->T = initT();
10204  strat->R = initR();
10205  strat->sevT = initsevT();
10206  /*- init local data struct.---------------------------------------- -*/
10207  strat->P.ecart=0;
10208  strat->P.length=0;
10210  {
10211  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10212  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10213  }
10214  #ifdef HAVE_RINGS
10216  {
10217  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10218  }
10219  #endif
10220  {
10221  if(TEST_OPT_SB_1)
10222  {
10223  int i;
10224  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10225  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10226  {
10227  P->m[i-strat->newIdeal] = F->m[i];
10228  F->m[i] = NULL;
10229  }
10230  initSSpecial(F,Q,P,strat);
10231  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10232  {
10233  F->m[i] = P->m[i-strat->newIdeal];
10234  P->m[i-strat->newIdeal] = NULL;
10235  }
10236  idDelete(&P);
10237  }
10238  else
10239  {
10240  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10241  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10242  }
10243  }
10244  strat->fromT = FALSE;
10245  if (!TEST_OPT_SB_1)
10246  {
10247  /* the only change: we do not fill the set T*/
10248  #ifdef HAVE_RINGS
10249  if(!rField_is_Ring(currRing))
10250  #endif
10251  updateS(FALSE,strat);
10252  }
10253  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10254  strat->fromQ=NULL;
10255  /* more changes: fill the set T with all the shifts of elts of S*/
10256  /* is done by other procedure */
10257 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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
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:6486
#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:6886
#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:437
#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:752
#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:7345
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 idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
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 1147 of file kutil.cc.

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

Definition at line 1139 of file kutil.cc.

1140 {
1141  h->FDeg = h->pFDeg();
1142  h->ecart = h->pLDeg() - h->FDeg;
1143  // h->length is set by h->pLDeg
1144  h->length=h->pLength=pLength(h->p);
1145 }
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 1154 of file kutil.cc.

1155 {
1156  Lp->FDeg = Lp->pFDeg();
1157  (*Lp).ecart = 0;
1158  (*Lp).length = 0;
1159 }
void initEcartPairMora ( LObject Lp,
poly  ,
poly  ,
int  ecartF,
int  ecartG 
)

Definition at line 1161 of file kutil.cc.

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

Definition at line 3032 of file kutil.cc.

3033 {
3034 
3035  if ((strat->syzComp==0)
3036  || (pGetComp(h)<=strat->syzComp))
3037  {
3038  int j;
3039  BOOLEAN new_pair=FALSE;
3040 
3041  if (pGetComp(h)==0)
3042  {
3043  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3044  if ((isFromQ)&&(strat->fromQ!=NULL))
3045  {
3046  for (j=0; j<=k; j++)
3047  {
3048  if (!strat->fromQ[j])
3049  {
3050  new_pair=TRUE;
3051  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3052  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3053  }
3054  }
3055  }
3056  else
3057  {
3058  new_pair=TRUE;
3059  for (j=0; j<=k; j++)
3060  {
3061  #if ADIDEBUG
3062  PrintS("\n Trying to add spoly : \n");
3063  PrintS(" ");p_Write(h, strat->tailRing);
3064  PrintS(" ");p_Write(strat->S[j],strat->tailRing);
3065  #endif
3066  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3067  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3068  }
3069  }
3070  }
3071  else
3072  {
3073  for (j=0; j<=k; j++)
3074  {
3075  if ((pGetComp(h)==pGetComp(strat->S[j]))
3076  || (pGetComp(strat->S[j])==0))
3077  {
3078  new_pair=TRUE;
3079  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3080  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3081  }
3082  }
3083  }
3084  if (new_pair)
3085  {
3086  #ifdef HAVE_RATGRING
3087  if (currRing->real_var_start>0)
3088  chainCritPart(h,ecart,strat);
3089  else
3090  #endif
3091  strat->chainCrit(h,ecart,strat);
3092  }
3093  kMergeBintoL(strat);
3094  }
3095 }
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:2405
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:2741
void initenterpairsShift ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 10730 of file kutil.cc.

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

Definition at line 3101 of file kutil.cc.

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

Definition at line 3753 of file kutil.cc.

3754 {
3755  const int iCompH = pGetComp(h);
3756  if (!nIsOne(pGetCoeff(h)))
3757  {
3758  int j;
3759 
3760  for (j=0; j<=k; j++)
3761  {
3762  // Print("j:%d, Ll:%d\n",j,strat->Ll);
3763 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
3764 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
3765  if (((iCompH == pGetComp(strat->S[j]))
3766  || (0 == pGetComp(strat->S[j])))
3767  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
3768  {
3769  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
3770  }
3771  }
3772  }
3773 /*
3774 ring r=256,(x,y,z),dp;
3775 ideal I=12xz-133y, 2xy-z;
3776 */
3777 }
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:1399
static Poly * h
Definition: janet.cc:978
void initenterzeropairsRing ( poly  p,
int  ecart,
kStrategy  strat,
int  atR 
)

Definition at line 3621 of file kutil.cc.

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

8073 {
8074 
8075  //if the ordering is local, then hilb criterion
8076  //can be used also if the ideal is not homogenous
8078  #ifdef HAVE_RINGS
8079  {
8081  *hilb=NULL;
8082  else
8083  return;
8084  }
8085 #endif
8086  if (strat->homog!=isHomog)
8087  {
8088  *hilb=NULL;
8089  }
8090 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
#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:754
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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 6383 of file kutil.cc.

6384 {
6385  int i,pos;
6386 
6387  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6388  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6389  strat->ecartS=initec(i);
6390  strat->sevS=initsevS(i);
6391  strat->S_2_R=initS_2_R(i);
6392  strat->fromQ=NULL;
6393  strat->Shdl=idInit(i,F->rank);
6394  strat->S=strat->Shdl->m;
6395  /*- put polys into S -*/
6396  if (Q!=NULL)
6397  {
6398  strat->fromQ=initec(i);
6399  memset(strat->fromQ,0,i*sizeof(int));
6400  for (i=0; i<IDELEMS(Q); i++)
6401  {
6402  if (Q->m[i]!=NULL)
6403  {
6404  LObject h;
6405  h.p = pCopy(Q->m[i]);
6407  {
6408  //pContent(h.p);
6409  h.pCleardenom(); // also does a pContent
6410  }
6411  else
6412  {
6413  h.pNorm();
6414  }
6416  {
6417  deleteHC(&h, strat);
6418  }
6419  if (h.p!=NULL)
6420  {
6421  strat->initEcart(&h);
6422  if (strat->sl==-1)
6423  pos =0;
6424  else
6425  {
6426  pos = posInS(strat,strat->sl,h.p,h.ecart);
6427  }
6428  h.sev = pGetShortExpVector(h.p);
6429  strat->enterS(h,pos,strat,-1);
6430  strat->fromQ[pos]=1;
6431  }
6432  }
6433  }
6434  }
6435  for (i=0; i<IDELEMS(F); i++)
6436  {
6437  if (F->m[i]!=NULL)
6438  {
6439  LObject h;
6440  h.p = pCopy(F->m[i]);
6442  {
6443  /*#ifdef HAVE_RINGS
6444  if (rField_is_Ring(currRing))
6445  {
6446  h.pCleardenom();
6447  }
6448  else
6449  #endif*/
6450  cancelunit(&h); /*- tries to cancel a unit -*/
6451  deleteHC(&h, strat);
6452  }
6453  if (h.p!=NULL)
6454  // do not rely on the input being a SB!
6455  {
6457  {
6458  //pContent(h.p);
6459  h.pCleardenom(); // also does a pContent
6460  }
6461  else
6462  {
6463  h.pNorm();
6464  }
6465  strat->initEcart(&h);
6466  if (strat->sl==-1)
6467  pos =0;
6468  else
6469  pos = posInS(strat,strat->sl,h.p,h.ecart);
6470  h.sev = pGetShortExpVector(h.p);
6471  strat->enterS(h,pos,strat,-1);
6472  }
6473  }
6474  }
6475  /*- test, if a unit is in F -*/
6476  if ((strat->sl>=0)
6477 #ifdef HAVE_RINGS
6478  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
6479 #endif
6480  && pIsConstant(strat->S[0]))
6481  {
6482  while (strat->sl>0) deleteInS(strat->sl,strat);
6483  }
6484 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:946
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:4201
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 8535 of file kutil.cc.

8536 {
8537  strat->interpt = BTEST1(OPT_INTERRUPT);
8538  strat->kHEdge=NULL;
8540  /*- creating temp data structures------------------- -*/
8541  strat->cp = 0;
8542  strat->c3 = 0;
8543  strat->tail = pInit();
8544  /*- set s -*/
8545  strat->sl = -1;
8546  /*- set ps -*/
8547  strat->syzl = -1;
8548  /*- set L -*/
8549  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8550  strat->Ll = -1;
8551  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8552  /*- set B -*/
8553  strat->Bmax = setmaxL;
8554  strat->Bl = -1;
8555  strat->B = initL();
8556  /*- set T -*/
8557  strat->tl = -1;
8558  strat->tmax = setmaxT;
8559  strat->T = initT();
8560  strat->R = initR();
8561  strat->sevT = initsevT();
8562  /*- init local data struct.---------------------------------------- -*/
8563  strat->P.ecart=0;
8564  strat->P.length=0;
8566  {
8567  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8568  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8569  }
8570  #ifdef HAVE_RINGS
8572  {
8573  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8574  }
8575  else
8576  #endif
8577  {
8578  if(TEST_OPT_SB_1)
8579  {
8580  int i;
8581  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8582  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8583  {
8584  P->m[i-strat->newIdeal] = F->m[i];
8585  F->m[i] = NULL;
8586  }
8587  initSSpecialSba(F,Q,P,strat);
8588  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8589  {
8590  F->m[i] = P->m[i-strat->newIdeal];
8591  P->m[i-strat->newIdeal] = NULL;
8592  }
8593  idDelete(&P);
8594  }
8595  else
8596  {
8597  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8598  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8599  }
8600  }
8601  strat->fromT = FALSE;
8602  if (!TEST_OPT_SB_1)
8603  {
8604  #ifdef HAVE_RINGS
8605  if(!rField_is_Ring(currRing))
8606  #endif
8607  updateS(TRUE,strat);
8608  }
8609  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8610  //strat->fromQ=NULL;
8611  assume(kTest_TS(strat));
8612 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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
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:7031
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:6585
#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:437
#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:752
#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:7345
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
int syzl
Definition: kutil.h:347
void initSbaCrit ( kStrategy  strat)

Definition at line 8159 of file kutil.cc.

8160 {
8161  //strat->enterOnePair=enterOnePairNormal;
8163  //strat->chainCrit=chainCritNormal;
8164  strat->chainCrit = chainCritSig;
8165  /******************************************
8166  * rewCrit1 and rewCrit2 are already set in
8167  * kSba() in kstd1.cc
8168  *****************************************/
8169  //strat->rewCrit1 = faugereRewCriterion;
8170  if (strat->sbaOrder == 1)
8171  {
8172  strat->syzCrit = syzCriterionInc;
8173  }
8174  else
8175  {
8176  strat->syzCrit = syzCriterion;
8177  }
8178 #ifdef HAVE_RINGS
8179  if (rField_is_Ring(currRing))
8180  {
8182  strat->chainCrit=chainCritRing;
8183  }
8184 #endif
8185 #ifdef HAVE_RATGRING
8186  if (rIsRatGRing(currRing))
8187  {
8188  strat->chainCrit=chainCritPart;
8189  /* enterOnePairNormal get rational part in it */
8190  }
8191 #endif
8192 
8193  strat->sugarCrit = TEST_OPT_SUGARCRIT;
8194  strat->Gebauer = strat->homog || strat->sugarCrit;
8195  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
8196  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
8197  strat->pairtest = NULL;
8198  /* alway use tailreduction, except:
8199  * - in local rings, - in lex order case, -in ring over extensions */
8202 
8203 #ifdef HAVE_PLURAL
8204  // and r is plural_ring
8205  // hence this holds for r a rational_plural_ring
8206  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
8207  { //or it has non-quasi-comm type... later
8208  strat->sugarCrit = FALSE;
8209  strat->Gebauer = FALSE;
8210  strat->honey = FALSE;
8211  }
8212 #endif
8213 
8214 #ifdef HAVE_RINGS
8215  // Coefficient ring?
8216  if (rField_is_Ring(currRing))
8217  {
8218  strat->sugarCrit = FALSE;
8219  strat->Gebauer = FALSE ;
8220  strat->honey = FALSE;
8221  }
8222 #endif
8223  #ifdef KDEBUG
8224  if (TEST_OPT_DEBUG)
8225  {
8226  if (strat->homog) PrintS("ideal/module is homogeneous\n");
8227  else PrintS("ideal/module is not homogeneous\n");
8228  }
8229  #endif
8230 }
#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
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
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:2682
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1536
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:3166
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:368
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:754
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5676
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5708
#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:437
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1181
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2741
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
void initSbaPos ( kStrategy  strat)

Definition at line 8437 of file kutil.cc.

8438 {
8440  {
8441  if (strat->honey)
8442  {
8443  strat->posInL = posInL15;
8444  // ok -- here is the deal: from my experiments for Singular-2-0
8445  // I conclude that that posInT_EcartpLength is the best of
8446  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8447  // see the table at the end of this file
8448  if (TEST_OPT_OLDSTD)
8449  strat->posInT = posInT15;
8450  else
8451  strat->posInT = posInT_EcartpLength;
8452  }
8453  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8454  {
8455  strat->posInL = posInL11;
8456  strat->posInT = posInT11;
8457  }
8458  else if (TEST_OPT_INTSTRATEGY)
8459  {
8460  strat->posInL = posInL11;
8461  strat->posInT = posInT11;
8462  }
8463  else
8464  {
8465  strat->posInL = posInL0;
8466  strat->posInT = posInT0;
8467  }
8468  //if (strat->minim>0) strat->posInL =posInLSpecial;
8469  if (strat->homog)
8470  {
8471  strat->posInL = posInL110;
8472  strat->posInT = posInT110;
8473  }
8474  }
8475  else
8476  {
8477  if (strat->homog)
8478  {
8479  strat->posInL = posInL11;
8480  strat->posInT = posInT11;
8481  }
8482  else
8483  {
8484  if ((currRing->order[0]==ringorder_c)
8485  ||(currRing->order[0]==ringorder_C))
8486  {
8487  strat->posInL = posInL17_c;
8488  strat->posInT = posInT17_c;
8489  }
8490  else
8491  {
8492  strat->posInL = posInL17;
8493  strat->posInT = posInT17;
8494  }
8495  }
8496  }
8497  if (strat->minim>0) strat->posInL =posInLSpecial;
8498  // for further tests only
8499  if ((BTEST1(11)) || (BTEST1(12)))
8500  strat->posInL = posInL11;
8501  else if ((BTEST1(13)) || (BTEST1(14)))
8502  strat->posInL = posInL13;
8503  else if ((BTEST1(15)) || (BTEST1(16)))
8504  strat->posInL = posInL15;
8505  else if ((BTEST1(17)) || (BTEST1(18)))
8506  strat->posInL = posInL17;
8507  if (BTEST1(11))
8508  strat->posInT = posInT11;
8509  else if (BTEST1(13))
8510  strat->posInT = posInT13;
8511  else if (BTEST1(15))
8512  strat->posInT = posInT15;
8513  else if ((BTEST1(17)))
8514  strat->posInT = posInT17;
8515  else if ((BTEST1(19)))
8516  strat->posInT = posInT19;
8517  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8518  strat->posInT = posInT1;
8519 #ifdef HAVE_RINGS
8520  if (rField_is_Ring(currRing))
8521  {
8522  strat->posInL = posInL11Ring;
8523  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8524  strat->posInL = posInL11Ringls;
8525  strat->posInT = posInT11;
8526  }
8527 #endif
8528  strat->posInLDependsOnLength = FALSE;
8529  strat->posInLSba = posInLSig;
8530  //strat->posInL = posInLSig;
8531  strat->posInL = posInLF5C;
8532  //strat->posInT = posInTSig;
8533 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5085
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:5562
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5231
#define FALSE
Definition: auxiliary.h:140
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4317
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5504
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5469
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:5073
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4622
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:5423
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4940
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:4375
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4744
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:5143
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4909
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5610
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4680
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4508
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4866
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4809
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4583
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4554
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 6486 of file kutil.cc.

6487 {
6488  int i,pos;
6489 
6490  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6491  else i=setmaxT;
6492  strat->ecartS=initec(i);
6493  strat->sevS=initsevS(i);
6494  strat->S_2_R=initS_2_R(i);
6495  strat->fromQ=NULL;
6496  strat->Shdl=idInit(i,F->rank);
6497  strat->S=strat->Shdl->m;
6498  /*- put polys into S -*/
6499  if (Q!=NULL)
6500  {
6501  strat->fromQ=initec(i);
6502  memset(strat->fromQ,0,i*sizeof(int));
6503  for (i=0; i<IDELEMS(Q); i++)
6504  {
6505  if (Q->m[i]!=NULL)
6506  {
6507  LObject h;
6508  h.p = pCopy(Q->m[i]);
6510  {
6511  deleteHC(&h,strat);
6512  }
6514  {
6515  //pContent(h.p);
6516  h.pCleardenom(); // also does a pContent
6517  }
6518  else
6519  {
6520  h.pNorm();
6521  }
6522  if (h.p!=NULL)
6523  {
6524  strat->initEcart(&h);
6525  if (strat->sl==-1)
6526  pos =0;
6527  else
6528  {
6529  pos = posInS(strat,strat->sl,h.p,h.ecart);
6530  }
6531  h.sev = pGetShortExpVector(h.p);
6532  strat->enterS(h,pos,strat,-1);
6533  strat->fromQ[pos]=1;
6534  }
6535  }
6536  }
6537  }
6538  for (i=0; i<IDELEMS(F); i++)
6539  {
6540  if (F->m[i]!=NULL)
6541  {
6542  LObject h;
6543  h.p = pCopy(F->m[i]);
6544  if (h.p!=NULL)
6545  {
6547  {
6548  cancelunit(&h); /*- tries to cancel a unit -*/
6549  deleteHC(&h, strat);
6550  }
6551  if (h.p!=NULL)
6552  {
6554  {
6555  //pContent(h.p);
6556  h.pCleardenom(); // also does a pContent
6557  }
6558  else
6559  {
6560  h.pNorm();
6561  }
6562  strat->initEcart(&h);
6563  if (strat->Ll==-1)
6564  pos =0;
6565  else
6566  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
6567  h.sev = pGetShortExpVector(h.p);
6568  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6569  }
6570  }
6571  }
6572  }
6573  /*- test, if a unit is in F -*/
6574 
6575  if ((strat->Ll>=0)
6576 #ifdef HAVE_RINGS
6577  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6578 #endif
6579  && pIsConstant(strat->L[strat->Ll].p))
6580  {
6581  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6582  }
6583 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:1115
#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:1053
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:4201
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 6585 of file kutil.cc.

6586 {
6587  int i,pos;
6588  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6589  else i=setmaxT;
6590  strat->ecartS = initec(i);
6591  strat->sevS = initsevS(i);
6592  strat->sevSig = initsevS(i);
6593  strat->S_2_R = initS_2_R(i);
6594  strat->fromQ = NULL;
6595  strat->Shdl = idInit(i,F->rank);
6596  strat->S = strat->Shdl->m;
6597  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
6598  if (strat->sbaOrder != 1)
6599  {
6600  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
6601  strat->sevSyz = initsevS(i);
6602  strat->syzmax = i;
6603  strat->syzl = 0;
6604  }
6605  /*- put polys into S -*/
6606  if (Q!=NULL)
6607  {
6608  strat->fromQ=initec(i);
6609  memset(strat->fromQ,0,i*sizeof(int));
6610  for (i=0; i<IDELEMS(Q); i++)
6611  {
6612  if (Q->m[i]!=NULL)
6613  {
6614  LObject h;
6615  h.p = pCopy(Q->m[i]);
6617  {
6618  deleteHC(&h,strat);
6619  }
6621  {
6622  //pContent(h.p);
6623  h.pCleardenom(); // also does a pContent
6624  }
6625  else
6626  {
6627  h.pNorm();
6628  }
6629  if (h.p!=NULL)
6630  {
6631  strat->initEcart(&h);
6632  if (strat->sl==-1)
6633  pos =0;
6634  else
6635  {
6636  pos = posInS(strat,strat->sl,h.p,h.ecart);
6637  }
6638  h.sev = pGetShortExpVector(h.p);
6639  strat->enterS(h,pos,strat,-1);
6640  strat->fromQ[pos]=1;
6641  }
6642  }
6643  }
6644  }
6645  for (i=0; i<IDELEMS(F); i++)
6646  {
6647  if (F->m[i]!=NULL)
6648  {
6649  LObject h;
6650  h.p = pCopy(F->m[i]);
6651  h.sig = pOne();
6652  //h.sig = pInit();
6653  //p_SetCoeff(h.sig,nInit(1),currRing);
6654  p_SetComp(h.sig,i+1,currRing);
6655  // if we are working with the Schreyer order we generate it
6656  // by multiplying the initial signatures with the leading monomial
6657  // of the corresponding initial polynomials generating the ideal
6658  // => we can keep the underlying monomial order and get a Schreyer
6659  // order without any bigger overhead
6660  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
6661  {
6662  p_ExpVectorAdd (h.sig,F->m[i],currRing);
6663  }
6664  h.sevSig = pGetShortExpVector(h.sig);
6665 #ifdef DEBUGF5
6666  pWrite(h.p);
6667  pWrite(h.sig);
6668 #endif
6669  if (h.p!=NULL)
6670  {
6672  {
6673  cancelunit(&h); /*- tries to cancel a unit -*/
6674  deleteHC(&h, strat);
6675  }
6676  if (h.p!=NULL)
6677  {
6679  {
6680  //pContent(h.p);
6681  h.pCleardenom(); // also does a pContent
6682  }
6683  else
6684  {
6685  h.pNorm();
6686  }
6687  strat->initEcart(&h);
6688  if (strat->Ll==-1)
6689  pos =0;
6690  else
6691  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
6692  h.sev = pGetShortExpVector(h.p);
6693  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6694  }
6695  }
6696  /*
6697  if (strat->sbaOrder != 1)
6698  {
6699  for(j=0;j<i;j++)
6700  {
6701  strat->syz[ctr] = pCopy(F->m[j]);
6702  p_SetCompP(strat->syz[ctr],i+1,currRing);
6703  // add LM(F->m[i]) to the signature to get a Schreyer order
6704  // without changing the underlying polynomial ring at all
6705  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
6706  // since p_Add_q() destroys all input
6707  // data we need to recreate help
6708  // each time
6709  poly help = pCopy(F->m[i]);
6710  p_SetCompP(help,j+1,currRing);
6711  pWrite(strat->syz[ctr]);
6712  pWrite(help);
6713  printf("%d\n",pLmCmp(strat->syz[ctr],help));
6714  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
6715  printf("%d. SYZ ",ctr);
6716  pWrite(strat->syz[ctr]);
6717  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
6718  ctr++;
6719  }
6720  strat->syzl = ps;
6721  }
6722  */
6723  }
6724  }
6725  /*- test, if a unit is in F -*/
6726 
6727  if ((strat->Ll>=0)
6728 #ifdef HAVE_RINGS
6729  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6730 #endif
6731  && pIsConstant(strat->L[strat->Ll].p))
6732  {
6733  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6734  }
6735 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:236
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:1115
#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:1053
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:1339
#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:4201
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 6886 of file kutil.cc.

6887 {
6888  int i,pos;
6889 
6890  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6891  else i=setmaxT;
6892  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
6893  strat->ecartS=initec(i);
6894  strat->sevS=initsevS(i);
6895  strat->S_2_R=initS_2_R(i);
6896  strat->fromQ=NULL;
6897  strat->Shdl=idInit(i,F->rank);
6898  strat->S=strat->Shdl->m;
6899 
6900  /*- put polys into S -*/
6901  if (Q!=NULL)
6902  {
6903  strat->fromQ=initec(i);
6904  memset(strat->fromQ,0,i*sizeof(int));
6905  for (i=0; i<IDELEMS(Q); i++)
6906  {
6907  if (Q->m[i]!=NULL)
6908  {
6909  LObject h;
6910  h.p = pCopy(Q->m[i]);
6911  //if (TEST_OPT_INTSTRATEGY)
6912  //{
6913  // //pContent(h.p);
6914  // h.pCleardenom(); // also does a pContent
6915  //}
6916  //else
6917  //{
6918  // h.pNorm();
6919  //}
6921  {
6922  deleteHC(&h,strat);
6923  }
6924  if (h.p!=NULL)
6925  {
6926  strat->initEcart(&h);
6927  if (strat->sl==-1)
6928  pos =0;
6929  else
6930  {
6931  pos = posInS(strat,strat->sl,h.p,h.ecart);
6932  }
6933  h.sev = pGetShortExpVector(h.p);
6934  strat->enterS(h,pos,strat, strat->tl+1);
6935  enterT(h, strat);
6936  strat->fromQ[pos]=1;
6937  }
6938  }
6939  }
6940  }
6941  /*- put polys into S -*/
6942  for (i=0; i<IDELEMS(F); i++)
6943  {
6944  if (F->m[i]!=NULL)
6945  {
6946  LObject h;
6947  h.p = pCopy(F->m[i]);
6949  {
6950  deleteHC(&h,strat);
6951  }
6952  else
6953  {
6954  h.p=redtailBba(h.p,strat->sl,strat);
6955  }
6956  if (h.p!=NULL)
6957  {
6958  strat->initEcart(&h);
6959  if (strat->sl==-1)
6960  pos =0;
6961  else
6962  pos = posInS(strat,strat->sl,h.p,h.ecart);
6963  h.sev = pGetShortExpVector(h.p);
6964  strat->enterS(h,pos,strat, strat->tl+1);
6965  enterT(h,strat);
6966  }
6967  }
6968  }
6969  for (i=0; i<IDELEMS(P); i++)
6970  {
6971  if (P->m[i]!=NULL)
6972  {
6973  LObject h;
6974  h.p=pCopy(P->m[i]);
6976  {
6977  h.pCleardenom();
6978  }
6979  else
6980  {
6981  h.pNorm();
6982  }
6983  if(strat->sl>=0)
6984  {
6986  {
6987  h.p=redBba(h.p,strat->sl,strat);
6988  if (h.p!=NULL)
6989  {
6990  h.p=redtailBba(h.p,strat->sl,strat);
6991  }
6992  }
6993  else
6994  {
6995  h.p=redMora(h.p,strat->sl,strat);
6996  }
6997  if(h.p!=NULL)
6998  {
6999  strat->initEcart(&h);
7001  {
7002  h.pCleardenom();
7003  }
7004  else
7005  {
7006  h.is_normalized = 0;
7007  h.pNorm();
7008  }
7009  h.sev = pGetShortExpVector(h.p);
7010  h.SetpFDeg();
7011  pos = posInS(strat,strat->sl,h.p,h.ecart);
7012  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
7013  strat->enterS(h,pos,strat, strat->tl+1);
7014  enterT(h,strat);
7015  }
7016  }
7017  else
7018  {
7019  h.sev = pGetShortExpVector(h.p);
7020  strat->initEcart(&h);
7021  strat->enterS(h,0,strat, strat->tl+1);
7022  enterT(h,strat);
7023  }
7024  }
7025  }
7026 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:4074
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6051
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7281
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7811
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:752
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
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:7304
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 7031 of file kutil.cc.

7032 {
7033  int i,pos;
7034 
7035  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7036  else i=setmaxT;
7037  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
7038  strat->sevS=initsevS(i);
7039  strat->sevSig=initsevS(i);
7040  strat->S_2_R=initS_2_R(i);
7041  strat->fromQ=NULL;
7042  strat->Shdl=idInit(i,F->rank);
7043  strat->S=strat->Shdl->m;
7044  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
7045  /*- put polys into S -*/
7046  if (Q!=NULL)
7047  {
7048  strat->fromQ=initec(i);
7049  memset(strat->fromQ,0,i*sizeof(int));
7050  for (i=0; i<IDELEMS(Q); i++)
7051  {
7052  if (Q->m[i]!=NULL)
7053  {
7054  LObject h;
7055  h.p = pCopy(Q->m[i]);
7056  //if (TEST_OPT_INTSTRATEGY)
7057  //{
7058  // //pContent(h.p);
7059  // h.pCleardenom(); // also does a pContent
7060  //}
7061  //else
7062  //{
7063  // h.pNorm();
7064  //}
7066  {
7067  deleteHC(&h,strat);
7068  }
7069  if (h.p!=NULL)
7070  {
7071  strat->initEcart(&h);
7072  if (strat->sl==-1)
7073  pos =0;
7074  else
7075  {
7076  pos = posInS(strat,strat->sl,h.p,h.ecart);
7077  }
7078  h.sev = pGetShortExpVector(h.p);
7079  strat->enterS(h,pos,strat, strat->tl+1);
7080  enterT(h, strat);
7081  strat->fromQ[pos]=1;
7082  }
7083  }
7084  }
7085  }
7086  /*- put polys into S -*/
7087  for (i=0; i<IDELEMS(F); i++)
7088  {
7089  if (F->m[i]!=NULL)
7090  {
7091  LObject h;
7092  h.p = pCopy(F->m[i]);
7094  {
7095  deleteHC(&h,strat);
7096  }
7097  else
7098  {
7099  h.p=redtailBba(h.p,strat->sl,strat);
7100  }
7101  if (h.p!=NULL)
7102  {
7103  strat->initEcart(&h);
7104  if (strat->sl==-1)
7105  pos =0;
7106  else
7107  pos = posInS(strat,strat->sl,h.p,h.ecart);
7108  h.sev = pGetShortExpVector(h.p);
7109  strat->enterS(h,pos,strat, strat->tl+1);
7110  enterT(h,strat);
7111  }
7112  }
7113  }
7114  for (i=0; i<IDELEMS(P); i++)
7115  {
7116  if (P->m[i]!=NULL)
7117  {
7118  LObject h;
7119  h.p=pCopy(P->m[i]);
7121  {
7122  h.pCleardenom();
7123  }
7124  else
7125  {
7126  h.pNorm();
7127  }
7128  if(strat->sl>=0)
7129  {
7131  {
7132  h.p=redBba(h.p,strat->sl,strat);
7133  if (h.p!=NULL)
7134  {
7135  h.p=redtailBba(h.p,strat->sl,strat);
7136  }
7137  }
7138  else
7139  {
7140  h.p=redMora(h.p,strat->sl,strat);
7141  }
7142  if(h.p!=NULL)
7143  {
7144  strat->initEcart(&h);
7146  {
7147  h.pCleardenom();
7148  }
7149  else
7150  {
7151  h.is_normalized = 0;
7152  h.pNorm();
7153  }
7154  h.sev = pGetShortExpVector(h.p);
7155  h.SetpFDeg();
7156  pos = posInS(strat,strat->sl,h.p,h.ecart);
7157  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
7158  strat->enterS(h,pos,strat, strat->tl+1);
7159  enterT(h,strat);
7160  }
7161  }
7162  else
7163  {
7164  h.sev = pGetShortExpVector(h.p);
7165  strat->initEcart(&h);
7166  strat->enterS(h,0,strat, strat->tl+1);
7167  enterT(h,strat);
7168  }
7169  }
7170  }
7171 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:4074
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6051
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7281
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7811
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:752
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
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:7304
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 6737 of file kutil.cc.

6738 {
6739  if( strat->S[0] )
6740  {
6741  if( strat->S[1] )
6742  {
6743  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
6744  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
6745  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
6746  }
6747  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
6748  /************************************************************
6749  * computing the length of the syzygy array needed
6750  ***********************************************************/
6751  for(i=1; i<=strat->sl; i++)
6752  {
6753  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6754  {
6755  ps += i;
6756  }
6757  }
6758  ps += strat->sl+1;
6759  //comp = pGetComp (strat->P.sig);
6760  comp = strat->currIdx;
6761  strat->syzIdx = initec(comp);
6762  strat->sevSyz = initsevS(ps);
6763  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
6764  strat->syzmax = ps;
6765  strat->syzl = 0;
6766  strat->syzidxmax = comp;
6767 #if defined(DEBUGF5) || defined(DEBUGF51)
6768  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
6769 #endif
6770  i = 1;
6771  j = 0;
6772  /************************************************************
6773  * generating the leading terms of the principal syzygies
6774  ***********************************************************/
6775  while (i <= strat->sl)
6776  {
6777  /**********************************************************
6778  * principal syzygies start with component index 2
6779  * the array syzIdx starts with index 0
6780  * => the rules for a signature with component comp start
6781  * at strat->syz[strat->syzIdx[comp-2]] !
6782  *********************************************************/
6783  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6784  {
6785  comp = pGetComp(strat->sig[i]);
6786  comp_old = pGetComp(strat->sig[i-1]);
6787  diff = comp - comp_old - 1;
6788  // diff should be zero, but sometimes also the initial generating
6789  // elements of the input ideal reduce to zero. then there is an
6790  // index-gap between the signatures. for these inbetween signatures we
6791  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6792  // in the following.
6793  // doing this, we keep the relation "j = comp - 2" alive, which makes
6794  // jumps way easier when checking criteria
6795  while (diff>0)
6796  {
6797  strat->syzIdx[j] = 0;
6798  diff--;
6799  j++;
6800  }
6801  strat->syzIdx[j] = ctr;
6802  j++;
6803  LObject Q;
6804  int pos;
6805  for (k = 0; k<i; k++)
6806  {
6807  Q.sig = pOne();
6808  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6809  p_SetCompP (Q.sig, comp, currRing);
6810  poly q = p_One(currRing);
6811  p_ExpVectorCopy(q,strat->S[i],currRing);
6812  q = p_Neg (q, currRing);
6813  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6814  Q.sig = p_Add_q (Q.sig, q, currRing);
6815  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6816  pos = posInSyz(strat, Q.sig);
6817  enterSyz(Q, strat, pos);
6818  ctr++;
6819  }
6820  }
6821  i++;
6822  }
6823  /**************************************************************
6824  * add syzygies for upcoming first element of new iteration step
6825  **************************************************************/
6826  comp = strat->currIdx;
6827  comp_old = pGetComp(strat->sig[i-1]);
6828  diff = comp - comp_old - 1;
6829  // diff should be zero, but sometimes also the initial generating
6830  // elements of the input ideal reduce to zero. then there is an
6831  // index-gap between the signatures. for these inbetween signatures we
6832  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6833  // in the following.
6834  // doing this, we keep the relation "j = comp - 2" alive, which makes
6835  // jumps way easier when checking criteria
6836  while (diff>0)
6837  {
6838  strat->syzIdx[j] = 0;
6839  diff--;
6840  j++;
6841  }
6842  strat->syzIdx[j] = ctr;
6843  LObject Q;
6844  int pos;
6845  for (k = 0; k<strat->sl+1; k++)
6846  {
6847  Q.sig = pOne();
6848  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6849  p_SetCompP (Q.sig, comp, currRing);
6850  poly q = p_One(currRing);
6851  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
6852  q = p_Neg (q, currRing);
6853  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6854  Q.sig = p_Add_q (Q.sig, q, currRing);
6855  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6856  pos = posInSyz(strat, Q.sig);
6857  enterSyz(Q, strat, pos);
6858  ctr++;
6859  }
6860 //#if 1
6861 #ifdef DEBUGF5
6862  PrintS("Principal syzygies:\n");
6863  Print("syzl %d\n",strat->syzl);
6864  Print("syzmax %d\n",strat->syzmax);
6865  Print("ps %d\n",ps);
6866  PrintS("--------------------------------\n");
6867  for(i=0;i<=strat->syzl-1;i++)
6868  {
6869  Print("%d - ",i);
6870  pWrite(strat->syz[i]);
6871  }
6872  for(i=0;i<strat->currIdx;i++)
6873  {
6874  Print("%d - %d\n",i,strat->syzIdx[i]);
6875  }
6876  PrintS("--------------------------------\n");
6877 #endif
6878  }
6879 }
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:243
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:1241
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4559
LSet L
Definition: kutil.h:323
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:5045
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:1018
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int syzl
Definition: kutil.h:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:8007
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 8994 of file kutil.cc.

8995 {
8996  if (strat->overflow) return FALSE;
8997  assume(L->p1 != NULL && L->p2 != NULL);
8998  // shift changes: from 0 to -1
8999  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
9000  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
9001  assume(strat->tailRing != currRing);
9002 
9003  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
9004  return FALSE;
9005  // shift changes: extra case inserted
9006  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
9007  {
9008  return TRUE;
9009  }
9010  poly p1_max = (strat->R[L->i_r1])->max;
9011  poly p2_max = (strat->R[L->i_r2])->max;
9012 
9013  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
9014  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
9015  {
9016  p_LmFree(m1, strat->tailRing);
9017  p_LmFree(m2, strat->tailRing);
9018  m1 = NULL;
9019  m2 = NULL;
9020  return FALSE;
9021  }
9022  return TRUE;
9023 }
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1821
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int max(int a, int b)
Definition: fast_mult.cc:264
#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 9032 of file kutil.cc.

9033 {
9034  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
9035  //assume(strat->tailRing != currRing);
9036 
9037  poly p1_max = (strat->R[atR])->max;
9038  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
9039 
9040  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
9041  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
9042  {
9043  return FALSE;
9044  }
9045  return TRUE;
9046 }
#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:1821
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 3558 of file kutil.cc.

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

Output some debug info about a given strategy.

Definition at line 9907 of file kutil.cc.

9908 {
9909  PrintS("red: ");
9910  if (strat->red==redFirst) PrintS("redFirst\n");
9911  else if (strat->red==redHoney) PrintS("redHoney\n");
9912  else if (strat->red==redEcart) PrintS("redEcart\n");
9913  else if (strat->red==redHomog) PrintS("redHomog\n");
9914  else Print("%p\n",(void*)strat->red);
9915  PrintS("posInT: ");
9916  if (strat->posInT==posInT0) PrintS("posInT0\n");
9917  else if (strat->posInT==posInT1) PrintS("posInT1\n");
9918  else if (strat->posInT==posInT11) PrintS("posInT11\n");
9919  else if (strat->posInT==posInT110) PrintS("posInT110\n");
9920  else if (strat->posInT==posInT13) PrintS("posInT13\n");
9921  else if (strat->posInT==posInT15) PrintS("posInT15\n");
9922  else if (strat->posInT==posInT17) PrintS("posInT17\n");
9923  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
9924  else if (strat->posInT==posInT19) PrintS("posInT19\n");
9925  else if (strat->posInT==posInT2) PrintS("posInT2\n");
9926 #ifdef HAVE_MORE_POS_IN_T
9927  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
9928  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
9929  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
9930 #endif
9931  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
9932  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
9933  else Print("%p\n",(void*)strat->posInT);
9934  PrintS("posInL: ");
9935  if (strat->posInL==posInL0) PrintS("posInL0\n");
9936  else if (strat->posInL==posInL10) PrintS("posInL10\n");
9937  else if (strat->posInL==posInL11) PrintS("posInL11\n");
9938  else if (strat->posInL==posInL110) PrintS("posInL110\n");
9939  else if (strat->posInL==posInL13) PrintS("posInL13\n");
9940  else if (strat->posInL==posInL15) PrintS("posInL15\n");
9941  else if (strat->posInL==posInL17) PrintS("posInL17\n");
9942  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
9943  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
9944  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
9945  else Print("%p\n",(void*)strat->posInL);
9946  PrintS("enterS: ");
9947  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
9948  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
9949  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
9950  else Print("%p\n",(void*)strat->enterS);
9951  PrintS("initEcart: ");
9952  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
9953  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
9954  else Print("%p\n",(void*)strat->initEcart);
9955  PrintS("initEcartPair: ");
9956  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
9957  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
9958  else Print("%p\n",(void*)strat->initEcartPair);
9959  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
9960  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
9961  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
9962  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
9963  PrintS("chainCrit: ");
9964  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
9965  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
9966  else Print("%p\n",(void*)strat->chainCrit);
9967  Print("posInLDependsOnLength=%d\n",
9968  strat->posInLDependsOnLength);
9969  PrintS(showOption());PrintLn();
9970  PrintS("LDeg: ");
9971  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9972  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9973  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
9974  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9975  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9976  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9977  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9978  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9979  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9980  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9981  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9982  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9983  else Print("? (%lx)", (long)currRing->pLDeg);
9984  PrintS(" / ");
9985  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9986  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9987  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
9988  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9989  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9990  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9991  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9992  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9993  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9994  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9995  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9996  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9997  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
9998  PrintLn();
9999  PrintS("currRing->pFDeg: ");
10000  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
10001  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
10002  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
10003  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
10004  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
10005  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
10006  else Print("? (%lx)", (long)currRing->pFDeg);
10007  PrintLn();
10008  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
10009  if(TEST_OPT_DEGBOUND)
10010  Print(" degBound: %d\n", Kstd1_deg);
10011 
10012  if( ecartWeights != NULL )
10013  {
10014  PrintS("ecartWeights: ");
10015  for (int i = rVar(currRing); i > 0; i--)
10016  Print("%hd ", ecartWeights[i]);
10017  PrintLn();
10019  }
10020 
10021 #ifndef SING_NDEBUG
10023 #endif
10024 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1154
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5085
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9873
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:4432
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5562
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
void PrintLn()
Definition: reporter.cc:322
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4345
#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:4317
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2451
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5339
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5504
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5469
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:726
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4622
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:518
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:5423
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
void rDebugPrint(ring r)
Definition: ring.cc:4035
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1116
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:4375
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4744
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:1161
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:1147
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:2208
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4909
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5610
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:4680
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:1378
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9782
#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:4508
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2666
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:4866
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:4809
void initEcartNormal(TObject *h)
Definition: kutil.cc:1139
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9836
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4583
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:4554
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart 
)

Definition at line 5872 of file kutil.cc.

5874 {
5875  int j = 0;
5876  const unsigned long not_sev = ~L->sev;
5877  const unsigned long* sev = strat->sevS;
5878  poly p;
5879  ring r;
5880  L->GetLm(p, r);
5881 
5882  assume(~not_sev == p_GetShortExpVector(p, r));
5883 
5884  if (r == currRing)
5885  {
5886  loop
5887  {
5888  if (j > pos) return NULL;
5889 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5890  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
5891  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5892  {
5893 #ifdef HAVE_RINGS
5894  if(rField_is_Ring(r))
5895  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5896  break;}
5897  else
5898 #endif
5899  break;
5900  }
5901 #else
5902  if (!(sev[j] & not_sev) &&
5903  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
5904  p_LmDivisibleBy(strat->S[j], p, r))
5905  {
5906 #ifdef HAVE_RINGS
5907  if(rField_is_Ring(r))
5908  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5909  break;}
5910  else
5911 #endif
5912  break;
5913  }
5914 
5915 #endif
5916  j++;
5917  }
5918  // if called from NF, T objects do not exist:
5919  if (strat->tl < 0 || strat->S_2_R[j] == -1)
5920  {
5921  T->Set(strat->S[j], r, strat->tailRing);
5922  return T;
5923  }
5924  else
5925  {
5926 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
5927 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
5928 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
5929  return strat->S_2_T(j);
5930  }
5931  }
5932  else
5933  {
5934  TObject* t;
5935  loop
5936  {
5937  if (j > pos) return NULL;
5938  assume(strat->S_2_R[j] != -1);
5939 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5940  t = strat->S_2_T(j);
5941  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
5942  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
5943  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5944  {
5945 #ifdef HAVE_RINGS
5946  if(rField_is_Ring(r))
5947  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5948  return t;}
5949  else
5950 #endif
5951  return t;
5952  }
5953 #else
5954  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5955  {
5956  t = strat->S_2_T(j);
5957  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
5958  if (p_LmDivisibleBy(t->t_p, p, r))
5959  {
5960 #ifdef HAVE_RINGS
5961  if(rField_is_Ring(r))
5962  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5963  return t;}
5964  else
5965 #endif
5966  return t;
5967  }
5968  }
5969 #endif
5970  j++;
5971  }
5972  }
5973 }
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 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4559
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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 2405 of file kutil.cc.

2406 {
2407  int j=strat->Ll+strat->Bl+1;
2408  if (j>strat->Lmax)
2409  {
2410  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
2411  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
2412  j*sizeof(LObject));
2413  strat->Lmax=j;
2414  }
2415  j = strat->Ll;
2416  int i;
2417  for (i=strat->Bl; i>=0; i--)
2418  {
2419  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
2420  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
2421  }
2422  strat->Bl = -1;
2423 }
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:1115
#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 2428 of file kutil.cc.

2429 {
2430  int j=strat->Ll+strat->Bl+1;
2431  if (j>strat->Lmax)
2432  {
2433  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
2434  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
2435  j*sizeof(LObject));
2436  strat->Lmax=j;
2437  }
2438  j = strat->Ll;
2439  int i;
2440  for (i=strat->Bl; i>=0; i--)
2441  {
2442  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
2443  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
2444  }
2445  strat->Bl = -1;
2446 }
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:1115
#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 8232 of file kutil.cc.

8235 {
8236  if (pos_in_l == posInL110 ||
8237  pos_in_l == posInL10 ||
8238  pos_in_l == posInLRing)
8239  return TRUE;
8240 
8241  return FALSE;
8242 }
#define FALSE
Definition: auxiliary.h:140
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4964
#define TRUE
Definition: auxiliary.h:144
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5423
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 9361 of file kutil.cc.

9362 {
9363  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
9364  /* initial setup or extending */
9365 
9366  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
9367  if (expbound >= currRing->bitmask) return FALSE;
9368  strat->overflow=FALSE;
9369  ring new_tailRing = rModifyRing(currRing,
9370  // Hmmm .. the condition pFDeg == p_Deg
9371  // might be too strong
9372 #ifdef HAVE_RINGS
9373  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver
9374 #else
9375  (strat->homog && currRing->pFDeg == p_Deg), // omit_degree
9376 #endif
9377  (strat->ak==0), // omit_comp if the input is an ideal
9378  expbound); // exp_limit
9379 
9380  if (new_tailRing == currRing) return TRUE;
9381 
9382  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
9383  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
9384 
9385  if (currRing->pFDeg != currRing->pFDegOrig)
9386  {
9387  new_tailRing->pFDeg = currRing->pFDeg;
9388  new_tailRing->pLDeg = currRing->pLDeg;
9389  }
9390 
9391  if (TEST_OPT_PROT)
9392  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
9393  kTest_TS(strat);
9394  assume(new_tailRing != strat->tailRing);
9395  pShallowCopyDeleteProc p_shallow_copy_delete
9396  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
9397 
9398  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
9399 
9400  int i;
9401  for (i=0; i<=strat->tl; i++)
9402  {
9403  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
9404  p_shallow_copy_delete);
9405  }
9406  for (i=0; i<=strat->Ll; i++)
9407  {
9408  assume(strat->L[i].p != NULL);
9409  if (pNext(strat->L[i].p) != strat->tail)
9410  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9411  }
9412  if ((strat->P.t_p != NULL) ||
9413  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
9414  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9415 
9416  if ((L != NULL) && (L->tailRing != new_tailRing))
9417  {
9418  if (L->i_r < 0)
9419  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9420  else
9421  {
9422  assume(L->i_r <= strat->tl);
9423  TObject* t_l = strat->R[L->i_r];
9424  assume(t_l != NULL);
9425  L->tailRing = new_tailRing;
9426  L->p = t_l->p;
9427  L->t_p = t_l->t_p;
9428  L->max = t_l->max;
9429  }
9430  }
9431 
9432  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
9433  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
9434 
9435  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
9436  if (strat->tailRing != currRing)
9437  rKillModifiedRing(strat->tailRing);
9438 
9439  strat->tailRing = new_tailRing;
9440  strat->tailBin = new_tailBin;
9441  strat->p_shallow_copy_delete
9442  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
9443 
9444  if (strat->kHEdge != NULL)
9445  {
9446  if (strat->t_kHEdge != NULL)
9447  p_LmFree(strat->t_kHEdge, strat->tailRing);
9448  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
9449  }
9450 
9451  if (strat->kNoether != NULL)
9452  {
9453  if (strat->t_kNoether != NULL)
9454  p_LmFree(strat->t_kNoether, strat->tailRing);
9456  new_tailRing);
9457  }
9458  kTest_TS(strat);
9459  if (TEST_OPT_PROT)
9460  PrintS("]");
9461  return TRUE;
9462 }
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:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
BOOLEAN homog
Definition: kutil.h: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:437
#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 9464 of file kutil.cc.

9465 {
9466  unsigned long l = 0;
9467  int i;
9468  long e;
9469 
9470  assume(strat->tailRing == currRing);
9471 
9472  for (i=0; i<= strat->Ll; i++)
9473  {
9474  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
9475  }
9476  for (i=0; i<=strat->tl; i++)
9477  {
9478  // Hmm ... this we could do in one Step
9479  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
9480  }
9481  if (rField_is_Ring(currRing))
9482  {
9483  l *= 2;
9484  }
9485  e = p_GetMaxExp(l, currRing);
9486  if (e <= 1) e = 2;
9487 
9488  kStratChangeTailRing(strat, NULL, NULL, e);
9489 }
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:743
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:9361
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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 6278 of file kutil.cc.

6279 {
6280  if (i != *olddeg)
6281  {
6282  Print("%d",i);
6283  *olddeg = i;
6284  }
6285  if (TEST_OPT_OLDSTD)
6286  {
6287  if (strat->Ll != *reduc)
6288  {
6289  if (strat->Ll != *reduc-1)
6290  Print("(%d)",strat->Ll+1);
6291  else
6292  PrintS("-");
6293  *reduc = strat->Ll;
6294  }
6295  else
6296  PrintS(".");
6297  mflush();
6298  }
6299  else
6300  {
6301  if (red_result == 0)
6302  PrintS("-");
6303  else if (red_result < 0)
6304  PrintS(".");
6305  if ((red_result > 0) || ((strat->Ll % 100)==99))
6306  {
6307  if (strat->Ll != *reduc && strat->Ll > 0)
6308  {
6309  Print("(%d)",strat->Ll+1);
6310  *reduc = strat->Ll;
6311  }
6312  }
6313  }
6314 }
#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 6319 of file kutil.cc.

6320 {
6321  //PrintS("\nUsage/Allocation of temporary storage:\n");
6322  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
6323  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
6324  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
6325  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
6326  /* in usual case strat->cv is 0, it gets changed only in shift routines */
6327  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
6328  /*mflush();*/
6329 }
#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 8924 of file kutil.cc.

8925 {
8926  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
8927  return FALSE;
8928  int i,j;
8929  poly newNoether;
8930 
8931 #if 0
8932  if (currRing->weight_all_1)
8933  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8934  else
8935  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8936 #else
8937  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8938 #endif
8939  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
8940  if (strat->tailRing != currRing)
8941  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
8942  /* compare old and new noether*/
8943  newNoether = pLmInit(strat->kHEdge);
8944  j = p_FDeg(newNoether,currRing);
8945 /* #ifdef HAVE_RINGS
8946  if (!rField_is_Ring(currRing))
8947  #endif */
8948  for (i=1; i<=(currRing->N); i++)
8949  {
8950  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
8951  }
8952  pSetm(newNoether);
8953  if (j < strat->HCord) /*- statistics -*/
8954  {
8955  if (TEST_OPT_PROT)
8956  {
8957  Print("H(%d)",j);
8958  mflush();
8959  }
8960  strat->HCord=j;
8961  #ifdef KDEBUG
8962  if (TEST_OPT_DEBUG)
8963  {
8964  Print("H(%d):",j);
8965  wrp(strat->kHEdge);
8966  PrintLn();
8967  }
8968  #endif
8969  }
8970  if (pCmp(strat->kNoether,newNoether)!=1)
8971  {
8972  pDelete(&strat->kNoether);
8973  strat->kNoether=newNoether;
8974  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
8975  if (strat->tailRing != currRing)
8976  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
8977 
8978  return TRUE;
8979  }
8980  #ifdef HAVE_RINGS
8981  if (rField_is_Ring(currRing))
8982  pLmDelete(newNoether);
8983  else
8984  #endif
8985  pLmFree(newNoether);
8986  return FALSE;
8987 }
#define pSetm(p)
Definition: polys.h:241
int HCord
Definition: kutil.cc:227
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h: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:679
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:905
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:369
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
poly t_kHEdge
Definition: kutil.h:327
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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 3492 of file kutil.cc.

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

p_HasNotCF for the IDLIFT case: ignore component

Definition at line 1824 of file kutil.cc.

1825 {
1826  int i = rVar(r);
1827  loop
1828  {
1829  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1830  return FALSE;
1831  i--;
1832  if (i == 0)
1833  return TRUE;
1834  }
1835 }
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:540
#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:465
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 10059 of file kutil.cc.

10060 {
10061  /* restores a poly in currRing from LObject */
10062  LObject h = H;
10063  h.Copy();
10064  poly p;
10065  if (h.p == NULL)
10066  {
10067  if (h.t_p != NULL)
10068  {
10069  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
10070  return(p);
10071  }
10072  else
10073  {
10074  /* h.tp == NULL -> the object is NULL */
10075  return(NULL);
10076  }
10077  }
10078  /* we're here if h.p != NULL */
10079  if (h.t_p == NULL)
10080  {
10081  /* then h.p is the whole poly in currRing */
10082  p = h.p;
10083  return(p);
10084  }
10085  /* we're here if h.p != NULL and h.t_p != NULL */
10086  // clean h.p, get poly from t_p
10087  pNext(h.p)=NULL;
10088  pDelete(&h.p);
10089  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
10090  /* dest. ring: */ currRing);
10091  // no need to clean h: we re-used the polys
10092  return(p);
10093 }
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
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:144
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
static BOOLEAN _p_LmDivisibleByPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition: p_polys.h:1635
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
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 10028 of file kutil.cc.

10029 {
10030  /* assume: p is completely in currRing */
10031  /* produces an object with LM in curring
10032  and TAIL in tailring */
10033  if (pNext(p)!=NULL)
10034  {
10035  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
10036  }
10037  return(p);
10038 }
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 10042 of file kutil.cc.

10043 {
10044  /* assume: p has LM in curring and TAIL in tailring */
10045  /* convert it to complete currRing */
10046 
10047  /* check that LM is in currRing */
10049 
10050  if (pNext(p)!=NULL)
10051  {
10052  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
10053  }
10054  return(p);
10055 }
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 4909 of file kutil.cc.

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

Definition at line 5085 of file kutil.cc.

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

Definition at line 5423 of file kutil.cc.

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

Definition at line 5143 of file kutil.cc.

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

Definition at line 5231 of file kutil.cc.

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

Definition at line 5469 of file kutil.cc.

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

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

Definition at line 5562 of file kutil.cc.

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

Definition at line 5610 of file kutil.cc.

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

Definition at line 5073 of file kutil.cc.

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

Definition at line 5339 of file kutil.cc.

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

Definition at line 4964 of file kutil.cc.

4966 {
4967  if (length < 0) return 0;
4968  if (set[length].FDeg > p->FDeg)
4969  return length+1;
4970  if (set[length].FDeg == p->FDeg)
4971  if(set[length].GetpLength() > p->GetpLength())
4972  return length+1;
4973  int i;
4974  int an = 0;
4975  int en= length+1;
4976  loop
4977  {
4978  if (an >= en-1)
4979  {
4980  if(an == en)
4981  return en;
4982  if (set[an].FDeg > p->FDeg)
4983  return en;
4984  if(set[an].FDeg == p->FDeg)
4985  {
4986  if(set[an].GetpLength() > p->GetpLength())
4987  {return en;}
4988  else
4989  {
4990  if(set[an].GetpLength() == p->GetpLength())
4991  {
4992  if(nGreater(set[an].p->coef, p->p->coef))
4993  {
4994  return en;
4995  }
4996  else
4997  {
4998  return an;
4999  }
5000  }
5001  else
5002  {
5003  return an;
5004  }
5005  }
5006  }
5007  else
5008  {return an;}
5009  }
5010  i=(an+en) / 2;
5011  if (set[i].FDeg > p->FDeg)
5012  an=i;
5013  else
5014  {
5015  if(set[i].FDeg == p->FDeg)
5016  {
5017  if(set[i].GetpLength() > p->GetpLength())
5018  an=i;
5019  else
5020  {
5021  if(set[i].GetpLength() == p->GetpLength())
5022  {
5023  if(nGreater(set[i].p->coef, p->p->coef))
5024  {
5025  an = i;
5026  }
5027  else
5028  {
5029  en = i;
5030  }
5031  }
5032  else
5033  {
5034  en=i;
5035  }
5036  }
5037  }
5038  else
5039  en=i;
5040  }
5041  }
5042 }
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 4940 of file kutil.cc.

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

Definition at line 4866 of file kutil.cc.

4868 {
4869  if (length<0) return 0;
4870 
4871  int d=p->GetpFDeg();
4872  int op=set[length].GetpFDeg();
4873 
4874  if ((op > d)
4875  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
4876  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
4877  return length+1;
4878 
4879  int i;
4880  int an = 0;
4881  int en= length;
4882  loop
4883  {
4884  if (an >= en-1)
4885  {
4886  op=set[an].GetpFDeg();
4887  if ((op > d)
4888  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
4889  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
4890  return en;
4891  return an;
4892  }
4893  i=(an+en) / 2;
4894  op=set[i].GetpFDeg();
4895  if ((op>d)
4896  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
4897  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
4898  an=i;
4899  else
4900  en=i;
4901  }
4902 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int posInS ( const kStrategy  strat,
const int  length,
const poly  p,
const int  ecart_p 
)

Definition at line 4201 of file kutil.cc.

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

Definition at line 5045 of file kutil.cc.

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

Definition at line 4306 of file kutil.cc.

4307 {
4308  return (length+1);
4309 }
int posInT1 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4317 of file kutil.cc.

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

Definition at line 4375 of file kutil.cc.

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

Definition at line 4508 of file kutil.cc.

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

Definition at line 4554 of file kutil.cc.

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

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

Definition at line 4680 of file kutil.cc.

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

Definition at line 4744 of file kutil.cc.

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

Definition at line 4809 of file kutil.cc.

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

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

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

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

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

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

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

9226 {
9227  if(!nCoeff_is_Ring_Z(currRing->cf))
9228  return;
9229  poly pH = h->GetP();
9230  poly p,pp;
9231  p = pH;
9232  bool deleted = FALSE, ok = FALSE;
9233  for(int i = 0; i<=strat->sl; i++)
9234  {
9235  p = pH;
9236  if(pNext(strat->S[i]) == NULL)
9237  {
9238  //pWrite(p);
9239  //pWrite(strat->S[i]);
9240  while(ok == FALSE)
9241  {
9242  if(pLmDivisibleBy(strat->S[i], p))
9243  {
9244  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
9245  p_SetCoeff(p,dummy,currRing);
9246  }
9247  if(nIsZero(p->coef))
9248  {
9249  pLmDelete(&p);
9250  deleted = TRUE;
9251  }
9252  else
9253  {
9254  ok = TRUE;
9255  }
9256  }
9257  pp = pNext(p);
9258  while(pp != NULL)
9259  {
9260  if(pLmDivisibleBy(strat->S[i], pp))
9261  {
9262  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
9263  p_SetCoeff(pp,dummy,currRing);
9264  if(nIsZero(pp->coef))
9265  {
9266  pLmDelete(&pNext(p));
9267  pp = pNext(p);
9268  deleted = TRUE;
9269  }
9270  else
9271  {
9272  p = pp;
9273  pp = pNext(p);
9274  }
9275  }
9276  else
9277  {
9278  p = pp;
9279  pp = pNext(p);
9280  }
9281  }
9282  }
9283  }
9284  h->SetLmCurrRing();
9285  if(deleted)
9286  strat->initEcart(h);
9287 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
#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:750
#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:401
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 9052 of file kutil.cc.

9053 {
9055  if(!nCoeff_is_Ring_Z(currRing->cf))
9056  return NULL;
9057  ideal F = idCopy(FOrig);
9058  idSkipZeroes(F);
9059  poly pmon;
9060  ring origR = currRing;
9061  ideal monred = idInit(1,1);
9062  for(int i=0; i<idElem(F); i++)
9063  {
9064  if(pNext(F->m[i]) == NULL)
9065  idInsertPoly(monred, F->m[i]);
9066  }
9067  int posconst = idPosConstant(F);
9068  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
9069  {
9070  pmon = pCopy(F->m[posconst]);
9071  idDelete(&F);
9072  idDelete(&monred);
9073  return pmon;
9074  }
9075  int idelemQ = 0;
9076  if(Q!=NULL)
9077  {
9078  idelemQ = IDELEMS(Q);
9079  for(int i=0; i<idelemQ; i++)
9080  {
9081  if(pNext(Q->m[i]) == NULL)
9082  idInsertPoly(monred, Q->m[i]);
9083  }
9084  idSkipZeroes(monred);
9085  posconst = idPosConstant(monred);
9086  //the constant, if found, will be from Q
9087  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
9088  {
9089  pmon = pCopy(monred->m[posconst]);
9090  idDelete(&F);
9091  idDelete(&monred);
9092  return pmon;
9093  }
9094  }
9095  ring QQ_ring = rCopy0(currRing,FALSE);
9096  nKillChar(QQ_ring->cf);
9097  QQ_ring->cf = nInitChar(n_Q, NULL);
9098  rComplete(QQ_ring,1);
9099  QQ_ring = rAssure_c_dp(QQ_ring);
9100  rChangeCurrRing(QQ_ring);
9101  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
9102  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
9103  for(int i = 0, j = 0; i<IDELEMS(F); i++)
9104  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
9105  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
9106  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
9107  ideal one = kStd(II, NULL, isNotHomog, NULL);
9108  idSkipZeroes(one);
9109  if(idIsConstant(one))
9110  {
9111  //one should be <1>
9112  for(int i = IDELEMS(II)-1; i>=0; i--)
9113  if(II->m[i] != NULL)
9114  II->m[i+1] = II->m[i];
9115  II->m[0] = pOne();
9116  ideal syz = idSyzygies(II, isNotHomog, NULL);
9117  poly integer = NULL;
9118  for(int i = IDELEMS(syz)-1;i>=0; i--)
9119  {
9120  if(pGetComp(syz->m[i]) == 1)
9121  {
9122  if(pIsConstant(syz->m[i]))
9123  {
9124  integer = pHead(syz->m[i]);
9125  pSetComp(integer, 0);
9126  break;
9127  }
9128  }
9129  }
9130  rChangeCurrRing(origR);
9131  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9132  pmon = prMapR(integer, nMap2, QQ_ring, origR);
9133  idDelete(&F);
9134  idDelete(&monred);
9135  idDelete(&II);
9136  idDelete(&one);
9137  idDelete(&syz);
9138  pDelete(&integer);
9139  rDelete(QQ_ring);
9140  return pmon;
9141  }
9142  else
9143  {
9144  if(idIs0(monred))
9145  {
9146  poly mindegmon = NULL;
9147  for(int i = 0; i<IDELEMS(one); i++)
9148  {
9149  if(pNext(one->m[i]) == NULL)
9150  {
9151  if(mindegmon == NULL)
9152  mindegmon = one->m[i];
9153  else
9154  {
9155  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
9156  mindegmon = one->m[i];
9157  }
9158  }
9159  }
9160  if(mindegmon != NULL)
9161  {
9162  for(int i = IDELEMS(II)-1; i>=0; i--)
9163  if(II->m[i] != NULL)
9164  II->m[i+1] = II->m[i];
9165  II->m[0] = mindegmon;
9166  ideal syz = idSyzygies(II, isNotHomog, NULL);
9167  bool found = FALSE;
9168  for(int i = IDELEMS(syz)-1;i>=0; i--)
9169  {
9170  if(pGetComp(syz->m[i]) == 1)
9171  {
9172  if(pIsConstant(syz->m[i]))
9173  {
9174  pSetCoeff(mindegmon, syz->m[i]->coef);
9175  found = TRUE;
9176  break;
9177  }
9178  }
9179  }
9180  idDelete(&syz);
9181  if (found == FALSE)
9182  {
9183  rChangeCurrRing(origR);
9184  idDelete(&F);
9185  idDelete(&monred);
9186  idDelete(&II);
9187  idDelete(&one);
9188  pDelete(&mindegmon);
9189  pDelete(&pmon);
9190  rDelete(QQ_ring);
9191  return NULL;
9192  }
9193  rChangeCurrRing(origR);
9194  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9195  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
9196  idDelete(&F);
9197  idDelete(&monred);
9198  idDelete(&II);
9199  idDelete(&one);
9200  idDelete(&syz);
9201  pDelete(&mindegmon);
9202  rDelete(QQ_ring);
9203  return pmon;
9204  }
9205  else
9206  rChangeCurrRing(origR);
9207  pDelete(&mindegmon);
9208  }
9209  else
9210  rChangeCurrRing(origR);
9211  }
9212  idDelete(&F);
9213  idDelete(&monred);
9214  idDelete(&II);
9215  idDelete(&one);
9216  pDelete(&pmon);
9217  rDelete(QQ_ring);
9218  return NULL;
9219 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:42
#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:750
#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:2221
#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:3435
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:720
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:76
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:560
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#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:56
static poly redBba ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 7281 of file kutil.cc.

7282 {
7283  int j = 0;
7284  unsigned long not_sev = ~ pGetShortExpVector(h);
7285 
7286  while (j <= maxIndex)
7287  {
7288  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
7289  {
7290  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
7291  if (h==NULL) return NULL;
7292  j = 0;
7293  not_sev = ~ pGetShortExpVector(h); }
7294  else j++;
7295  }
7296  return h;
7297 }
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:1082
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
static poly redBba1 ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 7176 of file kutil.cc.

7177 {
7178  int j = 0;
7179  unsigned long not_sev = ~ pGetShortExpVector(h);
7180 
7181  while (j <= maxIndex)
7182  {
7183  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
7184  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
7185  else j++;
7186  }
7187  return h;
7188 }
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:1092
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:1115
#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:1710
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:437
#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:322
#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:1115
#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
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:323
BOOLEAN LDegLast
Definition: kutil.h:375
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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 7304 of file kutil.cc.

7305 {
7306  int j=0;
7307  int e,l;
7308  unsigned long not_sev = ~ pGetShortExpVector(h);
7309 
7310  if (maxIndex >= 0)
7311  {
7312  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
7313  do
7314  {
7315  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
7316  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
7317  {
7318 #ifdef KDEBUG
7319  if (TEST_OPT_DEBUG)
7320  {PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);}
7321 #endif
7322  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
7323 #ifdef KDEBUG
7324  if(TEST_OPT_DEBUG)
7325  {PrintS(")\nto "); wrp(h); PrintLn();}
7326 #endif
7327  // pDelete(&h);
7328  if (h == NULL) return NULL;
7329  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
7330  j = 0;
7331  not_sev = ~ pGetShortExpVector(h);
7332  }
7333  else j++;
7334  }
7335  while (j <= maxIndex);
7336  }
7337  return h;
7338 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEBUG
Definition: options.h:103
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:134
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:369
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h: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:1082
void wrp(poly p)
Definition: polys.h:281
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94
poly redtail ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 5975 of file kutil.cc.

5976 {
5977  poly h, hn;
5978  strat->redTailChange=FALSE;
5979 
5980  L->GetP();
5981  poly p = L->p;
5982  if (strat->noTailReduction || pNext(p) == NULL)
5983  return p;
5984 
5985  LObject Ln(strat->tailRing);
5986  TObject* With;
5987  // placeholder in case strat->tl < 0
5988  TObject With_s(strat->tailRing);
5989  h = p;
5990  hn = pNext(h);
5991  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
5992  long e;
5993  int l;
5994  BOOLEAN save_HE=strat->kHEdgeFound;
5995  strat->kHEdgeFound |=
5996  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
5997 
5998  while(hn != NULL)
5999  {
6000  op = strat->tailRing->pFDeg(hn, strat->tailRing);
6001  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
6002  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
6003  loop
6004  {
6005  Ln.Set(hn, strat->tailRing);
6006  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
6007  if (strat->kHEdgeFound)
6008  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6009  else
6010  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
6011  if (With == NULL) break;
6012  With->length=0;
6013  With->pLength=0;
6014  strat->redTailChange=TRUE;
6015  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
6016  {
6017  // reducing the tail would violate the exp bound
6018  if (kStratChangeTailRing(strat, L))
6019  {
6020  strat->kHEdgeFound = save_HE;
6021  return redtail(L, pos, strat);
6022  }
6023  else
6024  return NULL;
6025  }
6026  hn = pNext(h);
6027  if (hn == NULL) goto all_done;
6028  op = strat->tailRing->pFDeg(hn, strat->tailRing);
6029  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
6030  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
6031  }
6032  h = hn;
6033  hn = pNext(h);
6034  }
6035 
6036  all_done:
6037  if (strat->redTailChange)
6038  {
6039  L->pLength = 0;
6040  }
6041  strat->kHEdgeFound = save_HE;
6042  return p;
6043 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5975
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:1055
#define TRUE
Definition: auxiliary.h:144
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9361
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5872
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:4559
#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 6045 of file kutil.cc.

6046 {
6047  LObject L(p, currRing);
6048  return redtail(&L, pos, strat);
6049 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5975
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 6051 of file kutil.cc.

6052 {
6053 #define REDTAIL_CANONICALIZE 100
6054  strat->redTailChange=FALSE;
6055  if (strat->noTailReduction) return L->GetLmCurrRing();
6056  poly h, p;
6057  p = h = L->GetLmTailRing();
6058  if ((h==NULL) || (pNext(h)==NULL))
6059  return L->GetLmCurrRing();
6060 
6061  TObject* With;
6062  // placeholder in case strat->tl < 0
6063  TObject With_s(strat->tailRing);
6064 
6065  LObject Ln(pNext(h), strat->tailRing);
6066  Ln.pLength = L->GetpLength() - 1;
6067 
6068  pNext(h) = NULL;
6069  if (L->p != NULL) pNext(L->p) = NULL;
6070  L->pLength = 1;
6071 
6072  Ln.PrepareRed(strat->use_buckets);
6073 
6074  int cnt=REDTAIL_CANONICALIZE;
6075  while(!Ln.IsNull())
6076  {
6077  loop
6078  {
6079  if (TEST_OPT_IDLIFT)
6080  {
6081  if (Ln.p!=NULL)
6082  {
6083  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
6084  }
6085  else
6086  {
6087  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
6088  }
6089  }
6090  Ln.SetShortExpVector();
6091  if (withT)
6092  {
6093  int j;
6094  j = kFindDivisibleByInT(strat, &Ln);
6095  if (j < 0) break;
6096  With = &(strat->T[j]);
6097  }
6098  else
6099  {
6100  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6101  if (With == NULL) break;
6102  }
6103  cnt--;
6104  if (cnt==0)
6105  {
6107  /*poly tmp=*/Ln.CanonicalizeP();
6108  if (normalize)
6109  {
6110  Ln.Normalize();
6111  //pNormalize(tmp);
6112  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
6113  }
6114  }
6115  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
6116  {
6117  With->pNorm();
6118  }
6119  strat->redTailChange=TRUE;
6120  if (ksReducePolyTail(L, With, &Ln))
6121  {
6122  // reducing the tail would violate the exp bound
6123  // set a flag and hope for a retry (in bba)
6124  strat->completeReduce_retry=TRUE;
6125  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6126  do
6127  {
6128  pNext(h) = Ln.LmExtractAndIter();
6129  pIter(h);
6130  L->pLength++;
6131  } while (!Ln.IsNull());
6132  goto all_done;
6133  }
6134  if (Ln.IsNull()) goto all_done;
6135  if (! withT) With_s.Init(currRing);
6136  }
6137  pNext(h) = Ln.LmExtractAndIter();
6138  pIter(h);
6139  pNormalize(h);
6140  L->pLength++;
6141  }
6142 
6143  all_done:
6144  Ln.Delete();
6145  if (L->p != NULL) pNext(L->p) = pNext(p);
6146 
6147  if (strat->redTailChange)
6148  {
6149  L->length = 0;
6150  L->pLength = 0;
6151  }
6152 
6153  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6154  //L->Normalize(); // HANNES: should have a test
6155  kTest_L(L);
6156  return L->GetLmCurrRing();
6157 }
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:1055
#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:5872
#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 6160 of file kutil.cc.

6162 {
6163  strat->redTailChange=FALSE;
6164  if (strat->noTailReduction) return L->GetLmCurrRing();
6165  poly h, p;
6166  p = h = L->GetLmTailRing();
6167  if ((h==NULL) || (pNext(h)==NULL))
6168  return L->GetLmCurrRing();
6169 
6170  TObject* With;
6171  // placeholder in case strat->tl < 0
6172  TObject With_s(strat->tailRing);
6173 
6174  LObject Ln(pNext(h), strat->tailRing);
6175  Ln.pLength = L->GetpLength() - 1;
6176 
6177  pNext(h) = NULL;
6178  if (L->p != NULL) pNext(L->p) = NULL;
6179  L->pLength = 1;
6180 
6181  Ln.PrepareRed(strat->use_buckets);
6182 
6183  int cnt=REDTAIL_CANONICALIZE;
6184  while(!Ln.IsNull())
6185  {
6186  loop
6187  {
6188  Ln.SetShortExpVector();
6189  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6190  if (With == NULL) break;
6191  cnt--;
6192  if (cnt==0)
6193  {
6195  /*poly tmp=*/Ln.CanonicalizeP();
6196  }
6197  // we are in Z, do not call pNorm
6198  strat->redTailChange=TRUE;
6199  // test divisibility of coefs:
6200  poly p_Ln=Ln.GetLmCurrRing();
6201  poly p_With=With->GetLmCurrRing();
6202  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
6203  if (!nIsZero(z))
6204  {
6205  // subtract z*Ln, add z.Ln to L
6206  poly m=pHead(p_Ln);
6207  pSetCoeff(m,z);
6208  poly mm=pHead(m);
6209  pNext(h) = m;
6210  pIter(h);
6211  L->pLength++;
6212  mm=pNeg(mm);
6213  if (Ln.bucket!=NULL)
6214  {
6215  int dummy=1;
6216  kBucket_Add_q(Ln.bucket,mm,&dummy);
6217  }
6218  else
6219  {
6220  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
6221  Ln.GetP();
6222  if (Ln.p!=NULL)
6223  {
6224  Ln.p=pAdd(Ln.p,mm);
6225  if (Ln.t_p!=NULL)
6226  {
6227  pNext(Ln.t_p)=NULL;
6228  p_LmDelete(Ln.t_p,strat->tailRing);
6229  }
6230  }
6231  }
6232  }
6233  else
6234  nDelete(&z);
6235 
6236  if (ksReducePolyTail(L, With, &Ln))
6237  {
6238  // reducing the tail would violate the exp bound
6239  // set a flag and hope for a retry (in bba)
6240  strat->completeReduce_retry=TRUE;
6241  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6242  do
6243  {
6244  pNext(h) = Ln.LmExtractAndIter();
6245  pIter(h);
6246  L->pLength++;
6247  } while (!Ln.IsNull());
6248  goto all_done;
6249  }
6250  if (Ln.IsNull()) goto all_done;
6251  With_s.Init(currRing);
6252  }
6253  pNext(h) = Ln.LmExtractAndIter();
6254  pIter(h);
6255  pNormalize(h);
6256  L->pLength++;
6257  }
6258 
6259  all_done:
6260  Ln.Delete();
6261  if (L->p != NULL) pNext(L->p) = pNext(p);
6262 
6263  if (strat->redTailChange)
6264  {
6265  L->length = 0;
6266  }
6267 
6268  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6269  //L->Normalize(); // HANNES: should have a test
6270  kTest_L(L);
6271  return L->GetLmCurrRing();
6272 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
#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:1055
#define pNeg(p)
Definition: polys.h:169
#define TRUE
Definition: auxiliary.h:144
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h: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:5872
#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:707
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 10846 of file kutil.cc.

10847 {
10848  /* for the shift case need to run it with withT = TRUE */
10849  strat->redTailChange=FALSE;
10850  if (strat->noTailReduction) return L->GetLmCurrRing();
10851  poly h, p;
10852  p = h = L->GetLmTailRing();
10853  if ((h==NULL) || (pNext(h)==NULL))
10854  return L->GetLmCurrRing();
10855 
10856  TObject* With;
10857  // placeholder in case strat->tl < 0
10858  TObject With_s(strat->tailRing);
10859 
10860  LObject Ln(pNext(h), strat->tailRing);
10861  Ln.pLength = L->GetpLength() - 1;
10862 
10863  pNext(h) = NULL;
10864  if (L->p != NULL) pNext(L->p) = NULL;
10865  L->pLength = 1;
10866 
10867  Ln.PrepareRed(strat->use_buckets);
10868 
10869  while(!Ln.IsNull())
10870  {
10871  loop
10872  {
10873  Ln.SetShortExpVector();
10874  if (withT)
10875  {
10876  int j;
10877  j = kFindDivisibleByInT(strat, &Ln);
10878  if (j < 0) break;
10879  With = &(strat->T[j]);
10880  }
10881  else
10882  {
10883  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
10884  if (With == NULL) break;
10885  }
10886  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
10887  {
10888  With->pNorm();
10889  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
10890  }
10891  strat->redTailChange=TRUE;
10892  if (ksReducePolyTail(L, With, &Ln))
10893  {
10894  // reducing the tail would violate the exp bound
10895  // set a flag and hope for a retry (in bba)
10896  strat->completeReduce_retry=TRUE;
10897  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
10898  do
10899  {
10900  pNext(h) = Ln.LmExtractAndIter();
10901  pIter(h);
10902  L->pLength++;
10903  } while (!Ln.IsNull());
10904  goto all_done;
10905  }
10906  if (Ln.IsNull()) goto all_done;
10907  if (! withT) With_s.Init(currRing);
10908  }
10909  pNext(h) = Ln.LmExtractAndIter();
10910  pIter(h);
10911  L->pLength++;
10912  }
10913 
10914  all_done:
10915  Ln.Delete();
10916  if (L->p != NULL) pNext(L->p) = pNext(p);
10917 
10918  if (strat->redTailChange)
10919  {
10920  L->length = 0;
10921  }
10922  L->Normalize(); // HANNES: should have a test
10923  kTest_L(L);
10924  return L->GetLmCurrRing();
10925 }
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:1055
#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:5872
#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 4148 of file kutil.cc.

4149 {
4150  int i,j,at,ecart, s2r;
4151  int fq=0;
4152  unsigned long sev;
4153  poly p;
4154  int new_suc=strat->sl+1;
4155  i= *suc;
4156  if (i<0) i=0;
4157 
4158  for (; i<=strat->sl; i++)
4159  {
4160  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4161  if (at != i)
4162  {
4163  if (new_suc > at) new_suc = at;
4164  p = strat->S[i];
4165  ecart = strat->ecartS[i];
4166  sev = strat->sevS[i];
4167  s2r = strat->S_2_R[i];
4168  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
4169  for (j=i; j>=at+1; j--)
4170  {
4171  strat->S[j] = strat->S[j-1];
4172  strat->ecartS[j] = strat->ecartS[j-1];
4173  strat->sevS[j] = strat->sevS[j-1];
4174  strat->S_2_R[j] = strat->S_2_R[j-1];
4175  }
4176  strat->S[at] = p;
4177  strat->ecartS[at] = ecart;
4178  strat->sevS[at] = sev;
4179  strat->S_2_R[at] = s2r;
4180  if (strat->fromQ!=NULL)
4181  {
4182  for (j=i; j>=at+1; j--)
4183  {
4184  strat->fromQ[j] = strat->fromQ[j-1];
4185  }
4186  strat->fromQ[at]=fq;
4187  }
4188  }
4189  }
4190  if (new_suc <= strat->sl) *suc=new_suc;
4191  else *suc=-1;
4192 }
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:4201
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 9491 of file kutil.cc.

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

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

Definition at line 1172 of file kutil.cc.

1173 {
1174  return (ecart1 <= ecart2);
1175 }
void superenterpairs ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR 
)

Definition at line 3904 of file kutil.cc.

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

5677 {
5678 //#if 1
5679 #ifdef DEBUGF5
5680  Print("syzygy criterion checks: ");
5681  pWrite(sig);
5682 #endif
5683  for (int k=0; k<strat->syzl; k++)
5684  {
5685  //printf("-%d",k);
5686 //#if 1
5687 #ifdef DEBUGF5
5688  Print("checking with: %d / %d -- \n",k,strat->syzl);
5689  pWrite(pHead(strat->syz[k]));
5690 #endif
5691  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5692  {
5693 //#if 1
5694 #ifdef DEBUGF5
5695  PrintS("DELETE!\n");
5696 #endif
5697  //printf("- T -\n\n");
5698  return TRUE;
5699  }
5700  }
5701  //printf("- F -\n\n");
5702  return FALSE;
5703 }
#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:1710
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 5708 of file kutil.cc.

5709 {
5710 //#if 1
5711 #ifdef DEBUGF5
5712  Print("--- syzygy criterion checks: ");
5713  pWrite(sig);
5714 #endif
5715  int comp = p_GetComp(sig, currRing);
5716  int min, max;
5717  if (comp<=1)
5718  return FALSE;
5719  else
5720  {
5721  min = strat->syzIdx[comp-2];
5722  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
5723  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
5724  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
5725  if (comp == strat->currIdx)
5726  {
5727  max = strat->syzl;
5728  }
5729  else
5730  {
5731  max = strat->syzIdx[comp-1];
5732  }
5733  for (int k=min; k<max; k++)
5734  {
5735 #ifdef F5DEBUG
5736  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
5737  Print("checking with: %d -- ",k);
5738  pWrite(pHead(strat->syz[k]));
5739 #endif
5740  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5741  return TRUE;
5742  }
5743  return FALSE;
5744  }
5745 }
#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:1710
#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 3366 of file kutil.cc.

3367 {
3368  return 1L << arg;
3369 }
void updateResult ( ideal  r,
ideal  Q,
kStrategy  strat 
)

Definition at line 8648 of file kutil.cc.

8649 {
8650  int l;
8651  if (strat->ak>0)
8652  {
8653  for (l=IDELEMS(r)-1;l>=0;l--)
8654  {
8655  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
8656  {
8657  pDelete(&r->m[l]); // and set it to NULL
8658  }
8659  }
8660  int q;
8661  poly p;
8662  for (l=IDELEMS(r)-1;l>=0;l--)
8663  {
8664  if ((r->m[l]!=NULL)
8665  //&& (strat->syzComp>0)
8666  //&& (pGetComp(r->m[l])<=strat->syzComp)
8667  )
8668  {
8669  for(q=IDELEMS(Q)-1; q>=0;q--)
8670  {
8671  if ((Q->m[q]!=NULL)
8672  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
8673  {
8674  #if HAVE_RINGS
8675  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8676  #endif
8677  {
8678  if (TEST_OPT_REDSB)
8679  {
8680  p=r->m[l];
8681  r->m[l]=kNF(Q,NULL,p);
8682  pDelete(&p);
8683  }
8684  else
8685  {
8686  pDelete(&r->m[l]); // and set it to NULL
8687  }
8688  break;
8689  }
8690  }
8691  }
8692  }
8693  }
8694  }
8695  else
8696  {
8697  int q;
8698  poly p;
8699  BOOLEAN reduction_found=FALSE;
8700  if (!rField_is_Ring(currRing))
8701  {
8702  for (l=IDELEMS(r)-1;l>=0;l--)
8703  {
8704  if (r->m[l]!=NULL)
8705  {
8706  for(q=IDELEMS(Q)-1; q>=0;q--)
8707  {
8708  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
8709  {
8710  if (TEST_OPT_REDSB)
8711  {
8712  p=r->m[l];
8713  r->m[l]=kNF(Q,NULL,p);
8714  pDelete(&p);
8715  reduction_found=TRUE;
8716  }
8717  else
8718  {
8719  pDelete(&r->m[l]); // and set it to NULL
8720  }
8721  break;
8722  }
8723  }
8724  }
8725  }
8726  }
8727  #ifdef HAVE_RINGS
8728  //Also need divisibility of the leading coefficients
8729  else
8730  {
8731  for (l=IDELEMS(r)-1;l>=0;l--)
8732  {
8733  if (r->m[l]!=NULL)
8734  {
8735  for(q=IDELEMS(Q)-1; q>=0;q--)
8736  {
8737  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8738  {
8739  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
8740  {
8741  if (TEST_OPT_REDSB)
8742  {
8743  p=r->m[l];
8744  r->m[l]=kNF(Q,NULL,p);
8745  pDelete(&p);
8746  reduction_found=TRUE;
8747  }
8748  else
8749  {
8750  pDelete(&r->m[l]); // and set it to NULL
8751  }
8752  break;
8753  }
8754  }
8755  }
8756  }
8757  }
8758  }
8759  #endif
8760  if (/*TEST_OPT_REDSB &&*/ reduction_found)
8761  {
8762  for (l=IDELEMS(r)-1;l>=0;l--)
8763  {
8764  if (r->m[l]!=NULL)
8765  {
8766  for(q=IDELEMS(r)-1;q>=0;q--)
8767  {
8768  if ((l!=q)
8769  && (r->m[q]!=NULL)
8770  &&(pLmDivisibleBy(r->m[l],r->m[q]))
8771  #if HAVE_RINGS
8772  && (!rField_is_Ring(currRing) ||
8773  n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8774  #endif
8775  )
8776  {
8777  //If they are equal then take the one with the smallest length
8778  if(pLmDivisibleBy(r->m[q],r->m[l])
8779  #ifdef HAVE_RINGS
8780  && ((rField_is_Ring(currRing)
8781  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8782  || !(rField_is_Ring(currRing)))
8783  #endif
8784  && (pLength(r->m[q]) < pLength(r->m[l]) ||
8785  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
8786  {
8787  pDelete(&r->m[l]);
8788  break;
8789  }
8790  else
8791  pDelete(&r->m[q]);
8792  }
8793  }
8794  }
8795  }
8796  }
8797  }
8798  idSkipZeroes(r);
8799 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
#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 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
#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:437
#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 7345 of file kutil.cc.

7346 {
7347  LObject h;
7348  int i, suc=0;
7349  poly redSi=NULL;
7350  BOOLEAN change,any_change;
7351 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
7352 // for (i=0; i<=(strat->sl); i++)
7353 // {
7354 // Print("s%d:",i);
7355 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
7356 // pWrite(strat->S[i]);
7357 // }
7358 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
7359  any_change=FALSE;
7361  {
7362  while (suc != -1)
7363  {
7364  i=suc+1;
7365  while (i<=strat->sl)
7366  {
7367  change=FALSE;
7368  #ifdef HAVE_RINGS
7370  any_change = FALSE;
7371  #endif
7372  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
7373  {
7374  redSi = pHead(strat->S[i]);
7375  strat->S[i] = redBba(strat->S[i],i-1,strat);
7376  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
7377  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
7378  if (pCmp(redSi,strat->S[i])!=0)
7379  {
7380  change=TRUE;
7381  any_change=TRUE;
7382  #ifdef KDEBUG
7383  if (TEST_OPT_DEBUG)
7384  {
7385  PrintS("reduce:");
7386  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
7387  }
7388  #endif
7389  if (TEST_OPT_PROT)
7390  {
7391  if (strat->S[i]==NULL)
7392  PrintS("V");
7393  else
7394  PrintS("v");
7395  mflush();
7396  }
7397  }
7398  pLmDelete(&redSi);
7399  if (strat->S[i]==NULL)
7400  {
7401  deleteInS(i,strat);
7402  i--;
7403  }
7404  else if (change)
7405  {
7407  {
7408  if (TEST_OPT_CONTENTSB)
7409  {
7410  number n;
7411  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
7412  if (!nIsOne(n))
7413  {
7415  denom->n=nInvers(n);
7416  denom->next=DENOMINATOR_LIST;
7417  DENOMINATOR_LIST=denom;
7418  }
7419  nDelete(&n);
7420  }
7421  else
7422  {
7423  //pContent(strat->S[i]);
7424  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
7425  }
7426  }
7427  else
7428  {
7429  pNorm(strat->S[i]);
7430  }
7431  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
7432  }
7433  }
7434  i++;
7435  }
7436  if (any_change) reorderS(&suc,strat);
7437  else break;
7438  }
7439  if (toT)
7440  {
7441  for (i=0; i<=strat->sl; i++)
7442  {
7443  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7444  {
7445  h.p = redtailBba(strat->S[i],i-1,strat);
7447  {
7448  h.pCleardenom();// also does a pContent
7449  }
7450  }
7451  else
7452  {
7453  h.p = strat->S[i];
7454  }
7455  strat->initEcart(&h);
7456  if (strat->honey)
7457  {
7458  strat->ecartS[i] = h.ecart;
7459  }
7460  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
7461  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
7462  h.sev = strat->sevS[i];
7463  /*puts the elements of S also to T*/
7464  strat->initEcart(&h);
7465  enterT(h,strat);
7466  strat->S_2_R[i] = strat->tl;
7467  }
7468  }
7469  }
7470  else
7471  {
7472  while (suc != -1)
7473  {
7474  i=suc;
7475  while (i<=strat->sl)
7476  {
7477  change=FALSE;
7478  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
7479  {
7480  redSi=pHead((strat->S)[i]);
7481  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
7482  if ((strat->S)[i]==NULL)
7483  {
7484  deleteInS(i,strat);
7485  i--;
7486  }
7487  else if (pCmp((strat->S)[i],redSi)!=0)
7488  {
7489  any_change=TRUE;
7490  h.p = strat->S[i];
7491  strat->initEcart(&h);
7492  strat->ecartS[i] = h.ecart;
7494  {
7495  if (TEST_OPT_CONTENTSB)
7496  {
7497  number n;
7498  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
7499  if (!nIsOne(n))
7500  {
7502  denom->n=nInvers(n);
7503  denom->next=DENOMINATOR_LIST;
7504  DENOMINATOR_LIST=denom;
7505  }
7506  nDelete(&n);
7507  }
7508  else
7509  {
7510  //pContent(strat->S[i]);
7511  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
7512  }
7513  }
7514  else
7515  {
7516  pNorm(strat->S[i]); // == h.p
7517  }
7518  h.sev = pGetShortExpVector(h.p);
7519  strat->sevS[i] = h.sev;
7520  }
7521  pLmDelete(&redSi);
7522  kTest(strat);
7523  }
7524  i++;
7525  }
7526 #ifdef KDEBUG
7527  kTest(strat);
7528 #endif
7529  if (any_change) reorderS(&suc,strat);
7530  else { suc=-1; break; }
7531  if (h.p!=NULL)
7532  {
7533  if (!strat->kHEdgeFound)
7534  {
7535  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
7536  }
7537  if (strat->kHEdgeFound)
7538  newHEdge(strat);
7539  }
7540  }
7541  for (i=0; i<=strat->sl; i++)
7542  {
7543  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7544  {
7545  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
7546  strat->initEcart(&h);
7547  strat->ecartS[i] = h.ecart;
7548  h.sev = pGetShortExpVector(h.p);
7549  strat->sevS[i] = h.sev;
7550  }
7551  else
7552  {
7553  h.p = strat->S[i];
7554  h.ecart=strat->ecartS[i];
7555  h.sev = strat->sevS[i];
7556  h.length = h.pLength = pLength(h.p);
7557  }
7558  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7559  cancelunit1(&h,&suc,strat->sl,strat);
7560  h.SetpFDeg();
7561  /*puts the elements of S also to T*/
7562  enterT(h,strat);
7563  strat->S_2_R[i] = strat->tl;
7564  }
7565  if (suc!= -1) updateS(toT,strat);
7566  }
7567 #ifdef KDEBUG
7568  kTest(strat);
7569 #endif
7570 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5975
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:322
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:7193
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4148
#define TEST_OPT_CONTENTSB
Definition: options.h:121
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int tl
Definition: kutil.h: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:946
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6051
#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:7281
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7811
#define mflush()
Definition: reporter.h:55
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2826
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
kStrategy strat
Definition: myNF.cc:319
#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:437
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
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:7345
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:7304
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8924
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:2682
void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 10152 of file kutil.cc.

10153 {
10154  /* to use after updateS(toT=FALSE,strat) */
10155  /* fills T with shifted elt's of S */
10156  int i;
10157  LObject h;
10158  int atT = -1; // or figure out smth better
10159  strat->tl = -1; // init
10160  for (i=0; i<=strat->sl; i++)
10161  {
10162  memset(&h,0,sizeof(h));
10163  h.p = strat->S[i]; // lm in currRing, tail in TR
10164  strat->initEcart(&h);
10165  h.sev = strat->sevS[i];
10166  h.t_p = NULL;
10167  h.GetTP(); // creates correct t_p
10168  /*puts the elements of S with their shifts to T*/
10169  // int atT, int uptodeg, int lV)
10170  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
10171  // need a small check for above; we insert >=1 elements
10172  // insert this check into kTest_TS ?
10173  enterTShift(h,strat,atT,uptodeg,lV);
10174  }
10175  /* what about setting strat->tl? */
10176 }
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:10803
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.