My Project  debian-1:4.1.2-p1+ds-2
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 "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 "polys/shiftop.h"
#include "polys/prCopy.h"
#include "kernel/GBEngine/ratgring.h"

Go to the source code of this file.

Macros

#define KUTIL_CC
 
#define MYTEST   0
 
#define ALL_VS_JUST   0
 
#define EXT_POLY_NEW   0
 
#define KDEBUG   2
 
#define ENTER_USE_MEMMOVE
 
#define pDivComp_EQUAL   2
 
#define pDivComp_LESS   1
 
#define pDivComp_GREATER   -1
 
#define pDivComp_INCOMP   0
 
#define REDTAIL_CANONICALIZE   100
 

Functions

static poly redMora (poly h, int maxIndex, kStrategy strat)
 
static poly redBba (poly h, int maxIndex, kStrategy strat)
 
static int pDivCompRing (poly p, poly q)
 
static int pDivComp (poly p, poly q)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext)
 
void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void cancelunit (LObject *L, BOOLEAN inNF)
 
void HEckeTest (poly pp, kStrategy strat)
 
static intset initec (const int maxnr)
 
static unsigned long * initsevS (const int maxnr)
 
static int * initS_2_R (const int maxnr)
 
static void enlargeT (TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
 
void cleanT (kStrategy strat)
 
void cleanTSbaRing (kStrategy strat)
 
static void enlargeL (LSet *L, int *length, const int incr)
 
void initPairtest (kStrategy strat)
 
BOOLEAN isInPairsetL (int length, poly p1, poly p2, int *k, kStrategy strat)
 
BOOLEAN isInPairsetB (poly q, int *k, kStrategy strat)
 
int kFindInT (poly p, TSet T, int tlength)
 returns index of p in TSet, or -1 if not found More...
 
int kFindInT (poly p, kStrategy strat)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
void initEcartPairBba (LObject *Lp, poly, poly, int, int)
 
void initEcartPairMora (LObject *Lp, poly, poly, int ecartF, int ecartG)
 
static BOOLEAN sugarDivisibleBy (int ecart1, int ecart2)
 
static void enterOnePairRing (int i, poly p, int, int isFromQ, kStrategy strat, int atR)
 
static BOOLEAN enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
 
BOOLEAN sbaCheckGcdPair (LObject *h, kStrategy strat)
 
static BOOLEAN enterOneStrongPolySig (int i, poly p, poly sig, int, int, kStrategy strat, int atR)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static BOOLEAN p_HasNotCF_Lift (poly p1, poly p2, const ring r)
 p_HasNotCF for the IDLIFT case: ignore component More...
 
static void enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static void enterOnePairSig (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static void enterOnePairSigRing (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSpecial (int i, poly p, int ecart, kStrategy strat, int atR=-1)
 
void kMergeBintoL (kStrategy strat)
 
void kMergeBintoLSba (kStrategy strat)
 
void chainCritNormal (poly p, int ecart, kStrategy strat)
 
void chainCritOpt_1 (poly, int, kStrategy strat)
 
void chainCritSig (poly p, int, kStrategy strat)
 
void chainCritPart (poly p, int ecart, kStrategy strat)
 
void initenterpairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSigRing (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void chainCritRing (poly p, int, kStrategy strat)
 
long ind2 (long arg)
 
long ind_fact_2 (long arg)
 
long twoPow (long arg)
 
void enterOneZeroPairRing (poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
 
int nextZeroSimplexExponent (long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
 
poly kCreateZeroPoly (long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
 
void initenterzeropairsRing (poly p, int ecart, kStrategy strat, int atR)
 
ideal createG0 ()
 
void initenterstrongPairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static void initenterstrongPairsSig (poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
 
void clearSbatch (poly h, int k, int pos, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSpecial (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
void reorderS (int *suc, kStrategy strat)
 
int posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInSMonFirst (const kStrategy strat, const int length, const poly p)
 
int posInIdealMonFirst (const ideal F, const poly p, int start, int end)
 
int posInT0 (const TSet, const int length, LObject &)
 
int posInT1 (const TSet set, const int length, LObject &p)
 
int posInT2 (const TSet set, const int length, LObject &p)
 
int posInT11 (const TSet set, const int length, LObject &p)
 
int posInT11Ring (const TSet set, const int length, LObject &p)
 
int posInTrg0 (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT110Ring (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT15Ring (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17Ring (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT17_cRing (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInLSpecial (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSig (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSigRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInSyz (const kStrategy strat, poly sig)
 
int posInLF5C (const LSet, const int, LObject *, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL11Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *p, const kStrategy)
 
int posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy)
 
int getIndexRng (long coeff)
 
int posInLrg0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL13 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_c (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_cRing (const LSet set, const int length, LObject *p, const kStrategy)
 
BOOLEAN syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN faugereRewCriterion (poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterion (poly, unsigned long, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
 
TObjectkFindDivisibleByInS_T (kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
 
poly redtail (LObject *L, int end_pos, kStrategy strat)
 
poly redtail (poly p, int end_pos, kStrategy strat)
 
poly redtailBba (LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
poly redtailBbaBound (LObject *L, int end_pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize)
 
void redtailBbaAlsoLC_Z (LObject *L, int end_pos, kStrategy strat)
 
poly redtailBba_Z (LObject *L, int end_pos, kStrategy strat)
 
void message (int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
 
void messageStat (int hilbcount, kStrategy strat)
 
void messageStatSBA (int hilbcount, kStrategy strat)
 
void initS (ideal F, ideal Q, kStrategy strat)
 
void initSL (ideal F, ideal Q, kStrategy strat)
 
void initSLSba (ideal F, ideal Q, kStrategy strat)
 
void initSyzRules (kStrategy strat)
 
void initSSpecial (ideal F, ideal Q, ideal P, kStrategy strat)
 
void initSSpecialSba (ideal F, ideal Q, ideal P, kStrategy strat)
 
static poly redBba1 (poly h, int maxIndex, kStrategy strat)
 
void cancelunit1 (LObject *p, int *suc, int index, kStrategy strat)
 
void updateS (BOOLEAN toT, kStrategy strat)
 
void enterSBba (LObject &p, int atS, kStrategy strat, int atR)
 
void enterSBbaShift (LObject &p, int atS, kStrategy strat, int atR)
 
void enterSSba (LObject &p, int atS, kStrategy strat, int atR)
 
void replaceInLAndSAndT (LObject &p, int tj, kStrategy strat)
 
void enterT (LObject &p, kStrategy strat, int atT)
 
void enterT_strong (LObject &p, kStrategy strat, int atT)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void initHilbCrit (ideal, ideal, intvec **hilb, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
BOOLEAN kPosInLDependsOnLength (int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
 
void initBuchMoraPos (kStrategy strat)
 
void initBuchMoraPosRing (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT)
 
BOOLEAN newHEdge (kStrategy strat)
 
BOOLEAN kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
 
BOOLEAN kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
 
poly preIntegerCheck (const ideal Forig, const ideal Q)
 used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMon (LObject *h, kStrategy strat)
 used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMonSig (LObject *h, kStrategy strat)
 
void finalReduceByMon (kStrategy strat)
 used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output More...
 
BOOLEAN kStratChangeTailRing (kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
 
void kStratInitChangeTailRing (kStrategy strat)
 
ring sbaRing (kStrategy strat, const ring r, BOOLEAN, int)
 
int posInT_EcartFDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_FDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_pLength (const TSet set, const int length, LObject &p)
 
int redFirst (LObject *h, kStrategy strat)
 
int redEcart (LObject *h, kStrategy strat)
 
void enterSMora (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSMoraNF (LObject &p, int atS, kStrategy strat, int atR=-1)
 
char * showOption ()
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject H, kStrategy strat)
 
static void enterOnePairWithShifts (int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_lastVblock)
 
static void enterOnePairWithoutShifts (int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_shift)
 
void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
 
void initenterpairsShift (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterTShift (LObject p, kStrategy strat, int atT)
 
poly redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 

Variables

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

Macro Definition Documentation

◆ ALL_VS_JUST

#define ALL_VS_JUST   0

Definition at line 16 of file kutil.cc.

◆ ENTER_USE_MEMMOVE

#define ENTER_USE_MEMMOVE

Definition at line 50 of file kutil.cc.

◆ EXT_POLY_NEW

#define EXT_POLY_NEW   0

Definition at line 20 of file kutil.cc.

◆ KDEBUG

#define KDEBUG   2

Definition at line 35 of file kutil.cc.

◆ KUTIL_CC

#define KUTIL_CC

Definition at line 9 of file kutil.cc.

◆ MYTEST

#define MYTEST   0

Definition at line 11 of file kutil.cc.

◆ pDivComp_EQUAL

#define pDivComp_EQUAL   2

Definition at line 138 of file kutil.cc.

◆ pDivComp_GREATER

#define pDivComp_GREATER   -1

Definition at line 140 of file kutil.cc.

◆ pDivComp_INCOMP

#define pDivComp_INCOMP   0

Definition at line 141 of file kutil.cc.

◆ pDivComp_LESS

#define pDivComp_LESS   1

Definition at line 139 of file kutil.cc.

◆ REDTAIL_CANONICALIZE

#define REDTAIL_CANONICALIZE   100

Function Documentation

◆ arriRewCriterion()

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

Definition at line 7187 of file kutil.cc.

7189 {
7191  return FALSE;
7192  poly p1 = pOne();
7193  poly p2 = pOne();
7194  for (int ii=strat->sl; ii>start; ii--)
7195  {
7196  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7197  {
7198  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7199  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7200  if (!(pLmCmp(p1,p2) == 1))
7201  {
7202  pDelete(&p1);
7203  pDelete(&p2);
7204  return TRUE;
7205  }
7206  }
7207  }
7208  pDelete(&p1);
7209  pDelete(&p2);
7210  return FALSE;

◆ arriRewCriterionPre()

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

Definition at line 7212 of file kutil.cc.

7214 {
7215  //Over Rings, there are still some changes to do: considering coeffs
7217  return FALSE;
7218  int found = -1;
7219  for (int i=strat->Bl; i>-1; i--) {
7220  if (pLmEqual(strat->B[i].sig,sig))
7221  {
7222  found = i;
7223  break;
7224  }
7225  }
7226  if (found != -1)
7227  {
7228  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7229  {
7230  deleteInL(strat->B,&strat->Bl,found,strat);
7231  }
7232  else
7233  {
7234  return TRUE;
7235  }
7236  }
7237  poly p1 = pOne();
7238  poly p2 = pOne();
7239  for (int ii=strat->sl; ii>-1; ii--)
7240  {
7241  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7242  {
7243  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7244  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7245  if (!(pLmCmp(p1,p2) == 1))
7246  {
7247  pDelete(&p1);
7248  pDelete(&p2);
7249  return TRUE;
7250  }
7251  }
7252  }
7253  pDelete(&p1);
7254  pDelete(&p2);
7255  return FALSE;

◆ cancelunit()

void cancelunit ( LObject L,
BOOLEAN  inNF 
)

Definition at line 332 of file kutil.cc.

334 {
335  number lc;
336 
337  if(rHasGlobalOrdering (currRing)) return;
338  if(TEST_OPT_CANCELUNIT) return;
339 
340  ring r = L->tailRing;
341  poly p = L->GetLmTailRing();
342  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
343 
344  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
345  lc = pGetCoeff(p);
346 #ifdef HAVE_RINGS
347  // Leading coef have to be a unit
348  // example 2x+4x2 should be simplified to 2x*(1+2x)
349  // and 2 is not a unit in Z
350  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
351 #endif
352 
353 
354 // for(i=r->N;i>0;i--)
355 // {
356 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
357 // }
358  poly h = pNext(p);
359  int i;
360 
362  {
363  loop
364  {
365  if (h==NULL)
366  {
367  p_Delete(&pNext(p), r);
368  if (!inNF)
369  {
370  number eins= nCopy(lc);
371  if (L->p != NULL)
372  {
373  pSetCoeff(L->p,eins);
374  if (L->t_p != NULL)
375  pSetCoeff0(L->t_p,eins);
376  }
377  else
378  pSetCoeff(L->t_p,eins);
379  /* p and t_p share the same coeff, if both are !=NULL */
380  /* p==NULL==t_p cannot happen here */
381  }
382  L->ecart = 0;
383  L->length = 1;
384  //if (L->pLength > 0)
385  L->pLength = 1;
386  L->max_exp = NULL;
387 
388  if (L->t_p != NULL && pNext(L->t_p) != NULL)
389  p_Delete(&pNext(L->t_p),r);
390  if (L->p != NULL && pNext(L->p) != NULL)
391  pNext(L->p) = NULL;
392  return;
393  }
394  i = rVar(r);
395  loop
396  {
397  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
398  i--;
399  if (i == 0) break; // does divide, try next monom
400  }
401  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
402  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
403  // domains), no zerodivisor test needed CAUTION
404  if (!n_DivBy(pGetCoeff(h),lc,r->cf))
405  {
406  return;
407  }
408  pIter(h);
409  }
410  }
411  else
412  {
413  loop
414  {
415  if (h==NULL)
416  {
417  p_Delete(&pNext(p), r);
418  if (!inNF)
419  {
420  number eins=nInit(1);
421  if (L->p != NULL)
422  {
423  pSetCoeff(L->p,eins);
424  if (L->t_p != NULL)
425  pSetCoeff0(L->t_p,eins);
426  }
427  else
428  pSetCoeff(L->t_p,eins);
429  /* p and t_p share the same coeff, if both are !=NULL */
430  /* p==NULL==t_p cannot happen here */
431  }
432  L->ecart = 0;
433  L->length = 1;
434  //if (L->pLength > 0)
435  L->pLength = 1;
436  L->max_exp = NULL;
437 
438  if (L->t_p != NULL && pNext(L->t_p) != NULL)
439  p_Delete(&pNext(L->t_p),r);
440  if (L->p != NULL && pNext(L->p) != NULL)
441  pNext(L->p) = NULL;
442 
443  return;
444  }
445  i = rVar(r);
446  loop
447  {
448  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
449  i--;
450  if (i == 0) break; // does divide, try next monom
451  }
452  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
453  pIter(h);
454  }
455  }

◆ cancelunit1()

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

Definition at line 8873 of file kutil.cc.

8880 {
8881  int k;
8882  poly r,h,h1,q;
8883 
8884  if (!pIsVector((*p).p) && ((*p).ecart != 0))
8885  {
8886 #ifdef HAVE_RINGS
8887  // Leading coef have to be a unit: no
8888  // example 2x+4x2 should be simplified to 2x*(1+2x)
8889  // and 2 is not a unit in Z
8890  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
8891 #endif
8892  k = 0;
8893  h1 = r = pCopy((*p).p);
8894  h =pNext(r);
8895  loop
8896  {
8897  if (h==NULL)
8898  {
8899  pDelete(&r);
8900  pDelete(&(pNext((*p).p)));
8901  (*p).ecart = 0;
8902  (*p).length = 1;
8903  (*p).pLength = 1;
8904  (*suc)=0;
8905  return;
8906  }
8907  if (!pDivisibleBy(r,h))
8908  {
8909  q=redBba1(h,index ,strat);
8910  if (q != h)
8911  {
8912  k++;
8913  pDelete(&h);
8914  pNext(h1) = h = q;
8915  }
8916  else
8917  {
8918  pDelete(&r);
8919  return;
8920  }
8921  }
8922  else
8923  {
8924  h1 = h;
8925  pIter(h);
8926  }
8927  if (k > 10)
8928  {

◆ chainCritNormal()

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

Definition at line 3191 of file kutil.cc.

3193 {
3194  int i,j,l;
3195 
3196  /*
3197  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3198  *In this case all elements in B such
3199  *that their lcm is divisible by the leading term of S[i] can be canceled
3200  */
3201  if (strat->pairtest!=NULL)
3202  {
3203  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3204  for (j=0; j<=strat->sl; j++)
3205  {
3206  if (strat->pairtest[j])
3207  {
3208  for (i=strat->Bl; i>=0; i--)
3209  {
3210  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3211  {
3212  deleteInL(strat->B,&strat->Bl,i,strat);
3213  strat->c3++;
3214  }
3215  }
3216  }
3217  }
3218  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3219  strat->pairtest=NULL;
3220  }
3221  if (strat->Gebauer || strat->fromT)
3222  {
3223  if (strat->sugarCrit)
3224  {
3225  /*
3226  *suppose L[j] == (s,r) and p/lcm(s,r)
3227  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3228  *and in case the sugar is o.k. then L[j] can be canceled
3229  */
3230  for (j=strat->Ll; j>=0; j--)
3231  {
3232  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3233  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3234  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3235  {
3236  if (strat->L[j].p == strat->tail)
3237  {
3238  deleteInL(strat->L,&strat->Ll,j,strat);
3239  strat->c3++;
3240  }
3241  }
3242  }
3243  /*
3244  *this is GEBAUER-MOELLER:
3245  *in B all elements with the same lcm except the "best"
3246  *(i.e. the last one in B with this property) will be canceled
3247  */
3248  j = strat->Bl;
3249  loop /*cannot be changed into a for !!! */
3250  {
3251  if (j <= 0) break;
3252  i = j-1;
3253  loop
3254  {
3255  if (i < 0) break;
3256  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3257  {
3258  strat->c3++;
3259  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3260  {
3261  deleteInL(strat->B,&strat->Bl,i,strat);
3262  j--;
3263  }
3264  else
3265  {
3266  deleteInL(strat->B,&strat->Bl,j,strat);
3267  break;
3268  }
3269  }
3270  i--;
3271  }
3272  j--;
3273  }
3274  }
3275  else /*sugarCrit*/
3276  {
3277  /*
3278  *suppose L[j] == (s,r) and p/lcm(s,r)
3279  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3280  *and in case the sugar is o.k. then L[j] can be canceled
3281  */
3282  for (j=strat->Ll; j>=0; j--)
3283  {
3284  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3285  {
3286  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3287  {
3288  deleteInL(strat->L,&strat->Ll,j,strat);
3289  strat->c3++;
3290  }
3291  }
3292  }
3293  /*
3294  *this is GEBAUER-MOELLER:
3295  *in B all elements with the same lcm except the "best"
3296  *(i.e. the last one in B with this property) will be canceled
3297  */
3298  j = strat->Bl;
3299  loop /*cannot be changed into a for !!! */
3300  {
3301  if (j <= 0) break;
3302  for(i=j-1; i>=0; i--)
3303  {
3304  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3305  {
3306  strat->c3++;
3307  deleteInL(strat->B,&strat->Bl,i,strat);
3308  j--;
3309  }
3310  }
3311  j--;
3312  }
3313  }
3314  /*
3315  *the elements of B enter L
3316  */
3317  kMergeBintoL(strat);
3318  }
3319  else
3320  {
3321  for (j=strat->Ll; j>=0; j--)
3322  {
3323  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3324  {
3325  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3326  {
3327  deleteInL(strat->L,&strat->Ll,j,strat);
3328  strat->c3++;
3329  }
3330  }
3331  }
3332  /*
3333  *this is our MODIFICATION of GEBAUER-MOELLER:
3334  *First the elements of B enter L,
3335  *then we fix a lcm and the "best" element in L
3336  *(i.e the last in L with this lcm and of type (s,p))
3337  *and cancel all the other elements of type (r,p) with this lcm
3338  *except the case the element (s,r) has also the same lcm
3339  *and is on the worst position with respect to (s,p) and (r,p)
3340  */
3341  /*
3342  *B enters to L/their order with respect to B is permutated for elements
3343  *B[i].p with the same leading term
3344  */
3345  kMergeBintoL(strat);
3346  j = strat->Ll;
3347  loop /*cannot be changed into a for !!! */
3348  {
3349  if (j <= 0)
3350  {
3351  /*now L[0] cannot be canceled any more and the tail can be removed*/
3352  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3353  break;
3354  }
3355  if (strat->L[j].p2 == p)
3356  {
3357  i = j-1;
3358  loop
3359  {
3360  if (i < 0) break;
3361  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3362  {
3363  /*L[i] could be canceled but we search for a better one to cancel*/
3364  strat->c3++;
3365  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3366  && (pNext(strat->L[l].p) == strat->tail)
3367  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3368  && pDivisibleBy(p,strat->L[l].lcm))
3369  {
3370  /*
3371  *"NOT equal(...)" because in case of "equal" the element L[l]
3372  *is "older" and has to be from theoretical point of view behind
3373  *L[i], but we do not want to reorder L
3374  */
3375  strat->L[i].p2 = strat->tail;
3376  /*
3377  *L[l] will be canceled, we cannot cancel L[i] later on,
3378  *so we mark it with "tail"
3379  */
3380  deleteInL(strat->L,&strat->Ll,l,strat);
3381  i--;
3382  }
3383  else
3384  {
3385  deleteInL(strat->L,&strat->Ll,i,strat);
3386  }
3387  j--;
3388  }
3389  i--;
3390  }
3391  }
3392  else if (strat->L[j].p2 == strat->tail)
3393  {
3394  /*now L[j] cannot be canceled any more and the tail can be removed*/
3395  strat->L[j].p2 = p;
3396  }
3397  j--;
3398  }
3399  }

◆ chainCritOpt_1()

void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 3404 of file kutil.cc.

3406 {
3407  if (strat->pairtest!=NULL)
3408  {
3409  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3410  strat->pairtest=NULL;
3411  }
3412  /*
3413  *the elements of B enter L
3414  */
3415  kMergeBintoL(strat);

◆ chainCritPart()

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

Definition at line 3479 of file kutil.cc.

3481 {
3482  int i,j,l;
3483 
3484  /*
3485  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3486  *In this case all elements in B such
3487  *that their lcm is divisible by the leading term of S[i] can be canceled
3488  */
3489  if (strat->pairtest!=NULL)
3490  {
3491  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3492  for (j=0; j<=strat->sl; j++)
3493  {
3494  if (strat->pairtest[j])
3495  {
3496  for (i=strat->Bl; i>=0; i--)
3497  {
3498  if (_p_LmDivisibleByPart(strat->S[j],currRing,
3499  strat->B[i].lcm,currRing,
3500  currRing->real_var_start,currRing->real_var_end))
3501  {
3502  if(TEST_OPT_DEBUG)
3503  {
3504  Print("chain-crit-part: S[%d]=",j);
3505  p_wrp(strat->S[j],currRing);
3506  Print(" divide B[%d].lcm=",i);
3507  p_wrp(strat->B[i].lcm,currRing);
3508  PrintLn();
3509  }
3510  deleteInL(strat->B,&strat->Bl,i,strat);
3511  strat->c3++;
3512  }
3513  }
3514  }
3515  }
3516  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3517  strat->pairtest=NULL;
3518  }
3519  if (strat->Gebauer || strat->fromT)
3520  {
3521  if (strat->sugarCrit)
3522  {
3523  /*
3524  *suppose L[j] == (s,r) and p/lcm(s,r)
3525  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3526  *and in case the sugar is o.k. then L[j] can be canceled
3527  */
3528  for (j=strat->Ll; j>=0; j--)
3529  {
3530  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3531  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3532  && pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3533  {
3534  if (strat->L[j].p == strat->tail)
3535  {
3536  if(TEST_OPT_DEBUG)
3537  {
3538  PrintS("chain-crit-part: pCompareChainPart p=");
3539  p_wrp(p,currRing);
3540  Print(" delete L[%d]",j);
3541  p_wrp(strat->L[j].lcm,currRing);
3542  PrintLn();
3543  }
3544  deleteInL(strat->L,&strat->Ll,j,strat);
3545  strat->c3++;
3546  }
3547  }
3548  }
3549  /*
3550  *this is GEBAUER-MOELLER:
3551  *in B all elements with the same lcm except the "best"
3552  *(i.e. the last one in B with this property) will be canceled
3553  */
3554  j = strat->Bl;
3555  loop /*cannot be changed into a for !!! */
3556  {
3557  if (j <= 0) break;
3558  i = j-1;
3559  loop
3560  {
3561  if (i < 0) break;
3562  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3563  {
3564  strat->c3++;
3565  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3566  {
3567  if(TEST_OPT_DEBUG)
3568  {
3569  Print("chain-crit-part: sugar B[%d].lcm=",j);
3570  p_wrp(strat->B[j].lcm,currRing);
3571  Print(" delete B[%d]",i);
3572  p_wrp(strat->B[i].lcm,currRing);
3573  PrintLn();
3574  }
3575  deleteInL(strat->B,&strat->Bl,i,strat);
3576  j--;
3577  }
3578  else
3579  {
3580  if(TEST_OPT_DEBUG)
3581  {
3582  Print("chain-crit-part: sugar B[%d].lcm=",i);
3583  p_wrp(strat->B[i].lcm,currRing);
3584  Print(" delete B[%d]",j);
3585  p_wrp(strat->B[j].lcm,currRing);
3586  PrintLn();
3587  }
3588  deleteInL(strat->B,&strat->Bl,j,strat);
3589  break;
3590  }
3591  }
3592  i--;
3593  }
3594  j--;
3595  }
3596  }
3597  else /*sugarCrit*/
3598  {
3599  /*
3600  *suppose L[j] == (s,r) and p/lcm(s,r)
3601  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3602  *and in case the sugar is o.k. then L[j] can be canceled
3603  */
3604  for (j=strat->Ll; j>=0; j--)
3605  {
3606  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3607  {
3608  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3609  {
3610  if(TEST_OPT_DEBUG)
3611  {
3612  PrintS("chain-crit-part: sugar:pCompareChainPart p=");
3613  p_wrp(p,currRing);
3614  Print(" delete L[%d]",j);
3615  p_wrp(strat->L[j].lcm,currRing);
3616  PrintLn();
3617  }
3618  deleteInL(strat->L,&strat->Ll,j,strat);
3619  strat->c3++;
3620  }
3621  }
3622  }
3623  /*
3624  *this is GEBAUER-MOELLER:
3625  *in B all elements with the same lcm except the "best"
3626  *(i.e. the last one in B with this property) will be canceled
3627  */
3628  j = strat->Bl;
3629  loop /*cannot be changed into a for !!! */
3630  {
3631  if (j <= 0) break;
3632  for(i=j-1; i>=0; i--)
3633  {
3634  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3635  {
3636  if(TEST_OPT_DEBUG)
3637  {
3638  Print("chain-crit-part: equal lcm B[%d].lcm=",j);
3639  p_wrp(strat->B[j].lcm,currRing);
3640  Print(" delete B[%d]\n",i);
3641  }
3642  strat->c3++;
3643  deleteInL(strat->B,&strat->Bl,i,strat);
3644  j--;
3645  }
3646  }
3647  j--;
3648  }
3649  }
3650  /*
3651  *the elements of B enter L
3652  */
3653  kMergeBintoL(strat);
3654  }
3655  else
3656  {
3657  for (j=strat->Ll; j>=0; j--)
3658  {
3659  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3660  {
3661  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3662  {
3663  if(TEST_OPT_DEBUG)
3664  {
3665  PrintS("chain-crit-part: pCompareChainPart p=");
3666  p_wrp(p,currRing);
3667  Print(" delete L[%d]",j);
3668  p_wrp(strat->L[j].lcm,currRing);
3669  PrintLn();
3670  }
3671  deleteInL(strat->L,&strat->Ll,j,strat);
3672  strat->c3++;
3673  }
3674  }
3675  }
3676  /*
3677  *this is our MODIFICATION of GEBAUER-MOELLER:
3678  *First the elements of B enter L,
3679  *then we fix a lcm and the "best" element in L
3680  *(i.e the last in L with this lcm and of type (s,p))
3681  *and cancel all the other elements of type (r,p) with this lcm
3682  *except the case the element (s,r) has also the same lcm
3683  *and is on the worst position with respect to (s,p) and (r,p)
3684  */
3685  /*
3686  *B enters to L/their order with respect to B is permutated for elements
3687  *B[i].p with the same leading term
3688  */
3689  kMergeBintoL(strat);
3690  j = strat->Ll;
3691  loop /*cannot be changed into a for !!! */
3692  {
3693  if (j <= 0)
3694  {
3695  /*now L[0] cannot be canceled any more and the tail can be removed*/
3696  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3697  break;
3698  }
3699  if (strat->L[j].p2 == p)
3700  {
3701  i = j-1;
3702  loop
3703  {
3704  if (i < 0) break;
3705  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3706  {
3707  /*L[i] could be canceled but we search for a better one to cancel*/
3708  strat->c3++;
3709  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3710  && (pNext(strat->L[l].p) == strat->tail)
3711  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3713  strat->L[l].lcm,currRing,
3714  currRing->real_var_start, currRing->real_var_end))
3715 
3716  {
3717  /*
3718  *"NOT equal(...)" because in case of "equal" the element L[l]
3719  *is "older" and has to be from theoretical point of view behind
3720  *L[i], but we do not want to reorder L
3721  */
3722  strat->L[i].p2 = strat->tail;
3723  /*
3724  *L[l] will be canceled, we cannot cancel L[i] later on,
3725  *so we mark it with "tail"
3726  */
3727  if(TEST_OPT_DEBUG)
3728  {
3729  PrintS("chain-crit-part: divisible_by p=");
3730  p_wrp(p,currRing);
3731  Print(" delete L[%d]",l);
3732  p_wrp(strat->L[l].lcm,currRing);
3733  PrintLn();
3734  }
3735  deleteInL(strat->L,&strat->Ll,l,strat);
3736  i--;
3737  }
3738  else
3739  {
3740  if(TEST_OPT_DEBUG)
3741  {
3742  PrintS("chain-crit-part: divisible_by(2) p=");
3743  p_wrp(p,currRing);
3744  Print(" delete L[%d]",i);
3745  p_wrp(strat->L[i].lcm,currRing);
3746  PrintLn();
3747  }
3748  deleteInL(strat->L,&strat->Ll,i,strat);
3749  }
3750  j--;
3751  }
3752  i--;
3753  }
3754  }
3755  else if (strat->L[j].p2 == strat->tail)
3756  {
3757  /*now L[j] cannot be canceled any more and the tail can be removed*/
3758  strat->L[j].p2 = p;
3759  }
3760  j--;
3761  }
3762  }

◆ chainCritRing()

void chainCritRing ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3955 of file kutil.cc.

3957 {
3958  int i,j,l;
3959  /*
3960  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3961  *In this case all elements in B such
3962  *that their lcm is divisible by the leading term of S[i] can be canceled
3963  */
3964  if (strat->pairtest!=NULL)
3965  {
3966  {
3967  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3968  for (j=0; j<=strat->sl; j++)
3969  {
3970  if (strat->pairtest[j])
3971  {
3972  for (i=strat->Bl; i>=0; i--)
3973  {
3974  if (pDivisibleBy(strat->S[j],strat->B[i].lcm) && n_DivBy(pGetCoeff(strat->B[i].lcm), pGetCoeff(strat->S[j]),currRing->cf))
3975  {
3976 #ifdef KDEBUG
3977  if (TEST_OPT_DEBUG)
3978  {
3979  PrintS("--- chain criterion func chainCritRing type 1\n");
3980  PrintS("strat->S[j]:");
3981  wrp(strat->S[j]);
3982  PrintS(" strat->B[i].lcm:");
3983  wrp(strat->B[i].lcm);PrintLn();
3984  pWrite(strat->B[i].p);
3985  pWrite(strat->B[i].p1);
3986  pWrite(strat->B[i].p2);
3987  wrp(strat->B[i].lcm);
3988  PrintLn();
3989  }
3990 #endif
3991  deleteInL(strat->B,&strat->Bl,i,strat);
3992  strat->c3++;
3993  }
3994  }
3995  }
3996  }
3997  }
3998  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3999  strat->pairtest=NULL;
4000  }
4001  assume(!(strat->Gebauer || strat->fromT));
4002  for (j=strat->Ll; j>=0; j--)
4003  {
4004  if ((strat->L[j].lcm != NULL) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(p), currRing->cf))
4005  {
4006  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
4007  {
4008  if ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
4009  {
4010  deleteInL(strat->L,&strat->Ll,j,strat);
4011  strat->c3++;
4012 #ifdef KDEBUG
4013  if (TEST_OPT_DEBUG)
4014  {
4015  PrintS("--- chain criterion func chainCritRing type 2\n");
4016  PrintS("strat->L[j].p:");
4017  wrp(strat->L[j].p);
4018  PrintS(" p:");
4019  wrp(p);
4020  PrintLn();
4021  }
4022 #endif
4023  }
4024  }
4025  }
4026  }
4027  /*
4028  *this is our MODIFICATION of GEBAUER-MOELLER:
4029  *First the elements of B enter L,
4030  *then we fix a lcm and the "best" element in L
4031  *(i.e the last in L with this lcm and of type (s,p))
4032  *and cancel all the other elements of type (r,p) with this lcm
4033  *except the case the element (s,r) has also the same lcm
4034  *and is on the worst position with respect to (s,p) and (r,p)
4035  */
4036  /*
4037  *B enters to L/their order with respect to B is permutated for elements
4038  *B[i].p with the same leading term
4039  */
4040  kMergeBintoL(strat);
4041  j = strat->Ll;
4042  loop /*cannot be changed into a for !!! */
4043  {
4044  if (j <= 0)
4045  {
4046  /*now L[0] cannot be canceled any more and the tail can be removed*/
4047  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
4048  break;
4049  }
4050  if (strat->L[j].p2 == p) // Was the element added from B?
4051  {
4052  i = j-1;
4053  loop
4054  {
4055  if (i < 0) break;
4056  // Element is from B and has the same lcm as L[j]
4057  if ((strat->L[i].p2 == p) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(strat->L[i].lcm), currRing->cf)
4058  && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
4059  {
4060  /*L[i] could be canceled but we search for a better one to cancel*/
4061  strat->c3++;
4062 #ifdef KDEBUG
4063  if (TEST_OPT_DEBUG)
4064  {
4065  PrintS("--- chain criterion func chainCritRing type 3\n");
4066  PrintS("strat->L[j].lcm:");
4067  wrp(strat->L[j].lcm);
4068  PrintS(" strat->L[i].lcm:");
4069  wrp(strat->L[i].lcm);
4070  PrintLn();
4071  }
4072 #endif
4073  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
4074  && (pNext(strat->L[l].p) == strat->tail)
4075  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
4076  && pDivisibleBy(p,strat->L[l].lcm))
4077  {
4078  /*
4079  *"NOT equal(...)" because in case of "equal" the element L[l]
4080  *is "older" and has to be from theoretical point of view behind
4081  *L[i], but we do not want to reorder L
4082  */
4083  strat->L[i].p2 = strat->tail;
4084  /*
4085  *L[l] will be canceled, we cannot cancel L[i] later on,
4086  *so we mark it with "tail"
4087  */
4088  deleteInL(strat->L,&strat->Ll,l,strat);
4089  i--;
4090  }
4091  else
4092  {
4093  deleteInL(strat->L,&strat->Ll,i,strat);
4094  }
4095  j--;
4096  }
4097  i--;
4098  }
4099  }
4100  else if (strat->L[j].p2 == strat->tail)
4101  {
4102  /*now L[j] cannot be canceled any more and the tail can be removed*/
4103  strat->L[j].p2 = p;
4104  }
4105  j--;
4106  }

◆ chainCritSig()

void chainCritSig ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3420 of file kutil.cc.

3422 {
3423  int i,j,l;
3424  kMergeBintoLSba(strat);
3425  j = strat->Ll;
3426  loop /*cannot be changed into a for !!! */
3427  {
3428  if (j <= 0)
3429  {
3430  /*now L[0] cannot be canceled any more and the tail can be removed*/
3431  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3432  break;
3433  }
3434  if (strat->L[j].p2 == p)
3435  {
3436  i = j-1;
3437  loop
3438  {
3439  if (i < 0) break;
3440  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3441  {
3442  /*L[i] could be canceled but we search for a better one to cancel*/
3443  strat->c3++;
3444  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3445  && (pNext(strat->L[l].p) == strat->tail)
3446  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3447  && pDivisibleBy(p,strat->L[l].lcm))
3448  {
3449  /*
3450  *"NOT equal(...)" because in case of "equal" the element L[l]
3451  *is "older" and has to be from theoretical point of view behind
3452  *L[i], but we do not want to reorder L
3453  */
3454  strat->L[i].p2 = strat->tail;
3455  /*
3456  *L[l] will be canceled, we cannot cancel L[i] later on,
3457  *so we mark it with "tail"
3458  */
3459  deleteInL(strat->L,&strat->Ll,l,strat);
3460  i--;
3461  }
3462  else
3463  {
3464  deleteInL(strat->L,&strat->Ll,i,strat);
3465  }
3466  j--;
3467  }
3468  i--;
3469  }
3470  }
3471  else if (strat->L[j].p2 == strat->tail)
3472  {
3473  /*now L[j] cannot be canceled any more and the tail can be removed*/
3474  strat->L[j].p2 = p;
3475  }
3476  j--;
3477  }

◆ cleanT()

void cleanT ( kStrategy  strat)

Definition at line 537 of file kutil.cc.

539 {
540  int i,j;
541  poly p;
542  assume(currRing == strat->tailRing || strat->tailRing != NULL);
543 
544  pShallowCopyDeleteProc p_shallow_copy_delete =
545  (strat->tailRing != currRing ?
547  NULL);
548  for (j=0; j<=strat->tl; j++)
549  {
550  p = strat->T[j].p;
551  strat->T[j].p=NULL;
552  if (strat->T[j].max_exp != NULL)
553  {
554  p_LmFree(strat->T[j].max_exp, strat->tailRing);
555  }
556  i = -1;
557  loop
558  {
559  i++;
560  if (i>strat->sl)
561  {
562  if (strat->T[j].t_p != NULL)
563  {
564  p_Delete(&(strat->T[j].t_p), strat->tailRing);
565  p_LmFree(p, currRing);
566  }
567  else
568  {
569 #ifdef HAVE_SHIFTBBA
570  if (currRing->isLPring && strat->T[j].shift > 0)
571  {
572  pNext(p) = NULL; // pNext(p) points to the unshifted tail, don't try to delete it here
573  }
574 #endif
575  pDelete(&p);
576  }
577  break;
578  }
579  if (p == strat->S[i])
580  {
581  if (strat->T[j].t_p != NULL)
582  {
583  if (p_shallow_copy_delete!=NULL)
584  {
585  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
586  currRing->PolyBin);
587  }
588  p_LmFree(strat->T[j].t_p, strat->tailRing);
589  }
590  break;
591  }
592  }
593  }
594  strat->tl=-1;

◆ cleanTSbaRing()

void cleanTSbaRing ( kStrategy  strat)

Definition at line 596 of file kutil.cc.

598 {
599  int i,j;
600  poly p;
601  assume(currRing == strat->tailRing || strat->tailRing != NULL);
602 
603  pShallowCopyDeleteProc p_shallow_copy_delete =
604  (strat->tailRing != currRing ?
606  NULL);
607  for (j=0; j<=strat->tl; j++)
608  {
609  p = strat->T[j].p;
610  strat->T[j].p=NULL;
611  if (strat->T[j].max_exp != NULL)
612  {
613  p_LmFree(strat->T[j].max_exp, strat->tailRing);
614  }
615  i = -1;
616  loop
617  {
618  i++;
619  if (i>strat->sl)
620  {
621  if (strat->T[j].t_p != NULL)
622  {
623  p_Delete(&(strat->T[j].t_p), strat->tailRing);
624  p_LmFree(p, currRing);
625  }
626  else
627  {
628  //pDelete(&p);
629  p = NULL;
630  }
631  break;
632  }
633  if (p == strat->S[i])
634  {
635  if (strat->T[j].t_p != NULL)
636  {
637  assume(p_shallow_copy_delete != NULL);
638  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
639  currRing->PolyBin);
640  p_LmFree(strat->T[j].t_p, strat->tailRing);
641  }
642  break;
643  }
644  }
645  }
646  strat->tl=-1;

◆ clearSbatch()

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

Definition at line 4804 of file kutil.cc.

4806 {
4807  int j = pos;
4808  if ( (!strat->fromT)
4809  && ((strat->syzComp==0)
4810  ||(pGetComp(h)<=strat->syzComp)
4811  ))
4812  {
4813  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4814  unsigned long h_sev = pGetShortExpVector(h);
4815  loop
4816  {
4817  if (j > k) break;
4818  clearS(h,h_sev, &j,&k,strat);
4819  j++;
4820  }
4821  // Print("end clearS sl=%d\n",strat->sl);
4822  }

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 10738 of file kutil.cc.

10746 {
10747  int i;
10748  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10749  LObject L;
10750 
10751 #ifdef KDEBUG
10752  // need to set this: during tailreductions of T[i], T[i].max is out of
10753  // sync
10754  sloppy_max = TRUE;
10755 #endif
10756 
10757  strat->noTailReduction = FALSE;
10758  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10759  if (TEST_OPT_PROT)
10760  {
10761  PrintLn();
10762 // if (timerv) writeTime("standard base computed:");
10763  }
10764  if (TEST_OPT_PROT)
10765  {
10766  Print("(S:%d)",strat->sl);mflush();
10767  }
10768  for (i=strat->sl; i>=low; i--)
10769  {
10770  int end_pos=strat->sl;
10771  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10772  if (strat->ak==0) end_pos=i-1;
10773  TObject* T_j = strat->s_2_t(i);
10774  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10775  {
10776  L = *T_j;
10777  #ifdef KDEBUG
10778  if (TEST_OPT_DEBUG)
10779  {
10780  Print("test S[%d]:",i);
10781  p_wrp(L.p,currRing,strat->tailRing);
10782  PrintLn();
10783  }
10784  #endif
10786  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10787  else
10788  strat->S[i] = redtail(&L, strat->sl, strat);
10789  #ifdef KDEBUG
10790  if (TEST_OPT_DEBUG)
10791  {
10792  Print("to (tailR) S[%d]:",i);
10793  p_wrp(strat->S[i],currRing,strat->tailRing);
10794  PrintLn();
10795  }
10796  #endif
10797 
10798  if (strat->redTailChange)
10799  {
10800  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10801  if (pNext(T_j->p) != NULL)
10802  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10803  else
10804  T_j->max_exp = NULL;
10805  }
10807  T_j->pCleardenom();
10808  }
10809  else
10810  {
10811  assume(currRing == strat->tailRing);
10812  #ifdef KDEBUG
10813  if (TEST_OPT_DEBUG)
10814  {
10815  Print("test S[%d]:",i);
10816  p_wrp(strat->S[i],currRing,strat->tailRing);
10817  PrintLn();
10818  }
10819  #endif
10821  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10822  else
10823  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10825  {
10826  if (TEST_OPT_CONTENTSB)
10827  {
10828  number n;
10829  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
10830  if (!nIsOne(n))
10831  {
10833  denom->n=nInvers(n);
10834  denom->next=DENOMINATOR_LIST;
10835  DENOMINATOR_LIST=denom;
10836  }
10837  nDelete(&n);
10838  }
10839  else
10840  {
10841  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
10842  }
10843  }
10844  #ifdef KDEBUG
10845  if (TEST_OPT_DEBUG)
10846  {
10847  Print("to (-tailR) S[%d]:",i);
10848  p_wrp(strat->S[i],currRing,strat->tailRing);
10849  PrintLn();
10850  }
10851  #endif
10852  }
10853  if (TEST_OPT_PROT)

◆ createG0()

ideal createG0 ( )

Definition at line 4455 of file kutil.cc.

4457 {
4458  // Initialize
4459  long exp[50]; // The exponent of \hat{X} (basepoint)
4460  long cexp[50]; // The current exponent for iterating over all
4461  long ind[50]; // The power of 2 in the i-th component of exp
4462  long cind[50]; // analog for cexp
4463  long mult[50]; // How to multiply the elements of G
4464  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4465  long habsind = 0; // The abs. index of the coefficient of h
4466  long step[50]; // The last increases
4467  for (int i = 1; i <= currRing->N; i++)
4468  {
4469  exp[i] = 0;
4470  cexp[i] = exp[i];
4471  ind[i] = 0;
4472  step[i] = 500000;
4473  cind[i] = ind[i];
4474  }
4475  long bound = currRing->ch;
4476  step[1] = 500000;
4477 #ifdef OLI_DEBUG
4478  PrintS("-------------\npoly :");
4479 // wrp(p);
4480  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4481  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4482  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4483  Print("bound : %d\n", bound);
4484  Print("cind : %d\n", cabsind);
4485 #endif
4486  if (cabsind == 0)
4487  {
4488  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4489  {
4490  return idInit(1, 1);
4491  }
4492  }
4493  ideal G0 = idInit(1, 1);
4494  // Now the whole simplex
4495  do
4496  {
4497  // Build s-polynomial
4498  // 2**ind-def * mult * g - exp-def * h
4499  poly t_p;
4500  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4501 #ifdef OLI_DEBUG
4502  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4503  PrintS("zPoly : ");
4504  wrp(zeroPoly);
4505  PrintLn();
4506 #endif
4507  // Add to ideal
4508  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4509  IDELEMS(G0) += 1;
4510  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4511  }
4512  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4513  idSkipZeroes(G0);
4514  return G0;

◆ deleteHC() [1/2]

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

Definition at line 243 of file kutil.cc.

245 {
246  if (strat->kHEdgeFound)
247  {
248  kTest_L(L,strat->tailRing);
249  poly p1;
250  poly p = L->GetLmTailRing();
251  int l = 1;
252  kBucket_pt bucket = NULL;
253  if (L->bucket != NULL)
254  {
255  kBucketClear(L->bucket, &pNext(p), &L->pLength);
256  L->pLength++;
257  bucket = L->bucket;
258  L->bucket = NULL;
259  }
260 
261  if (!fromNext && p_Cmp(p,strat->kNoetherTail(), L->tailRing) == -1)
262  {
263  L->Delete();
264  L->Clear();
265  L->ecart = -1;
266  if (bucket != NULL) kBucketDestroy(&bucket);
267  return;
268  }
269  p1 = p;
270  while (pNext(p1)!=NULL)
271  {
272  if (p_LmCmp(pNext(p1), strat->kNoetherTail(), L->tailRing) == -1)
273  {
274  p_Delete(&pNext(p1), L->tailRing);
275  if (p1 == p)
276  {
277  if (L->t_p != NULL)
278  {
279  assume(L->p != NULL && p == L->t_p);
280  pNext(L->p) = NULL;
281  }
282  L->max_exp = NULL;
283  }
284  else if (fromNext)
285  L->max_exp = p_GetMaxExpP(pNext(L->p), L->tailRing ); // p1;
286  //if (L->pLength != 0)
287  L->pLength = l;
288  // Hmmm when called from updateT, then only
289  // reset ecart when cut
290  if (fromNext)
291  L->ecart = L->pLDeg() - L->GetpFDeg();
292  break;
293  }
294  l++;
295  pIter(p1);
296  }
297  if (! fromNext)
298  {
299  L->SetpFDeg();
300  L->ecart = L->pLDeg(strat->LDegLast) - L->GetpFDeg();
301  }
302  if (bucket != NULL)
303  {
304  if (L->pLength > 1)
305  {
306  kBucketInit(bucket, pNext(p), L->pLength - 1);
307  pNext(p) = NULL;
308  if (L->t_p != NULL) pNext(L->t_p) = NULL;
309  L->pLength = 0;
310  L->bucket = bucket;
311  }
312  else
313  kBucketDestroy(&bucket);
314  }
315  kTest_L(L,strat->tailRing);
316  }

◆ deleteHC() [2/2]

void deleteHC ( poly *  p,
int *  e,
int *  l,
kStrategy  strat 
)

Definition at line 318 of file kutil.cc.

320 {
321  LObject L(*p, currRing, strat->tailRing);
322 
323  deleteHC(&L, strat);
324  *p = L.p;
325  *e = L.ecart;
326  *l = L.length;
327  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);

◆ deleteInL()

void deleteInL ( LSet  set,
int *  length,
int  j,
kStrategy  strat 
)

Definition at line 1202 of file kutil.cc.

1204 {
1205  if (set[j].lcm!=NULL)
1206  {
1207  kDeleteLcm(&set[j]);
1208  }
1209  if (set[j].sig!=NULL)
1210  {
1211 #ifdef HAVE_RINGS
1212  if (pGetCoeff(set[j].sig) != NULL)
1213  pLmDelete(set[j].sig);
1214  else
1215 #endif
1216  pLmFree(set[j].sig);
1217  }
1218  if (set[j].p!=NULL)
1219  {
1220  if (pNext(set[j].p) == strat->tail)
1221  {
1222 #ifdef HAVE_RINGS
1223  if (pGetCoeff(set[j].p) != NULL)
1224  pLmDelete(set[j].p);
1225  else
1226 #endif
1227  pLmFree(set[j].p);
1228  /*- tail belongs to several int spolys -*/
1229  }
1230  else
1231  {
1232  // search p in T, if it is there, do not delete it
1233  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1234  {
1235  // assure that for global orderings kFindInT fails
1236  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1237  set[j].Delete();
1238  }
1239  }
1240  }
1241  if (*length > 0 && j < *length)
1242  {
1243 #ifdef ENTER_USE_MEMMOVE
1244  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1245 #else
1246  int i;
1247  for (i=j; i < (*length); i++)
1248  set[i] = set[i+1];
1249 #endif
1250  }
1251 #ifdef KDEBUG
1252  memset(&(set[*length]),0,sizeof(LObject));
1253 #endif
1254  (*length)--;

◆ deleteInS()

void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 1095 of file kutil.cc.

1097 {
1098 #ifdef ENTER_USE_MEMMOVE
1099  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1100  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1101  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1102  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1103 #else
1104  int j;
1105  for (j=i; j<strat->sl; j++)
1106  {
1107  strat->S[j] = strat->S[j+1];
1108  strat->ecartS[j] = strat->ecartS[j+1];
1109  strat->sevS[j] = strat->sevS[j+1];
1110  strat->S_2_R[j] = strat->S_2_R[j+1];
1111  }
1112 #endif
1113  if (strat->lenS!=NULL)
1114  {
1115 #ifdef ENTER_USE_MEMMOVE
1116  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1117 #else
1118  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1119 #endif
1120  }
1121  if (strat->lenSw!=NULL)
1122  {
1123 #ifdef ENTER_USE_MEMMOVE
1124  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1125 #else
1126  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1127 #endif
1128  }
1129  if (strat->fromQ!=NULL)
1130  {
1131 #ifdef ENTER_USE_MEMMOVE
1132  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1133 #else
1134  for (j=i; j<strat->sl; j++)
1135  {
1136  strat->fromQ[j] = strat->fromQ[j+1];
1137  }
1138 #endif
1139  }
1140  strat->S[strat->sl] = NULL;
1141  strat->sl--;

◆ deleteInSSba()

void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 1147 of file kutil.cc.

1149 {
1150 #ifdef ENTER_USE_MEMMOVE
1151  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1152  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1153  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1154  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1155  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1156  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1157 #else
1158  int j;
1159  for (j=i; j<strat->sl; j++)
1160  {
1161  strat->S[j] = strat->S[j+1];
1162  strat->sig[j] = strat->sig[j+1];
1163  strat->ecartS[j] = strat->ecartS[j+1];
1164  strat->sevS[j] = strat->sevS[j+1];
1165  strat->sevSig[j] = strat->sevSig[j+1];
1166  strat->S_2_R[j] = strat->S_2_R[j+1];
1167  }
1168 #endif
1169  if (strat->lenS!=NULL)
1170  {
1171 #ifdef ENTER_USE_MEMMOVE
1172  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1173 #else
1174  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1175 #endif
1176  }
1177  if (strat->lenSw!=NULL)
1178  {
1179 #ifdef ENTER_USE_MEMMOVE
1180  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1181 #else
1182  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1183 #endif
1184  }
1185  if (strat->fromQ!=NULL)
1186  {
1187 #ifdef ENTER_USE_MEMMOVE
1188  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1189 #else
1190  for (j=i; j<strat->sl; j++)
1191  {
1192  strat->fromQ[j] = strat->fromQ[j+1];
1193  }
1194 #endif
1195  }
1196  strat->S[strat->sl] = NULL;
1197  strat->sl--;

◆ enlargeL()

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

Definition at line 655 of file kutil.cc.

657 {
658  assume((*L)!=NULL);
659  assume(((*length)+incr)>0);
660 
661  *L = (LSet)omReallocSize((*L),(*length)*sizeof(LObject),
662  ((*length)+incr)*sizeof(LObject));
663  (*length) += incr;

◆ enlargeT()

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

Definition at line 516 of file kutil.cc.

519 {
520  assume(T!=NULL);
521  assume(sevT!=NULL);
522  assume(R!=NULL);
523  assume((length+incr) > 0);
524 
525  int i;
526  T = (TSet)omRealloc0Size(T, length*sizeof(TObject),
527  (length+incr)*sizeof(TObject));
528 
529  sevT = (unsigned long*) omReallocSize(sevT, length*sizeof(long*),
530  (length+incr)*sizeof(long*));
531 
532  R = (TObject**)omRealloc0Size(R,length*sizeof(TObject*),
533  (length+incr)*sizeof(TObject*));
534  for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
535  length += incr;

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4603 of file kutil.cc.

4605 {
4606  if (nIsOne(pGetCoeff(h))) return;
4607  number gcd;
4608  bool go = false;
4609  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4610  {
4611  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4612  go = true;
4613  }
4614  else
4615  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4616  if (go || !nIsOne(gcd))
4617  {
4618  poly p = h->next;
4619  if (!go)
4620  {
4621  number tmp = gcd;
4622  gcd = n_Ann(gcd,currRing->cf);
4623  nDelete(&tmp);
4624  }
4625  p_Test(p,strat->tailRing);
4626  p = __pp_Mult_nn(p, gcd, strat->tailRing);
4627  nDelete(&gcd);
4628 
4629  if (p != NULL)
4630  {
4631  if (TEST_OPT_PROT)
4632  {
4633  PrintS("Z");
4634  }
4635 #ifdef KDEBUG
4636  if (TEST_OPT_DEBUG)
4637  {
4638  PrintS("--- create zero spoly: ");
4639  p_wrp(h,currRing,strat->tailRing);
4640  PrintS(" ---> ");
4641  }
4642 #endif
4643  poly tmp = pInit();
4644  pSetCoeff0(tmp, pGetCoeff(p));
4645  for (int i = 1; i <= rVar(currRing); i++)
4646  {
4647  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4648  }
4650  {
4651  p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
4652  }
4653  p_Setm(tmp, currRing);
4654  p = p_LmFreeAndNext(p, strat->tailRing);
4655  pNext(tmp) = p;
4656  LObject Lp;
4657  Lp.Init();
4658  Lp.p = tmp;
4659  Lp.tailRing = strat->tailRing;
4660  int posx;
4661  if (Lp.p!=NULL)
4662  {
4663  strat->initEcart(&Lp);
4664  if (strat->Ll==-1)
4665  posx =0;
4666  else
4667  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4668  Lp.sev = pGetShortExpVector(Lp.p);
4669  if (strat->tailRing != currRing)
4670  {
4671  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4672  }
4673 #ifdef KDEBUG
4674  if (TEST_OPT_DEBUG)
4675  {
4676  p_wrp(tmp,currRing,strat->tailRing);
4677  PrintLn();
4678  }
4679 #endif
4680  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4681  }
4682  }
4683  }
4684  nDelete(&gcd);

◆ enterExtendedSpolySig()

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

Definition at line 4686 of file kutil.cc.

4688 {
4689  if (nIsOne(pGetCoeff(h))) return;
4690  number gcd;
4691  bool go = false;
4692  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4693  {
4694  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4695  go = true;
4696  }
4697  else
4698  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4699  if (go || !nIsOne(gcd))
4700  {
4701  poly p = h->next;
4702  if (!go)
4703  {
4704  number tmp = gcd;
4705  gcd = n_Ann(gcd,currRing->cf);
4706  nDelete(&tmp);
4707  }
4708  p_Test(p,strat->tailRing);
4709  p = __pp_Mult_nn(p, gcd, strat->tailRing);
4710 
4711  if (p != NULL)
4712  {
4713  if (TEST_OPT_PROT)
4714  {
4715  PrintS("Z");
4716  }
4717 #ifdef KDEBUG
4718  if (TEST_OPT_DEBUG)
4719  {
4720  PrintS("--- create zero spoly: ");
4721  p_wrp(h,currRing,strat->tailRing);
4722  PrintS(" ---> ");
4723  }
4724 #endif
4725  poly tmp = pInit();
4726  pSetCoeff0(tmp, pGetCoeff(p));
4727  for (int i = 1; i <= rVar(currRing); i++)
4728  {
4729  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4730  }
4732  {
4733  p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
4734  }
4735  p_Setm(tmp, currRing);
4736  p = p_LmFreeAndNext(p, strat->tailRing);
4737  pNext(tmp) = p;
4738  LObject Lp;
4739  Lp.Init();
4740  Lp.p = tmp;
4741  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4742  #if EXT_POLY_NEW
4743  Lp.sig = __pp_Mult_nn(hSig, gcd, currRing);
4744  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4745  {
4746  strat->sigdrop = TRUE;
4747  //Try to reduce it as far as we can via redRing
4748  int red_result = redRing(&Lp,strat);
4749  if(red_result == 0)
4750  {
4751  // Cancel the sigdrop
4752  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4753  strat->sigdrop = FALSE;
4754  return;
4755  }
4756  else
4757  {
4758  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4759  #if 1
4760  strat->enterS(Lp,0,strat,strat->tl);
4761  #endif
4762  return;
4763  }
4764 
4765  }
4766  #else
4767  Lp.sig = pOne();
4768  if(strat->Ll >= 0)
4769  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4770  else
4771  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4772  #endif
4773  Lp.tailRing = strat->tailRing;
4774  int posx;
4775  if (Lp.p!=NULL)
4776  {
4777  strat->initEcart(&Lp);
4778  if (strat->Ll==-1)
4779  posx =0;
4780  else
4781  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4782  Lp.sev = pGetShortExpVector(Lp.p);
4783  if (strat->tailRing != currRing)
4784  {
4785  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4786  }
4787 #ifdef KDEBUG
4788  if (TEST_OPT_DEBUG)
4789  {
4790  p_wrp(tmp,currRing,strat->tailRing);
4791  PrintLn();
4792  }
4793 #endif
4794  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4795  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4796  }
4797  }
4798  nDelete(&gcd);
4799  }
4800  nDelete(&gcd);

◆ enterL()

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

Definition at line 1259 of file kutil.cc.

1261 {
1262  // this should be corrected
1263  assume(p.FDeg == p.pFDeg());
1264 
1265  if ((*length)>=0)
1266  {
1267  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1268  if (at <= (*length))
1269 #ifdef ENTER_USE_MEMMOVE
1270  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1271 #else
1272  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1273 #endif
1274  }
1275  else at = 0;
1276  (*set)[at] = p;
1277  (*length)++;

◆ enterOnePairLift()

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

Definition at line 2209 of file kutil.cc.

2211 {
2212  assume(ALLOW_PROD_CRIT(strat));
2214  assume(strat->syzComp==1);
2215  assume(i<=strat->sl);
2216 
2217  if ((strat->S[i]==NULL) || (p==NULL))
2218  return;
2219 
2220  int l,j,compare;
2221  LObject Lp;
2222  Lp.i_r = -1;
2223 
2224 #ifdef KDEBUG
2225  Lp.ecart=0; Lp.length=0;
2226 #endif
2227  /*- computes the lcm(s[i],p) -*/
2228  Lp.lcm = p_Lcm(p,strat->S[i],currRing);
2229 
2230  if (strat->sugarCrit)
2231  {
2232  if((!((strat->ecartS[i]>0)&&(ecart>0)))
2233  && p_HasNotCF_Lift(p,strat->S[i],currRing))
2234  {
2235  /*
2236  *the product criterion has applied for (s,p),
2237  *i.e. lcm(s,p)=product of the leading terms of s and p.
2238  *Suppose (s,r) is in L and the leading term
2239  *of p divides lcm(s,r)
2240  *(==> the leading term of p divides the leading term of r)
2241  *but the leading term of s does not divide the leading term of r
2242  *(notice that tis condition is automatically satisfied if r is still
2243  *in S), then (s,r) can be cancelled.
2244  *This should be done here because the
2245  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2246  *
2247  *Moreover, skipping (s,r) holds also for the noncommutative case.
2248  */
2249  strat->cp++;
2250  pLmFree(Lp.lcm);
2251  return;
2252  }
2253  else
2254  Lp.ecart = si_max(ecart,strat->ecartS[i]);
2255  if (strat->fromT && (strat->ecartS[i]>ecart))
2256  {
2257  pLmFree(Lp.lcm);
2258  return;
2259  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2260  }
2261  /*
2262  *the set B collects the pairs of type (S[j],p)
2263  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2264  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2265  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2266  */
2267  {
2268  j = strat->Bl;
2269  loop
2270  {
2271  if (j < 0) break;
2272  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2273  if ((compare==1)
2274  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2275  {
2276  strat->c3++;
2277  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2278  {
2279  pLmFree(Lp.lcm);
2280  return;
2281  }
2282  break;
2283  }
2284  else
2285  if ((compare ==-1)
2286  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2287  {
2288  deleteInL(strat->B,&strat->Bl,j,strat);
2289  strat->c3++;
2290  }
2291  j--;
2292  }
2293  }
2294  }
2295  else /*sugarcrit*/
2296  {
2297  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2298  p_HasNotCF_Lift(p,strat->S[i],currRing))
2299  {
2300  /*
2301  *the product criterion has applied for (s,p),
2302  *i.e. lcm(s,p)=product of the leading terms of s and p.
2303  *Suppose (s,r) is in L and the leading term
2304  *of p devides lcm(s,r)
2305  *(==> the leading term of p devides the leading term of r)
2306  *but the leading term of s does not devide the leading term of r
2307  *(notice that tis condition is automatically satisfied if r is still
2308  *in S), then (s,r) can be canceled.
2309  *This should be done here because the
2310  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2311  */
2312  strat->cp++;
2313  pLmFree(Lp.lcm);
2314  return;
2315  }
2316  if (strat->fromT && (strat->ecartS[i]>ecart))
2317  {
2318  pLmFree(Lp.lcm);
2319  return;
2320  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2321  }
2322  /*
2323  *the set B collects the pairs of type (S[j],p)
2324  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2325  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2326  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2327  */
2328  for(j = strat->Bl;j>=0;j--)
2329  {
2330  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2331  if (compare==1)
2332  {
2333  strat->c3++;
2334  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2335  {
2336  pLmFree(Lp.lcm);
2337  return;
2338  }
2339  break;
2340  }
2341  else
2342  if (compare ==-1)
2343  {
2344  deleteInL(strat->B,&strat->Bl,j,strat);
2345  strat->c3++;
2346  }
2347  }
2348  }
2349  /*
2350  *the pair (S[i],p) enters B if the spoly != 0
2351  */
2352  /*- compute the short s-polynomial -*/
2353  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2354  pNorm(p);
2355 
2356  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2357  Lp.p=NULL;
2358  else
2359  {
2361  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2362  }
2363  if (Lp.p == NULL)
2364  {
2365  /*- the case that the s-poly is 0 -*/
2366  if (strat->pairtest==NULL) initPairtest(strat);
2367  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2368  strat->pairtest[strat->sl+1] = TRUE;
2369  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2370  /*
2371  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2372  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2373  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2374  *term of p devides the lcm(s,r)
2375  *(this canceling should be done here because
2376  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2377  *the first case is handeled in chainCrit
2378  */
2379  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2380  }
2381  else
2382  {
2383  /*- the pair (S[i],p) enters B -*/
2384  Lp.p1 = strat->S[i];
2385  Lp.p2 = p;
2386 
2387  pNext(Lp.p) = strat->tail; // !!!
2388 
2389  if (atR >= 0)
2390  {
2391  Lp.i_r1 = strat->S_2_R[i];
2392  Lp.i_r2 = atR;
2393  }
2394  else
2395  {
2396  Lp.i_r1 = -1;
2397  Lp.i_r2 = -1;
2398  }
2399  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2400 
2402  {
2403  if (!rIsPluralRing(currRing)
2405  && (Lp.p->coef!=NULL))
2406  nDelete(&(Lp.p->coef));
2407  }
2408 
2409  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2410  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2411  }

◆ enterOnePairNormal()

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

Definition at line 1928 of file kutil.cc.

1930 {
1931  assume(i<=strat->sl);
1932 
1933  int l,j,compare;
1934  LObject Lp;
1935  Lp.i_r = -1;
1936 
1937 #ifdef KDEBUG
1938  Lp.ecart=0; Lp.length=0;
1939 #endif
1940  /*- computes the lcm(s[i],p) -*/
1941  Lp.lcm = pInit();
1942 
1943 #ifndef HAVE_RATGRING
1944  pLcm(p,strat->S[i],Lp.lcm);
1945 #elif defined(HAVE_RATGRING)
1946  if (rIsRatGRing(currRing))
1947  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1948  else
1949  pLcm(p,strat->S[i],Lp.lcm);
1950 #endif
1951  pSetm(Lp.lcm);
1952 
1953 
1954  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1955  {
1956  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1957  && pHasNotCF(p,strat->S[i]))
1958  {
1959  /*
1960  *the product criterion has applied for (s,p),
1961  *i.e. lcm(s,p)=product of the leading terms of s and p.
1962  *Suppose (s,r) is in L and the leading term
1963  *of p divides lcm(s,r)
1964  *(==> the leading term of p divides the leading term of r)
1965  *but the leading term of s does not divide the leading term of r
1966  *(notice that tis condition is automatically satisfied if r is still
1967  *in S), then (s,r) can be cancelled.
1968  *This should be done here because the
1969  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1970  *
1971  *Moreover, skipping (s,r) holds also for the noncommutative case.
1972  */
1973  strat->cp++;
1974  pLmFree(Lp.lcm);
1975  return;
1976  }
1977  else
1978  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1979  if (strat->fromT && (strat->ecartS[i]>ecart))
1980  {
1981  pLmFree(Lp.lcm);
1982  return;
1983  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1984  }
1985  /*
1986  *the set B collects the pairs of type (S[j],p)
1987  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1988  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1989  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1990  */
1991  {
1992  j = strat->Bl;
1993  loop
1994  {
1995  if (j < 0) break;
1996  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1997  if ((compare==1)
1998  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1999  {
2000  strat->c3++;
2001  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2002  {
2003  pLmFree(Lp.lcm);
2004  return;
2005  }
2006  break;
2007  }
2008  else
2009  if ((compare ==-1)
2010  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2011  {
2012  deleteInL(strat->B,&strat->Bl,j,strat);
2013  strat->c3++;
2014  }
2015  j--;
2016  }
2017  }
2018  }
2019  else /*sugarcrit*/
2020  {
2021  if (ALLOW_PROD_CRIT(strat))
2022  {
2023  // if currRing->nc_type!=quasi (or skew)
2024  // TODO: enable productCrit for super commutative algebras...
2025  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2026  pHasNotCF(p,strat->S[i]))
2027  {
2028  /*
2029  *the product criterion has applied for (s,p),
2030  *i.e. lcm(s,p)=product of the leading terms of s and p.
2031  *Suppose (s,r) is in L and the leading term
2032  *of p devides lcm(s,r)
2033  *(==> the leading term of p devides the leading term of r)
2034  *but the leading term of s does not devide the leading term of r
2035  *(notice that tis condition is automatically satisfied if r is still
2036  *in S), then (s,r) can be canceled.
2037  *This should be done here because the
2038  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2039  */
2040  strat->cp++;
2041  pLmFree(Lp.lcm);
2042  return;
2043  }
2044  if (strat->fromT && (strat->ecartS[i]>ecart))
2045  {
2046  pLmFree(Lp.lcm);
2047  return;
2048  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2049  }
2050  /*
2051  *the set B collects the pairs of type (S[j],p)
2052  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2053  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2054  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2055  */
2056  for(j = strat->Bl;j>=0;j--)
2057  {
2058  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2059  if (compare==1)
2060  {
2061  strat->c3++;
2062  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2063  {
2064  pLmFree(Lp.lcm);
2065  return;
2066  }
2067  break;
2068  }
2069  else
2070  if (compare ==-1)
2071  {
2072  deleteInL(strat->B,&strat->Bl,j,strat);
2073  strat->c3++;
2074  }
2075  }
2076  }
2077  }
2078  /*
2079  *the pair (S[i],p) enters B if the spoly != 0
2080  */
2081  /*- compute the short s-polynomial -*/
2082  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2083  pNorm(p);
2084 
2085  if ((strat->S[i]==NULL) || (p==NULL))
2086  return;
2087 
2088  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2089  Lp.p=NULL;
2090  else
2091  {
2092  #ifdef HAVE_PLURAL
2093  if ( rIsPluralRing(currRing) )
2094  {
2095  if(pHasNotCF(p, strat->S[i]))
2096  {
2097  if(ncRingType(currRing) == nc_lie)
2098  {
2099  // generalized prod-crit for lie-type
2100  strat->cp++;
2101  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2102  }
2103  else
2104  if( ALLOW_PROD_CRIT(strat) )
2105  {
2106  // product criterion for homogeneous case in SCA
2107  strat->cp++;
2108  Lp.p = NULL;
2109  }
2110  else
2111  {
2112  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2113  nc_CreateShortSpoly(strat->S[i], p, currRing);
2114  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2115  pNext(Lp.p) = strat->tail; // !!!
2116  }
2117  }
2118  else
2119  {
2120  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2121  nc_CreateShortSpoly(strat->S[i], p, currRing);
2122 
2123  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2124  pNext(Lp.p) = strat->tail; // !!!
2125  }
2126  }
2127  else
2128  #endif
2129  {
2131  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2132  }
2133  }
2134  if (Lp.p == NULL)
2135  {
2136  /*- the case that the s-poly is 0 -*/
2137  if (strat->pairtest==NULL) initPairtest(strat);
2138  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2139  strat->pairtest[strat->sl+1] = TRUE;
2140  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2141  /*
2142  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2143  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2144  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2145  *term of p devides the lcm(s,r)
2146  *(this canceling should be done here because
2147  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2148  *the first case is handeled in chainCrit
2149  */
2150  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2151  }
2152  else
2153  {
2154  /*- the pair (S[i],p) enters B -*/
2155  Lp.p1 = strat->S[i];
2156  Lp.p2 = p;
2157 
2158  if (
2160 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2161  )
2162  {
2163  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2164  pNext(Lp.p) = strat->tail; // !!!
2165  }
2166 
2167  if (atR >= 0)
2168  {
2169  Lp.i_r1 = strat->S_2_R[i];
2170  Lp.i_r2 = atR;
2171  }
2172  else
2173  {
2174  Lp.i_r1 = -1;
2175  Lp.i_r2 = -1;
2176  }
2177  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2178 
2180  {
2181  if (!rIsPluralRing(currRing)
2183  && (Lp.p->coef!=NULL))
2184  nDelete(&(Lp.p->coef));
2185  }
2186 
2187  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2188  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2189  }

◆ enterOnePairRing()

static void enterOnePairRing ( int  i,
poly  p,
int  ,
int  isFromQ,
kStrategy  strat,
int  atR 
)
static

Definition at line 1325 of file kutil.cc.

1327 {
1328  assume(atR >= 0);
1329  assume(i<=strat->sl);
1330  assume(p!=NULL);
1332  #if ALL_VS_JUST
1333  //Over rings, if we construct the strong pair, do not add the spair
1335  {
1336  number s,t,d;
1337  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1338 
1339  if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
1340  {
1341  nDelete(&d);
1342  nDelete(&s);
1343  nDelete(&t);
1344  return;
1345  }
1346  nDelete(&d);
1347  nDelete(&s);
1348  nDelete(&t);
1349  }
1350  #endif
1351  int j,compare,compareCoeff;
1352  LObject h;
1353 
1354 #ifdef KDEBUG
1355  h.ecart=0; h.length=0;
1356 #endif
1357  /*- computes the lcm(s[i],p) -*/
1358  if(pHasNotCFRing(p,strat->S[i]))
1359  {
1360  strat->cp++;
1361  return;
1362  }
1363  h.lcm = p_Lcm(p,strat->S[i],currRing);
1364  pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
1365  if (nIsZero(pGetCoeff(h.lcm)))
1366  {
1367  strat->cp++;
1368  pLmDelete(h.lcm);
1369  return;
1370  }
1371  // basic chain criterion
1372  /*
1373  *the set B collects the pairs of type (S[j],p)
1374  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
1375  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1376  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1377  */
1378 
1379  for(j = strat->Bl;j>=0;j--)
1380  {
1381  compare=pDivCompRing(strat->B[j].lcm,h.lcm);
1382  compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
1383  if(compare == pDivComp_EQUAL)
1384  {
1385  //They have the same LM
1386  if(compareCoeff == pDivComp_LESS)
1387  {
1388  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1389  {
1390  strat->c3++;
1391  pLmDelete(h.lcm);
1392  return;
1393  }
1394  break;
1395  }
1396  if(compareCoeff == pDivComp_GREATER)
1397  {
1398  deleteInL(strat->B,&strat->Bl,j,strat);
1399  strat->c3++;
1400  }
1401  if(compareCoeff == pDivComp_EQUAL)
1402  {
1403  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1404  {
1405  strat->c3++;
1406  pLmDelete(h.lcm);
1407  return;
1408  }
1409  break;
1410  }
1411  }
1412  if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
1413  {
1414  if(compare == pDivComp_LESS)
1415  {
1416  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1417  {
1418  strat->c3++;
1419  pLmDelete(h.lcm);
1420  return;
1421  }
1422  break;
1423  }
1424  if(compare == pDivComp_GREATER)
1425  {
1426  deleteInL(strat->B,&strat->Bl,j,strat);
1427  strat->c3++;
1428  }
1429  }
1430  }
1431  number s, t;
1432  poly m1, m2, gcd = NULL;
1433  s = pGetCoeff(strat->S[i]);
1434  t = pGetCoeff(p);
1435  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
1436  ksCheckCoeff(&s, &t, currRing->cf);
1437  pSetCoeff0(m1, s);
1438  pSetCoeff0(m2, t);
1439  m2 = pNeg(m2);
1440  p_Test(m1,strat->tailRing);
1441  p_Test(m2,strat->tailRing);
1442  poly si = pCopy(strat->S[i]);
1443  poly pm1 = pp_Mult_mm(pNext(p), m1, strat->tailRing);
1444  poly sim2 = pp_Mult_mm(pNext(si), m2, strat->tailRing);
1445  pDelete(&si);
1446  p_LmDelete(m1, currRing);
1447  p_LmDelete(m2, currRing);
1448  if(sim2 == NULL)
1449  {
1450  if(pm1 == NULL)
1451  {
1452  if(h.lcm != NULL)
1453  {
1454  pLmDelete(h.lcm);
1455  h.lcm=NULL;
1456  }
1457  h.Clear();
1458  if (strat->pairtest==NULL) initPairtest(strat);
1459  strat->pairtest[i] = TRUE;
1460  strat->pairtest[strat->sl+1] = TRUE;
1461  return;
1462  }
1463  else
1464  {
1465  gcd = pm1;
1466  pm1 = NULL;
1467  }
1468  }
1469  else
1470  {
1471  if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
1472  {
1473  p_SetCompP(sim2, pGetComp(p), strat->tailRing);
1474  pSetmComp(sim2);
1475  }
1476  //p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
1477  gcd = p_Add_q(pm1, sim2, strat->tailRing);
1478  }
1479  p_Test(gcd, strat->tailRing);
1480 #ifdef KDEBUG
1481  if (TEST_OPT_DEBUG)
1482  {
1483  wrp(gcd);
1484  PrintLn();
1485  }
1486 #endif
1487  h.p = gcd;
1488  h.i_r = -1;
1489  if(h.p == NULL)
1490  {
1491  if (strat->pairtest==NULL) initPairtest(strat);
1492  strat->pairtest[i] = TRUE;
1493  strat->pairtest[strat->sl+1] = TRUE;
1494  return;
1495  }
1496  h.tailRing = strat->tailRing;
1497  int posx;
1498  //h.pCleardenom();
1499  //pSetm(h.p);
1500  h.i_r1 = -1;h.i_r2 = -1;
1501  strat->initEcart(&h);
1502  #if 1
1503  h.p2 = strat->S[i];
1504  h.p1 = p;
1505  #endif
1506  #if 1
1507  if (atR >= 0)
1508  {
1509  h.i_r1 = atR;
1510  h.i_r2 = strat->S_2_R[i];
1511  }
1512  #endif
1513  if (strat->Bl==-1)
1514  posx =0;
1515  else
1516  posx = strat->posInL(strat->B,strat->Bl,&h,strat);
1517  h.sev = pGetShortExpVector(h.p);
1518  if (currRing!=strat->tailRing)
1519  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1520  enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
1521  kTest_TS(strat);

◆ enterOnePairShift()

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

Definition at line 12261 of file kutil.cc.

12271 {
12272 #ifdef CRITERION_DEBUG
12273  if (TEST_OPT_DEBUG)
12274  {
12275  PrintS("Consider pair ("); wrp(q); PrintS(", "); wrp(p); PrintS(")"); PrintLn();
12276  // also write the LMs in separate lines:
12277  poly lmq = pHead(q);
12278  poly lmp = pHead(p);
12279  pSetCoeff(lmq, n_Init(1, currRing->cf));
12280  pSetCoeff(lmp, n_Init(1, currRing->cf));
12281  Print(" %s\n", pString(lmq));
12282  Print(" %s\n", pString(lmp));
12283  pLmDelete(lmq);
12284  pLmDelete(lmp);
12285  }
12286 #endif
12287 
12288  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12289 
12290  /* check this Formats: */
12292  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12295 
12296  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12297 
12298  int qfromQ = qisFromQ;
12299 
12300  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12301 
12302  int l,j,compare;
12303  LObject Lp;
12304  Lp.i_r = -1;
12305 
12306 #ifdef KDEBUG
12307  Lp.ecart=0; Lp.length=0;
12308 #endif
12309  /*- computes the lcm(s[i],p) -*/
12310  Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation
12311 
12312  /* the V criterion */
12313  if (!pmIsInV(Lp.lcm))
12314  {
12315  strat->cv++; // counter for applying the V criterion
12316  pLmFree(Lp.lcm);
12317 #ifdef CRITERION_DEBUG
12318  if (TEST_OPT_DEBUG) PrintS("--- V crit\n");
12319 #endif
12320  return;
12321  }
12322 
12323  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12324  {
12325  if((!((ecartq>0)&&(ecart>0)))
12326  && pHasNotCF(p,q))
12327  {
12328  /*
12329  *the product criterion has applied for (s,p),
12330  *i.e. lcm(s,p)=product of the leading terms of s and p.
12331  *Suppose (s,r) is in L and the leading term
12332  *of p divides lcm(s,r)
12333  *(==> the leading term of p divides the leading term of r)
12334  *but the leading term of s does not divide the leading term of r
12335  *(notice that this condition is automatically satisfied if r is still
12336  *in S), then (s,r) can be cancelled.
12337  *This should be done here because the
12338  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12339  *
12340  *Moreover, skipping (s,r) holds also for the noncommutative case.
12341  */
12342  strat->cp++;
12343  pLmFree(Lp.lcm);
12344 #ifdef CRITERION_DEBUG
12345  if (TEST_OPT_DEBUG) PrintS("--- prod crit\n");
12346 #endif
12347  return;
12348  }
12349  else
12350  Lp.ecart = si_max(ecart,ecartq);
12351  if (strat->fromT && (ecartq>ecart))
12352  {
12353  pLmFree(Lp.lcm);
12354 #ifdef CRITERION_DEBUG
12355  if (TEST_OPT_DEBUG) PrintS("--- ecartq > ecart\n");
12356 #endif
12357  return;
12358  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12359  }
12360  /*
12361  *the set B collects the pairs of type (S[j],p)
12362  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12363  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12364  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12365  */
12366  {
12367  j = strat->Bl;
12368  loop
12369  {
12370  if (j < 0) break;
12371  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12372  if ((compare==1)
12373  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12374  {
12375  strat->c3++;
12376  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12377  {
12378  pLmFree(Lp.lcm);
12379 #ifdef CRITERION_DEBUG
12380  if (TEST_OPT_DEBUG) Print("--- divided by B[%d]\n", j);
12381 #endif
12382  return;
12383  }
12384  break;
12385  }
12386  else
12387  if ((compare ==-1)
12388  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12389  {
12390  deleteInL(strat->B,&strat->Bl,j,strat);
12391 #ifdef CRITERION_DEBUG
12392  if (TEST_OPT_DEBUG) Print("divides B[%d] -> delete B[%d]\n", j, j);
12393 #endif
12394  strat->c3++;
12395  }
12396  j--;
12397  }
12398  }
12399  }
12400  else /*sugarcrit*/
12401  {
12402  if (ALLOW_PROD_CRIT(strat))
12403  {
12404  // if currRing->nc_type!=quasi (or skew)
12405  // TODO: enable productCrit for super commutative algebras...
12406  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12407  pHasNotCF(p,q))
12408  {
12409  /*
12410  *the product criterion has applied for (s,p),
12411  *i.e. lcm(s,p)=product of the leading terms of s and p.
12412  *Suppose (s,r) is in L and the leading term
12413  *of p devides lcm(s,r)
12414  *(==> the leading term of p devides the leading term of r)
12415  *but the leading term of s does not devide the leading term of r
12416  *(notice that tis condition is automatically satisfied if r is still
12417  *in S), then (s,r) can be canceled.
12418  *This should be done here because the
12419  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12420  */
12421  strat->cp++;
12422  pLmFree(Lp.lcm);
12423 #ifdef CRITERION_DEBUG
12424  if (TEST_OPT_DEBUG) PrintS("--- prod crit\n");
12425 #endif
12426  return;
12427  }
12428  if (strat->fromT && (ecartq>ecart))
12429  {
12430  pLmFree(Lp.lcm);
12431 #ifdef CRITERION_DEBUG
12432  if (TEST_OPT_DEBUG) PrintS("--- ecartq > ecart\n");
12433 #endif
12434  return;
12435  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12436  }
12437  /*
12438  *the set B collects the pairs of type (S[j],p)
12439  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12440  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12441  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12442  */
12443  for(j = strat->Bl;j>=0;j--)
12444  {
12445  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12446  if (compare==1)
12447  {
12448  strat->c3++;
12449  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12450  {
12451  pLmFree(Lp.lcm);
12452 #ifdef CRITERION_DEBUG
12453  if (TEST_OPT_DEBUG) Print("--- divided by B[%d]\n", j);
12454 #endif
12455  return;
12456  }
12457  break;
12458  }
12459  else
12460  if (compare ==-1)
12461  {
12462  deleteInL(strat->B,&strat->Bl,j,strat);
12463 #ifdef CRITERION_DEBUG
12464  if (TEST_OPT_DEBUG) Print("divides B[%d] -> delete B[%d]\n", j, j);
12465 #endif
12466  strat->c3++;
12467  }
12468  }
12469  }
12470  }
12471  /*
12472  *the pair (S[i],p) enters B if the spoly != 0
12473  */
12474  /*- compute the short s-polynomial -*/
12475  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12476  pNorm(p);
12477  if ((q==NULL) || (p==NULL))
12478  {
12479 #ifdef CRITERION_DEBUG
12480  if (TEST_OPT_DEBUG) PrintS("--- q == NULL || p == NULL\n");
12481 #endif
12482  return;
12483  }
12484  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12485  {
12486  Lp.p=NULL;
12487 #ifdef CRITERION_DEBUG
12488  if (TEST_OPT_DEBUG) PrintS("--- pair from Q\n");
12489 #endif
12490  }
12491  else
12492  {
12493 // if ( rIsPluralRing(currRing) )
12494 // {
12495 // if(pHasNotCF(p, q))
12496 // {
12497 // if(ncRingType(currRing) == nc_lie)
12498 // {
12499 // // generalized prod-crit for lie-type
12500 // strat->cp++;
12501 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12502 // }
12503 // else
12504 // if( ALLOW_PROD_CRIT(strat) )
12505 // {
12506 // // product criterion for homogeneous case in SCA
12507 // strat->cp++;
12508 // Lp.p = NULL;
12509 // }
12510 // else
12511 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12512 // }
12513 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12514 // }
12515 // else
12516 // {
12517 
12518  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12519  /* p is already in this form, so convert q */
12520  // q = pMove2CurrTail(q, strat);
12521  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12522  // }
12523  }
12524  if (Lp.p == NULL)
12525  {
12526  /*- the case that the s-poly is 0 -*/
12527  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12528 // if (strat->pairtest==NULL) initPairtest(strat);
12529 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12530 // strat->pairtest[strat->sl+1] = TRUE;
12531 // new: visual check how often this happens: ! for the debug situation
12532 #ifdef KDEBUG
12533  Print("!");
12534  //if (TEST_OPT_DEBUG){Print("!");} // option teach
12535 #endif /* KDEBUG */
12536  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12537  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12538  /*
12539  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12540  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12541  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12542  *term of p devides the lcm(s,r)
12543  *(this canceling should be done here because
12544  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12545  *the first case is handeled in chainCrit
12546  */
12547  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12548 #ifdef CRITERION_DEBUG
12549  if (TEST_OPT_DEBUG) PrintS("--- S-poly = 0\n");
12550 #endif
12551  }
12552  else
12553  {
12554  /*- the pair (S[i],p) enters B -*/
12555  /* both of them should have their LM in currRing and TAIL in tailring */
12556  Lp.p1 = q; // already in the needed form
12557  Lp.p2 = p; // already in the needed form
12558 
12559  if ( !rIsPluralRing(currRing) )
12560  pNext(Lp.p) = strat->tail;
12561 
12562  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12563  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12564  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12565  {
12566  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12567  Lp.i_r2 = atR;
12568  }
12569  else
12570  {
12571  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12572  Lp.i_r1 = -1;
12573  Lp.i_r2 = -1;
12574  }
12575  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12576 
12578  {
12579  if (!rIsPluralRing(currRing)
12581  && (Lp.p->coef!=NULL))
12582  nDelete(&(Lp.p->coef));

◆ enterOnePairSig()

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

Definition at line 2421 of file kutil.cc.

2424 {
2425  assume(i<=strat->sl);
2426 
2427  int l;
2428  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2429  // the corresponding signatures for criteria checks
2430  LObject Lp;
2431  poly pSigMult = p_Copy(pSig,currRing);
2432  poly sSigMult = p_Copy(strat->sig[i],currRing);
2433  unsigned long pSigMultNegSev,sSigMultNegSev;
2434  Lp.i_r = -1;
2435 
2436 #ifdef KDEBUG
2437  Lp.ecart=0; Lp.length=0;
2438 #endif
2439  /*- computes the lcm(s[i],p) -*/
2440  Lp.lcm = pInit();
2441  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2442 #ifndef HAVE_RATGRING
2443  pLcm(p,strat->S[i],Lp.lcm);
2444 #elif defined(HAVE_RATGRING)
2445  if (rIsRatGRing(currRing))
2446  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2447  else
2448  pLcm(p,strat->S[i],Lp.lcm);
2449 #endif
2450  pSetm(Lp.lcm);
2451 
2452  // set coeffs of multipliers m1 and m2
2453  pSetCoeff0(m1, nInit(1));
2454  pSetCoeff0(m2, nInit(1));
2455 //#if 1
2456 #ifdef DEBUGF5
2457  PrintS("P1 ");
2458  pWrite(pHead(p));
2459  PrintS("P2 ");
2460  pWrite(pHead(strat->S[i]));
2461  PrintS("M1 ");
2462  pWrite(m1);
2463  PrintS("M2 ");
2464  pWrite(m2);
2465 #endif
2466  // get multiplied signatures for testing
2467  pSigMult = currRing->p_Procs->pp_Mult_mm(pSigMult,m1,currRing);
2468  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2469  sSigMult = currRing->p_Procs->pp_Mult_mm(sSigMult,m2,currRing);
2470  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2471 
2472 //#if 1
2473 #ifdef DEBUGF5
2474  PrintS("----------------\n");
2475  pWrite(pSigMult);
2476  pWrite(sSigMult);
2477  PrintS("----------------\n");
2478  Lp.checked = 0;
2479 #endif
2480  int sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2481 //#if 1
2482 #if DEBUGF5
2483  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2484  pWrite(pSigMult);
2485  pWrite(sSigMult);
2486 #endif
2487  if(sigCmp==0)
2488  {
2489  // printf("!!!! EQUAL SIGS !!!!\n");
2490  // pSig = sSig, delete element due to Rewritten Criterion
2491  pDelete(&pSigMult);
2492  pDelete(&sSigMult);
2493  if (rField_is_Ring(currRing))
2494  pLmDelete(Lp.lcm);
2495  else
2496  pLmFree(Lp.lcm);
2497  pDelete (&m1);
2498  pDelete (&m2);
2499  return;
2500  }
2501  // testing by syzCrit = F5 Criterion
2502  // testing by rewCrit1 = Rewritten Criterion
2503  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2504  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2505  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2506  || strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2507  )
2508  {
2509  pDelete(&pSigMult);
2510  pDelete(&sSigMult);
2511  if (rField_is_Ring(currRing))
2512  pLmDelete(Lp.lcm);
2513  else
2514  pLmFree(Lp.lcm);
2515  pDelete (&m1);
2516  pDelete (&m2);
2517  return;
2518  }
2519  /*
2520  *the pair (S[i],p) enters B if the spoly != 0
2521  */
2522  /*- compute the short s-polynomial -*/
2523  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2524  pNorm(p);
2525 
2526  if ((strat->S[i]==NULL) || (p==NULL))
2527  return;
2528 
2529  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2530  Lp.p=NULL;
2531  else
2532  {
2533  #ifdef HAVE_PLURAL
2534  if ( rIsPluralRing(currRing) )
2535  {
2536  if(pHasNotCF(p, strat->S[i]))
2537  {
2538  if(ncRingType(currRing) == nc_lie)
2539  {
2540  // generalized prod-crit for lie-type
2541  strat->cp++;
2542  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2543  }
2544  else
2545  if( ALLOW_PROD_CRIT(strat) )
2546  {
2547  // product criterion for homogeneous case in SCA
2548  strat->cp++;
2549  Lp.p = NULL;
2550  }
2551  else
2552  {
2553  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2554  nc_CreateShortSpoly(strat->S[i], p, currRing);
2555 
2556  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2557  pNext(Lp.p) = strat->tail; // !!!
2558  }
2559  }
2560  else
2561  {
2562  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2563  nc_CreateShortSpoly(strat->S[i], p, currRing);
2564 
2565  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2566  pNext(Lp.p) = strat->tail; // !!!
2567  }
2568  }
2569  else
2570  #endif
2571  {
2573  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2574  }
2575  }
2576  // store from which element this pair comes from for further tests
2577  //Lp.from = strat->sl+1;
2578  if(sigCmp==currRing->OrdSgn)
2579  {
2580  // pSig > sSig
2581  pDelete (&sSigMult);
2582  Lp.sig = pSigMult;
2583  Lp.sevSig = ~pSigMultNegSev;
2584  }
2585  else
2586  {
2587  // pSig < sSig
2588  pDelete (&pSigMult);
2589  Lp.sig = sSigMult;
2590  Lp.sevSig = ~sSigMultNegSev;
2591  }
2592  if (Lp.p == NULL)
2593  {
2594  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2595  int pos = posInSyz(strat, Lp.sig);
2596  enterSyz(Lp, strat, pos);
2597  }
2598  else
2599  {
2600  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
2601  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
2602  {
2603  pLmFree(Lp.lcm);
2604  pDelete(&Lp.sig);
2605  pDelete (&m1);
2606  pDelete (&m2);
2607  return;
2608  }
2609  // in any case Lp is checked up to the next strat->P which is added
2610  // to S right after this critical pair creation.
2611  // NOTE: this even holds if the 2nd generator gives the bigger signature
2612  // moreover, this improves rewCriterion,
2613  // i.e. strat->checked > strat->from if and only if the 2nd generator
2614  // gives the bigger signature.
2615  Lp.checked = strat->sl+1;
2616  // at this point it is clear that the pair will be added to L, since it has
2617  // passed all tests up to now
2618 
2619  // adds buchberger's first criterion
2620  if (pLmCmp(m2,pHead(p)) == 0)
2621  {
2622  Lp.prod_crit = TRUE; // Product Criterion
2623 #if 0
2624  int pos = posInSyz(strat, Lp.sig);
2625  enterSyz(Lp, strat, pos);
2626  pDelete (&m1);
2627  pDelete (&m2);
2628  return;
2629 #endif
2630  }
2631  pDelete (&m1);
2632  pDelete (&m2);
2633 #if DEBUGF5
2634  PrintS("SIGNATURE OF PAIR: ");
2635  pWrite(Lp.sig);
2636 #endif
2637  /*- the pair (S[i],p) enters B -*/
2638  Lp.p1 = strat->S[i];
2639  Lp.p2 = p;
2640 
2641  if (
2643 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2644  )
2645  {
2646  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2647  pNext(Lp.p) = strat->tail; // !!!
2648  }
2649 
2650  if (atR >= 0)
2651  {
2652  Lp.i_r1 = strat->S_2_R[i];
2653  Lp.i_r2 = atR;
2654  }
2655  else
2656  {
2657  Lp.i_r1 = -1;
2658  Lp.i_r2 = -1;
2659  }
2660  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2661 
2663  {
2664  if (!rIsPluralRing(currRing)
2666  && (Lp.p->coef!=NULL))
2667  nDelete(&(Lp.p->coef));
2668  }
2669 
2670  l = strat->posInLSba(strat->B,strat->Bl,&Lp,strat);
2671  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2672  }

◆ enterOnePairSigRing()

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

Definition at line 2678 of file kutil.cc.

2681 {
2682  #if ALL_VS_JUST
2683  //Over rings, if we construct the strong pair, do not add the spair
2685  {
2686  number s,t,d;
2687  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
2688 
2689  if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
2690  {
2691  nDelete(&d);
2692  nDelete(&s);
2693  nDelete(&t);
2694  return;
2695  }
2696  nDelete(&d);
2697  nDelete(&s);
2698  nDelete(&t);
2699  }
2700  #endif
2701  assume(i<=strat->sl);
2702  int l;
2703  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2704  // the corresponding signatures for criteria checks
2705  LObject Lp;
2706  poly pSigMult = p_Copy(pSig,currRing);
2707  poly sSigMult = p_Copy(strat->sig[i],currRing);
2708  unsigned long pSigMultNegSev,sSigMultNegSev;
2709  Lp.i_r = -1;
2710 
2711 #ifdef KDEBUG
2712  Lp.ecart=0; Lp.length=0;
2713 #endif
2714  /*- computes the lcm(s[i],p) -*/
2715  Lp.lcm = pInit();
2716  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2717 #ifndef HAVE_RATGRING
2718  pLcm(p,strat->S[i],Lp.lcm);
2719 #elif defined(HAVE_RATGRING)
2720  if (rIsRatGRing(currRing))
2721  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2722  else
2723  pLcm(p,strat->S[i],Lp.lcm);
2724 #endif
2725  pSetm(Lp.lcm);
2726 
2727  // set coeffs of multipliers m1 and m2
2729  {
2730  number s = nCopy(pGetCoeff(strat->S[i]));
2731  number t = nCopy(pGetCoeff(p));
2732  pSetCoeff0(Lp.lcm, n_Lcm(s, t, currRing->cf));
2733  ksCheckCoeff(&s, &t, currRing->cf);
2734  pSetCoeff0(m1,s);
2735  pSetCoeff0(m2,t);
2736  }
2737  else
2738  {
2739  pSetCoeff0(m1, nInit(1));
2740  pSetCoeff0(m2, nInit(1));
2741  }
2742 #ifdef DEBUGF5
2743  Print("P1 ");
2744  pWrite(pHead(p));
2745  Print("P2 ");
2746  pWrite(pHead(strat->S[i]));
2747  Print("M1 ");
2748  pWrite(m1);
2749  Print("M2 ");
2750  pWrite(m2);
2751 #endif
2752 
2753  // get multiplied signatures for testing
2754  pSigMult = pp_Mult_mm(pSigMult,m1,currRing);
2755  if(pSigMult != NULL)
2756  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2757  sSigMult = pp_Mult_mm(sSigMult,m2,currRing);
2758  if(sSigMult != NULL)
2759  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2760 //#if 1
2761 #ifdef DEBUGF5
2762  Print("----------------\n");
2763  pWrite(pSigMult);
2764  pWrite(sSigMult);
2765  Print("----------------\n");
2766  Lp.checked = 0;
2767 #endif
2768  int sigCmp;
2769  if(pSigMult != NULL && sSigMult != NULL)
2770  {
2772  sigCmp = p_LtCmpNoAbs(pSigMult,sSigMult,currRing);
2773  else
2774  sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2775  }
2776  else
2777  {
2778  if(pSigMult == NULL)
2779  {
2780  if(sSigMult == NULL)
2781  sigCmp = 0;
2782  else
2783  sigCmp = -1;
2784  }
2785  else
2786  sigCmp = 1;
2787  }
2788 //#if 1
2789 #if DEBUGF5
2790  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2791  pWrite(pSigMult);
2792  pWrite(sSigMult);
2793 #endif
2794  //In the ring case we already build the sig
2796  {
2797  if(sigCmp == 0)
2798  {
2799  //sigdrop since we loose the signature
2800  strat->sigdrop = TRUE;
2801  //Try to reduce it as far as we can via redRing
2803  {
2804  poly p1 = p_Copy(p,currRing);
2805  poly p2 = p_Copy(strat->S[i],currRing);
2806  p1 = p_Mult_mm(p1,m1,currRing);
2807  p2 = p_Mult_mm(p2,m2,currRing);
2808  Lp.p = p_Sub(p1,p2,currRing);
2809  if(Lp.p != NULL)
2810  Lp.sev = p_GetShortExpVector(Lp.p,currRing);
2811  }
2812  int red_result = redRing(&Lp,strat);
2813  if(red_result == 0)
2814  {
2815  // Cancel the sigdrop
2816  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
2817  strat->sigdrop = FALSE;
2818  return;
2819  }
2820  else
2821  {
2822  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
2823  #if 1
2824  strat->enterS(Lp,0,strat,strat->tl);
2825  #endif
2826  return;
2827  }
2828  }
2829  if(pSigMult != NULL && sSigMult != NULL && p_LmCmp(pSigMult,sSigMult,currRing) == 0)
2830  {
2831  //Same lm, have to substract
2832  Lp.sig = p_Sub(pCopy(pSigMult),pCopy(sSigMult),currRing);
2833  }
2834  else
2835  {
2836  if(sigCmp == 1)
2837  {
2838  Lp.sig = pCopy(pSigMult);
2839  }
2840  if(sigCmp == -1)
2841  {
2842  Lp.sig = pNeg(pCopy(sSigMult));
2843  }
2844  }
2845  Lp.sevSig = p_GetShortExpVector(Lp.sig,currRing);
2846  }
2847 
2848  #if 0
2849  if(sigCmp==0)
2850  {
2851  // printf("!!!! EQUAL SIGS !!!!\n");
2852  // pSig = sSig, delete element due to Rewritten Criterion
2853  pDelete(&pSigMult);
2854  pDelete(&sSigMult);
2855  if (rField_is_Ring(currRing))
2856  pLmDelete(Lp.lcm);
2857  else
2858  pLmFree(Lp.lcm);
2859  pDelete (&m1);
2860  pDelete (&m2);
2861  return;
2862  }
2863  #endif
2864  // testing by syzCrit = F5 Criterion
2865  // testing by rewCrit1 = Rewritten Criterion
2866  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2867  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2868  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2869  // With this rewCrit activated i get a wrong deletion in sba_int_56.tst
2870  //|| strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2871  )
2872  {
2873  pDelete(&pSigMult);
2874  pDelete(&sSigMult);
2875  if (rField_is_Ring(currRing))
2876  pLmDelete(Lp.lcm);
2877  else
2878  pLmFree(Lp.lcm);
2879  pDelete (&m1);
2880  pDelete (&m2);
2881  return;
2882  }
2883  /*
2884  *the pair (S[i],p) enters B if the spoly != 0
2885  */
2886  /*- compute the short s-polynomial -*/
2887  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2888  pNorm(p);
2889 
2890  if ((strat->S[i]==NULL) || (p==NULL))
2891  return;
2892 
2893  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2894  Lp.p=NULL;
2895  else
2896  {
2897  //Build p
2899  {
2900  poly p1 = p_Copy(p,currRing);
2901  poly p2 = p_Copy(strat->S[i],currRing);
2902  p1 = p_Mult_mm(p1,m1,currRing);
2903  p2 = p_Mult_mm(p2,m2,currRing);
2904  Lp.p = p_Sub(p1,p2,currRing);
2905  if(Lp.p != NULL)
2906  Lp.sev = p_GetShortExpVector(Lp.p,currRing);
2907  }
2908  else
2909  {
2910  #ifdef HAVE_PLURAL
2911  if ( rIsPluralRing(currRing) )
2912  {
2913  if(ncRingType(currRing) == nc_lie)
2914  {
2915  // generalized prod-crit for lie-type
2916  strat->cp++;
2917  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2918  }
2919  else
2920  if( ALLOW_PROD_CRIT(strat) )
2921  {
2922  // product criterion for homogeneous case in SCA
2923  strat->cp++;
2924  Lp.p = NULL;
2925  }
2926  else
2927  {
2928  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2929  nc_CreateShortSpoly(strat->S[i], p, currRing);
2930 
2931  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2932  pNext(Lp.p) = strat->tail; // !!!
2933  }
2934  }
2935  else
2936  #endif
2937  {
2939  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2940  }
2941  }
2942  }
2943  // store from which element this pair comes from for further tests
2944  //Lp.from = strat->sl+1;
2946  {
2947  //Put the sig to be > 0
2948  if(!nGreaterZero(pGetCoeff(Lp.sig)))
2949  {
2950  Lp.sig = pNeg(Lp.sig);
2951  Lp.p = pNeg(Lp.p);
2952  }
2953  }
2954  else
2955  {
2956  if(sigCmp==currRing->OrdSgn)
2957  {
2958  // pSig > sSig
2959  pDelete (&sSigMult);
2960  Lp.sig = pSigMult;
2961  Lp.sevSig = ~pSigMultNegSev;
2962  }
2963  else
2964  {
2965  // pSig < sSig
2966  pDelete (&pSigMult);
2967  Lp.sig = sSigMult;
2968  Lp.sevSig = ~sSigMultNegSev;
2969  }
2970  }
2971  if (Lp.p == NULL)
2972  {
2973  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2974  int pos = posInSyz(strat, Lp.sig);
2975  enterSyz(Lp, strat, pos);
2976  }
2977  else
2978  {
2979  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
2980  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
2981  {
2982  pLmFree(Lp.lcm);
2983  pDelete(&Lp.sig);
2984  pDelete (&m1);
2985  pDelete (&m2);
2986  return;
2987  }
2988  // in any case Lp is checked up to the next strat->P which is added
2989  // to S right after this critical pair creation.
2990  // NOTE: this even holds if the 2nd generator gives the bigger signature
2991  // moreover, this improves rewCriterion,
2992  // i.e. strat->checked > strat->from if and only if the 2nd generator
2993  // gives the bigger signature.
2994  Lp.checked = strat->sl+1;
2995  // at this point it is clear that the pair will be added to L, since it has
2996  // passed all tests up to now
2997 
2998  // adds buchberger's first criterion
2999  if (pLmCmp(m2,pHead(p)) == 0)
3000  {
3001  Lp.prod_crit = TRUE; // Product Criterion
3002 #if 0
3003  int pos = posInSyz(strat, Lp.sig);
3004  enterSyz(Lp, strat, pos);
3005  pDelete (&m1);
3006  pDelete (&m2);
3007  return;
3008 #endif
3009  }
3010  pDelete (&m1);
3011  pDelete (&m2);
3012 #if DEBUGF5
3013  PrintS("SIGNATURE OF PAIR: ");
3014  pWrite(Lp.sig);
3015 #endif
3016  /*- the pair (S[i],p) enters B -*/
3017  Lp.p1 = strat->S[i];
3018  Lp.p2 = p;
3019 
3020  if (
3022 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
3024  )
3025  {
3026  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
3027  pNext(Lp.p) = strat->tail; // !!!
3028  }
3029 
3030  if (atR >= 0)
3031  {
3032  Lp.i_r1 = strat->S_2_R[i];
3033  Lp.i_r2 = atR;
3034  }
3035  else
3036  {
3037  Lp.i_r1 = -1;
3038  Lp.i_r2 = -1;
3039  }
3040  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3041 
3043  {
3044  if (!rIsPluralRing(currRing)
3046  && (Lp.p->coef!=NULL))
3047  nDelete(&(Lp.p->coef));
3048  }
3049  // Check for sigdrop
3050  if(rField_is_Ring(currRing) && pLtCmp(Lp.sig,pSig) == -1)
3051  {
3052  strat->sigdrop = TRUE;
3053  // Completely reduce it
3054  int red_result = redRing(&Lp,strat);
3055  if(red_result == 0)
3056  {
3057  // Reduced to 0
3058  strat->sigdrop = FALSE;
3059  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
3060  return;
3061  }
3062  else
3063  {
3064  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
3065  // 0 - add just the original poly causing the sigdrop, 1 - add also this
3066  #if 1
3067  strat->enterS(Lp,0,strat, strat->tl+1);
3068  #endif
3069  return;
3070  }
3071  }
3072  l = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
3073  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3074  }

◆ enterOnePairSpecial()

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

Definition at line 3080 of file kutil.cc.

3082 {
3083  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
3084  if(pHasNotCF(p,strat->S[i]))
3085  {
3086  //PrintS("prod-crit\n");
3087  if(ALLOW_PROD_CRIT(strat))
3088  {
3089  //PrintS("prod-crit\n");
3090  strat->cp++;
3091  return;
3092  }
3093  }
3094 
3095  int l;
3096  LObject Lp;
3097  Lp.i_r = -1;
3098 
3099  Lp.lcm = p_Lcm(p,strat->S[i],currRing);
3100  /*- compute the short s-polynomial -*/
3101 
3102  #ifdef HAVE_PLURAL
3103  if (rIsPluralRing(currRing))
3104  {
3105  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
3106  }
3107  else
3108  #endif
3109  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
3110 
3111  if (Lp.p == NULL)
3112  {
3113  //PrintS("short spoly==NULL\n");
3114  pLmFree(Lp.lcm);
3115  }
3116  else
3117  {
3118  /*- the pair (S[i],p) enters L -*/
3119  Lp.p1 = strat->S[i];
3120  Lp.p2 = p;
3121  if (atR >= 0)
3122  {
3123  Lp.i_r1 = strat->S_2_R[i];
3124  Lp.i_r2 = atR;
3125  }
3126  else
3127  {
3128  Lp.i_r1 = -1;
3129  Lp.i_r2 = -1;
3130  }
3131  assume(pNext(Lp.p) == NULL);
3132  pNext(Lp.p) = strat->tail;
3133  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3135  {
3136  if (!rIsPluralRing(currRing)
3138  && (Lp.p->coef!=NULL))
3139  nDelete(&(Lp.p->coef));
3140  }
3141  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
3142  //Print("-> L[%d]\n",l);
3143  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3144  }

◆ enterOnePairWithoutShifts()

static void enterOnePairWithoutShifts ( int  p_inS,
poly  q,
poly  p,
int  ecartq,
int  q_isFromQ,
kStrategy  strat,
int  atR,
int  p_lastVblock,
int  q_shift 
)
static

Definition at line 12231 of file kutil.cc.

12231  {
12232  poly qq = pLPCopyAndShiftLM(q, j);
12233  enterOnePairShift(qq, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, j, q_inS);
12234  }
12235 }
12236 #endif
12237 
12238 #ifdef HAVE_SHIFTBBA
12239 // creates if possible (q,p), use it when q is already shifted
12240 static void enterOnePairWithoutShifts (int p_inS /*also i*/, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_shift)
12241 {
12242  // note: ecart and isFromQ is for p
12243  assume(p_inS < 0 || strat->S[p_inS] == p); // if p is from S, p_inS should be the index of p in S
12244  assume(pmFirstVblock(p) == 1);
12245  assume(p_lastVblock == pmLastVblock(p));
12246  assume(q_shift == pmFirstVblock(q) - 1);
12247 
12248  // TODO: is ecartp = 0 still ok?
12249  int ecartp = 0; //Hans says it's ok; we're in the homog e:, no ecart

◆ enterOnePairWithShifts()

static void enterOnePairWithShifts ( int  q_inS,
poly  q,
poly  p,
int  ecartp,
int  p_isFromQ,
kStrategy  strat,
int  atR,
int  p_lastVblock,
int  q_lastVblock 
)
static

Definition at line 12200 of file kutil.cc.

12210 {
12211  // note: ecart and isFromQ is for p
12212  assume(q_inS < 0 || strat->S[q_inS] == q); // if q is from S, q_inS should be the index of q in S
12213  assume(pmFirstVblock(p) == 1);
12214  assume(pmFirstVblock(q) == 1);
12215  assume(p_lastVblock == pmLastVblock(p));
12216  assume(q_lastVblock == pmLastVblock(q));
12217 
12218  // TODO: is ecartq = 0 still ok?
12219  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12220 
12221  int q_isFromQ = 0;
12222  if (strat->fromQ != NULL && q_inS >= 0)
12223  q_isFromQ = strat->fromQ[q_inS];
12224 
12225  int degbound = currRing->N/currRing->isLPring;
12226  int neededShift = p_lastVblock - 1;

◆ enterOneStrongPoly()

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

Definition at line 1527 of file kutil.cc.

1529 {
1530  number d, s, t;
1531  assume(atR >= 0);
1533  poly m1, m2, gcd,si;
1534  if(!enterTstrong)
1535  {
1536  assume(i<=strat->sl);
1537  si = strat->S[i];
1538  }
1539  else
1540  {
1541  assume(i<=strat->tl);
1542  si = strat->T[i].p;
1543  }
1544  //printf("\n--------------------------------\n");
1545  //pWrite(p);pWrite(si);
1546  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1547 
1548  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1549  {
1550  nDelete(&d);
1551  nDelete(&s);
1552  nDelete(&t);
1553  return FALSE;
1554  }
1555 
1556  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1557 
1559  unsigned long sev = pGetShortExpVector(gcd);
1560 
1561  for (int j = 0; j < strat->sl; j++) {
1562  if (j == i)
1563  continue;
1564 
1565  if (n_DivBy(d, pGetCoeff(strat->S[j]), currRing->cf) &&
1566  !(strat->sevS[j] & ~sev) &&
1567  p_LmDivisibleBy(strat->S[j], gcd, currRing)) {
1568  nDelete(&d);
1569  nDelete(&s);
1570  nDelete(&t);
1571  return FALSE;
1572  }
1573  }
1574  }
1575 
1576  //p_Test(m1,strat->tailRing);
1577  //p_Test(m2,strat->tailRing);
1578  /*if(!enterTstrong)
1579  {
1580  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1581  {
1582  memset(&(strat->P), 0, sizeof(strat->P));
1583  kStratChangeTailRing(strat);
1584  strat->P = *(strat->R[atR]);
1585  p_LmFree(m1, strat->tailRing);
1586  p_LmFree(m2, strat->tailRing);
1587  p_LmFree(gcd, currRing);
1588  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1589  }
1590  }*/
1591  pSetCoeff0(m1, s);
1592  pSetCoeff0(m2, t);
1593  pSetCoeff0(gcd, d);
1594  p_Test(m1,strat->tailRing);
1595  p_Test(m2,strat->tailRing);
1596  //printf("\n===================================\n");
1597  //pWrite(m1);pWrite(m2);pWrite(gcd);
1598 #ifdef KDEBUG
1599  if (TEST_OPT_DEBUG)
1600  {
1601  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1602  PrintS("m1 = ");
1603  p_wrp(m1, strat->tailRing);
1604  PrintS(" ; m2 = ");
1605  p_wrp(m2, strat->tailRing);
1606  PrintS(" ; gcd = ");
1607  wrp(gcd);
1608  PrintS("\n--- create strong gcd poly: ");
1609  Print("\n p: %d", i);
1610  wrp(p);
1611  Print("\n strat->S[%d]: ", i);
1612  wrp(si);
1613  PrintS(" ---> ");
1614  }
1615 #endif
1616 
1617  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1618  p_LmDelete(m1, strat->tailRing);
1619  p_LmDelete(m2, strat->tailRing);
1620 #ifdef KDEBUG
1621  if (TEST_OPT_DEBUG)
1622  {
1623  wrp(gcd);
1624  PrintLn();
1625  }
1626 #endif
1627 
1628  LObject h;
1629  h.p = gcd;
1630  h.tailRing = strat->tailRing;
1631  int posx;
1632  h.pCleardenom();
1633  strat->initEcart(&h);
1634  h.sev = pGetShortExpVector(h.p);
1635  h.i_r1 = -1;h.i_r2 = -1;
1636  if (currRing!=strat->tailRing)
1637  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1638  if(!enterTstrong)
1639  {
1640  #if 1
1641  h.p1 = p;h.p2 = strat->S[i];
1642  #endif
1643  if (atR >= 0)
1644  {
1645  h.i_r2 = strat->S_2_R[i];
1646  h.i_r1 = atR;
1647  }
1648  else
1649  {
1650  h.i_r1 = -1;
1651  h.i_r2 = -1;
1652  }
1653  if (strat->Ll==-1)
1654  posx =0;
1655  else
1656  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1657  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1658  }
1659  else
1660  {
1661  if(h.IsNull()) return FALSE;
1662  //int red_result;
1663  //reduzieren ist teur!!!
1664  //if(strat->L != NULL)
1665  //red_result = strat->red(&h,strat);
1666  if(!h.IsNull())
1667  {
1668  enterT(h, strat,-1);
1669  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1670  //strat->enterS(h,pos,strat,-1);
1671  }
1672  }
1673  return TRUE;

◆ enterOneStrongPolySig()

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

Definition at line 1733 of file kutil.cc.

1735 {
1736  number d, s, t;
1737  assume(atR >= 0);
1738  poly m1, m2, gcd,si;
1739  assume(i<=strat->sl);
1740  si = strat->S[i];
1741  //printf("\n--------------------------------\n");
1742  //pWrite(p);pWrite(si);
1743  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1744 
1745  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1746  {
1747  nDelete(&d);
1748  nDelete(&s);
1749  nDelete(&t);
1750  return FALSE;
1751  }
1752 
1753  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1754  //p_Test(m1,strat->tailRing);
1755  //p_Test(m2,strat->tailRing);
1756  /*if(!enterTstrong)
1757  {
1758  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1759  {
1760  memset(&(strat->P), 0, sizeof(strat->P));
1761  kStratChangeTailRing(strat);
1762  strat->P = *(strat->R[atR]);
1763  p_LmFree(m1, strat->tailRing);
1764  p_LmFree(m2, strat->tailRing);
1765  p_LmFree(gcd, currRing);
1766  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1767  }
1768  }*/
1769  pSetCoeff0(m1, s);
1770  pSetCoeff0(m2, t);
1771  pSetCoeff0(gcd, d);
1772  p_Test(m1,strat->tailRing);
1773  p_Test(m2,strat->tailRing);
1774  //printf("\n===================================\n");
1775  //pWrite(m1);pWrite(m2);pWrite(gcd);
1776 #ifdef KDEBUG
1777  if (TEST_OPT_DEBUG)
1778  {
1779  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1780  PrintS("m1 = ");
1781  p_wrp(m1, strat->tailRing);
1782  PrintS(" ; m2 = ");
1783  p_wrp(m2, strat->tailRing);
1784  PrintS(" ; gcd = ");
1785  wrp(gcd);
1786  PrintS("\n--- create strong gcd poly: ");
1787  Print("\n p: %d", i);
1788  wrp(p);
1789  Print("\n strat->S[%d]: ", i);
1790  wrp(si);
1791  PrintS(" ---> ");
1792  }
1793 #endif
1794 
1795  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1796 
1797 #ifdef KDEBUG
1798  if (TEST_OPT_DEBUG)
1799  {
1800  wrp(gcd);
1801  PrintLn();
1802  }
1803 #endif
1804 
1805  //Check and set the signatures
1806  poly pSigMult = p_Copy(sig,currRing);
1807  poly sSigMult = p_Copy(strat->sig[i],currRing);
1808  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1809  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1810  p_LmDelete(m1, strat->tailRing);
1811  p_LmDelete(m2, strat->tailRing);
1812  poly pairsig;
1813  if(pLmCmp(pSigMult,sSigMult) == 0)
1814  {
1815  //Same lm, have to add them
1816  pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1817  //This might be zero
1818  }
1819  else
1820  {
1821  //Set the sig to either pSigMult or sSigMult
1822  if(pLtCmp(pSigMult,sSigMult)==1)
1823  {
1824  pairsig = pSigMult;
1825  pDelete(&sSigMult);
1826  }
1827  else
1828  {
1829  pairsig = sSigMult;
1830  pDelete(&pSigMult);
1831  }
1832  }
1833 
1834  LObject h;
1835  h.p = gcd;
1836  h.tailRing = strat->tailRing;
1837  h.sig = pairsig;
1838  int posx;
1839  h.pCleardenom();
1840  strat->initEcart(&h);
1841  h.sev = pGetShortExpVector(h.p);
1842  h.i_r1 = -1;h.i_r2 = -1;
1843  if (currRing!=strat->tailRing)
1844  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1845  if(h.sig == NULL)
1846  {
1847  //sigdrop since we loose the signature
1848  strat->sigdrop = TRUE;
1849  //Try to reduce it as far as we can via redRing
1850  int red_result = redRing(&h,strat);
1851  if(red_result == 0)
1852  {
1853  // Cancel the sigdrop
1854  p_Delete(&h.sig,currRing);h.sig = NULL;
1855  strat->sigdrop = FALSE;
1856  return FALSE;
1857  }
1858  else
1859  {
1860  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1861  #if 1
1862  strat->enterS(h,0,strat,strat->tl);
1863  #endif
1864  return FALSE;
1865  }
1866  }
1867  if(!nGreaterZero(pGetCoeff(h.sig)))
1868  {
1869  h.sig = pNeg(h.sig);
1870  h.p = pNeg(h.p);
1871  }
1872 
1873  if(rField_is_Ring(currRing) && pLtCmp(h.sig,sig) == -1)
1874  {
1875  strat->sigdrop = TRUE;
1876  // Completely reduce it
1877  int red_result = redRing(&h,strat);
1878  if(red_result == 0)
1879  {
1880  // Reduced to 0
1881  strat->sigdrop = FALSE;
1882  p_Delete(&h.sig,currRing);h.sig = NULL;
1883  return FALSE;
1884  }
1885  else
1886  {
1887  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1888  // 0 - add just the original poly causing the sigdrop, 1 - add also this
1889  #if 1
1890  strat->enterS(h,0,strat, strat->tl+1);
1891  #endif
1892  return FALSE;
1893  }
1894  }
1895  //Check for sigdrop
1896  if(gcd != NULL && pLtCmp(sig,pairsig) > 0 && pLtCmp(strat->sig[i],pairsig) > 0)
1897  {
1898  strat->sigdrop = TRUE;
1899  //Enter this element to S
1900  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1901  strat->enterS(h,strat->sl+1,strat,strat->tl+1);
1902  }
1903  #if 1
1904  h.p1 = p;h.p2 = strat->S[i];
1905  #endif
1906  if (atR >= 0)
1907  {
1908  h.i_r2 = strat->S_2_R[i];
1909  h.i_r1 = atR;
1910  }
1911  else
1912  {
1913  h.i_r1 = -1;
1914  h.i_r2 = -1;
1915  }
1916  if (strat->Ll==-1)
1917  posx =0;
1918  else
1919  posx = strat->posInLSba(strat->L,strat->Ll,&h,strat);
1920  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1921  return TRUE;

◆ enterOneZeroPairRing()

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

Definition at line 4145 of file kutil.cc.

4147 {
4148  int l,j,compare,compareCoeff;
4149  LObject Lp;
4150 
4151 #ifdef KDEBUG
4152  Lp.ecart=0; Lp.length=0;
4153 #endif
4154  /*- computes the lcm(s[i],p) -*/
4155  Lp.lcm = p_Lcm(p,f,Lp.lcm,currRing);
4156  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
4157  assume(!strat->sugarCrit);
4158  assume(!strat->fromT);
4159  /*
4160  *the set B collects the pairs of type (S[j],p)
4161  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
4162  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
4163  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
4164  */
4165  for(j = strat->Bl;j>=0;j--)
4166  {
4167  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
4168  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
4169  if (compareCoeff == 0 || compare == compareCoeff)
4170  {
4171  if (compare == 1)
4172  {
4173  strat->c3++;
4174  pLmDelete(Lp.lcm);
4175  return;
4176  }
4177  else
4178  if (compare == -1)
4179  {
4180  deleteInL(strat->B,&strat->Bl,j,strat);
4181  strat->c3++;
4182  }
4183  }
4184  if (compare == pDivComp_EQUAL)
4185  {
4186  // Add hint for same LM and direction of LC (later) (TODO Oliver)
4187  if (compareCoeff == 1)
4188  {
4189  strat->c3++;
4190  pLmDelete(Lp.lcm);
4191  return;
4192  }
4193  else
4194  if (compareCoeff == -1)
4195  {
4196  deleteInL(strat->B,&strat->Bl,j,strat);
4197  strat->c3++;
4198  }
4199  }
4200  }
4201  /*
4202  *the pair (S[i],p) enters B if the spoly != 0
4203  */
4204  /*- compute the short s-polynomial -*/
4205  if ((f==NULL) || (p==NULL)) return;
4206  pNorm(p);
4207  {
4208  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
4209  }
4210  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
4211  {
4212  /*- the case that the s-poly is 0 -*/
4213 // if (strat->pairtest==NULL) initPairtest(strat);
4214 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
4215 // strat->pairtest[strat->sl+1] = TRUE;
4216  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
4217  /*
4218  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
4219  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
4220  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
4221  *term of p devides the lcm(s,r)
4222  *(this canceling should be done here because
4223  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
4224  *the first case is handeled in chainCrit
4225  */
4226  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
4227  }
4228  else
4229  {
4230  /*- the pair (S[i],p) enters B -*/
4231  Lp.p1 = f;
4232  Lp.p2 = p;
4233 
4234  pNext(Lp.p) = strat->tail;
4235 
4236  LObject tmp_h(f, currRing, strat->tailRing);
4237  tmp_h.SetShortExpVector();
4238  strat->initEcart(&tmp_h);
4239  tmp_h.sev = pGetShortExpVector(tmp_h.p);
4240  tmp_h.t_p = t_p;
4241 
4242  enterT(tmp_h, strat, strat->tl + 1);
4243 
4244  if (atR >= 0)
4245  {
4246  Lp.i_r2 = atR;
4247  Lp.i_r1 = strat->tl;
4248  }
4249 
4250  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
4251  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
4252  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
4253  }

◆ enterpairs()

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

Definition at line 4858 of file kutil.cc.

4860 {
4861  int j=pos;
4862 
4864  initenterpairs(h,k,ecart,0,strat, atR);
4865  if ( (!strat->fromT)
4866  && ((strat->syzComp==0)
4867  ||(pGetComp(h)<=strat->syzComp)))
4868  {
4869  unsigned long h_sev = pGetShortExpVector(h);
4870  loop
4871  {
4872  if (j > k) break;
4873  clearS(h,h_sev, &j,&k,strat);
4874  j++;
4875  }
4876  }

◆ enterpairsShift()

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

Definition at line 12768 of file kutil.cc.

12778 {
12779  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12780  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12781  int j=pos;
12782 
12784  initenterpairsShift(h,k,ecart,0,strat, atR);
12785  if ( (!strat->fromT)
12786  && ((strat->syzComp==0)
12787  ||(pGetComp(h)<=strat->syzComp)))
12788  {
12789  unsigned long h_sev = pGetShortExpVector(h);
12790  loop

◆ enterpairsSig()

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

Definition at line 4884 of file kutil.cc.

4886 {
4887  int j=pos;
4889  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4890  if ( (!strat->fromT)
4891  && ((strat->syzComp==0)
4892  ||(pGetComp(h)<=strat->syzComp)))
4893  {
4894  unsigned long h_sev = pGetShortExpVector(h);
4895  loop
4896  {
4897  if (j > k) break;
4898  clearS(h,h_sev, &j,&k,strat);
4899  j++;
4900  }
4901  }

◆ enterpairsSpecial()

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

Definition at line 4907 of file kutil.cc.

4909 {
4910  int j;
4911  const int iCompH = pGetComp(h);
4912 
4913  if (rField_is_Ring(currRing))
4914  {
4915  for (j=0; j<=k; j++)
4916  {
4917  const int iCompSj = pGetComp(strat->S[j]);
4918  if ((iCompH==iCompSj)
4919  //|| (0==iCompH) // can only happen,if iCompSj==0
4920  || (0==iCompSj))
4921  {
4922  enterOnePairRing(j,h,ecart,FALSE,strat, atR);
4923  }
4924  }
4925  kMergeBintoL(strat);
4926  }
4927  else
4928  {
4929  for (j=0; j<=k; j++)
4930  {
4931  const int iCompSj = pGetComp(strat->S[j]);
4932  if ((iCompH==iCompSj)
4933  //|| (0==iCompH) // can only happen,if iCompSj==0
4934  || (0==iCompSj))
4935  {
4936  enterOnePairSpecial(j,h,ecart,strat, atR);
4937  }
4938  }
4939  }
4940 
4941  if (strat->noClearS) return;
4942 
4943 // #ifdef HAVE_PLURAL
4944 /*
4945  if (rIsPluralRing(currRing))
4946  {
4947  j=pos;
4948  loop
4949  {
4950  if (j > k) break;
4951 
4952  if (pLmDivisibleBy(h, strat->S[j]))
4953  {
4954  deleteInS(j, strat);
4955  j--;
4956  k--;
4957  }
4958 
4959  j++;
4960  }
4961  }
4962  else
4963 */
4964 // #endif // ??? Why was the following cancelation disabled for non-commutative rings?
4965  {
4966  j=pos;
4967  loop
4968  {
4969  unsigned long h_sev = pGetShortExpVector(h);
4970  if (j > k) break;
4971  clearS(h,h_sev,&j,&k,strat);
4972  j++;
4973  }
4974  }

◆ enterSBba()

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

Definition at line 9265 of file kutil.cc.

9272 {
9273  strat->news = TRUE;
9274  /*- puts p to the standardbasis s at position at -*/
9275  if (strat->sl == IDELEMS(strat->Shdl)-1)
9276  {
9277  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9278  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9279  (IDELEMS(strat->Shdl)+setmaxTinc)
9280  *sizeof(unsigned long));
9281  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9282  IDELEMS(strat->Shdl)*sizeof(int),
9283  (IDELEMS(strat->Shdl)+setmaxTinc)
9284  *sizeof(int));
9285  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9286  IDELEMS(strat->Shdl)*sizeof(int),
9287  (IDELEMS(strat->Shdl)+setmaxTinc)
9288  *sizeof(int));
9289  if (strat->lenS!=NULL)
9290  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9291  IDELEMS(strat->Shdl)*sizeof(int),
9292  (IDELEMS(strat->Shdl)+setmaxTinc)
9293  *sizeof(int));
9294  if (strat->lenSw!=NULL)
9295  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9296  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9297  (IDELEMS(strat->Shdl)+setmaxTinc)
9298  *sizeof(wlen_type));
9299  if (strat->fromQ!=NULL)
9300  {
9301  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9302  IDELEMS(strat->Shdl)*sizeof(int),
9303  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9304  }
9305  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9306  IDELEMS(strat->Shdl)+=setmaxTinc;
9307  strat->Shdl->m=strat->S;
9308  }
9309  if (atS <= strat->sl)
9310  {
9311 #ifdef ENTER_USE_MEMMOVE
9312  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9313  (strat->sl - atS + 1)*sizeof(poly));
9314  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9315  (strat->sl - atS + 1)*sizeof(int));
9316  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9317  (strat->sl - atS + 1)*sizeof(unsigned long));
9318  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9319  (strat->sl - atS + 1)*sizeof(int));
9320  if (strat->lenS!=NULL)
9321  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9322  (strat->sl - atS + 1)*sizeof(int));
9323  if (strat->lenSw!=NULL)
9324  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9325  (strat->sl - atS + 1)*sizeof(wlen_type));
9326 #else
9327  for (i=strat->sl+1; i>=atS+1; i--)
9328  {
9329  strat->S[i] = strat->S[i-1];
9330  strat->ecartS[i] = strat->ecartS[i-1];
9331  strat->sevS[i] = strat->sevS[i-1];
9332  strat->S_2_R[i] = strat->S_2_R[i-1];
9333  }
9334  if (strat->lenS!=NULL)
9335  for (i=strat->sl+1; i>=atS+1; i--)
9336  strat->lenS[i] = strat->lenS[i-1];
9337  if (strat->lenSw!=NULL)
9338  for (i=strat->sl+1; i>=atS+1; i--)
9339  strat->lenSw[i] = strat->lenSw[i-1];
9340 #endif
9341  }
9342  if (strat->fromQ!=NULL)
9343  {
9344 #ifdef ENTER_USE_MEMMOVE
9345  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9346  (strat->sl - atS + 1)*sizeof(int));
9347 #else
9348  for (i=strat->sl+1; i>=atS+1; i--)
9349  {
9350  strat->fromQ[i] = strat->fromQ[i-1];
9351  }
9352 #endif
9353  strat->fromQ[atS]=0;
9354  }
9355 
9356  /*- save result -*/
9357  poly pp=p.p;
9358  strat->S[atS] = pp;
9359  if (strat->honey) strat->ecartS[atS] = p.ecart;
9360  if (p.sev == 0)
9361  p.sev = pGetShortExpVector(pp);
9362  else

◆ enterSBbaShift()

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

Definition at line 9365 of file kutil.cc.

9372 {
9373  int maxPossibleShift = p_mLPmaxPossibleShift(p.p, strat->tailRing);
9374  for (int i = maxPossibleShift; i > 0; i--)
9375  {
9376  LObject qq;
9377  qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order

◆ enterSMora()

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

Definition at line 1269 of file kstd1.cc.

1271 {
1272  enterSBba(p, atS, strat, atR);
1273  #ifdef KDEBUG
1274  if (TEST_OPT_DEBUG)
1275  {
1276  Print("new s%d:",atS);
1277  p_wrp(p.p,currRing,strat->tailRing);
1278  PrintLn();
1279  }
1280  #endif
1281  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1282  if (strat->kHEdgeFound)
1283  {
1284  if (newHEdge(strat))
1285  {
1286  firstUpdate(strat);
1287  if (TEST_OPT_FINDET)
1288  return;
1289 
1290  /*- cuts elements in L above noether and reorders L -*/
1291  updateLHC(strat);
1292  /*- reorders L with respect to posInL -*/
1293  reorderL(strat);
1294  }
1295  }
1296  else if (strat->kNoether!=NULL)
1297  strat->kHEdgeFound = TRUE;
1298  else if (TEST_OPT_FASTHC)
1299  {
1300  if (strat->posInLOldFlag)
1301  {
1302  missingAxis(&strat->lastAxis,strat);
1303  if (strat->lastAxis)
1304  {
1305  strat->posInLOld = strat->posInL;
1306  strat->posInLOldFlag = FALSE;
1307  strat->posInL = posInL10;
1308  strat->posInLDependsOnLength = TRUE;
1309  updateL(strat);
1310  reorderL(strat);
1311  }
1312  }
1313  else if (strat->lastAxis)
1314  updateL(strat);
1315  }

◆ enterSMoraNF()

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

Definition at line 1323 of file kstd1.cc.

1325 {
1326  enterSBba(p, atS, strat, atR);
1327  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1328  if (strat->kHEdgeFound)
1329  newHEdge(strat);
1330  else if (strat->kNoether!=NULL)
1331  strat->kHEdgeFound = TRUE;

◆ enterSSba()

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

Definition at line 9384 of file kutil.cc.

9391 {
9392  strat->news = TRUE;
9393  /*- puts p to the standardbasis s at position at -*/
9394  if (strat->sl == IDELEMS(strat->Shdl)-1)
9395  {
9396  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9397  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9398  (IDELEMS(strat->Shdl)+setmax)
9399  *sizeof(unsigned long));
9400  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9401  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9402  (IDELEMS(strat->Shdl)+setmax)
9403  *sizeof(unsigned long));
9404  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9405  IDELEMS(strat->Shdl)*sizeof(int),
9406  (IDELEMS(strat->Shdl)+setmax)
9407  *sizeof(int));
9408  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9409  IDELEMS(strat->Shdl)*sizeof(int),
9410  (IDELEMS(strat->Shdl)+setmax)
9411  *sizeof(int));
9412  if (strat->lenS!=NULL)
9413  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9414  IDELEMS(strat->Shdl)*sizeof(int),
9415  (IDELEMS(strat->Shdl)+setmax)
9416  *sizeof(int));
9417  if (strat->lenSw!=NULL)
9418  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9419  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9420  (IDELEMS(strat->Shdl)+setmax)
9421  *sizeof(wlen_type));
9422  if (strat->fromQ!=NULL)
9423  {
9424  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9425  IDELEMS(strat->Shdl)*sizeof(int),
9426  (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
9427  }
9428  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
9429  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmax);
9430  IDELEMS(strat->Shdl)+=setmax;
9431  strat->Shdl->m=strat->S;
9432  }
9433  // in a signature-based algorithm the following situation will never
9434  // appear due to the fact that the critical pairs are already sorted
9435  // by increasing signature.
9436  // True. However, in the case of integers we need to put the element
9437  // that caused the signature drop on the first position
9438  if (atS <= strat->sl)
9439  {
9440 #ifdef ENTER_USE_MEMMOVE
9441  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9442  (strat->sl - atS + 1)*sizeof(poly));
9443  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9444  (strat->sl - atS + 1)*sizeof(poly));
9445  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9446  (strat->sl - atS + 1)*sizeof(unsigned long));
9447  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9448  (strat->sl - atS + 1)*sizeof(int));
9449  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9450  (strat->sl - atS + 1)*sizeof(unsigned long));
9451  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9452  (strat->sl - atS + 1)*sizeof(int));
9453  if (strat->lenS!=NULL)
9454  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9455  (strat->sl - atS + 1)*sizeof(int));
9456  if (strat->lenSw!=NULL)
9457  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9458  (strat->sl - atS + 1)*sizeof(wlen_type));
9459 #else
9460  for (i=strat->sl+1; i>=atS+1; i--)
9461  {
9462  strat->S[i] = strat->S[i-1];
9463  strat->ecartS[i] = strat->ecartS[i-1];
9464  strat->sevS[i] = strat->sevS[i-1];
9465  strat->S_2_R[i] = strat->S_2_R[i-1];
9466  strat->sig[i] = strat->sig[i-1];
9467  strat->sevSig[i] = strat->sevSig[i-1];
9468  }
9469  if (strat->lenS!=NULL)
9470  for (i=strat->sl+1; i>=atS+1; i--)
9471  strat->lenS[i] = strat->lenS[i-1];
9472  if (strat->lenSw!=NULL)
9473  for (i=strat->sl+1; i>=atS+1; i--)
9474  strat->lenSw[i] = strat->lenSw[i-1];
9475 #endif
9476  }
9477  if (strat->fromQ!=NULL)
9478  {
9479 #ifdef ENTER_USE_MEMMOVE
9480  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9481  (strat->sl - atS + 1)*sizeof(int));
9482 #else
9483  for (i=strat->sl+1; i>=atS+1; i--)
9484  {
9485  strat->fromQ[i] = strat->fromQ[i-1];
9486  }
9487 #endif
9488  strat->fromQ[atS]=0;
9489  }
9490 
9491  /*- save result -*/
9492  strat->S[atS] = p.p;
9493  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9494  if (strat->honey) strat->ecartS[atS] = p.ecart;
9495  if (p.sev == 0)
9496  p.sev = pGetShortExpVector(p.p);
9497  else
9498  assume(p.sev == pGetShortExpVector(p.p));
9499  strat->sevS[atS] = p.sev;
9500  // during the interreduction process of a signature-based algorithm we do not
9501  // compute the signature at this point, but when the whole interreduction
9502  // process finishes, i.e. f5c terminates!
9503  if (p.sig != NULL)
9504  {
9505  if (p.sevSig == 0)
9506  p.sevSig = pGetShortExpVector(p.sig);
9507  else
9508  assume(p.sevSig == pGetShortExpVector(p.sig));
9509  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9510  }
9511  strat->ecartS[atS] = p.ecart;
9512  strat->S_2_R[atS] = atR;
9513  strat->sl++;
9514 #ifdef DEBUGF5
9515  int k;
9516  Print("--- LIST S: %d ---\n",strat->sl);
9517  for(k=0;k<=strat->sl;k++)

◆ enterSyz()

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

Definition at line 9782 of file kutil.cc.

9789 {
9790  int i;
9791  strat->newt = TRUE;
9792  if (strat->syzl == strat->syzmax-1)
9793  {
9794  pEnlargeSet(&strat->syz,strat->syzmax,setmax);
9795  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9796  (strat->syzmax)*sizeof(unsigned long),
9797  ((strat->syzmax)+setmax)
9798  *sizeof(unsigned long));
9799  strat->syzmax += setmax;
9800  }
9801  if (atT < strat->syzl)
9802  {
9803 #ifdef ENTER_USE_MEMMOVE
9804  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9805  (strat->syzl-atT+1)*sizeof(poly));
9806  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9807  (strat->syzl-atT+1)*sizeof(unsigned long));
9808 #endif
9809  for (i=strat->syzl; i>=atT+1; i--)
9810  {
9811 #ifndef ENTER_USE_MEMMOVE
9812  strat->syz[i] = strat->syz[i-1];
9813  strat->sevSyz[i] = strat->sevSyz[i-1];
9814 #endif
9815  }
9816  }
9817  //i = strat->syzl;
9818  i = atT;
9819  //Makes sure the syz saves just the signature
9820  #ifdef HAVE_RINGS
9822  pNext(p.sig) = NULL;
9823  #endif
9824  strat->syz[atT] = p.sig;
9825  strat->sevSyz[atT] = p.sevSig;
9826  strat->syzl++;
9827 #if F5DEBUG
9828  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9829  pWrite(strat->syz[atT]);
9830 #endif
9831  // recheck pairs in strat->L with new rule and delete correspondingly
9832  int cc = strat->Ll;
9833  while (cc>-1)
9834  {
9835  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9836  //printf("\npLmShDivBy(syz,L) = %i\nn_DivBy(L,syz) = %i\n pLtCmp(L,syz) = %i",p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],strat->L[cc].sig, ~strat->L[cc].sevSig, currRing), n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing), pLtCmp(strat->L[cc].sig,strat->syz[atT])==1);
9837  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9838  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9839  #ifdef HAVE_RINGS
9840  &&((!rField_is_Ring(currRing))
9841  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9842  #endif
9843  )
9844  {
9845  //printf("\nYES!\n");
9846  deleteInL(strat->L,&strat->Ll,cc,strat);
9847  }
9848  cc--;
9849  }
9850 //#if 1
9851 #ifdef DEBUGF5
9852  PrintS("--- Syzygies ---\n");
9853  Print("syzl %d\n",strat->syzl);
9854  Print("syzmax %d\n",strat->syzmax);
9855  PrintS("--------------------------------\n");
9856  for(i=0;i<=strat->syzl-1;i++)
9857  {

◆ enterT()

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

Definition at line 9580 of file kutil.cc.

9587 {
9588  int i;
9589 
9590 #ifdef PDEBUG
9591 #ifdef HAVE_SHIFTBBA
9592  if (currRing->isLPring && p.shift > 0)
9593  {
9594  // in this case, the order is not correct. test LM and tail separately
9595  p_LmTest(p.p, currRing);
9596  p_Test(pNext(p.p), currRing);
9597  }
9598  else
9599 #endif
9600  {
9601  pp_Test(p.p, currRing, p.tailRing);
9602  }
9603 #endif
9604  assume(strat->tailRing == p.tailRing);
9605  // redMoraNF complains about this -- but, we don't really
9606  // neeed this so far
9607  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9608  assume(p.FDeg == p.pFDeg());
9609  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9610 
9611 #ifdef KDEBUG
9612  // do not put an LObject twice into T:
9613  for(i=strat->tl;i>=0;i--)
9614  {
9615  if (p.p==strat->T[i].p)
9616  {
9617  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9618  return;
9619  }
9620  }
9621 #endif
9622 
9623 #ifdef HAVE_TAIL_RING
9624  if (currRing!=strat->tailRing)
9625  {
9626  p.t_p=p.GetLmTailRing();
9627  }
9628 #endif
9629  strat->newt = TRUE;
9630  if (atT < 0)
9631  atT = strat->posInT(strat->T, strat->tl, p);
9632  if (strat->tl == strat->tmax-1)
9633  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9634  if (atT <= strat->tl)
9635  {
9636 #ifdef ENTER_USE_MEMMOVE
9637  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9638  (strat->tl-atT+1)*sizeof(TObject));
9639  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9640  (strat->tl-atT+1)*sizeof(unsigned long));
9641 #endif
9642  for (i=strat->tl+1; i>=atT+1; i--)
9643  {
9644 #ifndef ENTER_USE_MEMMOVE
9645  strat->T[i] = strat->T[i-1];
9646  strat->sevT[i] = strat->sevT[i-1];
9647 #endif
9648  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9649  }
9650  }
9651 
9652  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9653  {
9654 #ifdef HAVE_SHIFTBBA
9655  // letterplace: if p.shift > 0 then pNext(p.p) is already in the tailBin
9656  if (!(currRing->isLPring && p.shift > 0))
9657 #endif
9658  {
9660  (strat->tailRing != NULL ?
9661  strat->tailRing : currRing),
9662  strat->tailBin);
9663  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9664  }
9665  }
9666  strat->T[atT] = (TObject) p;
9667  //printf("\nenterT: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9668 
9669  if (pNext(p.p) != NULL)
9670  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9671  else
9672  strat->T[atT].max_exp = NULL;
9673 
9674  strat->tl++;

◆ enterT_strong()

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

Definition at line 9680 of file kutil.cc.

9687 {
9689  int i;
9690 
9691  pp_Test(p.p, currRing, p.tailRing);
9692  assume(strat->tailRing == p.tailRing);
9693  // redMoraNF complains about this -- but, we don't really
9694  // neeed this so far
9695  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9696  assume(p.FDeg == p.pFDeg());
9697  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9698 
9699 #ifdef KDEBUG
9700  // do not put an LObject twice into T:
9701  for(i=strat->tl;i>=0;i--)
9702  {
9703  if (p.p==strat->T[i].p)
9704  {
9705  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9706  return;
9707  }
9708  }
9709 #endif
9710 
9711 #ifdef HAVE_TAIL_RING
9712  if (currRing!=strat->tailRing)
9713  {
9714  p.t_p=p.GetLmTailRing();
9715  }
9716 #endif
9717  strat->newt = TRUE;
9718  if (atT < 0)
9719  atT = strat->posInT(strat->T, strat->tl, p);
9720  if (strat->tl == strat->tmax-1)
9721  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9722  if (atT <= strat->tl)
9723  {
9724 #ifdef ENTER_USE_MEMMOVE
9725  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9726  (strat->tl-atT+1)*sizeof(TObject));
9727  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9728  (strat->tl-atT+1)*sizeof(unsigned long));
9729 #endif
9730  for (i=strat->tl+1; i>=atT+1; i--)
9731  {
9732 #ifndef ENTER_USE_MEMMOVE
9733  strat->T[i] = strat->T[i-1];
9734  strat->sevT[i] = strat->sevT[i-1];
9735 #endif
9736  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9737  }
9738  }
9739 
9740  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9741  {
9743  (strat->tailRing != NULL ?
9744  strat->tailRing : currRing),
9745  strat->tailBin);
9746  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9747  }
9748  strat->T[atT] = (TObject) p;
9749  //printf("\nenterT_strong: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9750 
9751  if (pNext(p.p) != NULL)
9752  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9753  else
9754  strat->T[atT].max_exp = NULL;
9755 
9756  strat->tl++;
9757  strat->R[strat->tl] = &(strat->T[atT]);
9758  strat->T[atT].i_r = strat->tl;
9759  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9760  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9761  #if 1
9763  && !n_IsUnit(p.p->coef, currRing->cf))
9764  {
9765  for(i=strat->tl;i>=0;i--)
9766  {
9767  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9768  {
9769  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9770  }
9771  }
9772  }
9773  /*
9774  printf("\nThis is T:\n");
9775  for(i=strat->tl;i>=0;i--)
9776  {

◆ enterTShift()

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

Definition at line 12798 of file kutil.cc.

12808 {
12809  /* determine how many elements we have to insert */
12810  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12811  /* hence, a total number of elt's to add is: */
12812  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12813  pAssume(p.p != NULL);
12814 
12815  int maxPossibleShift = p_mLPmaxPossibleShift(p.p, strat->tailRing);
12816 
12817  for (int i = 1; i <= maxPossibleShift; i++)

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10285 of file kutil.cc.

10285  {
10286  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10287  strat->fromQ=NULL;
10288  }
10289  assume(kTest_TS(strat));
10290 }
10291 
10292 void exitBuchMora (kStrategy strat)
10293 {
10294  /*- release temp data -*/
10295  cleanT(strat);
10296  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10297  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10298  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10299  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10300  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10301  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10302  /*- set L: should be empty -*/
10303  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10304  /*- set B: should be empty -*/
10305  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10306  pLmFree(&strat->tail);
10307  strat->syzComp=0;
10308 
10309 #ifdef HAVE_SHIFTBBA

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10486 of file kutil.cc.

10494 {
10495  /*- release temp data -*/
10497  cleanTSbaRing(strat);
10498  else
10499  cleanT(strat);
10500  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10501  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10502  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10503  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10504  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10505  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10506  if(strat->syzmax>0)
10507  {
10508  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10509  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10510  if (strat->sbaOrder == 1)
10511  {
10512  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10513  }
10514  }
10515  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10516  /*- set L: should be empty -*/
10517  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));

◆ faugereRewCriterion()

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

Definition at line 7128 of file kutil.cc.

7130 {
7131  //printf("Faugere Rewritten Criterion\n");
7133  return FALSE;
7134 //#if 1
7135 #ifdef DEBUGF5
7136  PrintS("rewritten criterion checks: ");
7137  pWrite(sig);
7138 #endif
7139  for(int k = strat->sl; k>=start; k--)
7140  {
7141 //#if 1
7142 #ifdef DEBUGF5
7143  PrintS("checking with: ");
7144  pWrite(strat->sig[k]);
7145  pWrite(pHead(strat->S[k]));
7146 #endif
7147  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7148  {
7149 //#if 1
7150 #ifdef DEBUGF5
7151  PrintS("DELETE!\n");
7152 #endif
7153  strat->nrrewcrit++;
7154  return TRUE;
7155  }
7156  //k--;
7157  }
7158 #ifdef DEBUGF5
7159  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7160  for(int kk = 0; kk<strat->sl+1; kk++)
7161  {
7162  pWrite(pHead(strat->S[kk]));
7163  }
7164  PrintS("------------------------------\n");
7165 #endif
7166  return FALSE;

◆ finalReduceByMon()

void finalReduceByMon ( kStrategy  strat)

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

Definition at line 11309 of file kutil.cc.

11319 {
11320  assume(strat->tl<0); /* can only be called with no elements in T:
11321  i.e. after exitBuchMora */
11322  /* do not use strat->S, strat->sl as they may be out of sync*/
11323  if(!nCoeff_is_Z(currRing->cf))
11324  return;
11325  poly p,pp;
11326  for(int j = 0; j<IDELEMS(strat->Shdl); j++)
11327  {
11328  if((strat->Shdl->m[j]!=NULL)&&(pNext(strat->Shdl->m[j]) == NULL))
11329  {
11330  for(int i = 0; i<IDELEMS(strat->Shdl); i++)
11331  {
11332  if((i != j) && (strat->Shdl->m[i] != NULL))
11333  {
11334  p = strat->Shdl->m[i];
11335  while((p!=NULL) && pLmDivisibleBy(strat->Shdl->m[j], p))
11336  {
11337  number dummy = n_IntMod(p->coef, strat->Shdl->m[j]->coef, currRing->cf);
11338  if (!nEqual(dummy,p->coef))
11339  {
11340  if (nIsZero(dummy))
11341  {
11342  nDelete(&dummy);
11343  pLmDelete(&strat->Shdl->m[i]);
11344  p=strat->Shdl->m[i];
11345  }
11346  else
11347  {
11348  p_SetCoeff(p,dummy,currRing);
11349  break;
11350  }
11351  }
11352  else
11353  {
11354  nDelete(&dummy);
11355  break;
11356  }
11357  }
11358  if (p!=NULL)
11359  {
11360  pp = pNext(p);
11361  while(pp != NULL)
11362  {
11363  if(pLmDivisibleBy(strat->Shdl->m[j], pp))
11364  {
11365  number dummy = n_IntMod(pp->coef, strat->Shdl->m[j]->coef, currRing->cf);
11366  if (!nEqual(dummy,pp->coef))
11367  {
11368  p_SetCoeff(pp,dummy,currRing);
11369  if(nIsZero(pp->coef))
11370  {
11371  pLmDelete(&pNext(p));
11372  pp = pNext(p);
11373  }
11374  else
11375  {
11376  p = pp;
11377  pp = pNext(p);
11378  }
11379  }
11380  else
11381  {
11382  nDelete(&dummy);
11383  p = pp;
11384  pp = pNext(p);
11385  }
11386  }
11387  else
11388  {
11389  p = pp;
11390  pp = pNext(p);
11391  }

◆ getIndexRng()

int getIndexRng ( long  coeff)
inline

Definition at line 6523 of file kutil.cc.

6525 {
6526  if (coeff == 0) return -1;
6527  long tmp = coeff;
6528  int ind = 0;
6529  while (tmp % 2 == 0)
6530  {
6531  tmp = tmp / 2;
6532  ind++;
6533  }
6534  return ind;

◆ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 467 of file kutil.cc.

469 {
470  int j,/*k,*/p;
471 
472  strat->kHEdgeFound=FALSE;
473  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
474  {
475  return;
476  }
477  if (strat->ak > 1) /*we are in the module case*/
478  {
479  return; // until ....
480  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
481  // return FALSE;
482  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
483  // return FALSE;
484  }
485  // k = 0;
486  p=pIsPurePower(pp);
487  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(pp),currRing->cf))) return;
488  if (p!=0) strat->NotUsedAxis[p] = FALSE;
489  /*- the leading term of pp is a power of the p-th variable -*/
490  for (j=(currRing->N);j>0; j--)
491  {
492  if (strat->NotUsedAxis[j])
493  {
494  return;
495  }
496  }
497  strat->kHEdgeFound=TRUE;

◆ ind2()

long ind2 ( long  arg)

Definition at line 4110 of file kutil.cc.

4112 {
4113  long ind = 0;
4114  if (arg <= 0) return 0;
4115  while (arg%2 == 0)
4116  {
4117  arg = arg / 2;
4118  ind++;
4119  }
4120  return ind;

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4122 of file kutil.cc.

4124 {
4125  long ind = 0;
4126  if (arg <= 0) return 0;
4127  if (arg%2 == 1) { arg--; }
4128  while (arg > 0)
4129  {
4130  ind += ind2(arg);
4131  arg = arg - 2;
4132  }
4133  return ind;

◆ initBuchMora()

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

Definition at line 10201 of file kutil.cc.

10209 {
10210  strat->interpt = BTEST1(OPT_INTERRUPT);
10211  strat->kHEdge=NULL;
10213  /*- creating temp data structures------------------- -*/
10214  strat->cp = 0;
10215  strat->c3 = 0;
10216 #ifdef HAVE_SHIFTBBA
10217  strat->cv = 0;
10218 #endif
10219  strat->tail = pInit();
10220  /*- set s -*/
10221  strat->sl = -1;
10222  /*- set L -*/
10223  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10224  strat->Ll = -1;
10225  strat->L = initL(strat->Lmax);
10226  /*- set B -*/
10227  strat->Bmax = setmaxL;
10228  strat->Bl = -1;
10229  strat->B = initL();
10230  /*- set T -*/
10231  strat->tl = -1;
10232  strat->tmax = setmaxT;
10233  strat->T = initT();
10234  strat->R = initR();
10235  strat->sevT = initsevT();
10236  /*- init local data struct.---------------------------------------- -*/
10237  strat->P.ecart=0;
10238  strat->P.length=0;
10239  strat->P.pLength=0;
10241  {
10242  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10243  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10244  }
10246  {
10247  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10248  }
10249  else
10250  {
10251  if(TEST_OPT_SB_1)
10252  {
10253  int i;
10254  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10255  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10256  {
10257  P->m[i-strat->newIdeal] = F->m[i];
10258  F->m[i] = NULL;
10259  }
10260  initSSpecial(F,Q,P,strat);
10261  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10262  {
10263  F->m[i] = P->m[i-strat->newIdeal];
10264  P->m[i-strat->newIdeal] = NULL;
10265  }
10266  idDelete(&P);
10267  }
10268  else
10269  {
10270  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10271  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10272  }
10273  }
10274  strat->fromT = FALSE;
10276  if ((!TEST_OPT_SB_1)
10277  || (rField_is_Ring(currRing))
10278  )
10279  {
10280  updateS(TRUE,strat);
10281  }
10282 #ifdef HAVE_SHIFTBBA
10283  if (!(rIsLPRing(currRing) && strat->rightGB)) // for right GB, we need to check later whether a poly is from Q

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9878 of file kutil.cc.

9879  {
9880  *hilb=NULL;
9881  }
9882 }
9883 
9884 void initBuchMoraCrit(kStrategy strat)
9885 {
9887  strat->chainCrit=chainCritNormal;
9888  if (TEST_OPT_SB_1)
9889  strat->chainCrit=chainCritOpt_1;
9890 #ifdef HAVE_RINGS
9891  if (rField_is_Ring(currRing))
9892  {
9894  strat->chainCrit=chainCritRing;
9895  }
9896 #endif
9897 #ifdef HAVE_RATGRING
9898  if (rIsRatGRing(currRing))
9899  {
9900  strat->chainCrit=chainCritPart;
9901  /* enterOnePairNormal get rational part in it */
9902  }
9903 #endif
9904  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9905  && (!rIsPluralRing(currRing)))
9907 
9908  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9909  strat->Gebauer = strat->homog || strat->sugarCrit;
9910  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9911  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9912  strat->pairtest = NULL;
9913  /* alway use tailreduction, except:
9914  * - in local rings, - in lex order case, -in ring over extensions */
9916  //if(rHasMixedOrdering(currRing)==2)
9917  //{
9918  // strat->noTailReduction =TRUE;
9919  //}
9920 
9921 #ifdef HAVE_PLURAL
9922  // and r is plural_ring
9923  // hence this holds for r a rational_plural_ring
9924  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9925  { //or it has non-quasi-comm type... later
9926  strat->sugarCrit = FALSE;
9927  strat->Gebauer = FALSE;
9928  strat->honey = FALSE;
9929  }
9930 #endif
9931 
9932  // Coefficient ring?
9933  if (rField_is_Ring(currRing))
9934  {
9935  strat->sugarCrit = FALSE;
9936  strat->Gebauer = FALSE ;
9937  strat->honey = FALSE;
9938  }
9939  #ifdef KDEBUG
9940  if (TEST_OPT_DEBUG)

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 10028 of file kutil.cc.

10036 {
10038  {
10039  if (strat->honey)
10040  {
10041  strat->posInL = posInL15;
10042  // ok -- here is the deal: from my experiments for Singular-2-0
10043  // I conclude that that posInT_EcartpLength is the best of
10044  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10045  // see the table at the end of this file
10046  if (TEST_OPT_OLDSTD)
10047  strat->posInT = posInT15;
10048  else
10049  strat->posInT = posInT_EcartpLength;
10050  }
10051  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10052  {
10053  strat->posInL = posInL11;
10054  strat->posInT = posInT11;
10055  }
10056  else if (TEST_OPT_INTSTRATEGY)
10057  {
10058  strat->posInL = posInL11;
10059  strat->posInT = posInT11;
10060  }
10061  else
10062  {
10063  strat->posInL = posInL0;
10064  strat->posInT = posInT0;
10065  }
10066  //if (strat->minim>0) strat->posInL =posInLSpecial;
10067  if (strat->homog)
10068  {
10069  strat->posInL = posInL110;
10070  strat->posInT = posInT110;
10071  }
10072  }
10073  else
10074  {
10075  if (strat->homog)
10076  {
10077  strat->posInL = posInL11;
10078  strat->posInT = posInT11;
10079  }
10080  else
10081  {
10082  if ((currRing->order[0]==ringorder_c)
10083  ||(currRing->order[0]==ringorder_C))
10084  {
10085  strat->posInL = posInL17_c;
10086  strat->posInT = posInT17_c;
10087  }
10088  else
10089  {
10090  strat->posInL = posInL17;
10091  strat->posInT = posInT17;
10092  }
10093  }
10094  }
10095  if (strat->minim>0) strat->posInL =posInLSpecial;
10096  // for further tests only
10097  if ((BTEST1(11)) || (BTEST1(12)))
10098  strat->posInL = posInL11;
10099  else if ((BTEST1(13)) || (BTEST1(14)))
10100  strat->posInL = posInL13;
10101  else if ((BTEST1(15)) || (BTEST1(16)))
10102  strat->posInL = posInL15;
10103  else if ((BTEST1(17)) || (BTEST1(18)))
10104  strat->posInL = posInL17;
10105  if (BTEST1(11))
10106  strat->posInT = posInT11;
10107  else if (BTEST1(13))
10108  strat->posInT = posInT13;
10109  else if (BTEST1(15))
10110  strat->posInT = posInT15;
10111  else if ((BTEST1(17)))

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10114 of file kutil.cc.

10122 {
10124  {
10125  if (strat->honey)
10126  {
10127  strat->posInL = posInL15Ring;
10128  // ok -- here is the deal: from my experiments for Singular-2-0
10129  // I conclude that that posInT_EcartpLength is the best of
10130  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10131  // see the table at the end of this file
10132  if (TEST_OPT_OLDSTD)
10133  strat->posInT = posInT15Ring;
10134  else
10135  strat->posInT = posInT_EcartpLength;
10136  }
10137  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10138  {
10139  strat->posInL = posInL11Ring;
10140  strat->posInT = posInT11;
10141  }
10142  else if (TEST_OPT_INTSTRATEGY)
10143  {
10144  strat->posInL = posInL11Ring;
10145  strat->posInT = posInT11;
10146  }
10147  else
10148  {
10149  strat->posInL = posInL0Ring;
10150  strat->posInT = posInT0;
10151  }
10152  //if (strat->minim>0) strat->posInL =posInLSpecial;
10153  if (strat->homog)
10154  {
10155  strat->posInL = posInL110Ring;
10156  strat->posInT = posInT110Ring;
10157  }
10158  }
10159  else
10160  {
10161  if (strat->homog)
10162  {
10163  //printf("\nHere 3\n");
10164  strat->posInL = posInL11Ring;
10165  strat->posInT = posInT11Ring;
10166  }
10167  else
10168  {
10169  if ((currRing->order[0]==ringorder_c)
10170  ||(currRing->order[0]==ringorder_C))
10171  {
10172  strat->posInL = posInL17_cRing;
10173  strat->posInT = posInT17_cRing;
10174  }
10175  else
10176  {
10177  strat->posInL = posInL11Ringls;
10178  strat->posInT = posInT17Ring;
10179  }
10180  }
10181  }
10182  if (strat->minim>0) strat->posInL =posInLSpecial;
10183  // for further tests only
10184  if ((BTEST1(11)) || (BTEST1(12)))
10185  strat->posInL = posInL11Ring;
10186  else if ((BTEST1(13)) || (BTEST1(14)))
10187  strat->posInL = posInL13;
10188  else if ((BTEST1(15)) || (BTEST1(16)))
10189  strat->posInL = posInL15Ring;
10190  else if ((BTEST1(17)) || (BTEST1(18)))
10191  strat->posInL = posInL17Ring;
10192  if (BTEST1(11))
10193  strat->posInT = posInT11Ring;
10194  else if (BTEST1(13))
10195  strat->posInT = posInT13;
10196  else if (BTEST1(15))
10197  strat->posInT = posInT15Ring;
10198  else if ((BTEST1(17)))

◆ initec()

static intset initec ( const int  maxnr)
inlinestatic

Definition at line 502 of file kutil.cc.

504 {
505  return (intset)omAlloc(maxnr*sizeof(int));

◆ initEcartBBA()

void initEcartBBA ( TObject h)

Definition at line 1291 of file kutil.cc.

1293 {
1294  h->FDeg = h->pFDeg();
1295  (*h).ecart = 0;
1296  h->length=h->pLength=pLength(h->p);

◆ initEcartNormal()

void initEcartNormal ( TObject h)

Definition at line 1283 of file kutil.cc.

1285 {
1286  h->FDeg = h->pFDeg();
1287  h->ecart = h->pLDeg() - h->FDeg;
1288  // h->length is set by h->pLDeg
1289  h->length=h->pLength=pLength(h->p);

◆ initEcartPairBba()

void initEcartPairBba ( LObject Lp,
poly  ,
poly  ,
int  ,
int   
)

Definition at line 1298 of file kutil.cc.

1300 {
1301  Lp->FDeg = Lp->pFDeg();
1302  (*Lp).ecart = 0;
1303  (*Lp).length = 0;

◆ initEcartPairMora()

void initEcartPairMora ( LObject Lp,
poly  ,
poly  ,
int  ecartF,
int  ecartG 
)

Definition at line 1305 of file kutil.cc.

1307 {
1308  Lp->FDeg = Lp->pFDeg();
1309  (*Lp).ecart = si_max(ecartF,ecartG);
1310  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1311  (*Lp).length = 0;

◆ initenterpairs()

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

Definition at line 3768 of file kutil.cc.

3770 {
3771 
3772  if ((strat->syzComp==0)
3773  || (pGetComp(h)<=strat->syzComp))
3774  {
3775  int j;
3776  BOOLEAN new_pair=FALSE;
3777 
3778  if (pGetComp(h)==0)
3779  {
3780  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3781  if ((isFromQ)&&(strat->fromQ!=NULL))
3782  {
3783  for (j=0; j<=k; j++)
3784  {
3785  if (!strat->fromQ[j])
3786  {
3787  new_pair=TRUE;
3788  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3789  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3790  }
3791  }
3792  }
3793  else
3794  {
3795  new_pair=TRUE;
3796  for (j=0; j<=k; j++)
3797  {
3798  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3799  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3800  }
3801  }
3802  }
3803  else
3804  {
3805  for (j=0; j<=k; j++)
3806  {
3807  if ((pGetComp(h)==pGetComp(strat->S[j]))
3808  || (pGetComp(strat->S[j])==0))
3809  {
3810  new_pair=TRUE;
3811  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3812  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3813  }
3814  }
3815  }
3816  if (new_pair)
3817  {
3818  #ifdef HAVE_RATGRING
3819  if (currRing->real_var_start>0)
3820  chainCritPart(h,ecart,strat);
3821  else
3822  #endif
3823  strat->chainCrit(h,ecart,strat);
3824  }
3825  kMergeBintoL(strat);
3826  }

◆ initenterpairsShift()

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

Definition at line 12591 of file kutil.cc.

12601 {
12602  int h_lastVblock = pmLastVblock(h);
12603  assume(h_lastVblock != 0 || pLmIsConstantComp(h));
12604  // TODO: is it allowed to skip pairs with constants? also with constants from other components?
12605  if (h_lastVblock == 0) return;
12606  assume(pmFirstVblock(h) == 1);
12607  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12608  // atR = -1;
12609  if ((strat->syzComp==0)
12610  || (pGetComp(h)<=strat->syzComp))
12611  {
12612  int i,j;
12613  BOOLEAN new_pair=FALSE;
12614 
12615  int degbound = currRing->N/currRing->isLPring;
12616  int maxShift = degbound - h_lastVblock;
12617 
12618  if (pGetComp(h)==0)
12619  {
12620  if (strat->rightGB)
12621  {
12622  if (isFromQ)
12623  {
12624  // pairs (shifts(h),s[1..k]), (h, s[1..k])
12625  for (i=0; i<=maxShift; i++)
12626  {
12627  poly hh = pLPCopyAndShiftLM(h, i);
12628  for (j=0; j<=k; j++)
12629  {
12630  if (strat->fromQ == NULL || !strat->fromQ[j])
12631  {
12632  new_pair=TRUE;
12633  poly s = strat->S[j];
12634  enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
12635  }
12636  }
12637  }
12638  }
12639  else
12640  {
12641  new_pair=TRUE;
12642  for (j=0; j<=k; j++)
12643  {
12644  poly s = strat->S[j];
12645  if (strat->fromQ != NULL && strat->fromQ[j])
12646  {
12647  // pairs (shifts(s[j]),h), (s[j],h)
12648  enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
12649  }
12650  else
12651  {
12652  // pair (h, s[j])
12653  enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0);
12654  }
12655  }
12656  }
12657  }
12658  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12659  else if ((isFromQ)&&(strat->fromQ!=NULL))
12660  {
12661  // pairs (shifts(s[1..k]),h), (s[1..k],h)
12662  for (j=0; j<=k; j++) {
12663  if (!strat->fromQ[j])
12664  {
12665  new_pair=TRUE;
12666  poly s = strat->S[j];
12667  enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
12668  }
12669  }
12670  // pairs (shifts(h),s[1..k])
12671  if (new_pair)
12672  {
12673  for (i=1; i<=maxShift; i++)
12674  {
12675  poly hh = pLPCopyAndShiftLM(h, i);
12676  for (j=0; j<=k; j++)
12677  {
12678  if (!strat->fromQ[j])
12679  {
12680  poly s = strat->S[j];
12681  enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
12682  }
12683  }
12684  }
12685  }
12686  }
12687  else
12688  {
12689  new_pair=TRUE;
12690  // pairs (shifts(s[1..k]),h), (s[1..k],h)
12691  for (j=0; j<=k; j++) {
12692  poly s = strat->S[j];
12693  // TODO: cache lastVblock of s[1..k] for later use
12694  enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
12695  }
12696  // pairs (shifts(h),s[1..k]), (shifts(h), h)
12697  for (i=1; i<=maxShift; i++)
12698  {
12699  poly hh = pLPCopyAndShiftLM(h, i);
12700  for (j=0; j<=k; j++)
12701  {
12702  poly s = strat->S[j];
12703  enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
12704  }
12705  enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i);
12706  }
12707  }
12708  }
12709  else
12710  {
12711  new_pair=TRUE;
12712  if (strat->rightGB)
12713  {
12714  for (j=0; j<=k; j++)
12715  {
12716  if ((pGetComp(h)==pGetComp(strat->S[j]))
12717  || (pGetComp(strat->S[j])==0))
12718  {
12719  assume(isFromQ == 0); // this case is not handeled here and should also never happen
12720  poly s = strat->S[j];
12721  if (strat->fromQ != NULL && strat->fromQ[j])
12722  {
12723  // pairs (shifts(s[j]),h), (s[j],h)
12724  enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
12725  }
12726  else
12727  {
12728  // pair (h, s[j])
12729  enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0);
12730  }
12731  }
12732  }
12733  }
12734  else
12735  {
12736  // pairs (shifts(s[1..k]),h), (s[1..k],h)
12737  for (j=0; j<=k; j++) {
12738  if ((pGetComp(h)==pGetComp(strat->S[j]))
12739  || (pGetComp(strat->S[j])==0))
12740  {
12741  poly s = strat->S[j];
12742  enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
12743  }
12744  }
12745  // pairs (shifts(h),s[1..k]), (shifts(h), h)
12746  for (i=1; i<=maxShift; i++)
12747  {
12748  poly hh = pLPCopyAndShiftLM(h, i);
12749  for (j=0; j<=k; j++)
12750  {
12751  if ((pGetComp(h)==pGetComp(strat->S[j]))
12752  || (pGetComp(strat->S[j])==0))
12753  {
12754  poly s = strat->S[j];
12755  enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
12756  }
12757  }
12758  enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i);
12759  }
12760  }

◆ initenterpairsSig()

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

Definition at line 3833 of file kutil.cc.

3835 {
3836 
3837  if ((strat->syzComp==0)
3838  || (pGetComp(h)<=strat->syzComp))
3839  {
3840  int j;
3841  BOOLEAN new_pair=FALSE;
3842 
3843  if (pGetComp(h)==0)
3844  {
3845  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3846  if ((isFromQ)&&(strat->fromQ!=NULL))
3847  {
3848  for (j=0; j<=k; j++)
3849  {
3850  if (!strat->fromQ[j])
3851  {
3852  new_pair=TRUE;
3853  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3854  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3855  }
3856  }
3857  }
3858  else
3859  {
3860  new_pair=TRUE;
3861  for (j=0; j<=k; j++)
3862  {
3863  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3864  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3865  }
3866  }
3867  }
3868  else
3869  {
3870  for (j=0; j<=k; j++)
3871  {
3872  if ((pGetComp(h)==pGetComp(strat->S[j]))
3873  || (pGetComp(strat->S[j])==0))
3874  {
3875  new_pair=TRUE;
3876  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3877  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3878  }
3879  }
3880  }
3881 
3882  if (new_pair)
3883  {
3884 #ifdef HAVE_RATGRING
3885  if (currRing->real_var_start>0)
3886  chainCritPart(h,ecart,strat);
3887  else
3888 #endif
3889  strat->chainCrit(h,ecart,strat);
3890  }
3891  }

◆ initenterpairsSigRing()

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

Definition at line 3893 of file kutil.cc.

3895 {
3896 
3897  if ((strat->syzComp==0)
3898  || (pGetComp(h)<=strat->syzComp))
3899  {
3900  int j;
3901 
3902  if (pGetComp(h)==0)
3903  {
3904  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3905  if ((isFromQ)&&(strat->fromQ!=NULL))
3906  {
3907  for (j=0; j<=k && !strat->sigdrop; j++)
3908  {
3909  if (!strat->fromQ[j])
3910  {
3911  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3912  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3913  }
3914  }
3915  }
3916  else
3917  {
3918  for (j=0; j<=k && !strat->sigdrop; j++)
3919  {
3920  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3921  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3922  }
3923  }
3924  }
3925  else
3926  {
3927  for (j=0; j<=k && !strat->sigdrop; j++)
3928  {
3929  if ((pGetComp(h)==pGetComp(strat->S[j]))
3930  || (pGetComp(strat->S[j])==0))
3931  {
3932  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3933  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3934  }
3935  }
3936  }
3937 
3938 #if 0
3939  if (new_pair)
3940  {
3941 #ifdef HAVE_RATGRING
3942  if (currRing->real_var_start>0)
3943  chainCritPart(h,ecart,strat);
3944  else
3945 #endif
3946  strat->chainCrit(h,ecart,strat);
3947  }
3948 #endif
3949  }

◆ initenterstrongPairs()

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

Definition at line 4521 of file kutil.cc.

4523 {
4524  if (!nIsOne(pGetCoeff(h)))
4525  {
4526  int j;
4527  BOOLEAN new_pair=FALSE;
4528 
4529  if (pGetComp(h)==0)
4530  {
4531  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
4532  if ((isFromQ)&&(strat->fromQ!=NULL))
4533  {
4534  for (j=0; j<=k; j++)
4535  {
4536  if (!strat->fromQ[j])
4537  {
4538  new_pair=TRUE;
4539  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
4540  }
4541  }
4542  }
4543  else
4544  {
4545  new_pair=TRUE;
4546  for (j=0; j<=k; j++)
4547  {
4548  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
4549  }
4550  }
4551  }
4552  else
4553  {
4554  for (j=0; j<=k; j++)
4555  {
4556  if ((pGetComp(h)==pGetComp(strat->S[j]))
4557  || (pGetComp(strat->S[j])==0))
4558  {
4559  new_pair=TRUE;
4560  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
4561  }
4562  }
4563  }
4564  if (new_pair)
4565  {
4566  #ifdef HAVE_RATGRING
4567  if (currRing->real_var_start>0)
4568  chainCritPart(h,ecart,strat);
4569  else
4570  #endif
4571  strat->chainCrit(h,ecart,strat);
4572  }
4573  kMergeBintoL(strat);
4574  }

◆ initenterstrongPairsSig()

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

Definition at line 4576 of file kutil.cc.

4578 {
4579  const int iCompH = pGetComp(h);
4580  if (!nIsOne(pGetCoeff(h)))
4581  {
4582  int j;
4583 
4584  for (j=0; j<=k && !strat->sigdrop; j++)
4585  {
4586  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4587 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4588 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4589  if (((iCompH == pGetComp(strat->S[j]))
4590  || (0 == pGetComp(strat->S[j])))
4591  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4592  {
4593  enterOneStrongPolySig(j,h,hSig,ecart,isFromQ,strat, atR);
4594  }
4595  }
4596  }

◆ initenterzeropairsRing()

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

Definition at line 4389 of file kutil.cc.

4391 {
4392  // Initialize
4393  long exp[50]; // The exponent of \hat{X} (basepoint)
4394  long cexp[50]; // The current exponent for iterating over all
4395  long ind[50]; // The power of 2 in the i-th component of exp
4396  long cind[50]; // analog for cexp
4397  long mult[50]; // How to multiply the elements of G
4398  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4399  long habsind = 0; // The abs. index of the coefficient of h
4400  long step[50]; // The last increases
4401  for (int i = 1; i <= currRing->N; i++)
4402  {
4403  exp[i] = p_GetExp(p, i, currRing);
4404  if (exp[i] & 1 != 0)
4405  {
4406  exp[i] = exp[i] - 1;
4407  mult[i] = 1;
4408  }
4409  cexp[i] = exp[i];
4410  ind[i] = ind_fact_2(exp[i]);
4411  cabsind += ind[i];
4412  cind[i] = ind[i];
4413  step[i] = 500000;
4414  }
4415  step[1] = 500000;
4416  habsind = ind2(n_Int(pGetCoeff(p), currRing->cf);
4417  long bound = currRing->ch - habsind;
4418 #ifdef OLI_DEBUG
4419  PrintS("-------------\npoly :");
4420  wrp(p);
4421  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4422  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4423  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4424  Print("bound : %d\n", bound);
4425  Print("cind : %d\n", cabsind);
4426 #endif
4427  if (cabsind == 0)
4428  {
4429  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4430  {
4431  return;
4432  }
4433  }
4434  // Now the whole simplex
4435  do
4436  {
4437  // Build s-polynomial
4438  // 2**ind-def * mult * g - exp-def * h
4439  poly t_p;
4440  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, strat->tailRing);
4441 #ifdef OLI_DEBUG
4442  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4443  PrintS("zPoly : ");
4444  wrp(zeroPoly);
4445  PrintLn();
4446 #endif
4447  enterOneZeroPairRing(zeroPoly, t_p, p, ecart, strat, atR);
4448  }
4449  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );

◆ initHilbCrit()

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

Definition at line 9860 of file kutil.cc.

9867 {
9868 
9869  //if the ordering is local, then hilb criterion
9870  //can be used also if the ideal is not homogenous
9872  {
9874  *hilb=NULL;
9875  else
9876  return;

◆ initPairtest()

void initPairtest ( kStrategy  strat)

Definition at line 665 of file kutil.cc.

667 {
668  strat->pairtest = (BOOLEAN *)omAlloc0((strat->sl+2)*sizeof(BOOLEAN));

◆ initS()

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

Definition at line 8075 of file kutil.cc.

8078 {
8079  int i,pos;
8080 
8081  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8082  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8083  strat->ecartS=initec(i);
8084  strat->sevS=initsevS(i);
8085  strat->S_2_R=initS_2_R(i);
8086  strat->fromQ=NULL;
8087  strat->Shdl=idInit(i,F->rank);
8088  strat->S=strat->Shdl->m;
8089  /*- put polys into S -*/
8090  if (Q!=NULL)
8091  {
8092  strat->fromQ=initec(i);
8093  memset(strat->fromQ,0,i*sizeof(int));
8094  for (i=0; i<IDELEMS(Q); i++)
8095  {
8096  if (Q->m[i]!=NULL)
8097  {
8098  LObject h;
8099  h.p = pCopy(Q->m[i]);
8101  {
8102  h.pCleardenom(); // also does remove Content
8103  }
8104  else
8105  {
8106  h.pNorm();
8107  }
8109  {
8110  deleteHC(&h, strat);
8111  }
8112  if (h.p!=NULL)
8113  {
8114  strat->initEcart(&h);
8115  if (strat->sl==-1)
8116  pos =0;
8117  else
8118  {
8119  pos = posInS(strat,strat->sl,h.p,h.ecart);
8120  }
8121  h.sev = pGetShortExpVector(h.p);
8122  strat->enterS(h,pos,strat,-1);
8123  strat->fromQ[pos]=1;
8124  }
8125  }
8126  }
8127  }
8128  for (i=0; i<IDELEMS(F); i++)
8129  {
8130  if (F->m[i]!=NULL)
8131  {
8132  LObject h;
8133  h.p = pCopy(F->m[i]);
8135  {
8136  cancelunit(&h); /*- tries to cancel a unit -*/
8137  deleteHC(&h, strat);
8138  }
8139  if (h.p!=NULL)
8140  // do not rely on the input being a SB!
8141  {
8143  {
8144  h.pCleardenom(); // also does remove Content
8145  }
8146  else
8147  {
8148  h.pNorm();
8149  }
8150  strat->initEcart(&h);
8151  if (strat->sl==-1)
8152  pos =0;
8153  else
8154  pos = posInS(strat,strat->sl,h.p,h.ecart);
8155  h.sev = pGetShortExpVector(h.p);
8156  strat->enterS(h,pos,strat,-1);
8157  }
8158  }
8159  }
8160  /*- test, if a unit is in F -*/
8161  if ((strat->sl>=0)
8162 #ifdef HAVE_RINGS
8163  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8164 #endif
8165  && pIsConstant(strat->S[0]))
8166  {
8167  while (strat->sl>0) deleteInS(strat->sl,strat);

◆ initS_2_R()

static int* initS_2_R ( const int  maxnr)
inlinestatic

Definition at line 511 of file kutil.cc.

513 {
514  return (int*)omAlloc0(maxnr*sizeof(int));

◆ initSbaBuchMora()

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

Definition at line 10413 of file kutil.cc.

10413  {
10414  strat->posInLSba = posInLSigRing;
10415  strat->posInL = posInL11Ring;
10416  }*/
10417  //strat->posInT = posInTSig;
10418 }
10419 
10420 void initSbaBuchMora (ideal F,ideal Q,kStrategy strat)
10421 {
10422  strat->interpt = BTEST1(OPT_INTERRUPT);
10423  strat->kHEdge=NULL;
10425  /*- creating temp data structures------------------- -*/
10426  strat->cp = 0;
10427  strat->c3 = 0;
10428  strat->tail = pInit();
10429  /*- set s -*/
10430  strat->sl = -1;
10431  /*- set ps -*/
10432  strat->syzl = -1;
10433  /*- set L -*/
10434  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10435  strat->Ll = -1;
10436  strat->L = initL(strat->Lmax);
10437  /*- set B -*/
10438  strat->Bmax = setmaxL;
10439  strat->Bl = -1;
10440  strat->B = initL();
10441  /*- set T -*/
10442  strat->tl = -1;
10443  strat->tmax = setmaxT;
10444  strat->T = initT();
10445  strat->R = initR();
10446  strat->sevT = initsevT();
10447  /*- init local data struct.---------------------------------------- -*/
10448  strat->P.ecart=0;
10449  strat->P.length=0;
10451  {
10452  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10453  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10454  }
10456  {
10457  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10458  }
10459  else
10460  {
10461  if(TEST_OPT_SB_1)
10462  {
10463  int i;
10464  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10465  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10466  {
10467  P->m[i-strat->newIdeal] = F->m[i];
10468  F->m[i] = NULL;
10469  }
10470  initSSpecialSba(F,Q,P,strat);
10471  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10472  {
10473  F->m[i] = P->m[i-strat->newIdeal];
10474  P->m[i-strat->newIdeal] = NULL;
10475  }
10476  idDelete(&P);
10477  }
10478  else
10479  {
10480  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10481  }
10482  }
10483  strat->fromT = FALSE;
10484  if (!TEST_OPT_SB_1)

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9942 of file kutil.cc.

9949 {
9950  //strat->enterOnePair=enterOnePairNormal;
9952  //strat->chainCrit=chainCritNormal;
9953  strat->chainCrit = chainCritSig;
9954  /******************************************
9955  * rewCrit1 and rewCrit2 are already set in
9956  * kSba() in kstd1.cc
9957  *****************************************/
9958  //strat->rewCrit1 = faugereRewCriterion;
9959  if (strat->sbaOrder == 1)
9960  {
9961  strat->syzCrit = syzCriterionInc;
9962  }
9963  else
9964  {
9965  strat->syzCrit = syzCriterion;
9966  }
9967 #ifdef HAVE_RINGS
9968  if (rField_is_Ring(currRing))
9969  {
9971  strat->chainCrit=chainCritRing;
9972  }
9973 #endif
9974 #ifdef HAVE_RATGRING
9975  if (rIsRatGRing(currRing))
9976  {
9977  strat->chainCrit=chainCritPart;
9978  /* enterOnePairNormal get rational part in it */
9979  }
9980 #endif
9981 
9982  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9983  strat->Gebauer = strat->homog || strat->sugarCrit;
9984  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9985  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9986  strat->pairtest = NULL;
9987  /* alway use tailreduction, except:
9988  * - in local rings, - in lex order case, -in ring over extensions */
9991 
9992 #ifdef HAVE_PLURAL
9993  // and r is plural_ring
9994  // hence this holds for r a rational_plural_ring
9995  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9996  { //or it has non-quasi-comm type... later
9997  strat->sugarCrit = FALSE;
9998  strat->Gebauer = FALSE;
9999  strat->honey = FALSE;
10000  }
10001 #endif
10002 
10003  // Coefficient ring?
10004  if (rField_is_Ring(currRing))
10005  {
10006  strat->sugarCrit = FALSE;
10007  strat->Gebauer = FALSE ;
10008  strat->honey = FALSE;
10009  }
10010  #ifdef KDEBUG

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10311 of file kutil.cc.

10311  {
10312  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10313  strat->fromQ=NULL;
10314  }
10315 #endif
10316 }
10317 
10318 void initSbaPos (kStrategy strat)
10319 {
10321  {
10322  if (strat->honey)
10323  {
10324  strat->posInL = posInL15;
10325  // ok -- here is the deal: from my experiments for Singular-2-0
10326  // I conclude that that posInT_EcartpLength is the best of
10327  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10328  // see the table at the end of this file
10329  if (TEST_OPT_OLDSTD)
10330  strat->posInT = posInT15;
10331  else
10332  strat->posInT = posInT_EcartpLength;
10333  }
10334  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10335  {
10336  strat->posInL = posInL11;
10337  strat->posInT = posInT11;
10338  }
10339  else if (TEST_OPT_INTSTRATEGY)
10340  {
10341  strat->posInL = posInL11;
10342  strat->posInT = posInT11;
10343  }
10344  else
10345  {
10346  strat->posInL = posInL0;
10347  strat->posInT = posInT0;
10348  }
10349  //if (strat->minim>0) strat->posInL =posInLSpecial;
10350  if (strat->homog)
10351  {
10352  strat->posInL = posInL110;
10353  strat->posInT = posInT110;
10354  }
10355  }
10356  else
10357  {
10358  if (strat->homog)
10359  {
10360  strat->posInL = posInL11;
10361  strat->posInT = posInT11;
10362  }
10363  else
10364  {
10365  if ((currRing->order[0]==ringorder_c)
10366  ||(currRing->order[0]==ringorder_C))
10367  {
10368  strat->posInL = posInL17_c;
10369  strat->posInT = posInT17_c;
10370  }
10371  else
10372  {
10373  strat->posInL = posInL17;
10374  strat->posInT = posInT17;
10375  }
10376  }
10377  }
10378  if (strat->minim>0) strat->posInL =posInLSpecial;
10379  // for further tests only
10380  if ((BTEST1(11)) || (BTEST1(12)))
10381  strat->posInL = posInL11;
10382  else if ((BTEST1(13)) || (BTEST1(14)))
10383  strat->posInL = posInL13;
10384  else if ((BTEST1(15)) || (BTEST1(16)))
10385  strat->posInL = posInL15;
10386  else if ((BTEST1(17)) || (BTEST1(18)))
10387  strat->posInL = posInL17;
10388  if (BTEST1(11))
10389  strat->posInT = posInT11;
10390  else if (BTEST1(13))
10391  strat->posInT = posInT13;
10392  else if (BTEST1(15))
10393  strat->posInT = posInT15;
10394  else if ((BTEST1(17)))
10395  strat->posInT = posInT17;
10396  else if ((BTEST1(19)))
10397  strat->posInT = posInT19;
10398  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10399  strat->posInT = posInT1;
10400  if (rField_is_Ring(currRing))
10401  {
10402  strat->posInL = posInL11Ring;
10403  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10404  strat->posInL = posInL11Ringls;
10405  strat->posInT = posInT11;
10406  }
10407  strat->posInLDependsOnLength = FALSE;
10408  strat->posInLSba = posInLSig;
10409  //strat->posInL = posInLSig;
10410  strat->posInL = posInLF5C;
10411  /*

◆ initsevS()

static unsigned long* initsevS ( const int  maxnr)
inlinestatic

Definition at line 507 of file kutil.cc.

509 {
510  return (unsigned long*)omAlloc0(maxnr*sizeof(unsigned long));

◆ initSL()

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

Definition at line 8169 of file kutil.cc.

8172 {
8173  int i,pos;
8174 
8175  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8176  else i=setmaxT;
8177  strat->ecartS=initec(i);
8178  strat->sevS=initsevS(i);
8179  strat->S_2_R=initS_2_R(i);
8180  strat->fromQ=NULL;
8181  strat->Shdl=idInit(i,F->rank);
8182  strat->S=strat->Shdl->m;
8183  /*- put polys into S -*/
8184  if (Q!=NULL)
8185  {
8186  strat->fromQ=initec(i);
8187  memset(strat->fromQ,0,i*sizeof(int));
8188  for (i=0; i<IDELEMS(Q); i++)
8189  {
8190  if (Q->m[i]!=NULL)
8191  {
8192  LObject h;
8193  h.p = pCopy(Q->m[i]);
8195  {
8196  deleteHC(&h,strat);
8197  }
8199  {
8200  h.pCleardenom(); // also does remove Content
8201  }
8202  else
8203  {
8204  h.pNorm();
8205  }
8206  if (h.p!=NULL)
8207  {
8208  strat->initEcart(&h);
8209  if (strat->sl==-1)
8210  pos =0;
8211  else
8212  {
8213  pos = posInS(strat,strat->sl,h.p,h.ecart);
8214  }
8215  h.sev = pGetShortExpVector(h.p);
8216  strat->enterS(h,pos,strat,-1);
8217  strat->fromQ[pos]=1;
8218  }
8219  }
8220  }
8221  }
8222  for (i=0; i<IDELEMS(F); i++)
8223  {
8224  if (F->m[i]!=NULL)
8225  {
8226  LObject h;
8227  h.p = pCopy(F->m[i]);
8228  if (h.p!=NULL)
8229  {
8231  {
8232  cancelunit(&h); /*- tries to cancel a unit -*/
8233  deleteHC(&h, strat);
8234  }
8235  if (h.p!=NULL)
8236  {
8238  {
8239  h.pCleardenom(); // also does remove Content
8240  }
8241  else
8242  {
8243  h.pNorm();
8244  }
8245  strat->initEcart(&h);
8246  if (strat->Ll==-1)
8247  pos =0;
8248  else
8249  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8250  h.sev = pGetShortExpVector(h.p);
8251  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8252  }
8253  }
8254  }
8255  }
8256  /*- test, if a unit is in F -*/
8257 
8258  if ((strat->Ll>=0)
8259 #ifdef HAVE_RINGS
8260  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8261 #endif
8262  && pIsConstant(strat->L[strat->Ll].p))
8263  {
8264  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);

◆ initSLSba()

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

Definition at line 8266 of file kutil.cc.

8269 {
8270  int i,pos;
8271  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8272  else i=setmaxT;
8273  strat->ecartS = initec(i);
8274  strat->sevS = initsevS(i);
8275  strat->sevSig = initsevS(i);
8276  strat->S_2_R = initS_2_R(i);
8277  strat->fromQ = NULL;
8278  strat->Shdl = idInit(i,F->rank);
8279  strat->S = strat->Shdl->m;
8280  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8281  if (strat->sbaOrder != 1)
8282  {
8283  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8284  strat->sevSyz = initsevS(i);
8285  strat->syzmax = i;
8286  strat->syzl = 0;
8287  }
8288  /*- put polys into S -*/
8289  if (Q!=NULL)
8290  {
8291  strat->fromQ=initec(i);
8292  memset(strat->fromQ,0,i*sizeof(int));
8293  for (i=0; i<IDELEMS(Q); i++)
8294  {
8295  if (Q->m[i]!=NULL)
8296  {
8297  LObject h;
8298  h.p = pCopy(Q->m[i]);
8300  {
8301  deleteHC(&h,strat);
8302  }
8304  {
8305  h.pCleardenom(); // also does remove Content
8306  }
8307  else
8308  {
8309  h.pNorm();
8310  }
8311  if (h.p!=NULL)
8312  {
8313  strat->initEcart(&h);
8314  if (strat->sl==-1)
8315  pos =0;
8316  else
8317  {
8318  pos = posInS(strat,strat->sl,h.p,h.ecart);
8319  }
8320  h.sev = pGetShortExpVector(h.p);
8321  strat->enterS(h,pos,strat,-1);
8322  strat->fromQ[pos]=1;
8323  }
8324  }
8325  }
8326  }
8327  for (i=0; i<IDELEMS(F); i++)
8328  {
8329  if (F->m[i]!=NULL)
8330  {
8331  LObject h;
8332  h.p = pCopy(F->m[i]);
8333  h.sig = pOne();
8334  //h.sig = pInit();
8335  //p_SetCoeff(h.sig,nInit(1),currRing);
8336  p_SetComp(h.sig,i+1,currRing);
8337  // if we are working with the Schreyer order we generate it
8338  // by multiplying the initial signatures with the leading monomial
8339  // of the corresponding initial polynomials generating the ideal
8340  // => we can keep the underlying monomial order and get a Schreyer
8341  // order without any bigger overhead
8342  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8343  {
8344  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8345  }
8346  h.sevSig = pGetShortExpVector(h.sig);
8347 #ifdef DEBUGF5
8348  pWrite(h.p);
8349  pWrite(h.sig);
8350 #endif
8351  if (h.p!=NULL)
8352  {
8354  {
8355  cancelunit(&h); /*- tries to cancel a unit -*/
8356  deleteHC(&h, strat);
8357  }
8358  if (h.p!=NULL)
8359  {
8361  {
8362  h.pCleardenom(); // also does remove Content
8363  }
8364  else
8365  {
8366  h.pNorm();
8367  }
8368  strat->initEcart(&h);
8369  if (strat->Ll==-1)
8370  pos =0;
8371  else
8372  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8373  h.sev = pGetShortExpVector(h.p);
8374  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8375  }
8376  }
8377  /*
8378  if (strat->sbaOrder != 1)
8379  {
8380  for(j=0;j<i;j++)
8381  {
8382  strat->syz[ctr] = pCopy(F->m[j]);
8383  p_SetCompP(strat->syz[ctr],i+1,currRing);
8384  // add LM(F->m[i]) to the signature to get a Schreyer order
8385  // without changing the underlying polynomial ring at all
8386  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8387  // since p_Add_q() destroys all input
8388  // data we need to recreate help
8389  // each time
8390  poly help = pCopy(F->m[i]);
8391  p_SetCompP(help,j+1,currRing);
8392  pWrite(strat->syz[ctr]);
8393  pWrite(help);
8394  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8395  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8396  printf("%d. SYZ ",ctr);
8397  pWrite(strat->syz[ctr]);
8398  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8399  ctr++;
8400  }
8401  strat->syzl = ps;
8402  }
8403  */
8404  }
8405  }
8406  /*- test, if a unit is in F -*/
8407 
8408  if ((strat->Ll>=0)
8409 #ifdef HAVE_RINGS
8410  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8411 #endif
8412  && pIsConstant(strat->L[strat->Ll].p))
8413  {
8414  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);

◆ initSSpecial()

void initSSpecial ( ideal  F,
ideal  Q,
ideal  P,
kStrategy  strat 
)

Definition at line 8567 of file kutil.cc.

8574 {
8575  int i,pos;
8576 
8577  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8578  else i=setmaxT;
8579  i=((i+IDELEMS(F)+IDELEMS(P)+setmax-1)/setmax)*setmax;
8580  strat->ecartS=initec(i);
8581  strat->sevS=initsevS(i);
8582  strat->S_2_R=initS_2_R(i);
8583  strat->fromQ=NULL;
8584  strat->Shdl=idInit(i,F->rank);
8585  strat->S=strat->Shdl->m;
8586 
8587  /*- put polys into S -*/
8588  if (Q!=NULL)
8589  {
8590  strat->fromQ=initec(i);
8591  memset(strat->fromQ,0,i*sizeof(int));
8592  for (i=0; i<IDELEMS(Q); i++)
8593  {
8594  if (Q->m[i]!=NULL)
8595  {
8596  LObject h;
8597  h.p = pCopy(Q->m[i]);
8598  //if (TEST_OPT_INTSTRATEGY)
8599  //{
8600  // h.pCleardenom(); // also does remove Content
8601  //}
8602  //else
8603  //{
8604  // h.pNorm();
8605  //}
8607  {
8608  deleteHC(&h,strat);
8609  }
8610  if (h.p!=NULL)
8611  {
8612  strat->initEcart(&h);
8613  if (strat->sl==-1)
8614  pos =0;
8615  else
8616  {
8617  pos = posInS(strat,strat->sl,h.p,h.ecart);
8618  }
8619  h.sev = pGetShortExpVector(h.p);
8620  strat->enterS(h,pos,strat, strat->tl+1);
8621  enterT(h, strat);
8622  strat->fromQ[pos]=1;
8623  }
8624  }
8625  }
8626  }
8627  /*- put polys into S -*/
8628  for (i=0; i<IDELEMS(F); i++)
8629  {
8630  if (F->m[i]!=NULL)
8631  {
8632  LObject h;
8633  h.p = pCopy(F->m[i]);
8635  {
8636  deleteHC(&h,strat);
8637  }
8638  else if (TEST_OPT_REDTAIL || TEST_OPT_REDSB)
8639  {
8640  h.p=redtailBba(h.p,strat->sl,strat);
8641  }
8642  if (h.p!=NULL)
8643  {
8644  strat->initEcart(&h);
8645  if (strat->sl==-1)
8646  pos =0;
8647  else
8648  pos = posInS(strat,strat->sl,h.p,h.ecart);
8649  h.sev = pGetShortExpVector(h.p);
8650  strat->enterS(h,pos,strat, strat->tl+1);
8651  enterT(h,strat);
8652  }
8653  }
8654  }
8655  for (i=0; i<IDELEMS(P); i++)
8656  {
8657  if (P->m[i]!=NULL)
8658  {
8659  LObject h;
8660  h.p=pCopy(P->m[i]);
8662  {
8663  h.pCleardenom();
8664  }
8665  else
8666  {
8667  h.pNorm();
8668  }
8669  if(strat->sl>=0)
8670  {
8672  {
8673  h.p=redBba(h.p,strat->sl,strat);
8674  if ((h.p!=NULL)&&(TEST_OPT_REDTAIL || TEST_OPT_REDSB))
8675  {
8676  h.p=redtailBba(h.p,strat->sl,strat);
8677  }
8678  }
8679  else
8680  {
8681  h.p=redMora(h.p,strat->sl,strat);
8682  }
8683  if(h.p!=NULL)
8684  {
8685  strat->initEcart(&h);
8687  {
8688  h.pCleardenom();
8689  }
8690  else
8691  {
8692  h.is_normalized = 0;
8693  h.pNorm();
8694  }
8695  h.sev = pGetShortExpVector(h.p);
8696  h.SetpFDeg();
8697  pos = posInS(strat,strat->sl,h.p,h.ecart);
8698  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8699  strat->enterS(h,pos,strat, strat->tl+1);
8700  enterT(h,strat);
8701  }
8702  }
8703  else
8704  {
8705  h.sev = pGetShortExpVector(h.p);
8706  strat->initEcart(&h);

◆ initSSpecialSba()

void initSSpecialSba ( ideal  F,
ideal  Q,
ideal  P,
kStrategy  strat 
)

Definition at line 8711 of file kutil.cc.

8718 {
8719  int i,pos;
8720 
8721  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8722  else i=setmaxT;
8723  i=((i+IDELEMS(F)+IDELEMS(P)+setmax-1)/setmax)*setmax;
8724  strat->sevS=initsevS(i);
8725  strat->sevSig=initsevS(i);
8726  strat->S_2_R=initS_2_R(i);
8727  strat->fromQ=NULL;
8728  strat->Shdl=idInit(i,F->rank);
8729  strat->S=strat->Shdl->m;
8730  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
8731  /*- put polys into S -*/
8732  if (Q!=NULL)
8733  {
8734  strat->fromQ=initec(i);
8735  memset(strat->fromQ,0,i*sizeof(int));
8736  for (i=0; i<IDELEMS(Q); i++)
8737  {
8738  if (Q->m[i]!=NULL)
8739  {
8740  LObject h;
8741  h.p = pCopy(Q->m[i]);
8742  //if (TEST_OPT_INTSTRATEGY)
8743  //{
8744  // h.pCleardenom(); // also does remove Content
8745  //}
8746  //else
8747  //{
8748  // h.pNorm();
8749  //}
8751  {
8752  deleteHC(&h,strat);
8753  }
8754  if (h.p!=NULL)
8755  {
8756  strat->initEcart(&h);
8757  if (strat->sl==-1)
8758  pos =0;
8759  else
8760  {
8761  pos = posInS(strat,strat->sl,h.p,h.ecart);
8762  }
8763  h.sev = pGetShortExpVector(h.p);
8764  strat->enterS(h,pos,strat, strat->tl+1);
8765  enterT(h, strat);
8766  strat->fromQ[pos]=1;
8767  }
8768  }
8769  }
8770  }
8771  /*- put polys into S -*/
8772  for (i=0; i<IDELEMS(F); i++)
8773  {
8774  if (F->m[i]!=NULL)
8775  {
8776  LObject h;
8777  h.p = pCopy(F->m[i]);
8779  {
8780  deleteHC(&h,strat);
8781  }
8782  else if (TEST_OPT_REDTAIL || TEST_OPT_REDSB)
8783  {
8784  h.p=redtailBba(h.p,strat->sl,strat);
8785  }
8786  if (h.p!=NULL)
8787  {
8788  strat->initEcart(&h);
8789  if (strat->sl==-1)
8790  pos =0;
8791  else
8792  pos = posInS(strat,strat->sl,h.p,h.ecart);
8793  h.sev = pGetShortExpVector(h.p);
8794  strat->enterS(h,pos,strat, strat->tl+1);
8795  enterT(h,strat);
8796  }
8797  }
8798  }
8799  for (i=0; i<IDELEMS(P); i++)
8800  {
8801  if (P->m[i]!=NULL)
8802  {
8803  LObject h;
8804  h.p=pCopy(P->m[i]);
8806  {
8807  h.pCleardenom();
8808  }
8809  else
8810  {
8811  h.pNorm();
8812  }
8813  if(strat->sl>=0)
8814  {
8816  {
8817  h.p=redBba(h.p,strat->sl,strat);
8818  if ((h.p!=NULL)&&(TEST_OPT_REDTAIL || TEST_OPT_REDSB))
8819  {
8820  h.p=redtailBba(h.p,strat->sl,strat);
8821  }
8822  }
8823  else
8824  {
8825  h.p=redMora(h.p,strat->sl,strat);
8826  }
8827  if(h.p!=NULL)
8828  {
8829  strat->initEcart(&h);
8831  {
8832  h.pCleardenom();
8833  }
8834  else
8835  {
8836  h.is_normalized = 0;
8837  h.pNorm();
8838  }
8839  h.sev = pGetShortExpVector(h.p);
8840  h.SetpFDeg();
8841  pos = posInS(strat,strat->sl,h.p,h.ecart);
8842  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8843  strat->enterS(h,pos,strat, strat->tl+1);
8844  enterT(h,strat);
8845  }
8846  }
8847  else
8848  {
8849  h.sev = pGetShortExpVector(h.p);
8850  strat->initEcart(&h);

◆ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8416 of file kutil.cc.

8419 {
8420  if( strat->S[0] )
8421  {
8422  if( strat->S[1] && !rField_is_Ring(currRing))
8423  {
8424  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8425  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8426  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8427  }
8428  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8429  /************************************************************
8430  * computing the length of the syzygy array needed
8431  ***********************************************************/
8432  for(i=1; i<=strat->sl; i++)
8433  {
8434  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8435  {
8436  ps += i;
8437  }
8438  }
8439  ps += strat->sl+1;
8440  //comp = pGetComp (strat->P.sig);
8441  comp = strat->currIdx;
8442  strat->syzIdx = initec(comp);
8443  strat->sevSyz = initsevS(ps);
8444  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8445  strat->syzmax = ps;
8446  strat->syzl = 0;
8447  strat->syzidxmax = comp;
8448 #if defined(DEBUGF5) || defined(DEBUGF51)
8449  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8450 #endif
8451  i = 1;
8452  j = 0;
8453  /************************************************************
8454  * generating the leading terms of the principal syzygies
8455  ***********************************************************/
8456  while (i <= strat->sl)
8457  {
8458  /**********************************************************
8459  * principal syzygies start with component index 2
8460  * the array syzIdx starts with index 0
8461  * => the rules for a signature with component comp start
8462  * at strat->syz[strat->syzIdx[comp-2]] !
8463  *********************************************************/
8464  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8465  {
8466  comp = pGetComp(strat->sig[i]);
8467  comp_old = pGetComp(strat->sig[i-1]);
8468  diff = comp - comp_old - 1;
8469  // diff should be zero, but sometimes also the initial generating
8470  // elements of the input ideal reduce to zero. then there is an
8471  // index-gap between the signatures. for these inbetween signatures we
8472  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8473  // in the following.
8474  // doing this, we keep the relation "j = comp - 2" alive, which makes
8475  // jumps way easier when checking criteria
8476  while (diff>0)
8477  {
8478  strat->syzIdx[j] = 0;
8479  diff--;
8480  j++;
8481  }
8482  strat->syzIdx[j] = ctr;
8483  j++;
8484  LObject Q;
8485  int pos;
8486  for (k = 0; k<i; k++)
8487  {
8488  Q.sig = pOne();
8490  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8491  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8492  p_SetCompP (Q.sig, comp, currRing);
8493  poly q = p_One(currRing);
8496  p_ExpVectorCopy(q,strat->S[i],currRing);
8497  q = p_Neg (q, currRing);
8498  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8499  Q.sig = p_Add_q (Q.sig, q, currRing);
8500  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8501  pos = posInSyz(strat, Q.sig);
8502  enterSyz(Q, strat, pos);
8503  ctr++;
8504  }
8505  }
8506  i++;
8507  }
8508  /**************************************************************
8509  * add syzygies for upcoming first element of new iteration step
8510  **************************************************************/
8511  comp = strat->currIdx;
8512  comp_old = pGetComp(strat->sig[i-1]);
8513  diff = comp - comp_old - 1;
8514  // diff should be zero, but sometimes also the initial generating
8515  // elements of the input ideal reduce to zero. then there is an
8516  // index-gap between the signatures. for these inbetween signatures we
8517  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8518  // in the following.
8519  // doing this, we keep the relation "j = comp - 2" alive, which makes
8520  // jumps way easier when checking criteria
8521  while (diff>0)
8522  {
8523  strat->syzIdx[j] = 0;
8524  diff--;
8525  j++;
8526  }
8527  strat->syzIdx[j] = ctr;
8528  LObject Q;
8529  int pos;
8530  for (k = 0; k<strat->sl+1; k++)
8531  {
8532  Q.sig = pOne();
8534  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8535  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8536  p_SetCompP (Q.sig, comp, currRing);
8537  poly q = p_One(currRing);
8539  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8540  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8541  q = p_Neg (q, currRing);
8542  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8543  Q.sig = p_Add_q (Q.sig, q, currRing);
8544  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8545  pos = posInSyz(strat, Q.sig);
8546  enterSyz(Q, strat, pos);
8547  ctr++;
8548  }
8549 //#if 1
8550 #ifdef DEBUGF5
8551  PrintS("Principal syzygies:\n");
8552  Print("syzl %d\n",strat->syzl);
8553  Print("syzmax %d\n",strat->syzmax);
8554  Print("ps %d\n",ps);
8555  PrintS("--------------------------------\n");
8556  for(i=0;i<=strat->syzl-1;i++)
8557  {
8558  Print("%d - ",i);
8559  pWrite(strat->syz[i]);
8560  }
8561  for(i=0;i<strat->currIdx;i++)
8562  {

◆ isInPairsetB()

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

Definition at line 695 of file kutil.cc.

697 {
698  LObject *p=&(strat->B[strat->Bl]);
699 
700  *k = strat->Bl;
701  loop
702  {
703  if ((*k) < 0) return FALSE;
704  if (q == (*p).p1)
705  return TRUE;
706  (*k)--;
707  p--;
708  }

◆ isInPairsetL()

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

Definition at line 674 of file kutil.cc.

676 {
677  LObject *p=&(strat->L[length]);
678 
679  *k = length;
680  loop
681  {
682  if ((*k) < 0) return FALSE;
683  if (((p1 == (*p).p1) && (p2 == (*p).p2))
684  || ((p1 == (*p).p2) && (p2 == (*p).p1)))
685  return TRUE;
686  (*k)--;
687  p--;
688  }

◆ kCheckSpolyCreation()

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

Definition at line 10923 of file kutil.cc.

10932 {
10933  if (strat->overflow) return FALSE;
10934  assume(L->p1 != NULL && L->p2 != NULL);
10935  // shift changes: from 0 to -1
10936  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10937  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10938  assume(strat->tailRing != currRing);
10939 
10940  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10941  return FALSE;
10942  // shift changes: extra case inserted
10943  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10944  {
10945  return TRUE;
10946  }
10947  poly p1_max=NULL;
10948  if (L->i_r1>=0) p1_max = (strat->R[L->i_r1])->max_exp;
10949  poly p2_max=NULL;
10950  if (L->i_r2>=0) p2_max = (strat->R[L->i_r2])->max_exp;
10951 
10952  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10953  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10954  {

◆ kCheckStrongCreation()

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

Definition at line 10962 of file kutil.cc.

10972 {
10973  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10974  //assume(strat->tailRing != currRing);
10975 
10976  poly p1_max = (strat->R[atR])->max_exp;

◆ kCreateZeroPoly()

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

Definition at line 4326 of file kutil.cc.

4328 {
4329 
4330  poly zeroPoly = NULL;
4331 
4332  number tmp1;
4333  poly tmp2, tmp3;
4334 
4335  if (cabsind == -1)
4336  {
4337  cabsind = 0;
4338  for (int i = 1; i <= leadRing->N; i++)
4339  {
4340  cabsind += ind_fact_2(exp[i]);
4341  }
4342 // Print("cabsind: %d\n", cabsind);
4343  }
4344  if (cabsind < leadRing->ch)
4345  {
4346  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4347  }
4348  else
4349  {
4350  zeroPoly = p_ISet(1, tailRing);
4351  }
4352  for (int i = 1; i <= leadRing->N; i++)
4353  {
4354  for (long j = 1; j <= exp[i]; j++)
4355  {
4356  tmp1 = nInit(j);
4357  tmp2 = p_ISet(1, tailRing);
4358  p_SetExp(tmp2, i, 1, tailRing);
4359  p_Setm(tmp2, tailRing);
4360  if (nIsZero(tmp1))
4361  { // should nowbe obsolet, test ! TODO OLIVER
4362  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4363  }
4364  else
4365  {
4366  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4367  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4368  }
4369  }
4370  }
4371  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4372  for (int i = 1; i <= leadRing->N; i++)
4373  {
4374  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4375  }
4376  p_Setm(tmp2, leadRing);
4377  *t_p = zeroPoly;
4378  zeroPoly = pNext(zeroPoly);
4379  pNext(*t_p) = NULL;
4380  pNext(tmp2) = zeroPoly;
4381  return tmp2;

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 11940 of file kutil.cc.

11950 {
11951  PrintS("red: ");
11952  if (strat->red==redFirst) PrintS("redFirst\n");
11953  else if (strat->red==redHoney) PrintS("redHoney\n");
11954  else if (strat->red==redEcart) PrintS("redEcart\n");
11955  else if (strat->red==redHomog) PrintS("redHomog\n");
11956  else Print("%p\n",(void*)strat->red);
11957  PrintS("posInT: ");
11958  if (strat->posInT==posInT0) PrintS("posInT0\n");
11959  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11960  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11961  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11962  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11963  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11964  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11965  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11966  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11967  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11968  #ifdef HAVE_RINGS
11969  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11970  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11971  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11972  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11973  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11974  #endif
11975 #ifdef HAVE_MORE_POS_IN_T
11976  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11977  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11978  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11979 #endif
11980  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11981  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11982  else Print("%p\n",(void*)strat->posInT);
11983  PrintS("posInL: ");
11984  if (strat->posInL==posInL0) PrintS("posInL0\n");
11985  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11986  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11987  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11988  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11989  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11990  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11991  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11992  #ifdef HAVE_RINGS
11993  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11994  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11995  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11996  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11997  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11998  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11999  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
12000  #endif
12001  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
12002  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
12003  else Print("%p\n",(void*)strat->posInL);
12004  PrintS("enterS: ");
12005  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
12006  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
12007  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
12008  else Print("%p\n",(void*)strat->enterS);
12009  PrintS("initEcart: ");
12010  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
12011  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
12012  else Print("%p\n",(void*)strat->initEcart);
12013  PrintS("initEcartPair: ");
12014  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
12015  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
12016  else Print("%p\n",(void*)strat->initEcartPair);
12017  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
12018  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
12019  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
12020  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
12021  PrintS("chainCrit: ");
12022  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
12023  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
12024  else Print("%p\n",(void*)strat->chainCrit);
12025  Print("posInLDependsOnLength=%d\n",
12026  strat->posInLDependsOnLength);
12027  PrintS(showOption());PrintLn();
12028  PrintS("LDeg: ");
12029  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12030  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12031  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
12032  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12033  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12034  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12035  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12036  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12037  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12038  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12039  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12040  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12041  else Print("? (%lx)", (long)currRing->pLDeg);
12042  PrintS(" / ");
12043  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12044  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12045  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
12046  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12047  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12048  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12049  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12050  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12051  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12052  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12053  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12054  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12055  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
12056  PrintLn();
12057  PrintS("currRing->pFDeg: ");
12058  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
12059  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
12060  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
12061  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
12062  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
12063  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
12064  else Print("? (%lx)", (long)currRing->pFDeg);
12065  PrintLn();
12066  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
12067  if(TEST_OPT_DEGBOUND)
12068  Print(" degBound: %d\n", Kstd1_deg);
12069 
12070  if( ecartWeights != NULL )
12071  {
12072  PrintS("ecartWeights: ");
12073  for (int i = rVar(currRing); i > 0; i--)

◆ kFindDivisibleByInS_T()

TObject* kFindDivisibleByInS_T ( kStrategy  strat,
int  end_pos,
LObject L,
TObject T,
long  ecart 
)

Definition at line 7261 of file kutil.cc.

7264 {
7265  int j = 0;
7266  const unsigned long not_sev = ~L->sev;
7267  const unsigned long* sev = strat->sevS;
7268  poly p;
7269  ring r;
7270  L->GetLm(p, r);
7271 
7272  assume(~not_sev == p_GetShortExpVector(p, r));
7273 
7274  if (r == currRing)
7275  {
7276  if(!rField_is_Ring(r))
7277  {
7278  loop
7279  {
7280  if (j > end_pos) return NULL;
7281  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7282  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7283  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7284  {
7285  break;
7286  }
7287  #else
7288  if (!(sev[j] & not_sev) &&
7289  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7290  p_LmDivisibleBy(strat->S[j], p, r))
7291  {
7292  break;
7293  }
7294  #endif
7295  j++;
7296  }
7297  }
7298  #ifdef HAVE_RINGS
7299  else
7300  {
7301  loop
7302  {
7303  if (j > end_pos) return NULL;
7304  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7305  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7306  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7307  {
7308  break;
7309  }
7310  #else
7311  if (!(sev[j] & not_sev) &&
7312  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7313  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7314  {
7315  break;
7316  }
7317  #endif
7318  j++;
7319  }
7320  }
7321  #endif
7322  // if called from NF, T objects do not exist:
7323  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7324  {
7325  T->Set(strat->S[j], r, strat->tailRing);
7326  assume(T->GetpLength()==pLength(T->p != __null ? T->p : T->t_p));
7327  return T;
7328  }
7329  else
7330  {
7331 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7332 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7333 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7334  return strat->S_2_T(j);
7335  }
7336  }
7337  else
7338  {
7339  TObject* t;
7340  if(!rField_is_Ring(r))
7341  {
7342  loop
7343  {
7344  if (j > end_pos) return NULL;
7345  assume(strat->S_2_R[j] != -1);
7346  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7347  t = strat->S_2_T(j);
7348  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7349  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7350  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7351  {
7352  t->pLength=pLength(t->t_p);
7353  return t;
7354  }
7355  #else
7356  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7357  {
7358  t = strat->S_2_T(j);
7359  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7360  if (p_LmDivisibleBy(t->t_p, p, r))
7361  {
7362  t->pLength=pLength(t->t_p);
7363  return t;
7364  }
7365  }
7366  #endif
7367  j++;
7368  }
7369  }
7370  #ifdef HAVE_RINGS
7371  else
7372  {
7373  loop
7374  {
7375  if (j > end_pos) return NULL;
7376  assume(strat->S_2_R[j] != -1);
7377  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7378  t = strat->S_2_T(j);
7379  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7380  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7381  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7382  {
7383  t->pLength=pLength(t->t_p);
7384  return t;
7385  }
7386  #else
7387  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7388  {
7389  t = strat->S_2_T(j);
7390  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7391  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7392  {
7393  t->pLength=pLength(t->t_p);
7394  return t;
7395  }
7396  }
7397  #endif
7398  j++;
7399  }
7400  }
7401  #endif

◆ kFindInT() [1/2]

int kFindInT ( poly  p,
kStrategy  strat 
)

Definition at line 721 of file kutil.cc.

723 {
724  int i;
725  do
726  {
727  i = kFindInT(p, strat->T, strat->tl);
728  if (i >= 0) return i;
729  strat = strat->next;
730  }
731  while (strat != NULL);
732  return -1;

◆ kFindInT() [2/2]

int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 710 of file kutil.cc.

712 {
713  int i;
714 
715  for (i=0; i<=tlength; i++)
716  {
717  if (T[i].p == p) return i;
718  }
719  return -1;

◆ kMergeBintoL()

void kMergeBintoL ( kStrategy  strat)

Definition at line 3149 of file kutil.cc.

3151 {
3152  int j=strat->Ll+strat->Bl+1;
3153  if (j>strat->Lmax)
3154  {
3155  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc-strat->Lmax;
3156  enlargeL(&(strat->L),&(strat->Lmax),j);
3157  }
3158  j = strat->Ll;
3159  int i;
3160  for (i=strat->Bl; i>=0; i--)
3161  {
3162  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
3163  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3164  }
3165  strat->Bl = -1;

◆ kMergeBintoLSba()

void kMergeBintoLSba ( kStrategy  strat)

Definition at line 3170 of file kutil.cc.

3172 {
3173  int j=strat->Ll+strat->Bl+1;
3174  if (j>strat->Lmax)
3175  {
3176  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc-strat->Lmax;
3177  enlargeL(&(strat->L),&(strat->Lmax),j);
3178  }
3179  j = strat->Ll;
3180  int i;
3181  for (i=strat->Bl; i>=0; i--)
3182  {
3183  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
3184  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3185  }
3186  strat->Bl = -1;

◆ kPosInLDependsOnLength()

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

Definition at line 10012 of file kutil.cc.

10012  {
10013  if (strat->homog) PrintS("ideal/module is homogeneous\n");
10014  else PrintS("ideal/module is not homogeneous\n");
10015  }
10016  #endif
10017 }
10018 
10019 BOOLEAN kPosInLDependsOnLength(int (*pos_in_l)
10020  (const LSet set, const int length,
10021  LObject* L,const kStrategy strat))
10022 {
10023  if (pos_in_l == posInL110
10024  || pos_in_l == posInL10
10025  #ifdef HAVE_RINGS
10026  || pos_in_l == posInL110Ring

◆ kStratChangeTailRing()

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

Definition at line 11394 of file kutil.cc.

11404 {
11405  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11406  /* initial setup or extending */
11407 
11408  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11409  if (expbound >= currRing->bitmask) return FALSE;
11410  strat->overflow=FALSE;
11411  ring new_tailRing = rModifyRing(currRing,
11412  // Hmmm .. the condition pFDeg == p_Deg
11413  // might be too strong
11414  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11415  (strat->ak==0), // omit_comp if the input is an ideal
11416  expbound); // exp_limit
11417 
11418  if (new_tailRing == currRing) return TRUE;
11419 
11420  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11421  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11422 
11423  if (currRing->pFDeg != currRing->pFDegOrig)
11424  {
11425  new_tailRing->pFDeg = currRing->pFDeg;
11426  new_tailRing->pLDeg = currRing->pLDeg;
11427  }
11428 
11429  if (TEST_OPT_PROT)
11430  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11431  kTest_TS(strat);
11432  assume(new_tailRing != strat->tailRing);
11433  pShallowCopyDeleteProc p_shallow_copy_delete
11434  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11435 
11436  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11437 
11438  int i;
11439  for (i=0; i<=strat->tl; i++)
11440  {
11441  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11442  p_shallow_copy_delete);
11443  }
11444  for (i=0; i<=strat->Ll; i++)
11445  {
11446  assume(strat->L[i].p != NULL);
11447  if (pNext(strat->L[i].p) != strat->tail)
11448  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11449  }
11450  if ((strat->P.t_p != NULL) ||
11451  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11452  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11453 
11454  if ((L != NULL) && (L->tailRing != new_tailRing))
11455  {
11456  if (L->i_r < 0)
11457  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11458  else
11459  {
11460  assume(L->i_r <= strat->tl);
11461  TObject* t_l = strat->R[L->i_r];
11462  assume(t_l != NULL);
11463  L->tailRing = new_tailRing;
11464  L->p = t_l->p;
11465  L->t_p = t_l->t_p;
11466  L->max_exp = t_l->max_exp;
11467  }
11468  }
11469 
11470  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11471  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11472 
11473  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11474  if (strat->tailRing != currRing)
11475  rKillModifiedRing(strat->tailRing);
11476 
11477  strat->tailRing = new_tailRing;
11478  strat->tailBin = new_tailBin;
11479  strat->p_shallow_copy_delete
11480  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11481 
11482  if (strat->kHEdge != NULL)
11483  {
11484  if (strat->t_kHEdge != NULL)
11485  p_LmFree(strat->t_kHEdge, strat->tailRing);
11486  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11487  }
11488 
11489  if (strat->kNoether != NULL)
11490  {
11491  if (strat->t_kNoether != NULL)

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11493 of file kutil.cc.

11503 {
11504  unsigned long l = 0;
11505  int i;
11506  long e;
11507 
11508  assume(strat->tailRing == currRing);
11509 
11510  for (i=0; i<= strat->Ll; i++)
11511  {
11512  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11513  }
11514  for (i=0; i<=strat->tl; i++)
11515  {
11516  // Hmm ... this we could do in one Step
11517  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11518  }

◆ message()

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

Definition at line 7952 of file kutil.cc.

7955 {
7956  if (i != *olddeg)
7957  {
7958  Print("%d",i);
7959  *olddeg = i;
7960  }
7961  if (TEST_OPT_OLDSTD)
7962  {
7963  if (strat->Ll != *reduc)
7964  {
7965  if (strat->Ll != *reduc-1)
7966  Print("(%d)",strat->Ll+1);
7967  else
7968  PrintS("-");
7969  *reduc = strat->Ll;
7970  }
7971  else
7972  PrintS(".");
7973  mflush();
7974  }
7975  else
7976  {
7977  if (red_result == 0)
7978  PrintS("-");
7979  else if (red_result < 0)
7980  PrintS(".");
7981  if ((red_result > 0) || ((strat->Ll % 100)==99))
7982  {
7983  if (strat->Ll != *reduc && strat->Ll > 0)
7984  {
7985  Print("(%d)",strat->Ll+1);
7986  *reduc = strat->Ll;
7987  }
7988  }

◆ messageStat()

void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7993 of file kutil.cc.

7996 {
7997  //PrintS("\nUsage/Allocation of temporary storage:\n");
7998  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7999  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
8000  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
8001  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
8002  #ifdef HAVE_SHIFTBBA
8003  /* in usual case strat->cv is 0, it gets changed only in shift routines */
8004  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 8006 of file kutil.cc.

8009 {
8010  //PrintS("\nUsage/Allocation of temporary storage:\n");
8011  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
8012  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
8013  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
8014  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
8015  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
8016  #ifdef HAVE_SHIFTBBA
8017  /* in usual case strat->cv is 0, it gets changed only in shift routines */
8018  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10860 of file kutil.cc.

10868 {
10869  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10870  return FALSE;
10871  int i,j;
10872  poly newNoether;
10873 
10874 #if 0
10875  if (currRing->weight_all_1)
10876  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10877  else
10878  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10879 #else
10880  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10881 #endif
10882  if (strat->kHEdge==NULL) return FALSE;
10883  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10884  if (strat->tailRing != currRing)
10885  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10886  /* compare old and new noether*/
10887  newNoether = pLmInit(strat->kHEdge);
10888  pSetCoeff0(newNoether,nInit(1));
10889  j = p_FDeg(newNoether,currRing);
10890  for (i=1; i<=(currRing->N); i++)
10891  {
10892  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10893  }
10894  pSetm(newNoether);
10895  if (j < strat->HCord) /*- statistics -*/
10896  {
10897  if (TEST_OPT_PROT)
10898  {
10899  Print("H(%d)",j);
10900  mflush();
10901  }
10902  strat->HCord=j;
10903  #ifdef KDEBUG
10904  if (TEST_OPT_DEBUG)
10905  {
10906  Print("H(%d):",j);
10907  wrp(strat->kHEdge);
10908  PrintLn();
10909  }
10910  #endif
10911  }
10912  if (pCmp(strat->kNoether,newNoether)!=1)
10913  {
10914  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
10915  strat->kNoether=newNoether;
10916  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10917  if (strat->tailRing != currRing)

◆ nextZeroSimplexExponent()

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

Definition at line 4260 of file kutil.cc.

4263 {
4264  long add = ind2(cexp[1] + 2);
4265  if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
4266  {
4267  cexp[1] += 2;
4268  cind[1] += add;
4269  *cabsind += add;
4270  }
4271  else
4272  {
4273  // cabsind >= habsind
4274  if (N == 1) return 0;
4275  int i = 1;
4276  while (exp[i] == cexp[i] && i <= N) i++;
4277  cexp[i] = exp[i];
4278  *cabsind -= cind[i];
4279  cind[i] = ind[i];
4280  step[i] = 500000;
4281  *cabsind += cind[i];
4282  // Print("in: %d\n", *cabsind);
4283  i += 1;
4284  if (i > N) return 0;
4285  do
4286  {
4287  step[1] = 500000;
4288  for (int j = i + 1; j <= N; j++)
4289  {
4290  if (step[1] > step[j]) step[1] = step[j];
4291  }
4292  add = ind2(cexp[i] + 2);
4293  if (*cabsind - step[1] + add >= bound)
4294  {
4295  cexp[i] = exp[i];
4296  *cabsind -= cind[i];
4297  cind[i] = ind[i];
4298  *cabsind += cind[i];
4299  step[i] = 500000;
4300  i += 1;
4301  if (i > N) return 0;
4302  }
4303  else step[1] = -1;
4304  } while (step[1] != -1);
4305  step[1] = 500000;
4306  cexp[i] += 2;
4307  cind[i] += add;
4308  *cabsind += add;
4309  if (add < step[i]) step[i] = add;
4310  for (i = 2; i <= N; i++)
4311  {
4312  if (step[1] > step[i]) step[1] = step[i];
4313  }
4314  }
4315  return 1;

◆ p_HasNotCF_Lift()

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

p_HasNotCF for the IDLIFT case: ignore component

Definition at line 2192 of file kutil.cc.

2194 {
2195  int i = rVar(r);
2196  loop
2197  {
2198  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
2199  return FALSE;
2200  i--;
2201  if (i == 0)
2202  return TRUE;
2203  }

◆ pCopyL2p()

poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 12107 of file kutil.cc.

12108  {
12109  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
12110  }
12111  return(p);
12112 }
12113 #endif
12114 
12115 #ifdef HAVE_SHIFTBBA
12116 poly pCopyL2p(LObject H, kStrategy strat)
12117 {
12118  /* restores a poly in currRing from LObject */
12119  LObject h = H;
12120  h.Copy();
12121  poly p;
12122  if (h.p == NULL)
12123  {
12124  if (h.t_p != NULL)
12125  {
12126  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
12127  return(p);
12128  }
12129  else
12130  {
12131  /* h.tp == NULL -> the object is NULL */
12132  return(NULL);
12133  }
12134  }
12135  /* we're here if h.p != NULL */
12136  if (h.t_p == NULL)
12137  {
12138  /* then h.p is the whole poly in currRing */
12139  p = h.p;
12140  return(p);
12141  }

◆ pDivComp()

static int pDivComp ( poly  p,
poly  q 
)
inlinestatic

Definition at line 186 of file kutil.cc.

188 {
189  if ((currRing->pCompIndex < 0)
191  {
192 #ifdef HAVE_RATGRING
193  if (rIsRatGRing(currRing))
194  {
196  q,currRing,
197  currRing->real_var_start, currRing->real_var_end))
198  return 0;
199  return pLmCmp(q,p); // ONLY FOR GLOBAL ORDER!
200  }
201 #endif
202  BOOLEAN a=FALSE, b=FALSE;
203  int i;
204  unsigned long la, lb;
205  unsigned long divmask = currRing->divmask;
206  for (i=0; i<currRing->VarL_Size; i++)
207  {
208  la = p->exp[currRing->VarL_Offset[i]];
209  lb = q->exp[currRing->VarL_Offset[i]];
210  if (la != lb)
211  {
212  if (la < lb)
213  {
214  if (b) return 0;
215  if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
216  return 0;
217  a = TRUE;
218  }
219  else
220  {
221  if (a) return 0;
222  if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
223  return 0;
224  b = TRUE;
225  }
226  }
227  }
228  if (a) { /*assume(pLmCmp(q,p)==1);*/ return 1; }
229  if (b) { /*assume(pLmCmp(q,p)==-1);*/return -1; }
230  /*assume(pLmCmp(q,p)==0);*/
231  }
232  return 0;

◆ pDivCompRing()

static int pDivCompRing ( poly  p,
poly  q 
)
inlinestatic

Definition at line 147 of file kutil.cc.

149 {
150  if ((currRing->pCompIndex < 0)
152  {
153  BOOLEAN a=FALSE, b=FALSE;
154  int i;
155  unsigned long la, lb;
156  unsigned long divmask = currRing->divmask;
157  for (i=0; i<currRing->VarL_Size; i++)
158  {
159  la = p->exp[currRing->VarL_Offset[i]];
160  lb = q->exp[currRing->VarL_Offset[i]];
161  if (la != lb)
162  {
163  if (la < lb)
164  {
165  if (b) return pDivComp_INCOMP;
166  if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
167  return pDivComp_INCOMP;
168  a = TRUE;
169  }
170  else
171  {
172  if (a) return pDivComp_INCOMP;
173  if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
174  return pDivComp_INCOMP;
175  b = TRUE;
176  }
177  }
178  }
179  if (a) return pDivComp_LESS;
180  if (b) return pDivComp_GREATER;
181  if (!a & !b) return pDivComp_EQUAL;
182  }
183  return pDivComp_INCOMP;

◆ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 12076 of file kutil.cc.

12086 {

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 12090 of file kutil.cc.

12091  {
12092  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
12093  }
12094  return(p);
12095 }
12096 #endif
12097 
12098 #ifdef HAVE_SHIFTBBA
12099 poly pMoveCurrTail2poly(poly p, kStrategy strat)
12100 {
12101  /* assume: p has LM in curring and TAIL in tailring */
12102  /* convert it to complete currRing */
12103 

◆ posInIdealMonFirst()

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

Definition at line 5212 of file kutil.cc.

5214 {
5215  if(end < 0 || end >= IDELEMS(F))
5216  end = IDELEMS(F);
5217  if (end<0) return 0;
5218  if(pNext(p) == NULL) return start;
5219  polyset set=F->m;
5220  int o = p_Deg(p,currRing);
5221  int op;
5222  int i;
5223  int an = start;
5224  for(i=start;i<end;i++)
5225  if(set[i] != NULL && pNext(set[i]) == NULL)
5226  an++;
5227  if(an == end-1)
5228  return end;
5229  int en= end;
5230  loop
5231  {
5232  if(an>=en)
5233  return en;
5234  if (an == en-1)
5235  {
5236  op = p_Deg(set[an],currRing);
5237  if ((op < o)
5238  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5239  return en;
5240  return an;
5241  }
5242  i=(an+en) / 2;
5243  op = p_Deg(set[i],currRing);
5244  if ((op < o)
5245  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5246  an=i;
5247  else
5248  en=i;
5249  }

◆ posInL0()

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

Definition at line 6064 of file kutil.cc.

6067 {
6068  if (length<0) return 0;
6069 
6070  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6071  return length+1;
6072 
6073  int i;
6074  int an = 0;
6075  int en= length;
6076  loop
6077  {
6078  if (an >= en-1)
6079  {
6080  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6081  return an;
6082  }
6083  i=(an+en) / 2;
6084  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6085  else en=i;
6086  /*aend. fuer lazy == in !=- machen */
6087  }

◆ posInL0Ring()

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

Definition at line 6090 of file kutil.cc.

6093 {
6094  if (length<0) return 0;
6095 
6096  if (pLtCmpOrdSgnEqP(set[length].p,p->p))
6097  return length+1;
6098 
6099  int i;
6100  int an = 0;
6101  int en= length;
6102  loop
6103  {
6104  if (an >= en-1)
6105  {
6106  if (pLtCmpOrdSgnEqP(set[an].p,p->p)) return en;
6107  return an;
6108  }
6109  i=(an+en) / 2;
6110  if (pLtCmpOrdSgnEqP(set[i].p,p->p)) an=i;
6111  else en=i;
6112  /*aend. fuer lazy == in !=- machen */
6113  }

◆ posInL11()

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

Definition at line 6322 of file kutil.cc.

6325 {
6326  if (length<0) return 0;
6327 
6328  int o = p->GetpFDeg();
6329  int op = set[length].GetpFDeg();
6330 
6331  if ((op > o)
6332  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6333  return length+1;
6334  int i;
6335  int an = 0;
6336  int en= length;
6337  loop
6338  {
6339  if (an >= en-1)
6340  {
6341  op = set[an].GetpFDeg();
6342  if ((op > o)
6343  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6344  return en;
6345  return an;
6346  }
6347  i=(an+en) / 2;
6348  op = set[i].GetpFDeg();
6349  if ((op > o)
6350  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6351  an=i;
6352  else
6353  en=i;
6354  }

◆ posInL110()

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

Definition at line 6620 of file kutil.cc.

6623 {
6624  if (length<0) return 0;
6625 
6626  int o = p->GetpFDeg();
6627  int op = set[length].GetpFDeg();
6628 
6629  if ((op > o)
6630  || ((op == o) && (set[length].length >p->length))
6631  || ((op == o) && (set[length].length <= p->length)
6632  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6633  return length+1;
6634  int i;
6635  int an = 0;
6636  int en= length;
6637  loop
6638  {
6639  if (an >= en-1)
6640  {
6641  op = set[an].GetpFDeg();
6642  if ((op > o)
6643  || ((op == o) && (set[an].length >p->length))
6644  || ((op == o) && (set[an].length <=p->length)
6645  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6646  return en;
6647  return an;
6648  }
6649  i=(an+en) / 2;
6650  op = set[i].GetpFDeg();
6651  if ((op > o)
6652  || ((op == o) && (set[i].length > p->length))
6653  || ((op == o) && (set[i].length <= p->length)
6654  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6655  an=i;
6656  else
6657  en=i;
6658  }

◆ posInL110Ring()

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

Definition at line 6661 of file kutil.cc.

6664 {
6665  if (length<0) return 0;
6666 
6667  int o = p->GetpFDeg();
6668  int op = set[length].GetpFDeg();
6669 
6670  if ((op > o)
6671  || ((op == o) && (set[length].length >p->length))
6672  || ((op == o) && (set[length].length <= p->length)
6673  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6674  return length+1;
6675  int i;
6676  int an = 0;
6677  int en= length;
6678  loop
6679  {
6680  if (an >= en-1)
6681  {
6682  op = set[an].GetpFDeg();
6683  if ((op > o)
6684  || ((op == o) && (set[an].length >p->length))
6685  || ((op == o) && (set[an].length <=p->length)
6686  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6687  return en;
6688  return an;
6689  }
6690  i=(an+en) / 2;
6691  op = set[i].GetpFDeg();
6692  if ((op > o)
6693  || ((op == o) && (set[i].length > p->length))
6694  || ((op == o) && (set[i].length <= p->length)
6695  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6696  an=i;
6697  else
6698  en=i;
6699  }

◆ posInL11Ring()

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

Definition at line 6364 of file kutil.cc.

6367 {
6368  if (length<0) return 0;
6369 
6370  int o = p->GetpFDeg();
6371  int op = set[length].GetpFDeg();
6372 
6373  if ((op > o)
6374  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6375  return length+1;
6376  int i;
6377  int an = 0;
6378  int en= length;
6379  loop
6380  {
6381  if (an >= en-1)
6382  {
6383  op = set[an].GetpFDeg();
6384  if ((op > o)
6385  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6386  return en;
6387  return an;
6388  }
6389  i=(an+en) / 2;
6390  op = set[i].GetpFDeg();
6391  if ((op > o)
6392  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6393  an=i;
6394  else
6395  en=i;
6396  }

◆ posInL11Ringls()

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

Definition at line 6434 of file kutil.cc.

6437 {
6438  if (length < 0) return 0;
6439  int an,en,i;
6440  an = 0;
6441  en = length+1;
6442  loop
6443  {
6444  if (an >= en-1)
6445  {
6446  if(an == en)
6447  return en;
6448  if (set[an].FDeg > p->FDeg)
6449  return en;
6450  if (set[an].FDeg < p->FDeg)
6451  return an;
6452  if (set[an].FDeg == p->FDeg)
6453  {
6454  number lcset,lcp;
6455  lcset = pGetCoeff(set[an].p);
6456  lcp = pGetCoeff(p->p);
6457  if(!nGreaterZero(lcset))
6458  {
6459  set[an].p=p_Neg(set[an].p,currRing);
6460  if (set[an].t_p!=NULL)
6461  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6462  lcset=pGetCoeff(set[an].p);
6463  }
6464  if(!nGreaterZero(lcp))
6465  {
6466  p->p=p_Neg(p->p,currRing);
6467  if (p->t_p!=NULL)
6468  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6469  lcp=pGetCoeff(p->p);
6470  }
6471  if(nGreater(lcset, lcp))
6472  {
6473  return en;
6474  }
6475  else
6476  {
6477  return an;
6478  }
6479  }
6480  }
6481  i=(an+en) / 2;
6482  if (set[i].FDeg > p->FDeg)
6483  an=i;
6484  if (set[i].FDeg < p->FDeg)
6485  en=i;
6486  if (set[i].FDeg == p->FDeg)
6487  {
6488  number lcset,lcp;
6489  lcset = pGetCoeff(set[i].p);
6490  lcp = pGetCoeff(p->p);
6491  if(!nGreaterZero(lcset))
6492  {
6493  set[i].p=p_Neg(set[i].p,currRing);
6494  if (set[i].t_p!=NULL)
6495  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6496  lcset=pGetCoeff(set[i].p);
6497  }
6498  if(!nGreaterZero(lcp))
6499  {
6500  p->p=p_Neg(p->p,currRing);
6501  if (p->t_p!=NULL)
6502  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6503  lcp=pGetCoeff(p->p);
6504  }
6505  if(nGreater(lcset, lcp))
6506  {
6507  an = i;
6508  }
6509  else
6510  {
6511  en = i;
6512  }
6513  }
6514  }

◆ posInL13()

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

Definition at line 6708 of file kutil.cc.

6711 {
6712  if (length<0) return 0;
6713 
6714  int o = p->GetpFDeg();
6715 
6716  if (set[length].GetpFDeg() > o)
6717  return length+1;
6718 
6719  int i;
6720  int an = 0;
6721  int en= length;
6722  loop
6723  {
6724  if (an >= en-1)
6725  {
6726  if (set[an].GetpFDeg() >= o)
6727  return en;
6728  return an;
6729  }
6730  i=(an+en) / 2;
6731  if (set[i].GetpFDeg() >= o)
6732  an=i;
6733  else
6734  en=i;
6735  }

◆ posInL15()

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

Definition at line 6743 of file kutil.cc.

6746 {
6747  if (length<0) return 0;
6748 
6749  int o = p->GetpFDeg() + p->ecart;
6750  int op = set[length].GetpFDeg() + set[length].ecart;
6751 
6752  if ((op > o)
6753  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6754  return length+1;
6755  int i;
6756  int an = 0;
6757  int en= length;
6758  loop
6759  {
6760  if (an >= en-1)
6761  {
6762  op = set[an].GetpFDeg() + set[an].ecart;
6763  if ((op > o)
6764  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6765  return en;
6766  return an;
6767  }
6768  i=(an+en) / 2;
6769  op = set[i].GetpFDeg() + set[i].ecart;
6770  if ((op > o)
6771  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6772  an=i;
6773  else
6774  en=i;
6775  }

◆ posInL15Ring()

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

Definition at line 6778 of file kutil.cc.

6781 {
6782  if (length<0) return 0;
6783 
6784  int o = p->GetpFDeg() + p->ecart;
6785  int op = set[length].GetpFDeg() + set[length].ecart;
6786 
6787  if ((op > o)
6788  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6789  return length+1;
6790  int i;
6791  int an = 0;
6792  int en= length;
6793  loop
6794  {
6795  if (an >= en-1)
6796  {
6797  op = set[an].GetpFDeg() + set[an].ecart;
6798  if ((op > o)
6799  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6800  return en;
6801  return an;
6802  }
6803  i=(an+en) / 2;
6804  op = set[i].GetpFDeg() + set[i].ecart;
6805  if ((op > o)
6806  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6807  an=i;
6808  else
6809  en=i;
6810  }

◆ posInL17()

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

Definition at line 6819 of file kutil.cc.

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

◆ posInL17_c()

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

Definition at line 6913 of file kutil.cc.

6916 {
6917  if (length<0) return 0;
6918 
6919  int cc = (-1+2*currRing->order[0]==ringorder_c);
6920  /* cc==1 for (c,..), cc==-1 for (C,..) */
6921  unsigned long c = pGetComp(p->p)*cc;
6922  int o = p->GetpFDeg() + p->ecart;
6923 
6924  if (pGetComp(set[length].p)*cc > c)
6925  return length+1;
6926  if (pGetComp(set[length].p)*cc == c)
6927  {
6928  if ((set[length].GetpFDeg() + set[length].ecart > o)
6929  || ((set[length].GetpFDeg() + set[length].ecart == o)
6930  && (set[length].ecart > p->ecart))
6931  || ((set[length].GetpFDeg() + set[length].ecart == o)
6932  && (set[length].ecart == p->ecart)
6933  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6934  return length+1;
6935  }
6936  int i;
6937  int an = 0;
6938  int en= length;
6939  loop
6940  {
6941  if (an >= en-1)
6942  {
6943  if (pGetComp(set[an].p)*cc > c)
6944  return en;
6945  if (pGetComp(set[an].p)*cc == c)
6946  {
6947  if ((set[an].GetpFDeg() + set[an].ecart > o)
6948  || ((set[an].GetpFDeg() + set[an].ecart == o)
6949  && (set[an].ecart > p->ecart))
6950  || ((set[an].GetpFDeg() + set[an].ecart == o)
6951  && (set[an].ecart == p->ecart)
6952  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6953  return en;
6954  }
6955  return an;
6956  }
6957  i=(an+en) / 2;
6958  if (pGetComp(set[i].p)*cc > c)
6959  an=i;
6960  else if (pGetComp(set[i].p)*cc == c)
6961  {
6962  if ((set[i].GetpFDeg() + set[i].ecart > o)
6963  || ((set[i].GetpFDeg() + set[i].ecart == o)
6964  && (set[i].ecart > p->ecart))
6965  || ((set[i].GetpFDeg() +set[i].ecart == o)
6966  && (set[i].ecart == p->ecart)
6967  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6968  an=i;
6969  else
6970  en=i;
6971  }
6972  else
6973  en=i;
6974  }

◆ posInL17_cRing()

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

Definition at line 6977 of file kutil.cc.

6980 {
6981  if (length<0) return 0;
6982 
6983  int cc = (-1+2*currRing->order[0]==ringorder_c);
6984  /* cc==1 for (c,..), cc==-1 for (C,..) */
6985  unsigned long c = pGetComp(p->p)*cc;
6986  int o = p->GetpFDeg() + p->ecart;
6987 
6988  if (pGetComp(set[length].p)*cc > c)
6989  return length+1;
6990  if (pGetComp(set[length].p)*cc == c)
6991  {
6992  if ((set[length].GetpFDeg() + set[length].ecart > o)
6993  || ((set[length].GetpFDeg() + set[length].ecart == o)
6994  && (set[length].ecart > p->ecart))
6995  || ((set[length].GetpFDeg() + set[length].ecart == o)
6996  && (set[length].ecart == p->ecart)
6997  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6998  return length+1;
6999  }
7000  int i;
7001  int an = 0;
7002  int en= length;
7003  loop
7004  {
7005  if (an >= en-1)
7006  {
7007  if (pGetComp(set[an].p)*cc > c)
7008  return en;
7009  if (pGetComp(set[an].p)*cc == c)
7010  {
7011  if ((set[an].GetpFDeg() + set[an].ecart > o)
7012  || ((set[an].GetpFDeg() + set[an].ecart == o)
7013  && (set[an].ecart > p->ecart))
7014  || ((set[an].GetpFDeg() + set[an].ecart == o)
7015  && (set[an].ecart == p->ecart)
7016  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
7017  return en;
7018  }
7019  return an;
7020  }
7021  i=(an+en) / 2;
7022  if (pGetComp(set[i].p)*cc > c)
7023  an=i;
7024  else if (pGetComp(set[i].p)*cc == c)
7025  {
7026  if ((set[i].GetpFDeg() + set[i].ecart > o)
7027  || ((set[i].GetpFDeg() + set[i].ecart == o)
7028  && (set[i].ecart > p->ecart))
7029  || ((set[i].GetpFDeg() +set[i].ecart == o)
7030  && (set[i].ecart == p->ecart)
7031  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
7032  an=i;
7033  else
7034  en=i;
7035  }
7036  else
7037  en=i;
7038  }

◆ posInL17Ring()

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

Definition at line 6863 of file kutil.cc.

6866 {
6867  if (length<0) return 0;
6868 
6869  int o = p->GetpFDeg() + p->ecart;
6870 
6871  if ((set[length].GetpFDeg() + set[length].ecart > o)
6872  || ((set[length].GetpFDeg() + set[length].ecart == o)
6873  && (set[length].ecart > p->ecart))
6874  || ((set[length].GetpFDeg() + set[length].ecart == o)
6875  && (set[length].ecart == p->ecart)
6876  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6877  return length+1;
6878  int i;
6879  int an = 0;
6880  int en= length;
6881  loop
6882  {
6883  if (an >= en-1)
6884  {
6885  if ((set[an].GetpFDeg() + set[an].ecart > o)
6886  || ((set[an].GetpFDeg() + set[an].ecart == o)
6887  && (set[an].ecart > p->ecart))
6888  || ((set[an].GetpFDeg() + set[an].ecart == o)
6889  && (set[an].ecart == p->ecart)
6890  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6891  return en;
6892  return an;
6893  }
6894  i=(an+en) / 2;
6895  if ((set[i].GetpFDeg() + set[i].ecart > o)
6896  || ((set[i].GetpFDeg() + set[i].ecart == o)
6897  && (set[i].ecart > p->ecart))
6898  || ((set[i].GetpFDeg() +set[i].ecart == o)
6899  && (set[i].ecart == p->ecart)
6900  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6901  an=i;
6902  else
6903  en=i;
6904  }

◆ posInLF5C()

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

Definition at line 6310 of file kutil.cc.

6313 {
6314  return strat->Ll+1;

◆ posInLF5CRing()

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

Definition at line 6398 of file kutil.cc.

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

◆ posInLrg0()

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

Definition at line 6536 of file kutil.cc.

6547 {
6548  if (length < 0) return 0;
6549 
6550  int o = p->GetpFDeg();
6551  int op = set[length].GetpFDeg();
6552 
6553  if ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6554  return length + 1;
6555  int i;
6556  int an = 0;
6557  int en = length;
6558  loop
6559  {
6560  if (an >= en - 1)
6561  {
6562  op = set[an].GetpFDeg();
6563  if ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6564  return en;
6565  return an;
6566  }
6567  i = (an+en) / 2;
6568  op = set[i].GetpFDeg();
6569  if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6570  an = i;
6571  else
6572  en = i;
6573  }

◆ posInLRing()

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

Definition at line 6209 of file kutil.cc.

6212 {
6213  if (length < 0) return 0;
6214  if (set[length].FDeg > p->FDeg)
6215  return length+1;
6216  if (set[length].FDeg == p->FDeg)
6217  if(set[length].GetpLength() > p->GetpLength())
6218  return length+1;
6219  int i;
6220  int an = 0;
6221  int en= length+1;
6222  loop
6223  {
6224  if (an >= en-1)
6225  {
6226  if(an == en)
6227  return en;
6228  if (set[an].FDeg > p->FDeg)
6229  return en;
6230  if(set[an].FDeg == p->FDeg)
6231  {
6232  if(set[an].GetpLength() > p->GetpLength())
6233  return en;
6234  else
6235  {
6236  if(set[an].GetpLength() == p->GetpLength())
6237  {
6238  if(nGreater(set[an].p->coef, p->p->coef))
6239  return en;
6240  else
6241  return an;
6242  }
6243  else
6244  {
6245  return an;
6246  }
6247  }
6248  }
6249  else
6250  return an;
6251  }
6252  i=(an+en) / 2;
6253  if (set[i].FDeg > p->FDeg)
6254  an=i;
6255  else
6256  {
6257  if(set[i].FDeg == p->FDeg)
6258  {
6259  if(set[i].GetpLength() > p->GetpLength())
6260  an=i;
6261  else
6262  {
6263  if(set[i].GetpLength() == p->GetpLength())
6264  {
6265  if(nGreater(set[i].p->coef, p->p->coef))
6266  an = i;
6267  else
6268  en = i;
6269  }
6270  else
6271  {
6272  en=i;
6273  }
6274  }
6275  }
6276  else
6277  en=i;
6278  }
6279  }

◆ posInLSig()

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

Definition at line 6122 of file kutil.cc.

6125 {
6126  if (length<0) return 0;
6127  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6128  return length+1;
6129 
6130  int i;
6131  int an = 0;
6132  int en= length;
6133  loop
6134  {
6135  if (an >= en-1)
6136  {
6137  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6138  return an;
6139  }
6140  i=(an+en) / 2;
6141  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6142  else en=i;
6143  /*aend. fuer lazy == in !=- machen */
6144  }

◆ posInLSigRing()

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

Definition at line 6146 of file kutil.cc.

6149 {
6150  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6151  if (length<0) return 0;
6152  if (pLtCmp(set[length].sig,p->sig)== 1)
6153  return length+1;
6154 
6155  int an,en,i;
6156  an = 0;
6157  en = length+1;
6158  int cmp;
6159  loop
6160  {
6161  if (an >= en-1)
6162  {
6163  if(an == en)
6164  return en;
6165  cmp = pLtCmp(set[an].sig,p->sig);
6166  if (cmp == 1)
6167  return en;
6168  if (cmp == -1)
6169  return an;
6170  if (cmp == 0)
6171  {
6172  if (set[an].FDeg > p->FDeg)
6173  return en;
6174  if (set[an].FDeg < p->FDeg)
6175  return an;
6176  if (set[an].FDeg == p->FDeg)
6177  {
6178  cmp = pLtCmp(set[an].p,p->p);
6179  if(cmp == 1)
6180  return en;
6181  else
6182  return an;
6183  }
6184  }
6185  }
6186  i=(an+en) / 2;
6187  cmp = pLtCmp(set[i].sig,p->sig);
6188  if (cmp == 1)
6189  an = i;
6190  if (cmp == -1)
6191  en = i;
6192  if (cmp == 0)
6193  {
6194  if (set[i].FDeg > p->FDeg)
6195  an = i;
6196  if (set[i].FDeg < p->FDeg)
6197  en = i;
6198  if (set[i].FDeg == p->FDeg)
6199  {
6200  cmp = pLtCmp(set[i].p,p->p);
6201  if(cmp == 1)
6202  an = i;
6203  else
6204  en = i;
6205  }
6206  }
6207  }

◆ posInLSpecial()

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

Definition at line 6021 of file kutil.cc.

6024 {
6025  if (length<0) return 0;
6026 
6027  int d=p->GetpFDeg();
6028  int op=set[length].GetpFDeg();
6029 
6030  if ((op > d)
6031  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
6032  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
6033  return length+1;
6034 
6035  int i;
6036  int an = 0;
6037  int en= length;
6038  loop
6039  {
6040  if (an >= en-1)
6041  {
6042  op=set[an].GetpFDeg();
6043  if ((op > d)
6044  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
6045  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
6046  return en;
6047  return an;
6048  }
6049  i=(an+en) / 2;
6050  op=set[i].GetpFDeg();
6051  if ((op>d)
6052  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
6053  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
6054  an=i;
6055  else
6056  en=i;
6057  }

◆ posInS()

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

Definition at line 5034 of file kutil.cc.

5037 {
5038  if(length==-1) return 0;
5039  polyset set=strat->S;
5040  int i;
5041  int an = 0;
5042  int en = length;
5043  int cmp_int = currRing->OrdSgn;
5045 #ifdef HAVE_PLURAL
5046  && (currRing->real_var_start==0)
5047 #endif
5048 #if 0
5049  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5050 #endif
5051  )
5052  {
5053  int o=p_Deg(p,currRing);
5054  int oo=p_Deg(set[length],currRing);
5055 
5056  if ((oo<o)
5057  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5058  return length+1;
5059 
5060  loop
5061  {
5062  if (an >= en-1)
5063  {
5064  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5065  {
5066  return an;
5067  }
5068  return en;
5069  }
5070  i=(an+en) / 2;
5071  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5072  else an=i;
5073  }
5074  }
5075  else
5076  {
5077  if (rField_is_Ring(currRing))
5078  {
5079  if (pLmCmp(set[length],p)== -cmp_int)
5080  return length+1;
5081  int cmp;
5082  loop
5083  {
5084  if (an >= en-1)
5085  {
5086  cmp = pLmCmp(set[an],p);
5087  if (cmp == cmp_int) return an;
5088  if (cmp == -cmp_int) return en;
5089  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5090  return an;
5091  }
5092  i = (an+en) / 2;
5093  cmp = pLmCmp(set[i],p);
5094  if (cmp == cmp_int) en = i;
5095  else if (cmp == -cmp_int) an = i;
5096  else
5097  {
5098  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5099  else en = i;
5100  }
5101  }
5102  }
5103  else
5104  if (pLmCmp(set[length],p)== -cmp_int)
5105  return length+1;
5106 
5107  loop
5108  {
5109  if (an >= en-1)
5110  {
5111  if (pLmCmp(set[an],p) == cmp_int) return an;
5112  if (pLmCmp(set[an],p) == -cmp_int) return en;
5113  if ((cmp_int!=1)
5114  && ((strat->ecartS[an])>ecart_p))
5115  return an;
5116  return en;
5117  }
5118  i=(an+en) / 2;
5119  if (pLmCmp(set[i],p) == cmp_int) en=i;
5120  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5121  else
5122  {
5123  if ((cmp_int!=1)
5124  &&((strat->ecartS[i])<ecart_p))
5125  en=i;
5126  else
5127  an=i;
5128  }
5129  }
5130  }

◆ posInSMonFirst()

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

Definition at line 5135 of file kutil.cc.

5137 {
5138  if (length<0) return 0;
5139  polyset set=strat->S;
5140  if(pNext(p) == NULL)
5141  {
5142  int mon = 0;
5143  for(int i = 0;i<=length;i++)
5144  {
5145  if(set[i] != NULL && pNext(set[i]) == NULL)
5146  mon++;
5147  }
5148  int o = p_Deg(p,currRing);
5149  int op = p_Deg(set[mon],currRing);
5150 
5151  if ((op < o)
5152  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5153  return length+1;
5154  int i;
5155  int an = 0;
5156  int en= mon;
5157  loop
5158  {
5159  if (an >= en-1)
5160  {
5161  op = p_Deg(set[an],currRing);
5162  if ((op < o)
5163  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5164  return en;
5165  return an;
5166  }
5167  i=(an+en) / 2;
5168  op = p_Deg(set[i],currRing);
5169  if ((op < o)
5170  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5171  an=i;
5172  else
5173  en=i;
5174  }
5175  }
5176  else /*if(pNext(p) != NULL)*/
5177  {
5178  int o = p_Deg(p,currRing);
5179  int op = p_Deg(set[length],currRing);
5180 
5181  if ((op < o)
5182  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5183  return length+1;
5184  int i;
5185  int an = 0;
5186  for(i=0;i<=length;i++)
5187  if(set[i] != NULL && pNext(set[i]) == NULL)
5188  an++;
5189  int en= length;
5190  loop
5191  {
5192  if (an >= en-1)
5193  {
5194  op = p_Deg(set[an],currRing);
5195  if ((op < o)
5196  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5197  return en;
5198  return an;
5199  }
5200  i=(an+en) / 2;
5201  op = p_Deg(set[i],currRing);
5202  if ((op < o)
5203  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5204  an=i;
5205  else
5206  en=i;
5207  }
5208  }

◆ posInSyz()

int posInSyz ( const kStrategy  strat,
poly  sig 
)

Definition at line 6282 of file kutil.cc.

6284 {
6285  if (strat->syzl==0) return 0;
6286  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6287  return strat->syzl;
6288  int i;
6289  int an = 0;
6290  int en= strat->syzl-1;
6291  loop
6292  {
6293  if (an >= en-1)
6294  {
6295  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6296  return an;
6297  }
6298  i=(an+en) / 2;
6299  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6300  else en=i;
6301  /*aend. fuer lazy == in !=- machen */
6302  }

◆ posInT0()

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

Definition at line 5256 of file kutil.cc.

5258 {
5259  return (length+1);

◆ posInT1()

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

Definition at line 5267 of file kutil.cc.

5269 {
5270  if (length==-1) return 0;
5271 
5272  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5273 
5274  int i;
5275  int an = 0;
5276  int en= length;
5277 
5278  loop
5279  {
5280  if (an >= en-1)
5281  {
5282  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5283  return en;
5284  }
5285  i=(an+en) / 2;
5286  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5287  else an=i;
5288  }

◆ posInT11()

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

Definition at line 5325 of file kutil.cc.

5327 {
5328  if (length==-1) return 0;
5329 
5330  int o = p.GetpFDeg();
5331  int op = set[length].GetpFDeg();
5332 
5333  if ((op < o)
5334  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5335  return length+1;
5336 
5337  int i;
5338  int an = 0;
5339  int en= length;
5340 
5341  loop
5342  {
5343  if (an >= en-1)
5344  {
5345  op= set[an].GetpFDeg();
5346  if ((op > o)
5347  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5348  return an;
5349  return en;
5350  }
5351  i=(an+en) / 2;
5352  op = set[i].GetpFDeg();
5353  if (( op > o)
5354  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5355  en=i;
5356  else
5357  an=i;
5358  }

◆ posInT110()

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

Definition at line 5478 of file kutil.cc.

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

◆ posInT110Ring()

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

Definition at line 5520 of file kutil.cc.

5522 {
5523  p.GetpLength();
5524  if (length==-1) return 0;
5525 
5526  int o = p.GetpFDeg();
5527  int op = set[length].GetpFDeg();
5528 
5529  if (( op < o)
5530  || (( op == o) && (set[length].length<p.length))
5531  || (( op == o) && (set[length].length == p.length)
5532  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5533  return length+1;
5534 
5535  int i;
5536  int an = 0;
5537  int en= length;
5538  loop
5539  {
5540  if (an >= en-1)
5541  {
5542  op = set[an].GetpFDeg();
5543  if (( op > o)
5544  || (( op == o) && (set[an].length > p.length))
5545  || (( op == o) && (set[an].length == p.length)
5546  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5547  return an;
5548  return en;
5549  }
5550  i=(an+en) / 2;
5551  op = set[i].GetpFDeg();
5552  if (( op > o)
5553  || (( op == o) && (set[i].length > p.length))
5554  || (( op == o) && (set[i].length == p.length)
5555  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5556  en=i;
5557  else
5558  an=i;
5559  }

◆ posInT11Ring()

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

Definition at line 5361 of file kutil.cc.

5363 {
5364  if (length==-1) return 0;
5365 
5366  int o = p.GetpFDeg();
5367  int op = set[length].GetpFDeg();
5368 
5369  if ((op < o)
5370  || ((op == o) && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5371  return length+1;
5372 
5373  int i;
5374  int an = 0;
5375  int en= length;
5376 
5377  loop
5378  {
5379  if (an >= en-1)
5380  {
5381  op= set[an].GetpFDeg();
5382  if ((op > o)
5383  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5384  return an;
5385  return en;
5386  }
5387  i=(an+en) / 2;
5388  op = set[i].GetpFDeg();
5389  if (( op > o)
5390  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5391  en=i;
5392  else
5393  an=i;
5394  }

◆ posInT13()

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

Definition at line 5567 of file kutil.cc.

5569 {
5570  if (length==-1) return 0;
5571 
5572  int o = p.GetpFDeg();
5573 
5574  if (set[length].GetpFDeg() <= o)
5575  return length+1;
5576 
5577  int i;
5578  int an = 0;
5579  int en= length;
5580  loop
5581  {
5582  if (an >= en-1)
5583  {
5584  if (set[an].GetpFDeg() > o)
5585  return an;
5586  return en;
5587  }
5588  i=(an+en) / 2;
5589  if (set[i].GetpFDeg() > o)
5590  en=i;
5591  else
5592  an=i;
5593  }

◆ posInT15()

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

Definition at line 5635 of file kutil.cc.

5655 {
5656  if (length==-1) return 0;
5657 
5658  int o = p.GetpFDeg() + p.ecart;
5659  int op = set[length].GetpFDeg()+set[length].ecart;
5660 
5661  if ((op < o)
5662  || ((op == o)
5663  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5664  return length+1;
5665 
5666  int i;
5667  int an = 0;
5668  int en= length;
5669  loop
5670  {
5671  if (an >= en-1)
5672  {
5673  op = set[an].GetpFDeg()+set[an].ecart;
5674  if (( op > o)
5675  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5676  return an;
5677  return en;
5678  }
5679  i=(an+en) / 2;
5680  op = set[i].GetpFDeg()+set[i].ecart;
5681  if (( op > o)
5682  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5683  en=i;
5684  else
5685  an=i;
5686  }

◆ posInT15Ring()

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

Definition at line 5689 of file kutil.cc.

5691 {
5692  if (length==-1) return 0;
5693 
5694  int o = p.GetpFDeg() + p.ecart;
5695  int op = set[length].GetpFDeg()+set[length].ecart;
5696 
5697  if ((op < o)
5698  || ((op == o)
5699  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5700  return length+1;
5701 
5702  int i;
5703  int an = 0;
5704  int en= length;
5705  loop
5706  {
5707  if (an >= en-1)
5708  {
5709  op = set[an].GetpFDeg()+set[an].ecart;
5710  if (( op > o)
5711  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5712  return an;
5713  return en;
5714  }
5715  i=(an+en) / 2;
5716  op = set[i].GetpFDeg()+set[i].ecart;
5717  if (( op > o)
5718  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5719  en=i;
5720  else
5721  an=i;
5722  }

◆ posInT17()

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

Definition at line 5730 of file kutil.cc.

5752 {
5753  if (length==-1) return 0;
5754 
5755  int o = p.GetpFDeg() + p.ecart;
5756  int op = set[length].GetpFDeg()+set[length].ecart;
5757 
5758  if ((op < o)
5759  || (( op == o) && (set[length].ecart > p.ecart))
5760  || (( op == o) && (set[length].ecart==p.ecart)
5761  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5762  return length+1;
5763 
5764  int i;
5765  int an = 0;
5766  int en= length;
5767  loop
5768  {
5769  if (an >= en-1)
5770  {
5771  op = set[an].GetpFDeg()+set[an].ecart;
5772  if (( op > o)
5773  || (( op == o) && (set[an].ecart < p.ecart))
5774  || (( op == o) && (set[an].ecart==p.ecart)
5775  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5776  return an;
5777  return en;
5778  }
5779  i=(an+en) / 2;
5780  op = set[i].GetpFDeg()+set[i].ecart;
5781  if ((op > o)
5782  || (( op == o) && (set[i].ecart < p.ecart))
5783  || (( op == o) && (set[i].ecart == p.ecart)
5784  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5785  en=i;
5786  else
5787  an=i;
5788  }

◆ posInT17_c()

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

Definition at line 5837 of file kutil.cc.

5839 {
5840  if (length==-1) return 0;
5841 
5842  int cc = (-1+2*currRing->order[0]==ringorder_c);
5843  /* cc==1 for (c,..), cc==-1 for (C,..) */
5844  int o = p.GetpFDeg() + p.ecart;
5845  int c = pGetComp(p.p)*cc;
5846 
5847  if (pGetComp(set[length].p)*cc < c)
5848  return length+1;
5849  if (pGetComp(set[length].p)*cc == c)
5850  {
5851  int op = set[length].GetpFDeg()+set[length].ecart;
5852  if ((op < o)
5853  || ((op == o) && (set[length].ecart > p.ecart))
5854  || ((op == o) && (set[length].ecart==p.ecart)
5855  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5856  return length+1;
5857  }
5858 
5859  int i;
5860  int an = 0;
5861  int en= length;
5862  loop
5863  {
5864  if (an >= en-1)
5865  {
5866  if (pGetComp(set[an].p)*cc < c)
5867  return en;
5868  if (pGetComp(set[an].p)*cc == c)
5869  {
5870  int op = set[an].GetpFDeg()+set[an].ecart;
5871  if ((op > o)
5872  || ((op == o) && (set[an].ecart < p.ecart))
5873  || ((op == o) && (set[an].ecart==p.ecart)
5874  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5875  return an;
5876  }
5877  return en;
5878  }
5879  i=(an+en) / 2;
5880  if (pGetComp(set[i].p)*cc > c)
5881  en=i;
5882  else if (pGetComp(set[i].p)*cc == c)
5883  {
5884  int op = set[i].GetpFDeg()+set[i].ecart;
5885  if ((op > o)
5886  || ((op == o) && (set[i].ecart < p.ecart))
5887  || ((op == o) && (set[i].ecart == p.ecart)
5888  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5889  en=i;
5890  else
5891  an=i;
5892  }
5893  else
5894  an=i;
5895  }

◆ posInT17_cRing()

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

Definition at line 5898 of file kutil.cc.

5900 {
5901  if (length==-1) return 0;
5902 
5903  int cc = (-1+2*currRing->order[0]==ringorder_c);
5904  /* cc==1 for (c,..), cc==-1 for (C,..) */
5905  int o = p.GetpFDeg() + p.ecart;
5906  int c = pGetComp(p.p)*cc;
5907 
5908  if (pGetComp(set[length].p)*cc < c)
5909  return length+1;
5910  if (pGetComp(set[length].p)*cc == c)
5911  {
5912  int op = set[length].GetpFDeg()+set[length].ecart;
5913  if ((op < o)
5914  || ((op == o) && (set[length].ecart > p.ecart))
5915  || ((op == o) && (set[length].ecart==p.ecart)
5916  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5917  return length+1;
5918  }
5919 
5920  int i;
5921  int an = 0;
5922  int en= length;
5923  loop
5924  {
5925  if (an >= en-1)
5926  {
5927  if (pGetComp(set[an].p)*cc < c)
5928  return en;
5929  if (pGetComp(set[an].p)*cc == c)
5930  {
5931  int op = set[an].GetpFDeg()+set[an].ecart;
5932  if ((op > o)
5933  || ((op == o) && (set[an].ecart < p.ecart))
5934  || ((op == o) && (set[an].ecart==p.ecart)
5935  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5936  return an;
5937  }
5938  return en;
5939  }
5940  i=(an+en) / 2;
5941  if (pGetComp(set[i].p)*cc > c)
5942  en=i;
5943  else if (pGetComp(set[i].p)*cc == c)
5944  {
5945  int op = set[i].GetpFDeg()+set[i].ecart;
5946  if ((op > o)
5947  || ((op == o) && (set[i].ecart < p.ecart))
5948  || ((op == o) && (set[i].ecart == p.ecart)
5949  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5950  en=i;
5951  else
5952  an=i;
5953  }
5954  else
5955  an=i;
5956  }

◆ posInT17Ring()

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

Definition at line 5791 of file kutil.cc.

5793 {
5794  if (length==-1) return 0;
5795 
5796  int o = p.GetpFDeg() + p.ecart;
5797  int op = set[length].GetpFDeg()+set[length].ecart;
5798 
5799  if ((op < o)
5800  || (( op == o) && (set[length].ecart > p.ecart))
5801  || (( op == o) && (set[length].ecart==p.ecart)
5802  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5803  return length+1;
5804 
5805  int i;
5806  int an = 0;
5807  int en= length;
5808  loop
5809  {
5810  if (an >= en-1)
5811  {
5812  op = set[an].GetpFDeg()+set[an].ecart;
5813  if (( op > o)
5814  || (( op == o) && (set[an].ecart < p.ecart))
5815  || (( op == o) && (set[an].ecart==p.ecart)
5816  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5817  return an;
5818  return en;
5819  }
5820  i=(an+en) / 2;
5821  op = set[i].GetpFDeg()+set[i].ecart;
5822  if ((op > o)
5823  || (( op == o) && (set[i].ecart < p.ecart))
5824  || (( op == o) && (set[i].ecart == p.ecart)
5825  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5826  en=i;
5827  else
5828  an=i;
5829  }

◆ posInT19()

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

Definition at line 5964 of file kutil.cc.

5966 {
5967  p.GetpLength();
5968  if (length==-1) return 0;
5969 
5970  int o = p.ecart;
5971  int op=p.GetpFDeg();
5972 
5973  if (set[length].ecart < o)
5974  return length+1;
5975  if (set[length].ecart == o)
5976  {
5977  int oo=set[length].GetpFDeg();
5978  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
5979  return length+1;
5980  }
5981 
5982  int i;
5983  int an = 0;
5984  int en= length;
5985  loop
5986  {
5987  if (an >= en-1)
5988  {
5989  if (set[an].ecart > o)
5990  return an;
5991  if (set[an].ecart == o)
5992  {
5993  int oo=set[an].GetpFDeg();
5994  if((oo > op)
5995  || ((oo==op) && (set[an].length > p.length)))
5996  return an;
5997  }
5998  return en;
5999  }
6000  i=(an+en) / 2;
6001  if (set[i].ecart > o)
6002  en=i;
6003  else if (set[i].ecart == o)
6004  {
6005  int oo=set[i].GetpFDeg();
6006  if ((oo > op)
6007  || ((oo == op) && (set[i].length > p.length)))
6008  en=i;
6009  else
6010  an=i;
6011  }
6012  else
6013  an=i;
6014  }

◆ posInT2()

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

Definition at line 5295 of file kutil.cc.

5297 {
5298  p.GetpLength();
5299  if (length==-1)
5300  return 0;
5301  if (set[length].length<p.length)
5302  return length+1;
5303 
5304  int i;
5305  int an = 0;
5306  int en= length;
5307 
5308  loop
5309  {
5310  if (an >= en-1)
5311  {
5312  if (set[an].length>p.length) return an;
5313  return en;
5314  }
5315  i=(an+en) / 2;
5316  if (set[i].length>p.length) en=i;
5317  else an=i;
5318  }

◆ posInT_EcartFDegpLength()

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

Definition at line 11815 of file kutil.cc.

11825 {
11826 
11827  if (length==-1) return 0;
11828 
11829  int o = p.ecart;
11830  int op=p.GetpFDeg();
11831  int ol = p.GetpLength();
11832 
11833  if (set[length].ecart < o)
11834  return length+1;
11835  if (set[length].ecart == o)
11836  {
11837  int oo=set[length].GetpFDeg();
11838  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11839  return length+1;
11840  }
11841 
11842  int i;
11843  int an = 0;
11844  int en= length;
11845  loop
11846  {
11847  if (an >= en-1)
11848  {
11849  if (set[an].ecart > o)
11850  return an;
11851  if (set[an].ecart == o)
11852  {
11853  int oo=set[an].GetpFDeg();
11854  if((oo > op)
11855  || ((oo==op) && (set[an].pLength > ol)))
11856  return an;
11857  }
11858  return en;
11859  }
11860  i=(an+en) / 2;
11861  if (set[i].ecart > o)
11862  en=i;
11863  else if (set[i].ecart == o)
11864  {
11865  int oo=set[i].GetpFDeg();
11866  if ((oo > op)

◆ posInT_EcartpLength()

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

Definition at line 5596 of file kutil.cc.

5598 {
5599  int ol = p.GetpLength();
5600  if (length==-1) return 0;
5601 
5602  int op=p.ecart;
5603 
5604  int oo=set[length].ecart;
5605  if ((oo < op) || ((oo==op) && (set[length].length <= ol)))
5606  return length+1;
5607 
5608  int i;
5609  int an = 0;
5610  int en= length;
5611  loop
5612  {
5613  if (an >= en-1)
5614  {
5615  int oo=set[an].ecart;
5616  if((oo > op)
5617  || ((oo==op) && (set[an].pLength > ol)))
5618  return an;
5619  return en;
5620  }
5621  i=(an+en) / 2;
5622  int oo=set[i].ecart;
5623  if ((oo > op)
5624  || ((oo == op) && (set[i].pLength > ol)))
5625  en=i;
5626  else
5627  an=i;
5628  }

◆ posInT_FDegpLength()

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

Definition at line 11869 of file kutil.cc.

11879 {
11880 
11881  if (length==-1) return 0;
11882 
11883  int op=p.GetpFDeg();
11884  int ol = p.GetpLength();
11885 
11886  int oo=set[length].GetpFDeg();
11887  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11888  return length+1;
11889 
11890  int i;
11891  int an = 0;
11892  int en= length;
11893  loop
11894  {
11895  if (an >= en-1)
11896  {
11897  int oo=set[an].GetpFDeg();
11898  if((oo > op)
11899  || ((oo==op) && (set[an].pLength > ol)))
11900  return an;
11901  return en;
11902  }

◆ posInT_pLength()

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

Definition at line 11906 of file kutil.cc.

11916 {
11917  int ol = p.GetpLength();
11918  if (length==-1)
11919  return 0;
11920  if (set[length].length<p.length)
11921  return length+1;
11922 
11923  int i;
11924  int an = 0;
11925  int en= length;
11926 
11927  loop
11928  {
11929  if (an >= en-1)

◆ posInTrg0()

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

Definition at line 5402 of file kutil.cc.

5404 {
5405  if (length==-1) return 0;
5406  int o = p.GetpFDeg();
5407  int op = set[length].GetpFDeg();
5408  int i;
5409  int an = 0;
5410  int en = length;
5411  int cmp_int = currRing->OrdSgn;
5412  if ((op < o) || (pLmCmp(set[length].p,p.p)== -cmp_int))
5413  return length+1;
5414  int cmp;
5415  loop
5416  {
5417  if (an >= en-1)
5418  {
5419  op = set[an].GetpFDeg();
5420  if (op > o) return an;
5421  if (op < 0) return en;
5422  cmp = pLmCmp(set[an].p,p.p);
5423  if (cmp == cmp_int) return an;
5424  if (cmp == -cmp_int) return en;
5425  if (nGreater(pGetCoeff(p.p), pGetCoeff(set[an].p))) return en;
5426  return an;
5427  }
5428  i = (an + en) / 2;
5429  op = set[i].GetpFDeg();
5430  if (op > o) en = i;
5431  else if (op < o) an = i;
5432  else
5433  {
5434  cmp = pLmCmp(set[i].p,p.p);
5435  if (cmp == cmp_int) en = i;
5436  else if (cmp == -cmp_int) an = i;
5437  else if (nGreater(pGetCoeff(p.p), pGetCoeff(set[i].p))) an = i;
5438  else en = i;
5439  }
5440  }

◆ postReduceByMon()

void postReduceByMon ( LObject h,
kStrategy  strat 
)

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

Definition at line 11152 of file kutil.cc.

11162 {
11163  if(!nCoeff_is_Z(currRing->cf))
11164  return;
11165  poly pH = h->GetP();
11166  poly p,pp;
11167  p = pH;
11168  bool deleted = FALSE, ok = FALSE;
11169  for(int i = 0; i<=strat->sl; i++)
11170  {
11171  p = pH;
11172  if(pNext(strat->S[i]) == NULL)
11173  {
11174  //pWrite(p);
11175  //pWrite(strat->S[i]);
11176  while(ok == FALSE && p != NULL)
11177  {
11178  if(pLmDivisibleBy(strat->S[i], p))
11179  {
11180  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11181  p_SetCoeff(p,dummy,currRing);
11182  }
11183  if(nIsZero(p->coef))
11184  {
11185  pLmDelete(&p);
11186  h->p = p;
11187  deleted = TRUE;
11188  }
11189  else
11190  {
11191  ok = TRUE;
11192  }
11193  }
11194  if (p!=NULL)
11195  {
11196  pp = pNext(p);
11197  while(pp != NULL)
11198  {
11199  if(pLmDivisibleBy(strat->S[i], pp))
11200  {
11201  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11202  p_SetCoeff(pp,dummy,currRing);
11203  if(nIsZero(pp->coef))
11204  {
11205  pLmDelete(&pNext(p));
11206  pp = pNext(p);
11207  deleted = TRUE;
11208  }
11209  else
11210  {
11211  p = pp;
11212  pp = pNext(p);
11213  }
11214  }
11215  else
11216  {
11217  p = pp;
11218  pp = pNext(p);

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11220 of file kutil.cc.

11230 {
11231  if(!nCoeff_is_Z(currRing->cf))
11232  return;
11233  poly hSig = h->sig;
11234  poly pH = h->GetP();
11235  poly p,pp;
11236  p = pH;
11237  bool deleted = FALSE, ok = FALSE;
11238  for(int i = 0; i<=strat->sl; i++)
11239  {
11240  p = pH;
11241  if(pNext(strat->S[i]) == NULL)
11242  {
11243  while(ok == FALSE && p!=NULL)
11244  {
11245  if(pLmDivisibleBy(strat->S[i], p))
11246  {
11247  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11248  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11249  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11250  {
11251  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11252  p_SetCoeff(p,dummy,currRing);
11253  }
11254  pDelete(&sigMult);
11255  }
11256  if(nIsZero(p->coef))
11257  {
11258  pLmDelete(&p);
11259  h->p = p;
11260  deleted = TRUE;
11261  }
11262  else
11263  {
11264  ok = TRUE;
11265  }
11266  }
11267  if(p == NULL)
11268  return;
11269  pp = pNext(p);
11270  while(pp != NULL)
11271  {
11272  if(pLmDivisibleBy(strat->S[i], pp))
11273  {
11274  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11275  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11276  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11277  {
11278  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11279  p_SetCoeff(pp,dummy,currRing);
11280  if(nIsZero(pp->coef))
11281  {
11282  pLmDelete(&pNext(p));
11283  pp = pNext(p);
11284  deleted = TRUE;
11285  }
11286  else
11287  {
11288  p = pp;
11289  pp = pNext(p);
11290  }
11291  }
11292  else
11293  {
11294  p = pp;
11295  pp = pNext(p);
11296  }
11297  pDelete(&sigMult);
11298  }
11299  else
11300  {
11301  p = pp;
11302  pp = pNext(p);

◆ preIntegerCheck()

poly preIntegerCheck ( const ideal  Forig,
const ideal  Q 
)

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

Definition at line 10985 of file kutil.cc.

10995 {
10996  if(!nCoeff_is_Z(currRing->cf))
10997  return NULL;
10998  ideal F = idCopy(Forig);
10999  idSkipZeroes(F);
11000  poly pmon;
11001  ring origR = currRing;
11002  ideal monred = idInit(1,1);
11003  for(int i=0; i<idElem(F); i++)
11004  {
11005  if(pNext(F->m[i]) == NULL)
11006  idInsertPoly(monred, pCopy(F->m[i]));
11007  }
11008  int posconst = idPosConstant(F);
11009  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
11010  {
11011  idDelete(&F);
11012  idDelete(&monred);
11013  return NULL;
11014  }
11015  int idelemQ = 0;
11016  if(Q!=NULL)
11017  {
11018  idelemQ = IDELEMS(Q);
11019  for(int i=0; i<idelemQ; i++)
11020  {
11021  if(pNext(Q->m[i]) == NULL)
11022  idInsertPoly(monred, pCopy(Q->m[i]));
11023  }
11024  idSkipZeroes(monred);
11025  posconst = idPosConstant(monred);
11026  //the constant, if found, will be from Q
11027  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
11028  {
11029  pmon = pCopy(monred->m[posconst]);
11030  idDelete(&F);
11031  idDelete(&monred);
11032  return pmon;
11033  }
11034  }
11035  ring QQ_ring = rCopy0(currRing,FALSE);
11036  nKillChar(QQ_ring->cf);
11037  QQ_ring->cf = nInitChar(n_Q, NULL);
11038  rComplete(QQ_ring,1);
11039  QQ_ring = rAssure_c_dp(QQ_ring);
11040  rChangeCurrRing(QQ_ring);
11041  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
11042  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
11043  for(int i = 0, j = 0; i<IDELEMS(F); i++)
11044  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
11045  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
11046  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
11047  ideal one = kStd(II, NULL, isNotHomog, NULL);
11048  idSkipZeroes(one);
11049  if(idIsConstant(one))
11050  {
11051  //one should be <1>
11052  for(int i = IDELEMS(II)-1; i>=0; i--)
11053  if(II->m[i] != NULL)
11054  II->m[i+1] = II->m[i];
11055  II->m[0] = pOne();
11056  ideal syz = idSyzygies(II, isNotHomog, NULL);
11057  poly integer = NULL;
11058  for(int i = IDELEMS(syz)-1;i>=0; i--)
11059  {
11060  if(pGetComp(syz->m[i]) == 1)
11061  {
11062  pSetComp(syz->m[i],0);
11063  if(pIsConstant(pHead(syz->m[i])))
11064  {
11065  integer = pHead(syz->m[i]);
11066  break;
11067  }
11068  }
11069  }
11070  rChangeCurrRing(origR);
11071  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11072  pmon = prMapR(integer, nMap2, QQ_ring, origR);
11073  idDelete(&monred);
11074  idDelete(&F);
11075  id_Delete(&II,QQ_ring);
11076  id_Delete(&one,QQ_ring);
11077  id_Delete(&syz,QQ_ring);
11078  p_Delete(&integer,QQ_ring);
11079  rDelete(QQ_ring);
11080  return pmon;
11081  }
11082  else
11083  {
11084  if(idIs0(monred))
11085  {
11086  poly mindegmon = NULL;
11087  for(int i = 0; i<IDELEMS(one); i++)
11088  {
11089  if(pNext(one->m[i]) == NULL)
11090  {
11091  if(mindegmon == NULL)
11092  mindegmon = pCopy(one->m[i]);
11093  else
11094  {
11095  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
11096  mindegmon = pCopy(one->m[i]);
11097  }
11098  }
11099  }
11100  if(mindegmon != NULL)
11101  {
11102  for(int i = IDELEMS(II)-1; i>=0; i--)
11103  if(II->m[i] != NULL)
11104  II->m[i+1] = II->m[i];
11105  II->m[0] = pCopy(mindegmon);
11106  ideal syz = idSyzygies(II, isNotHomog, NULL);
11107  bool found = FALSE;
11108  for(int i = IDELEMS(syz)-1;i>=0; i--)
11109  {
11110  if(pGetComp(syz->m[i]) == 1)
11111  {
11112  pSetComp(syz->m[i],0);
11113  if(pIsConstant(pHead(syz->m[i])))
11114  {
11115  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
11116  found = TRUE;
11117  break;
11118  }
11119  }
11120  }
11121  id_Delete(&syz,QQ_ring);
11122  if (found == FALSE)
11123  {
11124  rChangeCurrRing(origR);
11125  idDelete(&monred);
11126  idDelete(&F);
11127  id_Delete(&II,QQ_ring);
11128  id_Delete(&one,QQ_ring);
11129  rDelete(QQ_ring);
11130  return NULL;
11131  }
11132  rChangeCurrRing(origR);
11133  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11134  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11135  idDelete(&monred);
11136  idDelete(&F);
11137  id_Delete(&II,QQ_ring);
11138  id_Delete(&one,QQ_ring);
11139  id_Delete(&syz,QQ_ring);
11140  rDelete(QQ_ring);
11141  return pmon;
11142  }
11143  }

◆ redBba()

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

Definition at line 8961 of file kutil.cc.

8968 {
8969  int j = 0;
8970  unsigned long not_sev = ~ pGetShortExpVector(h);
8971 
8972  while (j <= maxIndex)
8973  {
8974  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
8975  {
8976  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8977  if (h==NULL) return NULL;
8978  j = 0;

◆ redBba1()

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

Definition at line 8856 of file kutil.cc.

8863 {
8864  int j = 0;
8865  unsigned long not_sev = ~ pGetShortExpVector(h);
8866 
8867  while (j <= maxIndex)
8868  {

◆ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 165 of file kstd1.cc.

167 {
168  int i,at,ei,li,ii;
169  int j = 0;
170  int pass = 0;
171  long d,reddeg;
172 
173  d = h->GetpFDeg()+ h->ecart;
174  reddeg = strat->LazyDegree+d;
175  h->SetShortExpVector();
176  loop
177  {
178  j = kFindDivisibleByInT(strat, h);
179  if (j < 0)
180  {
181  if (strat->honey) h->SetLength(strat->length_pLength);
182  return 1;
183  }
184 
185  ei = strat->T[j].ecart;
186  ii = j;
187 
188  if (ei > h->ecart && ii < strat->tl)
189  {
190  li = strat->T[j].length;
191  // the polynomial to reduce with (up to the moment) is;
192  // pi with ecart ei and length li
193  // look for one with smaller ecart
194  i = j;
195  loop
196  {
197  /*- takes the first possible with respect to ecart -*/
198  i++;
199 #if 1
200  if (i > strat->tl) break;
201  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
202  strat->T[i].length < li))
203  &&
204  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing))
205 #else
206  j = kFindDivisibleByInT(strat, h, i);
207  if (j < 0) break;
208  i = j;
209  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
210  strat->T[i].length < li))
211 #endif
212  {
213  // the polynomial to reduce with is now
214  ii = i;
215  ei = strat->T[i].ecart;
216  if (ei <= h->ecart) break;
217  li = strat->T[i].length;
218  }
219  }
220  }
221 
222  // end of search: have to reduce with pi
223  if (ei > h->ecart)
224  {
225  // It is not possible to reduce h with smaller ecart;
226  // if possible h goes to the lazy-set L,i.e
227  // if its position in L would be not the last one
228  strat->fromT = TRUE;
229  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
230  {
231  h->SetLmCurrRing();
232  if (strat->honey && strat->posInLDependsOnLength)
233  h->SetLength(strat->length_pLength);
234  assume(h->FDeg == h->pFDeg());
235  at = strat->posInL(strat->L,strat->Ll,h,strat);
236  if (at <= strat->Ll)
237  {
238  /*- h will not become the next element to reduce -*/
239  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
240 #ifdef KDEBUG
241  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
242 #endif
243  h->Clear();
244  strat->fromT = FALSE;
245  return -1;
246  }
247  }
248  }
249 
250  // now we finally can reduce
251  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
252  strat->fromT=FALSE;
253 
254  // are we done ???
255  if (h->IsNull())
256  {
258  kDeleteLcm(h);
259  h->Clear();
260  return 0;
261  }
262 
263  // NO!
264  h->SetShortExpVector();
265  h->SetpFDeg();
266  if (strat->honey)
267  {
268  if (ei <= h->ecart)
269  h->ecart = d-h->GetpFDeg();
270  else
271  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
272  }
273  else
274  // this has the side effect of setting h->length
275  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
276 #if 0
277  if (strat->syzComp!=0)
278  {
279  if ((strat->syzComp>0) && (h->Comp() > strat->syzComp))
280  {
281  assume(h->MinComp() > strat->syzComp);
282  if (strat->honey) h->SetLength();
283 #ifdef KDEBUG
284  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
285 #endif
286  return -2;
287  }
288  }
289 #endif
290  /*- try to reduce the s-polynomial -*/
291  pass++;
292  d = h->GetpFDeg()+h->ecart;
293  /*
294  *test whether the polynomial should go to the lazyset L
295  *-if the degree jumps
296  *-if the number of pre-defined reductions jumps
297  */
298  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
299  && ((d >= reddeg) || (pass > strat->LazyPass)))
300  {
301  h->SetLmCurrRing();
302  if (strat->honey && strat->posInLDependsOnLength)
303  h->SetLength(strat->length_pLength);
304  assume(h->FDeg == h->pFDeg());
305  at = strat->posInL(strat->L,strat->Ll,h,strat);
306  if (at <= strat->Ll)
307  {
308  int dummy=strat->sl;
309  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
310  {
311  if (strat->honey && !strat->posInLDependsOnLength)
312  h->SetLength(strat->length_pLength);
313  return 1;
314  }
315  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
316 #ifdef KDEBUG
317  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
318 #endif
319  h->Clear();
320  return -1;
321  }
322  }
323  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
324  {
325  Print(".%ld",d);mflush();
326  reddeg = d+1;
327  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
328  {
329  strat->overflow=TRUE;
330  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
331  h->GetP();
332  at = strat->posInL(strat->L,strat->Ll,h,strat);
333  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
334  h->Clear();
335  return -1;
336  }
337  }
338  }

◆ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 527 of file kstd1.cc.

529 {
530  if (h->IsNull()) return 0;
531 
532  int at;
533  long reddeg,d;
534  int pass = 0;
535  int j = 0;
536 
537  if (! strat->homog)
538  {
539  d = h->GetpFDeg() + h->ecart;
540  reddeg = strat->LazyDegree+d;
541  }
542  h->SetShortExpVector();
543  loop
544  {
545  j = kFindDivisibleByInT(strat, h);
546  if (j < 0)
547  {
548  h->SetDegStuffReturnLDeg(strat->LDegLast);
549  return 1;
550  }
551 
553  strat->T[j].pNorm();
554 #ifdef KDEBUG
555  if (TEST_OPT_DEBUG)
556  {
557  PrintS("reduce ");
558  h->wrp();
559  PrintS(" with ");
560  strat->T[j].wrp();
561  }
562 #endif
563  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
564 #ifdef KDEBUG
565  if (TEST_OPT_DEBUG)
566  {
567  PrintS(" to ");
568  wrp(h->p);
569  PrintLn();
570  }
571 #endif
572  if (h->IsNull())
573  {
575  kDeleteLcm(h);
576  h->Clear();
577  return 0;
578  }
579  h->SetShortExpVector();
580 
581 #if 0
582  if ((strat->syzComp!=0) && !strat->honey)
583  {
584  if ((strat->syzComp>0) &&
585  (h->Comp() > strat->syzComp))
586  {
587  assume(h->MinComp() > strat->syzComp);
588 #ifdef KDEBUG
589  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
590 #endif
591  if (strat->homog)
592  h->SetDegStuffReturnLDeg(strat->LDegLast);
593  return -2;
594  }
595  }
596 #endif
597  if (!strat->homog)
598  {
599  if (!TEST_OPT_OLDSTD && strat->honey)
600  {
601  h->SetpFDeg();
602  if (strat->T[j].ecart <= h->ecart)
603  h->ecart = d - h->GetpFDeg();
604  else
605  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
606 
607  d = h->GetpFDeg() + h->ecart;
608  }
609  else
610  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
611  /*- try to reduce the s-polynomial -*/
612  pass++;
613  /*
614  *test whether the polynomial should go to the lazyset L
615  *-if the degree jumps
616  *-if the number of pre-defined reductions jumps
617  */
618  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
619  && ((d >= reddeg) || (pass > strat->LazyPass)))
620  {
621  h->SetLmCurrRing();
622  if (strat->posInLDependsOnLength)
623  h->SetLength(strat->length_pLength);
624  at = strat->posInL(strat->L,strat->Ll,h,strat);
625  if (at <= strat->Ll)
626  {
627  int dummy=strat->sl;
628  if (kFindDivisibleByInS(strat,&dummy, h) < 0)
629  return 1;
630  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
631 #ifdef KDEBUG
632  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
633 #endif
634  h->Clear();
635  return -1;
636  }
637  }
638  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
639  {
640  reddeg = d+1;
641  Print(".%ld",d);mflush();
642  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
643  {
644  strat->overflow=TRUE;
645  //Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
646  h->GetP();
647  at = strat->posInL(strat->L,strat->Ll,h,strat);
648  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
649  h->Clear();
650  return -1;
651  }
652  }
653  }
654  }

◆ redMora()

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

Definition at line 8985 of file kutil.cc.

8992 {
8993  int j=0;
8994  int e,l;
8995  unsigned long not_sev = ~ pGetShortExpVector(h);
8996 
8997  if (maxIndex >= 0)
8998  {
8999  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
9000  do
9001  {
9002  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
9003  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
9004  {
9005 #ifdef KDEBUG
9006  if (TEST_OPT_DEBUG)
9007  {
9008  PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);
9009  }
9010 #endif
9011  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
9012 #ifdef KDEBUG
9013  if(TEST_OPT_DEBUG)
9014  {
9015  PrintS(")\nto "); wrp(h); PrintLn();
9016  }
9017 #endif
9018  // pDelete(&h);
9019  if (h == NULL) return NULL;
9020  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
9021  j = 0;
9022  not_sev = ~ pGetShortExpVector(h);
9023  }

◆ redtail() [1/2]

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

Definition at line 7403 of file kutil.cc.

7406 {
7407  poly h, hn;
7408  strat->redTailChange=FALSE;
7409 
7410  L->GetP();
7411  poly p = L->p;
7412  if (strat->noTailReduction || pNext(p) == NULL)
7413  return p;
7414 
7415  LObject Ln(strat->tailRing);
7416  TObject* With;
7417  // placeholder in case strat->tl < 0
7418  TObject With_s(strat->tailRing);
7419  h = p;
7420  hn = pNext(h);
7421  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7422  long e;
7423  int l;
7424  BOOLEAN save_HE=strat->kHEdgeFound;
7425  strat->kHEdgeFound |=
7426  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7427 
7428  while(hn != NULL)
7429  {
7430  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7431  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7432  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7433  loop
7434  {
7435  Ln.Set(hn, strat->tailRing);
7436  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7437  if (strat->kHEdgeFound)
7438  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7439  else
7440  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s, e);
7441  if (With == NULL) break;
7442  With->length=0;
7443  With->pLength=0;
7444  strat->redTailChange=TRUE;
7445  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7446  {
7447  // reducing the tail would violate the exp bound
7448  if (kStratChangeTailRing(strat, L))
7449  {
7450  strat->kHEdgeFound = save_HE;
7451  return redtail(L, end_pos, strat);
7452  }
7453  else
7454  return NULL;
7455  }
7456  hn = pNext(h);
7457  if (hn == NULL) goto all_done;
7458  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7459  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7460  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7461  }
7462  h = hn;
7463  hn = pNext(h);
7464  }
7465 
7466  all_done:
7467  if (strat->redTailChange)
7468  {
7469  L->pLength = 0;
7470  }
7471  strat->kHEdgeFound = save_HE;

◆ redtail() [2/2]

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

Definition at line 7473 of file kutil.cc.

7476 {
7477  LObject L(p, currRing);

◆ redtailBba()

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

Definition at line 7479 of file kutil.cc.

7482 {
7483 #define REDTAIL_CANONICALIZE 100
7484  strat->redTailChange=FALSE;
7485  if (strat->noTailReduction) return L->GetLmCurrRing();
7486  poly h, p;
7487  p = h = L->GetLmTailRing();
7488  if ((h==NULL) || (pNext(h)==NULL))
7489  return L->GetLmCurrRing();
7490 
7491  TObject* With;
7492  // placeholder in case strat->tl < 0
7493  TObject With_s(strat->tailRing);
7494 
7495  LObject Ln(pNext(h), strat->tailRing);
7496  Ln.GetpLength();
7497 
7498  pNext(h) = NULL;
7499  if (L->p != NULL)
7500  {
7501  pNext(L->p) = NULL;
7502  if (L->t_p != NULL) pNext(L->t_p) = NULL;
7503  }
7504  L->pLength = 1;
7505 
7506  Ln.PrepareRed(strat->use_buckets);
7507 
7508  int cnt=REDTAIL_CANONICALIZE;
7509  while(!Ln.IsNull())
7510  {
7511  loop
7512  {
7513  if (TEST_OPT_IDLIFT)
7514  {
7515  if (Ln.p!=NULL)
7516  {
7517  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7518  }
7519  else
7520  {
7521  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7522  }
7523  }
7524  Ln.SetShortExpVector();
7525  if (withT)
7526  {
7527  int j;
7528  j = kFindDivisibleByInT(strat, &Ln);
7529  if (j < 0) break;
7530  With = &(strat->T[j]);
7531  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7532  }
7533  else
7534  {
7535  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7536  if (With == NULL) break;
7537  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7538  }
7539  cnt--;
7540  if (cnt==0)
7541  {
7543  /*poly tmp=*/Ln.CanonicalizeP();
7544  if (normalize)
7545  {
7546  Ln.Normalize();
7547  //pNormalize(tmp);
7548  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7549  }
7550  }
7551  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7552  {
7553  With->pNorm();
7554  }
7555  strat->redTailChange=TRUE;
7556  if (ksReducePolyTail(L, With, &Ln))
7557  {
7558  // reducing the tail would violate the exp bound
7559  // set a flag and hope for a retry (in bba)
7560  strat->completeReduce_retry=TRUE;
7561  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7562  do
7563  {
7564  pNext(h) = Ln.LmExtractAndIter();
7565  pIter(h);
7566  L->pLength++;
7567  } while (!Ln.IsNull());
7568  goto all_done;
7569  }
7570  if (Ln.IsNull()) goto all_done;
7571  if (! withT) With_s.Init(currRing);
7572  }
7573  pNext(h) = Ln.LmExtractAndIter();
7574  pIter(h);
7575  pNormalize(h);
7576  L->pLength++;
7577  }
7578 
7579  all_done:
7580  Ln.Delete();
7581  if (L->p != NULL) pNext(L->p) = pNext(p);
7582 
7583  if (strat->redTailChange)
7584  {
7585  L->length = 0;
7586  L->pLength = 0;
7587  }
7588 
7589  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7590  //L->Normalize(); // HANNES: should have a test
7591  kTest_L(L,strat->tailRing);

◆ redtailBba_Z()

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

Definition at line 7834 of file kutil.cc.

7838 {
7839  strat->redTailChange=FALSE;
7840  if (strat->noTailReduction) return L->GetLmCurrRing();
7841  poly h, p;
7842  p = h = L->GetLmTailRing();
7843  if ((h==NULL) || (pNext(h)==NULL))
7844  return L->GetLmCurrRing();
7845 
7846  TObject* With;
7847  // placeholder in case strat->tl < 0
7848  TObject With_s(strat->tailRing);
7849 
7850  LObject Ln(pNext(h), strat->tailRing);
7851  Ln.pLength = L->GetpLength() - 1;
7852 
7853  pNext(h) = NULL;
7854  if (L->p != NULL) pNext(L->p) = NULL;
7855  L->pLength = 1;
7856 
7857  Ln.PrepareRed(strat->use_buckets);
7858 
7859  int cnt=REDTAIL_CANONICALIZE;
7860  while(!Ln.IsNull())
7861  {
7862  loop
7863  {
7864  Ln.SetShortExpVector();
7865  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7866  if (With == NULL) break;
7867  cnt--;
7868  if (cnt==0)
7869  {
7871  /*poly tmp=*/Ln.CanonicalizeP();
7872  }
7873  // we are in Z, do not call pNorm
7874  strat->redTailChange=TRUE;
7875  // test divisibility of coefs:
7876  poly p_Ln=Ln.GetLmCurrRing();
7877  poly p_With=With->GetLmCurrRing();
7878  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7879  if (!nIsZero(z))
7880  {
7881  // subtract z*Ln, add z.Ln to L
7882  poly m=pHead(p_Ln);
7883  pSetCoeff(m,z);
7884  poly mm=pHead(m);
7885  pNext(h) = m;
7886  pIter(h);
7887  L->pLength++;
7888  mm=pNeg(mm);
7889  if (Ln.bucket!=NULL)
7890  {
7891  int dummy=1;
7892  kBucket_Add_q(Ln.bucket,mm,&dummy);
7893  }
7894  else
7895  {
7896  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7897  Ln.GetP();
7898  if (Ln.p!=NULL)
7899  {
7900  Ln.p=pAdd(Ln.p,mm);
7901  if (Ln.t_p!=NULL)
7902  {
7903  pNext(Ln.t_p)=NULL;
7904  p_LmDelete(Ln.t_p,strat->tailRing);
7905  }
7906  }
7907  }
7908  }
7909  else
7910  nDelete(&z);
7911 
7912  if (ksReducePolyTail(L, With, &Ln))
7913  {
7914  // reducing the tail would violate the exp bound
7915  // set a flag and hope for a retry (in bba)
7916  strat->completeReduce_retry=TRUE;
7917  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7918  do
7919  {
7920  pNext(h) = Ln.LmExtractAndIter();
7921  pIter(h);
7922  L->pLength++;
7923  } while (!Ln.IsNull());
7924  goto all_done;
7925  }
7926  if (Ln.IsNull()) goto all_done;
7927  With_s.Init(currRing);
7928  }
7929  pNext(h) = Ln.LmExtractAndIter();
7930  pIter(h);
7931  pNormalize(h);
7932  L->pLength++;
7933  }
7934 
7935  all_done:
7936  Ln.Delete();
7937  if (L->p != NULL) pNext(L->p) = pNext(p);
7938 
7939  if (strat->redTailChange)
7940  {
7941  L->length = 0;
7942  }
7943 
7944  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7945  //L->Normalize(); // HANNES: should have a test
7946  kTest_L(L,strat->tailRing);

◆ redtailBbaAlsoLC_Z()

void redtailBbaAlsoLC_Z ( LObject L,
int  end_pos,
kStrategy  strat 
)

Definition at line 7709 of file kutil.cc.

7713 {
7714  strat->redTailChange=FALSE;
7715 
7716  poly h, p;
7717  p = h = L->GetLmTailRing();
7718  if ((h==NULL) || (pNext(h)==NULL))
7719  return;
7720 
7721  TObject* With;
7722  LObject Ln(pNext(h), strat->tailRing);
7723  Ln.GetpLength();
7724 
7725  pNext(h) = NULL;
7726  if (L->p != NULL)
7727  {
7728  pNext(L->p) = NULL;
7729  if (L->t_p != NULL) pNext(L->t_p) = NULL;
7730  }
7731  L->pLength = 1;
7732 
7733  Ln.PrepareRed(strat->use_buckets);
7734 
7735  int cnt=REDTAIL_CANONICALIZE;
7736 
7737  while(!Ln.IsNull())
7738  {
7739  loop
7740  {
7741  if (TEST_OPT_IDLIFT)
7742  {
7743  if (Ln.p!=NULL)
7744  {
7745  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7746  }
7747  else
7748  {
7749  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7750  }
7751  }
7752  Ln.SetShortExpVector();
7753  int j;
7754  j = kFindDivisibleByInT(strat, &Ln);
7755  if (j < 0) {
7756  j = kFindDivisibleByInT_Z(strat, &Ln);
7757  if (j < 0) {
7758  break;
7759  } else {
7760  /* reduction not cancelling a tail term, but reducing its coefficient */
7761  With = &(strat->T[j]);
7762  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7763  cnt--;
7764  if (cnt==0)
7765  {
7767  /*poly tmp=*/Ln.CanonicalizeP();
7768  }
7769  strat->redTailChange=TRUE;
7770  /* reduction cancelling a tail term */
7771  if (ksReducePolyTailLC_Z(L, With, &Ln))
7772  {
7773  // reducing the tail would violate the exp bound
7774  // set a flag and hope for a retry (in bba)
7775  strat->completeReduce_retry=TRUE;
7776  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7777  do
7778  {
7779  pNext(h) = Ln.LmExtractAndIter();
7780  pIter(h);
7781  L->pLength++;
7782  } while (!Ln.IsNull());
7783  goto all_done;
7784  }
7785  /* we have to break since we did not cancel the term, but only decreased
7786  * its coefficient. */
7787  break;
7788  }
7789  } else {
7790  With = &(strat->T[j]);
7791  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7792  cnt--;
7793  if (cnt==0)
7794  {
7796  /*poly tmp=*/Ln.CanonicalizeP();
7797  }
7798  strat->redTailChange=TRUE;
7799  /* reduction cancelling a tail term */
7800  if (ksReducePolyTail_Z(L, With, &Ln))
7801  {
7802  // reducing the tail would violate the exp bound
7803  // set a flag and hope for a retry (in bba)
7804  strat->completeReduce_retry=TRUE;
7805  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7806  do
7807  {
7808  pNext(h) = Ln.LmExtractAndIter();
7809  pIter(h);
7810  L->pLength++;
7811  } while (!Ln.IsNull());
7812  goto all_done;
7813  }
7814  }
7815  if (Ln.IsNull()) goto all_done;
7816  }
7817  pNext(h) = Ln.LmExtractAndIter();
7818  pIter(h);
7819  L->pLength++;
7820  }
7821 
7822  all_done:
7823  Ln.Delete();
7824  if (L->p != NULL) pNext(L->p) = pNext(p);
7825 
7826  if (strat->redTailChange)
7827  {
7828  L->length = 0;
7829  L->pLength = 0;
7830  }
7831 
7832  kTest_L(L, strat->tailRing);

◆ redtailBbaBound()

poly redtailBbaBound ( LObject L,
int  end_pos,
kStrategy  strat,
int  bound,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 7593 of file kutil.cc.

7596 {
7597  strat->redTailChange=FALSE;
7598  if (strat->noTailReduction) return L->GetLmCurrRing();
7599  poly h, p;
7600  p = h = L->GetLmTailRing();
7601  if ((h==NULL) || (pNext(h)==NULL))
7602  return L->GetLmCurrRing();
7603 
7604  TObject* With;
7605  // placeholder in case strat->tl < 0
7606  TObject With_s(strat->tailRing);
7607 
7608  LObject Ln(pNext(h), strat->tailRing);
7609  Ln.pLength = L->GetpLength() - 1;
7610 
7611  pNext(h) = NULL;
7612  if (L->p != NULL) pNext(L->p) = NULL;
7613  L->pLength = 1;
7614 
7615  Ln.PrepareRed(strat->use_buckets);
7616 
7617  int cnt=REDTAIL_CANONICALIZE;
7618  while(!Ln.IsNull())
7619  {
7620  loop
7621  {
7622  if (TEST_OPT_IDLIFT)
7623  {
7624  if (Ln.p!=NULL)
7625  {
7626  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7627  }
7628  else
7629  {
7630  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7631  }
7632  }
7633  Ln.SetShortExpVector();
7634  if (withT)
7635  {
7636  int j;
7637  j = kFindDivisibleByInT(strat, &Ln);
7638  if (j < 0) break;
7639  With = &(strat->T[j]);
7640  }
7641  else
7642  {
7643  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7644  if (With == NULL) break;
7645  }
7646  cnt--;
7647  if (cnt==0)
7648  {
7650  /*poly tmp=*/Ln.CanonicalizeP();
7651  if (normalize)
7652  {
7653  Ln.Normalize();
7654  //pNormalize(tmp);
7655  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7656  }
7657  }
7658  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7659  {
7660  With->pNorm();
7661  }
7662  strat->redTailChange=TRUE;
7663  if (ksReducePolyTail(L, With, &Ln))
7664  {
7665  // reducing the tail would violate the exp bound
7666  // set a flag and hope for a retry (in bba)
7667  strat->completeReduce_retry=TRUE;
7668  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7669  do
7670  {
7671  pNext(h) = Ln.LmExtractAndIter();
7672  pIter(h);
7673  L->pLength++;
7674  } while (!Ln.IsNull());
7675  goto all_done;
7676  }
7677  if(!Ln.IsNull())
7678  {
7679  Ln.GetP();
7680  Ln.p = pJet(Ln.p,bound);
7681  }
7682  if (Ln.IsNull())
7683  {
7684  goto all_done;
7685  }
7686  if (! withT) With_s.Init(currRing);
7687  }
7688  pNext(h) = Ln.LmExtractAndIter();
7689  pIter(h);
7690  pNormalize(h);
7691  L->pLength++;
7692  }
7693 
7694  all_done:
7695  Ln.Delete();
7696  if (L->p != NULL) pNext(L->p) = pNext(p);
7697 
7698  if (strat->redTailChange)
7699  {
7700  L->length = 0;
7701  L->pLength = 0;
7702  }
7703 
7704  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7705  //L->Normalize(); // HANNES: should have a test
7706  kTest_L(L,strat->tailRing);

◆ redtailBbaShift()

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

Definition at line 12821 of file kutil.cc.

12831 {
12832  /* for the shift case need to run it with withT = TRUE */
12833  strat->redTailChange=FALSE;
12834  if (strat->noTailReduction) return L->GetLmCurrRing();
12835  poly h, p;
12836  p = h = L->GetLmTailRing();
12837  if ((h==NULL) || (pNext(h)==NULL))
12838  return L->GetLmCurrRing();
12839 
12840  TObject* With;
12841  // placeholder in case strat->tl < 0
12842  TObject With_s(strat->tailRing);
12843 
12844  LObject Ln(pNext(h), strat->tailRing);
12845  Ln.pLength = L->GetpLength() - 1;
12846 
12847  pNext(h) = NULL;
12848  if (L->p != NULL) pNext(L->p) = NULL;
12849  L->pLength = 1;
12850 
12851  Ln.PrepareRed(strat->use_buckets);
12852 
12853  while(!Ln.IsNull())
12854  {
12855  loop
12856  {
12857  Ln.SetShortExpVector();
12858  if (withT)
12859  {
12860  int j;
12861  j = kFindDivisibleByInT(strat, &Ln);
12862  if (j < 0) break;
12863  With = &(strat->T[j]);
12864  }
12865  else
12866  {
12867  With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
12868  if (With == NULL) break;
12869  }
12870  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12871  {
12872  With->pNorm();
12873  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12874  }
12875  strat->redTailChange=TRUE;
12876  if (ksReducePolyTail(L, With, &Ln))
12877  {
12878  // reducing the tail would violate the exp bound
12879  // set a flag and hope for a retry (in bba)
12880  strat->completeReduce_retry=TRUE;
12881  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12882  do
12883  {
12884  pNext(h) = Ln.LmExtractAndIter();
12885  pIter(h);
12886  L->pLength++;
12887  } while (!Ln.IsNull());
12888  goto all_done;
12889  }
12890  if (Ln.IsNull()) goto all_done;
12891  if (! withT) With_s.Init(currRing);
12892  }
12893  pNext(h) = Ln.LmExtractAndIter();
12894  pIter(h);
12895  L->pLength++;
12896  }
12897 
12898  all_done:
12899  Ln.Delete();
12900  if (L->p != NULL) pNext(L->p) = pNext(p);

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 4981 of file kutil.cc.

4983 {
4984  int i,j,at,ecart, s2r;
4985  int fq=0;
4986  unsigned long sev;
4987  poly p;
4988  int new_suc=strat->sl+1;
4989  i= *suc;
4990  if (i<0) i=0;
4991 
4992  for (; i<=strat->sl; i++)
4993  {
4994  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4995  if (at != i)
4996  {
4997  if (new_suc > at) new_suc = at;
4998  p = strat->S[i];
4999  ecart = strat->ecartS[i];
5000  sev = strat->sevS[i];
5001  s2r = strat->S_2_R[i];
5002  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5003  for (j=i; j>=at+1; j--)
5004  {
5005  strat->S[j] = strat->S[j-1];
5006  strat->ecartS[j] = strat->ecartS[j-1];
5007  strat->sevS[j] = strat->sevS[j-1];
5008  strat->S_2_R[j] = strat->S_2_R[j-1];
5009  }
5010  strat->S[at] = p;
5011  strat->ecartS[at] = ecart;
5012  strat->sevS[at] = sev;
5013  strat->S_2_R[at] = s2r;
5014  if (strat->fromQ!=NULL)
5015  {
5016  for (j=i; j>=at+1; j--)
5017  {
5018  strat->fromQ[j] = strat->fromQ[j-1];
5019  }
5020  strat->fromQ[at]=fq;
5021  }
5022  }
5023  }
5024  if (new_suc <= strat->sl) *suc=new_suc;
5025  else *suc=-1;

◆ replaceInLAndSAndT()

void replaceInLAndSAndT ( LObject p,
int  tj,
kStrategy  strat 
)

Definition at line 9519 of file kutil.cc.

9526 {
9527  p.GetP(strat->lmBin);
9528  if (strat->homog) strat->initEcart(&p);
9529  strat->redTailChange=FALSE;
9531  p.pCleardenom();
9532  if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) {
9533  p.p = redtailBba(&p,strat->sl,strat, FALSE,!TEST_OPT_CONTENTSB);
9534  p.pCleardenom();
9535  if (strat->redTailChange)
9536  p.t_p=NULL;
9537  }
9538  }
9539 
9540  assume(strat->tailRing == p.tailRing);
9541  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9542 
9543  int i, j, pos;
9544  poly tp = strat->T[tj].p;
9545 
9546  /* enter p to T set */
9547  enterT(p, strat);
9548 
9549  for (j = 0; j <= strat->sl; ++j) {
9550  if (pLtCmp(tp, strat->S[j]) == 0) {
9551  break;
9552  }
9553  }
9554  /* it may be that the exchanged element
9555  * is until now only in T and not in S */
9556  if (j <= strat->sl) {
9557  deleteInS(j, strat);
9558  }
9559 
9560  pos = posInS(strat, strat->sl, p.p, p.ecart);
9561 
9562  pp_Test(p.p, currRing, p.tailRing);
9563  assume(p.FDeg == p.pFDeg());
9564 
9565  /* remove useless pairs from L set */
9566  for (i = 0; i <= strat->Ll; ++i) {
9567  if (strat->L[i].p1 != NULL && pLtCmp(tp, strat->L[i].p1) == 0) {
9568  deleteInL(strat->L, &(strat->Ll), i, strat);
9569  i--;
9570  continue;
9571  }
9572  if (strat->L[i].p2 != NULL && pLtCmp(tp, strat->L[i].p2) == 0) {
9573  deleteInL(strat->L, &(strat->Ll), i, strat);
9574  i--;
9575  }

◆ sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair ( LObject h,
kStrategy  strat 
)

Definition at line 1675 of file kutil.cc.

1677 {
1678  if(strat->sl < 0) return FALSE;
1679  int i;
1680  for(i=0;i<strat->sl;i++)
1681  {
1682  //Construct the gcd pair between h and S[i]
1683  number d, s, t;
1684  poly m1, m2, gcd;
1685  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1686  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1687  {
1688  nDelete(&d);
1689  nDelete(&s);
1690  nDelete(&t);
1691  }
1692  else
1693  {
1694  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1695  pSetCoeff0(m1, s);
1696  pSetCoeff0(m2, t);
1697  pSetCoeff0(gcd, d);
1698  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(h->p), m1, strat->tailRing), pp_Mult_mm(pNext(strat->S[i]), m2, strat->tailRing), strat->tailRing);
1699  poly pSigMult = p_Copy(h->sig,currRing);
1700  poly sSigMult = p_Copy(strat->sig[i],currRing);
1701  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1702  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1703  p_LmDelete(m1, strat->tailRing);
1704  p_LmDelete(m2, strat->tailRing);
1705  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1706  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1707  {
1708  pDelete(&h->p);
1709  h->p = gcd;
1710  pDelete(&h->sig);
1711  h->sig = pairsig;
1712  pNext(h->sig) = NULL;
1713  strat->initEcart(h);
1714  h->sev = pGetShortExpVector(h->p);
1715  h->sevSig = pGetShortExpVector(h->sig);
1716  h->i_r1 = -1;h->i_r2 = -1;
1717  if(h->lcm != NULL)
1718  {
1719  pLmDelete(h->lcm);
1720  h->lcm = NULL;
1721  }
1722  if (currRing!=strat->tailRing)
1723  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1724  return TRUE;
1725  }
1726  //Delete what you didn't use
1727  pDelete(&gcd);
1728  pDelete(&pairsig);
1729  }
1730  }
1731  return FALSE;

◆ sbaRing()

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

Definition at line 11520 of file kutil.cc.

11520  {
11521  l *= 2;
11522  }
11523  e = p_GetMaxExp(l, currRing);
11524  if (e <= 1) e = 2;
11525 
11526  kStratChangeTailRing(strat, NULL, NULL, e);
11527 }
11528 
11529 ring sbaRing (kStrategy strat, const ring r, BOOLEAN /*complete*/, int /*sgn*/)
11530 {
11531  int n = rBlocks(r); // Including trailing zero!
11532  // if sbaOrder == 1 => use (C,monomial order from r)
11533  if (strat->sbaOrder == 1)
11534  {
11535  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11536  {
11537  return r;
11538  }
11539  ring res = rCopy0(r, TRUE, FALSE);
11540  res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
11541  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11542  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11543  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11544  res->wvhdl = wvhdl;
11545  for (int i=1; i<n; i++)
11546  {
11547  res->order[i] = r->order[i-1];
11548  res->block0[i] = r->block0[i-1];
11549  res->block1[i] = r->block1[i-1];
11550  res->wvhdl[i] = r->wvhdl[i-1];
11551  }
11552 
11553  // new 1st block
11554  res->order[0] = ringorder_C; // Prefix
11555  // removes useless secondary component order if defined in old ring
11556  for (int i=rBlocks(res); i>0; --i)
11557  {
11558  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11559  {
11560  res->order[i] = (rRingOrder_t)0;
11561  }
11562  }
11563  rComplete(res, 1);
11564 #ifdef HAVE_PLURAL
11565  if (rIsPluralRing(r))
11566  {
11567  if ( nc_rComplete(r, res, false) ) // no qideal!
11568  {
11569 #ifndef SING_NDEBUG
11570  WarnS("error in nc_rComplete");
11571 #endif
11572  // cleanup?
11573 
11574  // rDelete(res);
11575  // return r;
11576 
11577  // just go on..
11578  }
11579  }
11580 #endif
11581  strat->tailRing = res;
11582  return (res);
11583  }
11584  // if sbaOrder == 3 => degree - position - ring order
11585  if (strat->sbaOrder == 3)
11586  {
11587  ring res = rCopy0(r, TRUE, FALSE);
11588  res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
11589  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11590  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11591  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11592  res->wvhdl = wvhdl;
11593  for (int i=2; i<n+2; i++)
11594  {
11595  res->order[i] = r->order[i-2];
11596  res->block0[i] = r->block0[i-2];
11597  res->block1[i] = r->block1[i-2];
11598  res->wvhdl[i] = r->wvhdl[i-2];
11599  }
11600 
11601  // new 1st block
11602  res->order[0] = ringorder_a; // Prefix
11603  res->block0[0] = 1;
11604  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11605  for (int i=0; i<res->N; ++i)
11606  res->wvhdl[0][i] = 1;
11607  res->block1[0] = si_min(res->N, rVar(res));
11608  // new 2nd block
11609  res->order[1] = ringorder_C; // Prefix
11610  res->wvhdl[1] = NULL;
11611  // removes useless secondary component order if defined in old ring
11612  for (int i=rBlocks(res); i>1; --i)
11613  {
11614  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11615  {
11616  res->order[i] = (rRingOrder_t)0;
11617  }
11618  }
11619  rComplete(res, 1);
11620 #ifdef HAVE_PLURAL
11621  if (rIsPluralRing(r))
11622  {
11623  if ( nc_rComplete(r, res, false) ) // no qideal!
11624  {
11625 #ifndef SING_NDEBUG
11626  WarnS("error in nc_rComplete");
11627 #endif
11628  // cleanup?
11629 
11630  // rDelete(res);
11631  // return r;
11632 
11633  // just go on..
11634  }
11635  }
11636 #endif
11637  strat->tailRing = res;
11638  return (res);
11639  }
11640 
11641  // not sbaOrder == 1 => use Schreyer order
11642  // this is done by a trick when initializing the signatures
11643  // in initSLSba():
11644  // Instead of using the signature 1e_i for F->m[i], we start
11645  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11646  // Schreyer order w.r.t. the underlying monomial order.
11647  // => we do not need to change the underlying polynomial ring at all!
11648 
11649  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11650 
11651  /*
11652  else
11653  {
11654  ring res = rCopy0(r, FALSE, FALSE);
11655  // Create 2 more blocks for prefix/suffix:
11656  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11657  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11658  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11659  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11660 
11661  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11662  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11663 
11664  // new 1st block
11665  int j = 0;
11666  res->order[j] = ringorder_IS; // Prefix
11667  res->block0[j] = res->block1[j] = 0;
11668  // wvhdl[j] = NULL;
11669  j++;
11670 
11671  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11672  {
11673  res->order [j] = r->order [i];
11674  res->block0[j] = r->block0[i];
11675  res->block1[j] = r->block1[i];
11676 
11677  if (r->wvhdl[i] != NULL)
11678  {
11679  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11680  } // else wvhdl[j] = NULL;
11681  }
11682 
11683  // new last block
11684  res->order [j] = ringorder_IS; // Suffix
11685  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11686  // wvhdl[j] = NULL;
11687  j++;
11688 
11689  // res->order [j] = 0; // The End!
11690  res->wvhdl = wvhdl;
11691 
11692  // j == the last zero block now!
11693  assume(j == (n+1));
11694  assume(res->order[0]==ringorder_IS);
11695  assume(res->order[j-1]==ringorder_IS);
11696  assume(res->order[j]==0);
11697 
11698  if (complete)
11699  {
11700  rComplete(res, 1);
11701 
11702 #ifdef HAVE_PLURAL
11703  if (rIsPluralRing(r))
11704  {
11705  if ( nc_rComplete(r, res, false) ) // no qideal!
11706  {
11707  }
11708  }
11709  assume(rIsPluralRing(r) == rIsPluralRing(res));
11710 #endif
11711 
11712 
11713 #ifdef HAVE_PLURAL
11714  ring old_ring = r;
11715 
11716 #endif
11717 
11718  if (r->qideal!=NULL)
11719  {
11720  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11721 
11722  assume(idRankFreeModule(res->qideal, res) == 0);
11723 
11724 #ifdef HAVE_PLURAL
11725  if( rIsPluralRing(res) )
11726  if( nc_SetupQuotient(res, r, true) )
11727  {
11728  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11729  }
11730 
11731 #endif
11732  assume(idRankFreeModule(res->qideal, res) == 0);
11733  }
11734 
11735 #ifdef HAVE_PLURAL
11736  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11737  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11738  assume(rIsSCA(res) == rIsSCA(old_ring));
11739  assume(ncRingType(res) == ncRingType(old_ring));
11740 #endif

◆ showOption()

char* showOption ( )

Definition at line 723 of file misc_ip.cc.

724 {
725  int i;
726  BITSET tmp;
727 
728  StringSetS("//options:");
729  if ((si_opt_1!=0)||(si_opt_2!=0))
730  {
731  tmp=si_opt_1;
732  if(tmp)
733  {
734  for (i=0; optionStruct[i].setval!=0; i++)
735  {
736  if (optionStruct[i].setval & tmp)
737  {
739  tmp &=optionStruct[i].resetval;
740  }
741  }
742  for (i=0; i<32; i++)
743  {
744  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
745  }
746  }
747  tmp=si_opt_2;
748  if (tmp)
749  {
750  for (i=0; verboseStruct[i].setval!=0; i++)
751  {
752  if (verboseStruct[i].setval & tmp)
753  {
755  tmp &=verboseStruct[i].resetval;
756  }
757  }
758  for (i=1; i<32; i++)
759  {
760  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
761  }
762  }
763  return StringEndS();
764  }
765  StringAppendS(" none");
766  return StringEndS();
767 }

◆ sugarDivisibleBy()

static BOOLEAN sugarDivisibleBy ( int  ecart1,
int  ecart2 
)
inlinestatic

Definition at line 1316 of file kutil.cc.

1318 {
1319  return (ecart1 <= ecart2);

◆ superenterpairs()

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

Definition at line 4830 of file kutil.cc.

4832 {
4834  // enter also zero divisor * poly, if this is non zero and of smaller degree
4835  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4836  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4837  initenterpairs(h, k, ecart, 0, strat, atR);
4838  clearSbatch(h, k, pos, strat);

◆ superenterpairsSig()

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

Definition at line 4840 of file kutil.cc.

4842 {
4844  // enter also zero divisor * poly, if this is non zero and of smaller degree
4845  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4846  if(strat->sigdrop) return;
4847  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4848  if(strat->sigdrop) return;
4849  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4850  if(strat->sigdrop) return;
4851  clearSbatch(h, k, pos, strat);

◆ syzCriterion()

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

Definition at line 7044 of file kutil.cc.

7046 {
7047 //#if 1
7048 #ifdef DEBUGF5
7049  PrintS("syzygy criterion checks: ");
7050  pWrite(sig);
7051 #endif
7052  for (int k=0; k<strat->syzl; k++)
7053  {
7054  //printf("-%d",k);
7055 //#if 1
7056 #ifdef DEBUGF5
7057  Print("checking with: %d / %d -- \n",k,strat->syzl);
7058  pWrite(pHead(strat->syz[k]));
7059 #endif
7060  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7061  && (!rField_is_Ring(currRing) ||
7062  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7063  {
7064 //#if 1
7065 #ifdef DEBUGF5
7066  PrintS("DELETE!\n");
7067 #endif
7068  strat->nrsyzcrit++;
7069  //printf("- T -\n\n");
7070  return TRUE;
7071  }
7072  }
7073  //printf("- F -\n\n");
7074  return FALSE;

◆ syzCriterionInc()

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

Definition at line 7079 of file kutil.cc.

7081 {
7082 //#if 1
7083  if(sig == NULL)
7084  return FALSE;
7085 #ifdef DEBUGF5
7086  PrintS("--- syzygy criterion checks: ");
7087  pWrite(sig);
7088 #endif
7089  int comp = __p_GetComp(sig, currRing);
7090  int min, max;
7091  if (comp<=1)
7092  return FALSE;
7093  else
7094  {
7095  min = strat->syzIdx[comp-2];
7096  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7097  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7098  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7099  if (comp == strat->currIdx)
7100  {
7101  max = strat->syzl;
7102  }
7103  else
7104  {
7105  max = strat->syzIdx[comp-1];
7106  }
7107  for (int k=min; k<max; k++)
7108  {
7109 #ifdef F5DEBUG
7110  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7111  Print("checking with: %d -- ",k);
7112  pWrite(pHead(strat->syz[k]));
7113 #endif
7114  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7115  && (!rField_is_Ring(currRing) ||
7116  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7117  {
7118  strat->nrsyzcrit++;
7119  return TRUE;
7120  }
7121  }
7122  return FALSE;
7123  }

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4137 of file kutil.cc.

4139 {
4140  return 1L << arg;

◆ updateResult()

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

Definition at line 10526 of file kutil.cc.

10534 {
10535  int l;
10536  if (strat->ak>0)
10537  {
10538  for (l=IDELEMS(r)-1;l>=0;l--)
10539  {
10540  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10541  {
10542  pDelete(&r->m[l]); // and set it to NULL
10543  }
10544  }
10545  int q;
10546  poly p;
10547  if(!rField_is_Ring(currRing))
10548  {
10549  for (l=IDELEMS(r)-1;l>=0;l--)
10550  {
10551  if ((r->m[l]!=NULL)
10552  //&& (strat->syzComp>0)
10553  //&& (pGetComp(r->m[l])<=strat->syzComp)
10554  )
10555  {
10556  for(q=IDELEMS(Q)-1; q>=0;q--)
10557  {
10558  if ((Q->m[q]!=NULL)
10559  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10560  {
10561  if (TEST_OPT_REDSB)
10562  {
10563  p=r->m[l];
10564  r->m[l]=kNF(Q,NULL,p);
10565  pDelete(&p);
10566  }
10567  else
10568  {
10569  pDelete(&r->m[l]); // and set it to NULL
10570  }
10571  break;
10572  }
10573  }
10574  }
10575  }
10576  }
10577  #ifdef HAVE_RINGS
10578  else
10579  {
10580  for (l=IDELEMS(r)-1;l>=0;l--)
10581  {
10582  if ((r->m[l]!=NULL)
10583  //&& (strat->syzComp>0)
10584  //&& (pGetComp(r->m[l])<=strat->syzComp)
10585  )
10586  {
10587  for(q=IDELEMS(Q)-1; q>=0;q--)
10588  {
10589  if ((Q->m[q]!=NULL)
10590  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10591  {
10592  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10593  {
10594  if (TEST_OPT_REDSB)
10595  {
10596  p=r->m[l];
10597  r->m[l]=kNF(Q,NULL,p);
10598  pDelete(&p);
10599  }
10600  else
10601  {
10602  pDelete(&r->m[l]); // and set it to NULL
10603  }
10604  break;
10605  }
10606  }
10607  }
10608  }
10609  }
10610  }
10611  #endif
10612  }
10613  else
10614  {
10615  int q;
10616  poly p;
10617  BOOLEAN reduction_found=FALSE;
10618  if (!rField_is_Ring(currRing))
10619  {
10620  for (l=IDELEMS(r)-1;l>=0;l--)
10621  {
10622  if (r->m[l]!=NULL)
10623  {
10624  for(q=IDELEMS(Q)-1; q>=0;q--)
10625  {
10626  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10627  {
10628  if (TEST_OPT_REDSB)
10629  {
10630  p=r->m[l];
10631  r->m[l]=kNF(Q,NULL,p);
10632  pDelete(&p);
10633  reduction_found=TRUE;
10634  }
10635  else
10636  {
10637  pDelete(&r->m[l]); // and set it to NULL
10638  }
10639  break;
10640  }
10641  }
10642  }
10643  }
10644  }
10645  #ifdef HAVE_RINGS
10646  //Also need divisibility of the leading coefficients
10647  else
10648  {
10649  for (l=IDELEMS(r)-1;l>=0;l--)
10650  {
10651  if (r->m[l]!=NULL)
10652  {
10653  for(q=IDELEMS(Q)-1; q>=0;q--)
10654  {
10655  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10656  {
10657  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10658  {
10659  if (TEST_OPT_REDSB)
10660  {
10661  p=r->m[l];
10662  r->m[l]=kNF(Q,NULL,p);
10663  pDelete(&p);
10664  reduction_found=TRUE;
10665  }
10666  else
10667  {
10668  pDelete(&r->m[l]); // and set it to NULL
10669  }
10670  break;
10671  }
10672  }
10673  }
10674  }
10675  }
10676  }
10677  #endif
10678  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10679  {
10680  #ifdef HAVE_RINGS
10682  {
10683  for (l=IDELEMS(r)-1;l>=0;l--)
10684  {
10685  if (r->m[l]!=NULL)
10686  {
10687  for(q=IDELEMS(r)-1;q>=0;q--)
10688  {
10689  if ((l!=q)
10690  && (r->m[q]!=NULL)
10691  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10692  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10693  )
10694  {
10695  //If they are equal then take the one with the smallest length
10696  if(pLmDivisibleBy(r->m[q],r->m[l])
10697  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10698  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10699  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10700  {
10701  pDelete(&r->m[l]);
10702  break;
10703  }
10704  else
10705  pDelete(&r->m[q]);
10706  }
10707  }
10708  }
10709  }
10710  }
10711  else
10712  #endif
10713  {
10714  for (l=IDELEMS(r)-1;l>=0;l--)
10715  {
10716  if (r->m[l]!=NULL)
10717  {
10718  for(q=IDELEMS(r)-1;q>=0;q--)
10719  {
10720  if ((l!=q)
10721  && (r->m[q]!=NULL)
10722  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10723  )
10724  {
10725  //If they are equal then take the one with the smallest length
10726  if(pLmDivisibleBy(r->m[q],r->m[l])
10727  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10728  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10729  {
10730  pDelete(&r->m[l]);
10731  break;
10732  }
10733  else
10734  pDelete(&r->m[q]);
10735  }
10736  }

◆ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9030 of file kutil.cc.

9037 {
9038  LObject h;
9039  int i, suc=0;
9040  poly redSi=NULL;
9041  BOOLEAN change,any_change;
9042 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9043 // for (i=0; i<=(strat->sl); i++)
9044 // {
9045 // Print("s%d:",i);
9046 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9047 // pWrite(strat->S[i]);
9048 // }
9049 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9050  any_change=FALSE;
9052  {
9053  while (suc != -1)
9054  {
9055  i=suc+1;
9056  while (i<=strat->sl)
9057  {
9058  change=FALSE;
9060  any_change = FALSE;
9061  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9062  {
9063  redSi = pHead(strat->S[i]);
9064  strat->S[i] = redBba(strat->S[i],i-1,strat);
9065  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9066  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9067  if (pCmp(redSi,strat->S[i])!=0)
9068  {
9069  change=TRUE;
9070  any_change=TRUE;
9071  #ifdef KDEBUG
9072  if (TEST_OPT_DEBUG)
9073  {
9074  PrintS("reduce:");
9075  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9076  }
9077  #endif
9078  if (TEST_OPT_PROT)
9079  {
9080  if (strat->S[i]==NULL)
9081  PrintS("V");
9082  else
9083  PrintS("v");
9084  mflush();
9085  }
9086  }
9087  pLmDelete(&redSi);
9088  if (strat->S[i]==NULL)
9089  {
9090  deleteInS(i,strat);
9091  i--;
9092  }
9093  else if (change)
9094  {
9096  {
9097  if (TEST_OPT_CONTENTSB)
9098  {
9099  number n;
9100  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
9101  if (!nIsOne(n))
9102  {
9104  denom->n=nInvers(n);
9105  denom->next=DENOMINATOR_LIST;
9106  DENOMINATOR_LIST=denom;
9107  }
9108  nDelete(&n);
9109  }
9110  else
9111  {
9112  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
9113  }
9114  }
9115  else
9116  {
9117  pNorm(strat->S[i]);
9118  }
9119  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9120  }
9121  }
9122  i++;
9123  }
9124  if (any_change) reorderS(&suc,strat);
9125  else break;
9126  }
9127  if (toT)
9128  {
9129  for (i=0; i<=strat->sl; i++)
9130  {
9131  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9132  {
9133  h.p = redtailBba(strat->S[i],i-1,strat);
9135  {
9136  h.pCleardenom();// also does remove Content
9137  }
9138  }
9139  else
9140  {
9141  h.p = strat->S[i];
9142  }
9143  strat->initEcart(&h);
9144  if (strat->honey)
9145  {
9146  strat->ecartS[i] = h.ecart;
9147  }
9148  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9149  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9150  h.sev = strat->sevS[i];
9151  /*puts the elements of S also to T*/
9152  strat->initEcart(&h);
9153  enterT(h,strat);
9154  strat->S_2_R[i] = strat->tl;
9155 #ifdef HAVE_SHIFTBBA
9156  if (currRing->isLPring)
9157  enterTShift(h, strat);
9158 #endif
9159  }
9160  }
9161  }
9162  else
9163  {
9164  while (suc != -1)
9165  {
9166  i=suc;
9167  while (i<=strat->sl)
9168  {
9169  change=FALSE;
9170  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9171  {
9172  redSi=pHead((strat->S)[i]);
9173  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9174  if ((strat->S)[i]==NULL)
9175  {
9176  deleteInS(i,strat);
9177  i--;
9178  }
9179  else if (pCmp((strat->S)[i],redSi)!=0)
9180  {
9181  any_change=TRUE;
9182  h.p = strat->S[i];
9183  strat->initEcart(&h);
9184  strat->ecartS[i] = h.ecart;
9186  {
9187  if (TEST_OPT_CONTENTSB)
9188  {
9189  number n;
9190  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
9191  if (!nIsOne(n))
9192  {
9194  denom->n=nInvers(n);
9195  denom->next=DENOMINATOR_LIST;
9196  DENOMINATOR_LIST=denom;
9197  }
9198  nDelete(&n);
9199  }
9200  else
9201  {
9202  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
9203  }
9204  }
9205  else
9206  {
9207  pNorm(strat->S[i]); // == h.p
9208  }
9209  h.sev = pGetShortExpVector(h.p);
9210  strat->sevS[i] = h.sev;
9211  }
9212  pLmDelete(&redSi);
9213  kTest(strat);
9214  }
9215  i++;
9216  }
9217 #ifdef KDEBUG
9218  kTest(strat);
9219 #endif
9220  if (any_change) reorderS(&suc,strat);
9221  else { suc=-1; break; }
9222  if (h.p!=NULL)
9223  {
9224  if (!strat->kHEdgeFound)
9225  {
9226  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9227  }
9228  if (strat->kHEdgeFound)
9229  newHEdge(strat);
9230  }
9231  }
9232  for (i=0; i<=strat->sl; i++)
9233  {
9234  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9235  {
9236  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9237  strat->initEcart(&h);
9238  strat->ecartS[i] = h.ecart;
9239  h.sev = pGetShortExpVector(h.p);
9240  strat->sevS[i] = h.sev;
9241  }
9242  else
9243  {
9244  h.p = strat->S[i];
9245  h.ecart=strat->ecartS[i];
9246  h.sev = strat->sevS[i];
9247  h.length = h.pLength = pLength(h.p);
9248  }
9249  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9250  cancelunit1(&h,&suc,strat->sl,strat);
9251  h.SetpFDeg();
9252  /*puts the elements of S also to T*/
9253  enterT(h,strat);
9254  strat->S_2_R[i] = strat->tl;
9255 #ifdef HAVE_SHIFTBBA
9256  if (currRing->isLPring)
9257  enterTShift(h, strat);
9258 #endif
9259  }

Variable Documentation

◆ DENOMINATOR_LIST

VAR denominator_list DENOMINATOR_LIST =NULL

Definition at line 87 of file kutil.cc.

◆ HCord

VAR int HCord

Definition at line 235 of file kutil.cc.

◆ Kstd1_deg

VAR int Kstd1_deg

Definition at line 236 of file kutil.cc.

◆ Kstd1_mu

VAR int Kstd1_mu =32000

Definition at line 237 of file kutil.cc.

n_IntMod
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:627
chainCritSig
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3420
clearS
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1172
rHasGlobalOrdering
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:753
skStrategy::S_2_T
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:38
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:141
updateL
void updateL(kStrategy strat)
Definition: kstd1.cc:1038
ksCheckCoeff
int ksCheckCoeff(number *a, number *b)
pDivisibleBy
#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:132
FALSE
#define FALSE
Definition: auxiliary.h:96
enterOnePairShift
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
Definition: kutil.cc:12261
chainCritRing
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3955
posInLSig
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6122
idCopy
ideal idCopy(ideal A)
Definition: ideals.h:59
pLPCopyAndShiftLM
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:14
_p_LmDivisibleByPart
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:1761
skStrategy
Definition: kutil.h:266
idElem
int idElem(const ideal F)
count non-zero elements
Definition: simpleideals.cc:218
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:689
pLDeg1
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:830
pLtCmpOrdSgnEqP
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:123
deleteHC
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
p_GetCoeff
#define p_GetCoeff(p, r)
Definition: monomials.h:47
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:224
skStrategy::fromQ
intset fromQ
Definition: kutil.h:316
initBuchMoraCrit
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9878
p_GetComp
#define p_GetComp(p, r)
Definition: monomials.h:61
enterExtendedSpolySig
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition: kutil.cc:4686
skStrategy::tail
poly tail
Definition: kutil.h:331
pLmEqual
#define pLmEqual(p1, p2)
Definition: polys.h:107
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:106
initPairtest
void initPairtest(kStrategy strat)
Definition: kutil.cc:665
enterOneZeroPairRing
void enterOneZeroPairRing(poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:4145
pGetComp
#define pGetComp(p)
Component.
Definition: polys.h:36
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:456
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
posInT17_c
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5837
pNorm
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:347
TEST_OPT_INFREDTAIL
#define TEST_OPT_INFREDTAIL
Definition: options.h:114
cleanT
void cleanT(kStrategy strat)
Definition: kutil.cc:537
rIsLPRing
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:407
pCompareChainPart
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)
Definition: kpolys.cc:71
Kstd1_deg
VAR int Kstd1_deg
Definition: kutil.cc:236
skStrategy::enterS
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:281
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition: options.h:100
pLDeg0c
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:759
redEcart
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:165
pHasNotCF
#define pHasNotCF(p1, p2)
Definition: polys.h:248
k
int k
Definition: cfEzgcd.cc:92
idDelete
#define idDelete(H)
delete an ideal
Definition: ideals.h:28
scComputeHC
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1004
nCoeff_is_Z
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:837
pLmFree
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:68
skStrategy::tmax
int tmax
Definition: kutil.h:347
TEST_OPT_REDTAIL
#define TEST_OPT_REDTAIL
Definition: options.h:113
pAssume
#define pAssume(cond)
Definition: monomials.h:86
enterOneStrongPoly
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1527
skStrategy::cp
int cp
Definition: kutil.h:344
TObject
class sTObject TObject
Definition: kutil.h:52
kFindDivisibleByInS
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:326
ppMult_mm
#define ppMult_mm(p, m)
Definition: polys.h:189
LSet
LObject * LSet
Definition: kutil.h:55
posInL0
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6064
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:481
pLDeg0
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:728
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition: polys.cc:15
TEST_OPT_DEGBOUND
#define TEST_OPT_DEGBOUND
Definition: options.h:110
nc_p_Bracket_qq
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
posInL17_c
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
skStrategy::P
LObject P
Definition: kutil.h:297
skStrategy::sbaOrder
unsigned sbaOrder
Definition: kutil.h:311
initT
KINLINE TSet initT()
Definition: kInline.h:83
polyset
poly * polyset
Definition: polys.h:244
nGreater
#define nGreater(a, b)
Definition: numbers.h:27
skStrategy::ecartS
intset ecartS
Definition: kutil.h:304
reorderL
void reorderL(kStrategy strat)
Definition: kstd1.cc:866
pLDeg1_Totaldegree
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:964
pGetExp
#define pGetExp(p, i)
Exponent.
Definition: polys.h:40
posInT_EcartFDegpLength
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11815
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3653
ADDRESS
void * ADDRESS
Definition: auxiliary.h:135
redtail
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7403
posInT17
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5730
initenterpairsShift
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:12591
isInPairsetL
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:674
skStrategy::t_kHEdge
poly t_kHEdge
Definition: kutil.h:326
si_opt_1
VAR unsigned si_opt_1
Definition: options.c:5
posInT110Ring
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5520
h
STATIC_VAR Poly * h
Definition: janet.cc:971
p_Mult_mm
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:985
skStrategy::posInLOld
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:283
skStrategy::chainCrit
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:286
skStrategy::R
TObject ** R
Definition: kutil.h:337
ncRingType
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
BITSET
#define BITSET
Definition: structs.h:19
skStrategy::L
LSet L
Definition: kutil.h:322
skStrategy::S
polyset S
Definition: kutil.h:301
initsevT
KINLINE unsigned long * initsevT()
Definition: kInline.h:99
skStrategy::z2homog
char z2homog
Definition: kutil.h:372
isNotHomog
Definition: structs.h:40
p_Neg
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1031
nEqual
#define nEqual(n1, n2)
Definition: numbers.h:19
skStrategy::lenS
intset lenS
Definition: kutil.h:314
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:244
rKillModifiedRing
void rKillModifiedRing(ring r)
Definition: ring.cc:3001
BTEST1
#define BTEST1(a)
Definition: options.h:32
totaldegreeWecart
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:216
posInT110
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5478
skStrategy::tailRing
ring tailRing
Definition: kutil.h:340
idInsertPoly
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
Definition: simpleideals.cc:648
redtailBba
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7479
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ind_fact_2
long ind_fact_2(long arg)
Definition: kutil.cc:4122
optionStruct
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:521
p_ShallowCopyDelete
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:872
p_ExpVectorCopy
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1235
TEST_OPT_CONTENTSB
#define TEST_OPT_CONTENTSB
Definition: options.h:123
__p_GetComp
#define __p_GetComp(p, r)
Definition: monomials.h:60
updateS
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9030
prMapR
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:45
pLDeg1c_Deg
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:930
skStrategy::tailBin
omBin tailBin
Definition: kutil.h:342
TEST_OPT_DEBUG
#define TEST_OPT_DEBUG
Definition: options.h:105
pNeg
#define pNeg(p)
Definition: polys.h:186
p_Test
#define p_Test(p, r)
Definition: p_polys.h:154
nc_rComplete
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5533
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:372
skStrategy::overflow
char overflow
Definition: kutil.h:402
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349
pGetShortExpVector
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:146
n_Q
rational (GMP) numbers
Definition: coeffs.h:30
omGetStickyBinOfBin
#define omGetStickyBinOfBin(B)
Definition: xalloc.h:288
REDTAIL_CANONICALIZE
#define REDTAIL_CANONICALIZE
pp_Mult_mm
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:975
posInS
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5034
skStrategy::sevS
unsigned long * sevS
Definition: kutil.h:317
skStrategy::homog
char homog
Definition: kutil.h:370
pLDeg1c_WFirstTotalDegree
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1057
sValAssign_sys::arg
short arg
Definition: gentable.cc:107
pDelete
#define pDelete(p_ptr)
Definition: polys.h:175
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
pLtCmp
#define pLtCmp(p, q)
Definition: polys.h:118
posInT_EcartpLength
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5596
skStrategy::honey
char honey
Definition: kutil.h:375
StringEndS
char * StringEndS()
Definition: reporter.cc:150
posInL0Ring
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6090
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:776
enlargeL
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:655
posInT_FDegpLength
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11869
loop
#define loop
Definition: structs.h:79
skStrategy::B
LSet B
Definition: kutil.h:323
skStrategy::Lmax
int Lmax
Definition: kutil.h:348
pSetComp
#define pSetComp(p, v)
Definition: polys.h:37
syzCriterion
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7044
pJet
#define pJet(p, m)
Definition: polys.h:352
pString
char * pString(poly p)
Definition: polys.h:290
TEST_OPT_REDSB
#define TEST_OPT_REDSB
Definition: options.h:101
pLmIsConstantComp
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition: polys.h:228
b
CanonicalForm b
Definition: cfModGcd.cc:4044
p_Lcm
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1627
initec
static intset initec(const int maxnr)
Definition: kutil.cc:502
ind2
long ind2(long arg)
Definition: kutil.cc:4110
p_LmDivisibleBy
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1802
posInSyz
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6282
posInT17_cRing
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5898
pLDegb
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:800
skStrategy::lmBin
omBin lmBin
Definition: kutil.h:341
p_LmCheckIsFromRing
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:65
enterSMoraNF
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1323
posInT19
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5964
found
bool found
Definition: facFactorize.cc:56
setmax
#define setmax
Definition: kutil.h:28
nGreaterZero
#define nGreaterZero(n)
Definition: numbers.h:26
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:475
skStrategy::t_kNoether
poly t_kNoether
Definition: kutil.h:328
ringorder_C
Definition: ring.h:72
k_LmInit_currRing_2_tailRing
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:902
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1364
prMoveR
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:396
rGetCurrSyzLimit
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
skStrategy::syzidxmax
int syzidxmax
Definition: kutil.h:346
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:182
TEST_OPT_FINDET
#define TEST_OPT_FINDET
Definition: options.h:108
rAssure_c_dp
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4909
kTest
#define kTest(A)
Definition: kutil.h:651
newHEdge
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10860
kMergeBintoLSba
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3170
chainCritOpt_1
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3404
ksCreateShortSpoly
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1402
syzCriterionInc
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7079
degbound
#define degbound(p)
Definition: tgb.cc:153
p_WFirstTotalDegree
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:585
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:796
posInLSigRing
int posInLSigRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6146
skStrategy::sevSyz
unsigned long * sevSyz
Definition: kutil.h:318
initEcartPairBba
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1298
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
denominator_list
denominator_list_s * denominator_list
Definition: kutil.h:58
posInLSpecial
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6021
ALLOW_PROD_CRIT
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
p_ExpVectorAdd
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1332
TRUE
#define TRUE
Definition: auxiliary.h:100
skStrategy::s_2_t
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:47
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition: options.h:107
i
int i
Definition: cfEzgcd.cc:125
p_OneComp
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1195
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: simpleideals.cc:122
rHasLocalOrMixedOrdering
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:754
skStrategy::syz
polyset syz
Definition: kutil.h:302
ksReducePoly
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:186
p_Sub
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1962
res
CanonicalForm res
Definition: facAbsFact.cc:64
nIsOne
#define nIsOne(n)
Definition: numbers.h:24
kBucket_Add_q
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:653
skStrategy::sl
int sl
Definition: kutil.h:345
n_Ann
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
nc_lie
Definition: nc.h:18
skStrategy::redTailChange
char redTailChange
Definition: kutil.h:397
kBucketDestroy
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:215
DENOMINATOR_LIST
VAR denominator_list DENOMINATOR_LIST
Definition: kutil.cc:87
firstUpdate
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1202
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition: simpleideals.cc:790
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
skStrategy::T
TSet T
Definition: kutil.h:321
redRing
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
skStrategy::posInLDependsOnLength
char posInLDependsOnLength
Definition: kutil.h:387
skStrategy::syzl
int syzl
Definition: kutil.h:346
skStrategy::LazyDegree
int LazyDegree
Definition: kutil.h:350
pDivCompRing
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:147
Sy_bit
#define Sy_bit(x)
Definition: options.h:30
enterSBba
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9265
posInT2
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5295
skStrategy::Gebauer
char Gebauer
Definition: kutil.h:376
initEcartNormal
void initEcartNormal(TObject *h)
Definition: kutil.cc:1283
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
enterTShift
void enterTShift(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:12798
TEST_OPT_NOT_SUGAR
#define TEST_OPT_NOT_SUGAR
Definition: options.h:103
skStrategy::syzIdx
intset syzIdx
Definition: kutil.h:308
lc
CanonicalForm lc(const CanonicalForm &f)
Definition: canonicalform.h:297
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:87
pLDeg1_WFirstTotalDegree
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1027
p_Cmp
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1635
pIsVector
#define pIsVector(p)
Definition: polys.h:236
soptionStruct::resetval
unsigned resetval
Definition: ipid.h:148
kBucketInit
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:492
pmLastVblock
#define pmLastVblock(p)
Definition: shiftop.h:33
pLcm
#define pLcm(a, b, m)
Definition: polys.h:279
skStrategy::LazyPass
int LazyPass
Definition: kutil.h:350
setmaxTinc
#define setmaxTinc
Definition: kutil.h:33
TEST_OPT_OLDSTD
#define TEST_OPT_OLDSTD
Definition: options.h:119
pDivComp_EQUAL
#define pDivComp_EQUAL
Definition: kutil.cc:138
ksReducePolyTail
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1088
posInT_pLength
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11906
skStrategy::newIdeal
int newIdeal
Definition: kutil.h:354
skStrategy::Shdl
ideal Shdl
Definition: kutil.h:298
enterOnePairWithShifts
static void enterOnePairWithShifts(int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_lastVblock)
Definition: kutil.cc:12200
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:180
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:478
posInTrg0
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5402
skStrategy::sig
polyset sig
Definition: kutil.h:303
denominator_list_s
Definition: kutil.h:60
posInL11Ringls
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6434
skStrategy::posInL
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:279
skStrategy::next
kStrategy next
Definition: kutil.h:272
skStrategy::kNoetherTail
KINLINE poly kNoetherTail()
Definition: kInline.h:66
TSet
TObject * TSet
Definition: kutil.h:54
initS_2_R
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:511
exitBuchMora
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10285
rIsRatGRing
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:422
ENTER_USE_MEMMOVE
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:50
redFirst
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:527
initenterpairs
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3768
skStrategy::fromT
char fromT
Definition: kutil.h:377
max
static int max(int a, int b)
Definition: fast_mult.cc:264
skStrategy::pOrigFDeg_TailRing
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:293
posInL17Ring
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6863
initenterstrongPairsSig
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4576
initL
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:697
intset
int * intset
Definition: kutil.h:48
pInit
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:59
redMora
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8985
k_GetLeadTerms
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:960
pCopyL2p
poly pCopyL2p(LObject H, kStrategy strat)
Definition: kutil.cc:12107
pOne
#define pOne()
Definition: polys.h:299
kMergeBintoL
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3149
enterSyz
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9782
posInL10
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1005
cancelunit1
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8873
kFindDivisibleByInT
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:216
enterOnePairLift
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2209
pDivComp_GREATER
#define pDivComp_GREATER
Definition: kutil.cc:140
pLDeg1c_Totaldegree
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:994
Q
STATIC_VAR jList * Q
Definition: janet.cc:30
pIter
#define pIter(p)
Definition: monomials.h:34
setmaxT
#define setmaxT
Definition: kutil.h:32
pLtCmpOrdSgnDiffP
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:121
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2788
soptionStruct::setval
unsigned setval
Definition: ipid.h:147
pDivComp_INCOMP
#define pDivComp_INCOMP
Definition: kutil.cc:141
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
posInL11Ring
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6364
p_mLPmaxPossibleShift
int p_mLPmaxPossibleShift(poly p, const ring r)
Definition: shiftgb.cc:44
skStrategy::rewCrit1
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:288
initenterpairsSigRing
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3893
skStrategy::sevSig
unsigned long * sevSig
Definition: kutil.h:319
skStrategy::syzmax
int syzmax
Definition: kutil.h:346
pGetShallowCopyDeleteProc
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
Definition: pShallowCopyDelete.cc:48
pLDeg1c
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:866
ksReducePolyTailLC_Z
KINLINE int ksReducePolyTailLC_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1050
p_LmExpVectorAddIsOk
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1944
kTest_TS
#define kTest_TS(A)
Definition: kutil.h:652
T
STATIC_VAR jList * T
Definition: janet.cc:30
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
skStrategy::rightGB
char rightGB
Definition: kutil.h:367
clearSbatch
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4804
sugarDivisibleBy
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1316
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1481
enterOnePairSig
static void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2421
chainCritPart
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3479
p_ExpVectorSum
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
pp
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
p_GetMaxExpP
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:1126
kBucketClear
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:520
kFindDivisibleByInS_T
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7261
skStrategy::lenSw
wlen_set lenSw
Definition: kutil.h:315
rBlocks
static int rBlocks(ring r)
Definition: ring.h:562
__pp_Mult_nn
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:946
tmp1
CFList tmp1
Definition: facFqBivar.cc:70
pLtCmpOrdSgnDiffM
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:120
skStrategy::S_2_R
int * S_2_R
Definition: kutil.h:339
pLcmRat
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
posInL15Ring
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6778
skStrategy::kHEdgeFound
char kHEdgeFound
Definition: kutil.h:374
skStrategy::noTailReduction
char noTailReduction
Definition: kutil.h:376
enterOnePairWithoutShifts
static void enterOnePairWithoutShifts(int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_shift)
Definition: kutil.cc:12231
pCompareChain
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:17
p_LtCmpNoAbs
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
Definition: p_polys.h:1548
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2823
ksOldSpolyRed
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1114
pAdd
#define pAdd(p, q)
Definition: polys.h:191
pLmInit
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:62
pDivideM
#define pDivideM(a, b)
Definition: polys.h:278
skStrategy::news
char news
Definition: kutil.h:398
ringorder_c
Definition: ring.h:71
skStrategy::syzComp
int syzComp
Definition: kutil.h:351
posInT13
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5567
posInL13
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6708
wlen_type
int64 wlen_type
Definition: kutil.h:49
p_LmTest
#define p_LmTest(p, r)
Definition: p_polys.h:155
pSetCoeff
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:30
kFindInT
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:710
pDecrExp
#define pDecrExp(p, i)
Definition: polys.h:43
posInL110Ring
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6661
exp
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:356
skStrategy::NotUsedAxis
BOOLEAN * NotUsedAxis
Definition: kutil.h:329
pmIsInV
#define pmIsInV(p)
Definition: shiftop.h:51
enterOnePairSigRing
static void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2678
skStrategy::interpt
char interpt
Definition: kutil.h:369
n_DivComp
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition: coeffs.h:521
skStrategy::kHEdge
poly kHEdge
Definition: kutil.h:324
skStrategy::posInLSba
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:277
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:447
skStrategy::pOrigLDeg_TailRing
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:294
p_LmFree
static void p_LmFree(poly p, ring)
Definition: p_polys.h:669
n_Lcm
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
nc_CreateShortSpoly
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
nIsZero
#define nIsZero(n)
Definition: numbers.h:18
initSbaPos
void initSbaPos(kStrategy strat)
Definition: kutil.cc:10311
skStrategy::cv
int cv
Definition: kutil.h:366
p_Deg
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:576
posInL11
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6322
skStrategy::sigdrop
bool sigdrop
Definition: kutil.h:357
omBin
omBin_t * omBin
Definition: omStructs.h:11
pmFirstVblock
#define pmFirstVblock(p)
Definition: shiftop.h:35
posInL17_cRing
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6977
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:845
initSL
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8169
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:880
skStrategy::Ll
int Ll
Definition: kutil.h:348
min
static int min(int a, int b)
Definition: fast_mult.cc:268
posInL17
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6819
redBba1
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8856
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1300
maxdegreeWecart
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:246
posInT15Ring
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5689
pDivComp_LESS
#define pDivComp_LESS
Definition: kutil.cc:139
setmaxL
#define setmaxL
Definition: kutil.h:29
kFindDivisibleByInT_Z
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition: kstd2.cc:139
normalize
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1025
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:127
chainCritNormal
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3191
skStrategy::c3
int c3
Definition: kutil.h:344
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
pSetmComp
#define pSetmComp(p)
TODO:
Definition: polys.h:258
mult
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
skStrategy::LDegLast
char LDegLast
Definition: kutil.h:383
enterSMora
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1269
skStrategy::p_shallow_copy_delete
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:335
pLDeg1_Deg
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:899
skStrategy::sevT
unsigned long * sevT
Definition: kutil.h:320
rRing_has_Comp
#define rRing_has_Comp(r)
Definition: monomials.h:258
posInL110
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6620
redBba
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8961
ringorder_a
Definition: ring.h:69
initSLSba
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8266
Print
#define Print
Definition: emacs.cc:79
skStrategy::initEcartPair
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:282
nInvers
#define nInvers(a)
Definition: numbers.h:32
skStrategy::newt
char newt
Definition: kutil.h:399
initSbaBuchMora
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10413
TEST_OPT_WEIGHTM
#define TEST_OPT_WEIGHTM
Definition: options.h:117
TEST_OPT_SUGARCRIT
#define TEST_OPT_SUGARCRIT
Definition: options.h:104
cleanTSbaRing
void cleanTSbaRing(kStrategy strat)
Definition: kutil.cc:596
reorderS
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4981
p_NSet
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1452
pIsPurePower
#define pIsPurePower(p)
Definition: polys.h:234
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:34
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:399
pp_Test
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:156
posInLF5C
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6310
name
char name(const Variable &v)
Definition: factory.h:180
initsevS
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:507
TEST_OPT_IDLIFT
#define TEST_OPT_IDLIFT
Definition: options.h:125
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:56
rModifyRing
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2641
n_Gcd
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
skStrategy::pairtest
BOOLEAN * pairtest
Definition: kutil.h:330
showOption
char * showOption()
Definition: misc_ip.cc:723
m
int m
Definition: cfEzgcd.cc:121
skStrategy::kNoether
poly kNoether
Definition: kutil.h:325
enterOnePairRing
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1325
HEckeTest
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:467
skStrategy::tl
int tl
Definition: kutil.h:347
skStrategy::Bl
int Bl
Definition: kutil.h:349
WarnS
#define WarnS
Definition: emacs.cc:77
n_DivBy
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:774
assume
#define assume(x)
Definition: mod2.h:384
enterpairsSpecial
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4907
omMergeStickyBinIntoBin
#define omMergeStickyBinIntoBin(A, B)
Definition: xalloc.h:317
p_GetMaxExpL
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:1163
NULL
#define NULL
Definition: omList.c:11
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:74
skStrategy::posInLOldFlag
char posInLOldFlag
Definition: kutil.h:380
posInT1
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5267
pSetm
#define pSetm(p)
Definition: polys.h:256
idSyzygies
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:728
skStrategy::noClearS
char noClearS
Definition: kutil.h:400
skStrategy::length_pLength
char length_pLength
Definition: kutil.h:385
mflush
#define mflush()
Definition: reporter.h:56
pLmShortDivisibleBy
#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:140
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:237
l
int l
Definition: cfEzgcd.cc:93
lcm
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
enlargeT
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:516
nDelete
#define nDelete(n)
Definition: numbers.h:15
posInLrg0
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6536
skStrategy::lastAxis
int lastAxis
Definition: kutil.h:353
n_Int
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:546
p_WTotaldegree
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:602
omRealloc0Size
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:219
skStrategy::rewCrit3
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:290
kBucket
Definition: kbuckets.h:177
R
#define R
Definition: sirandom.c:27
initSSpecialSba
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8711
posInT11Ring
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
kPosInLDependsOnLength
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:10012
HCord
VAR int HCord
Definition: kutil.cc:235
skStrategy::completeReduce_retry
char completeReduce_retry
Definition: kutil.h:401
TEST_OPT_SB_1
#define TEST_OPT_SB_1
Definition: options.h:115
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:223
LObject
class sLObject LObject
Definition: kutil.h:53
skStrategy::ak
int ak
Definition: kutil.h:350
posInL15
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6743
TEST_OPT_CANCELUNIT
#define TEST_OPT_CANCELUNIT
Definition: options.h:124
gcd
int gcd(int a, int b)
Definition: walkSupport.cc:836
StringAppend
#define StringAppend
Definition: emacs.cc:78
pLmDivisibleBy
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:134
pSetExp
#define pSetExp(p, i, v)
Definition: polys.h:41
initenterstrongPairs
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4521
denominator_list_s::next
denominator_list next
Definition: kutil.h:60
doRed
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:115
ksReducePolyTail_Z
KINLINE int ksReducePolyTail_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1068
cancelunit
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
pDivComp
static int pDivComp(poly p, poly q)
Definition: kutil.cc:186
TEST_OPT_REDTHROUGH
#define TEST_OPT_REDTHROUGH
Definition: options.h:118
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1428
p
int p
Definition: cfModGcd.cc:4019
pShallowCopyDeleteProc
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:43
enterOneStrongPolySig
static BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
Definition: kutil.cc:1733
posInT17Ring
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5791
enterL
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1259
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
deleteInL
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1202
add
STATIC_VAR unsigned add[]
Definition: misc_ip.cc:117
skStrategy::initEcart
void(* initEcart)(TObject *L)
Definition: kutil.h:275
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
p_GetMaxExp
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:732
nInit
#define nInit(i)
Definition: numbers.h:23
pLmCmp
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:101
initSSpecial
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8567
H
CanonicalForm H
Definition: facAbsFact.cc:64
rIsSyzIndexRing
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
skStrategy::red
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:273
kTest_L
#define kTest_L(T, R)
Definition: kutil.h:655
p_HasNotCF_Lift
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case: ignore component
Definition: kutil.cc:2192
kHomModDeg
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2074
initEcartBBA
void initEcartBBA(TObject *h)
Definition: kutil.cc:1291
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:174
skStrategy::nrsyzcrit
int nrsyzcrit
Definition: kutil.h:358
n_SetMap
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
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:23
skStrategy::posInT
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:276
pNormalize
#define pNormalize(p)
Definition: polys.h:301
posInT15
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5635
skStrategy::currIdx
int currIdx
Definition: kutil.h:312
initenterpairsSig
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3833
kStd
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:2087
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1284
comp
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition: facSparseHensel.h:25
posInT0
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5256
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1038
deleteInS
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1095
kDeleteLcm
static void kDeleteLcm(LObject *P)
Definition: kutil.h:863
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:65
initEcartPairMora
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1305
k_GetStrongLeadTerms
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1003
skStrategy::sugarCrit
char sugarCrit
Definition: kutil.h:375
rHasMixedOrdering
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:755
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:41
tmp2
CFList tmp2
Definition: facFqBivar.cc:70
denominator_list_s::n
number n
Definition: kutil.h:60
skStrategy::minim
int minim
Definition: kutil.h:355
enterOnePairNormal
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1928
PrintLn
void PrintLn()
Definition: reporter.cc:309
skStrategy::use_buckets
char use_buckets
Definition: kutil.h:381
skStrategy::Bmax
int Bmax
Definition: kutil.h:349
sbaRing
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:11520
rIsSCA
static bool rIsSCA(const ring r)
Definition: nc.h:190
kStratChangeTailRing
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11394
ecartWeights
EXTERN_VAR short * ecartWeights
Definition: weight.h:11
p_GetShortExpVector
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4682
initR
KINLINE TObject ** initR()
Definition: kInline.h:94
skStrategy::syzCrit
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:287
diff
STATIC_VAR gmp_float * diff
Definition: mpr_complex.cc:44
p_FDeg
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:368
kCreateZeroPoly
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4326
enterExtendedSpoly
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4603
index
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:585
redHoney
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
nCopy
#define nCopy(n)
Definition: numbers.h:14
n_ExtGcd
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
n_IsUnit
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:514
pHasNotCFRing
#define pHasNotCFRing(p1, p2)
Definition: polys.h:247
rRingOrder_t
rRingOrder_t
order stuff
Definition: ring.h:66
skStrategy::HCord
int HCord
Definition: kutil.h:352
pNext
#define pNext(p)
Definition: monomials.h:33
missingAxis
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:924
enterT
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9580
setmaxLinc
#define setmaxLinc
Definition: kutil.h:30
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
p_LmShortDivisibleBy
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1836
pCmp
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
Definition: polys.h:111
OPT_INTERRUPT
#define OPT_INTERRUPT
Definition: options.h:76
TEST_OPT_FASTHC
#define TEST_OPT_FASTHC
Definition: options.h:106
posInT11
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5325
twoPow
long twoPow(long arg)
Definition: kutil.cc:4137
si_opt_2
VAR unsigned si_opt_2
Definition: options.c:6
enterOnePairSpecial
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:3080
nKillChar
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:510
idIsConstant
#define idIsConstant(I)
Definition: ideals.h:39
skStrategy::enterOnePair
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:285
idPosConstant
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:36
redHomog
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
pMoveCurrTail2poly
poly pMoveCurrTail2poly(poly p, kStrategy strat)
Definition: kutil.cc:12090
updateLHC
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1109
skStrategy::nrrewcrit
int nrrewcrit
Definition: kutil.h:359
nextZeroSimplexExponent
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4260
rComplete
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:3397
pWrite
void pWrite(poly p)
Definition: polys.h:292
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:218
wrp
void wrp(poly p)
Definition: polys.h:294
p_Cleardenom_n
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2897
verboseStruct
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:551
p_CheckIsFromRing
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:96