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)
 
void updateSShift (kStrategy strat)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
static void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int)
 
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

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

Macro Definition Documentation

◆ ALL_VS_JUST

#define ALL_VS_JUST   0

Definition at line 17 of file kutil.cc.

◆ ENTER_USE_MEMMOVE

#define ENTER_USE_MEMMOVE

Definition at line 51 of file kutil.cc.

◆ EXT_POLY_NEW

#define EXT_POLY_NEW   0

Definition at line 21 of file kutil.cc.

◆ KDEBUG

#define KDEBUG   2

Definition at line 36 of file kutil.cc.

◆ KUTIL_CC

#define KUTIL_CC

Definition at line 10 of file kutil.cc.

◆ MYTEST

#define MYTEST   0

Definition at line 12 of file kutil.cc.

◆ pDivComp_EQUAL

#define pDivComp_EQUAL   2

Definition at line 139 of file kutil.cc.

◆ pDivComp_GREATER

#define pDivComp_GREATER   -1

Definition at line 141 of file kutil.cc.

◆ pDivComp_INCOMP

#define pDivComp_INCOMP   0

Definition at line 142 of file kutil.cc.

◆ pDivComp_LESS

#define pDivComp_LESS   1

Definition at line 140 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 7188 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;
7211 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:98
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
LObject P
Definition: kutil.h:298
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1360

◆ arriRewCriterionPre()

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

Definition at line 7213 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;
7256 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:98
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
LSet B
Definition: kutil.h:324
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1360
#define pLmEqual(p1, p2)
Definition: polys.h:111

◆ cancelunit()

void cancelunit ( LObject L,
BOOLEAN  inNF 
)

Definition at line 333 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  }
456 }
#define p_GetComp(p, r)
Definition: monomials.h:64
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
CanonicalForm lc(const CanonicalForm &f)
#define pIter(p)
Definition: monomials.h:37
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
int i
Definition: cfEzgcd.cc:125
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define TEST_OPT_CANCELUNIT
Definition: options.h:126
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int p
Definition: cfModGcd.cc:4019
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:971
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1198

◆ cancelunit1()

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

Definition at line 8877 of file kutil.cc.

8878 {
8879  int k;
8880  poly r,h,h1,q;
8881 
8882  if (!pIsVector((*p).p) && ((*p).ecart != 0))
8883  {
8884 #ifdef HAVE_RINGS
8885  // Leading coef have to be a unit: no
8886  // example 2x+4x2 should be simplified to 2x*(1+2x)
8887  // and 2 is not a unit in Z
8888  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
8889 #endif
8890  k = 0;
8891  h1 = r = pCopy((*p).p);
8892  h =pNext(r);
8893  loop
8894  {
8895  if (h==NULL)
8896  {
8897  pDelete(&r);
8898  pDelete(&(pNext((*p).p)));
8899  (*p).ecart = 0;
8900  (*p).length = 1;
8901  (*p).pLength = 1;
8902  (*suc)=0;
8903  return;
8904  }
8905  if (!pDivisibleBy(r,h))
8906  {
8907  q=redBba1(h,index ,strat);
8908  if (q != h)
8909  {
8910  k++;
8911  pDelete(&h);
8912  pNext(h1) = h = q;
8913  }
8914  else
8915  {
8916  pDelete(&r);
8917  return;
8918  }
8919  }
8920  else
8921  {
8922  h1 = h;
8923  pIter(h);
8924  }
8925  if (k > 10)
8926  {
8927  pDelete(&r);
8928  return;
8929  }
8930  }
8931  }
8932 }
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8860
#define pIter(p)
Definition: monomials.h:37
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:12
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
#define pIsVector(p)
Definition: polys.h:245

◆ chainCritNormal()

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

Definition at line 3192 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  }
3400 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define loop
Definition: structs.h:80
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:675
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:17
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
char Gebauer
Definition: kutil.h:376
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ chainCritOpt_1()

void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 3405 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);
3416 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
#define NULL
Definition: omList.c:12
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
int BOOLEAN
Definition: auxiliary.h:85

◆ chainCritPart()

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

Definition at line 3480 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  }
3763 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:349
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define TEST_OPT_DEBUG
Definition: options.h:107
#define loop
Definition: structs.h:80
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:675
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
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:1778
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
char Gebauer
Definition: kutil.h:376
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)
Definition: kpolys.cc:71

◆ chainCritRing()

void chainCritRing ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3956 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  }
4107 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
int Ll
Definition: kutil.h:349
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
void pWrite(poly p)
Definition: polys.h:303
#define TEST_OPT_DEBUG
Definition: options.h:107
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:675
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:17
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
char Gebauer
Definition: kutil.h:376
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305
int BOOLEAN
Definition: auxiliary.h:85
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ chainCritSig()

void chainCritSig ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3421 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  }
3478 }
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
int c3
Definition: kutil.h:345
#define loop
Definition: structs.h:80
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:675
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3171
LSet L
Definition: kutil.h:323
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ cleanT()

void cleanT ( kStrategy  strat)

Definition at line 538 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;
595 }
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:348
#define loop
Definition: structs.h:80
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:44
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019

◆ cleanTSbaRing()

void cleanTSbaRing ( kStrategy  strat)

Definition at line 597 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;
647 }
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:348
#define loop
Definition: structs.h:80
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:44
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019

◆ clearSbatch()

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

Definition at line 4805 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  }
4823 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 10719 of file kutil.cc.

10720 {
10721  int i;
10722  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10723  LObject L;
10724 
10725 #ifdef KDEBUG
10726  // need to set this: during tailreductions of T[i], T[i].max is out of
10727  // sync
10728  sloppy_max = TRUE;
10729 #endif
10730 
10731  strat->noTailReduction = FALSE;
10732  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10733  if (TEST_OPT_PROT)
10734  {
10735  PrintLn();
10736 // if (timerv) writeTime("standard base computed:");
10737  }
10738  if (TEST_OPT_PROT)
10739  {
10740  Print("(S:%d)",strat->sl);mflush();
10741  }
10742  for (i=strat->sl; i>=low; i--)
10743  {
10744  int end_pos=strat->sl;
10745  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10746  if (strat->ak==0) end_pos=i-1;
10747  TObject* T_j = strat->s_2_t(i);
10748  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10749  {
10750  L = *T_j;
10751  #ifdef KDEBUG
10752  if (TEST_OPT_DEBUG)
10753  {
10754  Print("test S[%d]:",i);
10755  p_wrp(L.p,currRing,strat->tailRing);
10756  PrintLn();
10757  }
10758  #endif
10760  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10761  else
10762  strat->S[i] = redtail(&L, strat->sl, strat);
10763  #ifdef KDEBUG
10764  if (TEST_OPT_DEBUG)
10765  {
10766  Print("to (tailR) S[%d]:",i);
10767  p_wrp(strat->S[i],currRing,strat->tailRing);
10768  PrintLn();
10769  }
10770  #endif
10771 
10772  if (strat->redTailChange)
10773  {
10774  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10775  if (pNext(T_j->p) != NULL)
10776  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10777  else
10778  T_j->max_exp = NULL;
10779  }
10781  T_j->pCleardenom();
10782  }
10783  else
10784  {
10785  assume(currRing == strat->tailRing);
10786  #ifdef KDEBUG
10787  if (TEST_OPT_DEBUG)
10788  {
10789  Print("test S[%d]:",i);
10790  p_wrp(strat->S[i],currRing,strat->tailRing);
10791  PrintLn();
10792  }
10793  #endif
10795  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10796  else
10797  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10799  {
10800  if (TEST_OPT_CONTENTSB)
10801  {
10802  number n;
10803  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
10804  if (!nIsOne(n))
10805  {
10807  denom->n=nInvers(n);
10808  denom->next=DENOMINATOR_LIST;
10809  DENOMINATOR_LIST=denom;
10810  }
10811  nDelete(&n);
10812  }
10813  else
10814  {
10815  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
10816  }
10817  }
10818  #ifdef KDEBUG
10819  if (TEST_OPT_DEBUG)
10820  {
10821  Print("to (-tailR) S[%d]:",i);
10822  p_wrp(strat->S[i],currRing,strat->tailRing);
10823  PrintLn();
10824  }
10825  #endif
10826  }
10827  if (TEST_OPT_PROT)
10828  PrintS("-");
10829  }
10830  if (TEST_OPT_PROT) PrintLn();
10831 #ifdef KDEBUG
10832  sloppy_max = FALSE;
10833 #endif
10834 }
denominator_list_s * denominator_list
Definition: kutil.h:59
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
#define TEST_OPT_CONTENTSB
Definition: options.h:125
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:88
int ak
Definition: kutil.h:351
#define TEST_OPT_DEBUG
Definition: options.h:107
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2900
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
ring tailRing
Definition: kutil.h:341
denominator_list next
Definition: kutil.h:61
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:47
int sl
Definition: kutil.h:346
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2791
char redTailChange
Definition: kutil.h:397
class sTObject TObject
Definition: kutil.h:53
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:1128

◆ createG0()

ideal createG0 ( )

Definition at line 4456 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;
4515 }
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:80
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4327
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4261
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void wrp(poly p)
Definition: polys.h:305

◆ deleteHC() [1/2]

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

Definition at line 244 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  }
317 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:521
char kHEdgeFound
Definition: kutil.h:374
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:493
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1651
char LDegLast
Definition: kutil.h:383
#define pIter(p)
Definition: monomials.h:37
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:216
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int l
Definition: cfEzgcd.cc:93
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:1128

◆ deleteHC() [2/2]

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

Definition at line 319 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);
328 }
class sLObject LObject
Definition: kutil.h:54
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ deleteInL()

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

Definition at line 1203 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)--;
1255 }
int j
Definition: facHensel.cc:105
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
class sLObject LObject
Definition: kutil.h:54
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:711
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int p
Definition: cfModGcd.cc:4019

◆ deleteInS()

void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 1096 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--;
1142 }
int j
Definition: facHensel.cc:105
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346

◆ deleteInSSba()

void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 1148 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--;
1198 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int j
Definition: facHensel.cc:105
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346

◆ enlargeL()

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

Definition at line 656 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;
664 }
class sLObject LObject
Definition: kutil.h:54
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:390
LObject * LSet
Definition: kutil.h:56
#define NULL
Definition: omList.c:12
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263

◆ enlargeT()

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

Definition at line 517 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;
536 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
TObject * TSet
Definition: kutil.h:55
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
static jList * T
Definition: janet.cc:30
class sTObject TObject
Definition: kutil.h:53

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4604 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);
4685 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:686
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define pSetExp(p, i, v)
Definition: polys.h:42
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
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:701
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:957
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:702
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:162
#define rRing_has_Comp(r)
Definition: monomials.h:266
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ enterExtendedSpolySig()

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

Definition at line 4687 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);
4801 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:686
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:358
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pGetComp(p)
Component.
Definition: polys.h:37
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL ...
Definition: coeffs.h:701
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
LObject P
Definition: kutil.h:298
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:957
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:310
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:702
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:162
#define rRing_has_Comp(r)
Definition: monomials.h:266
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int sl
Definition: kutil.h:346
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ enterL()

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

Definition at line 1260 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)++;
1278 }
class sLObject LObject
Definition: kutil.h:54
#define setmaxLinc
Definition: kutil.h:31
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:656
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:51

◆ enterOnePairLift()

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

Definition at line 2210 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  }
2412 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int c3
Definition: kutil.h:345
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case: ignore component
Definition: kutil.cc:2193
#define TRUE
Definition: auxiliary.h:98
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:666
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
int l
Definition: cfEzgcd.cc:93

◆ enterOnePairManyShifts()

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

Definition at line 12290 of file kutil.cc.

12291 {
12292  poly s = strat->S[i];
12293  assume(i<=strat->sl); // from OnePair
12294 
12295  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12296  /* that is create the pairs (f, s \dot g) */
12297 
12298  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12299  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12300 
12301  /* determine how many elements we have to insert for a given s[i] */
12302  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12303  /* hence, a total number of elt's to add is: */
12304  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12305  int toInsert = itoInsert(s, currRing);
12306 
12307 
12308  /* these vars hold for all shifts of s[i] */
12309  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12310 
12311  int qfromQ;
12312  if (strat->fromQ != NULL)
12313  {
12314  qfromQ = strat->fromQ[i];
12315  }
12316  else
12317  {
12318  qfromQ = -1;
12319  }
12320 
12321  // for the 0th shift: insert the orig. pair
12322  enterOnePairShift(s, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i);
12323 
12324  for (int j = 1; j <= toInsert; j++)
12325  {
12326  poly q = pLPCopyAndShiftLM(s, j);
12327  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i);
12328  }
12329 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
int j
Definition: facHensel.cc:105
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
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:12361
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ enterOnePairNormal()

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

Definition at line 1929 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  }
2190 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
int j
Definition: facHensel.cc:105
#define pSetm(p)
Definition: polys.h:266
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int c3
Definition: kutil.h:345
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:258
#define pLcm(a, b, m)
Definition: polys.h:290
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:666
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
int sl
Definition: kutil.h:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
int l
Definition: cfEzgcd.cc:93
Definition: nc.h:18
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ enterOnePairRing()

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

Definition at line 1326 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);
1522 }
#define pSetmComp(p)
TODO:
Definition: polys.h:268
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
const CanonicalForm int s
Definition: facAbsFact.cc:55
int j
Definition: facHensel.cc:105
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
#define pDivComp_LESS
Definition: kutil.cc:140
void PrintLn()
Definition: reporter.cc:310
#define pDivComp_EQUAL
Definition: kutil.cc:139
#define pHasNotCFRing(p1, p2)
Definition: polys.h:257
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int c3
Definition: kutil.h:345
int ksCheckCoeff(number *a, number *b)
#define pNeg(p)
Definition: polys.h:193
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:986
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pGetComp(p)
Component.
Definition: polys.h:37
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:253
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition: coeffs.h:522
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:712
int cp
Definition: kutil.h:345
#define p_Test(p, r)
Definition: p_polys.h:162
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:693
void initPairtest(kStrategy strat)
Definition: kutil.cc:666
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:148
int sl
Definition: kutil.h:346
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305
#define pDivComp_GREATER
Definition: kutil.cc:141
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ enterOnePairSelfShifts()

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

Definition at line 12337 of file kutil.cc.

12338 {
12339  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12340  /* that is create the pairs (f, s \dot g) */
12341 
12342  int toInsert = itoInsert(qq, currRing);
12343 
12344  /* these vars hold for all shifts of s[i] */
12345  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12346  int qfromQ = 0; // strat->fromQ[i];
12347 
12348  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 */
12349  for (int j = 1; j<= toInsert; j++)
12350  {
12351  poly q = pLPCopyAndShiftLM(qq, j);
12352  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1);
12353  }
12354 }
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
int j
Definition: facHensel.cc:105
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
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:12361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

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

12362 {
12363 
12364  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12365 
12366  /* check this Formats: */
12368  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12371 
12372 #ifdef KDEBUG
12373 // if (TEST_OPT_DEBUG)
12374 // {
12375 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12376 // wrp(q); // wrp(pHead(q));
12377 // PrintS(", p = ");
12378 // wrp(p); //wrp(pHead(p));
12379 // PrintLn();
12380 // }
12381 #endif
12382 
12383  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12384 
12385  int qfromQ = qisFromQ;
12386 
12387  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12388 
12389  int l,j,compare;
12390  LObject Lp;
12391  Lp.i_r = -1;
12392 
12393 #ifdef KDEBUG
12394  Lp.ecart=0; Lp.length=0;
12395 #endif
12396  /*- computes the lcm(s[i],p) -*/
12397  Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation
12398 
12399  /* apply the V criterion */
12400  if (!pIsInV(Lp.lcm))
12401  {
12402 #ifdef KDEBUG
12403  if (TEST_OPT_DEBUG)
12404  {
12405  PrintS("V crit applied to q = ");
12406  wrp(q); // wrp(pHead(q));
12407  PrintS(", p = ");
12408  wrp(p); //wrp(pHead(p));
12409  PrintLn();
12410  }
12411 #endif
12412  pLmFree(Lp.lcm);
12413  /* + counter for applying the V criterion */
12414  strat->cv++;
12415  return;
12416  }
12417 
12418  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12419  {
12420  if((!((ecartq>0)&&(ecart>0)))
12421  && pHasNotCF(p,q))
12422  {
12423  /*
12424  *the product criterion has applied for (s,p),
12425  *i.e. lcm(s,p)=product of the leading terms of s and p.
12426  *Suppose (s,r) is in L and the leading term
12427  *of p divides lcm(s,r)
12428  *(==> the leading term of p divides the leading term of r)
12429  *but the leading term of s does not divide the leading term of r
12430  *(notice that this condition is automatically satisfied if r is still
12431  *in S), then (s,r) can be cancelled.
12432  *This should be done here because the
12433  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12434  *
12435  *Moreover, skipping (s,r) holds also for the noncommutative case.
12436  */
12437  strat->cp++;
12438  pLmFree(Lp.lcm);
12439  return;
12440  }
12441  else
12442  Lp.ecart = si_max(ecart,ecartq);
12443  if (strat->fromT && (ecartq>ecart))
12444  {
12445  pLmFree(Lp.lcm);
12446  return;
12447  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12448  }
12449  /*
12450  *the set B collects the pairs of type (S[j],p)
12451  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12452  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12453  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12454  */
12455  {
12456  j = strat->Bl;
12457  loop
12458  {
12459  if (j < 0) break;
12460  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12461  if ((compare==1)
12462  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12463  {
12464  strat->c3++;
12465  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12466  {
12467  pLmFree(Lp.lcm);
12468  return;
12469  }
12470  break;
12471  }
12472  else
12473  if ((compare ==-1)
12474  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12475  {
12476  deleteInL(strat->B,&strat->Bl,j,strat);
12477  strat->c3++;
12478  }
12479  j--;
12480  }
12481  }
12482  }
12483  else /*sugarcrit*/
12484  {
12485  if (ALLOW_PROD_CRIT(strat))
12486  {
12487  // if currRing->nc_type!=quasi (or skew)
12488  // TODO: enable productCrit for super commutative algebras...
12489  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12490  pHasNotCF(p,q))
12491  {
12492  /*
12493  *the product criterion has applied for (s,p),
12494  *i.e. lcm(s,p)=product of the leading terms of s and p.
12495  *Suppose (s,r) is in L and the leading term
12496  *of p devides lcm(s,r)
12497  *(==> the leading term of p devides the leading term of r)
12498  *but the leading term of s does not devide the leading term of r
12499  *(notice that tis condition is automatically satisfied if r is still
12500  *in S), then (s,r) can be canceled.
12501  *This should be done here because the
12502  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12503  */
12504  strat->cp++;
12505  pLmFree(Lp.lcm);
12506  return;
12507  }
12508  if (strat->fromT && (ecartq>ecart))
12509  {
12510  pLmFree(Lp.lcm);
12511  return;
12512  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12513  }
12514  /*
12515  *the set B collects the pairs of type (S[j],p)
12516  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12517  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12518  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12519  */
12520  for(j = strat->Bl;j>=0;j--)
12521  {
12522  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12523  if (compare==1)
12524  {
12525  strat->c3++;
12526  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12527  {
12528  pLmFree(Lp.lcm);
12529  return;
12530  }
12531  break;
12532  }
12533  else
12534  if (compare ==-1)
12535  {
12536  deleteInL(strat->B,&strat->Bl,j,strat);
12537  strat->c3++;
12538  }
12539  }
12540  }
12541  }
12542  /*
12543  *the pair (S[i],p) enters B if the spoly != 0
12544  */
12545  /*- compute the short s-polynomial -*/
12546  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12547  pNorm(p);
12548  if ((q==NULL) || (p==NULL))
12549  return;
12550  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12551  Lp.p=NULL;
12552  else
12553  {
12554 // if ( rIsPluralRing(currRing) )
12555 // {
12556 // if(pHasNotCF(p, q))
12557 // {
12558 // if(ncRingType(currRing) == nc_lie)
12559 // {
12560 // // generalized prod-crit for lie-type
12561 // strat->cp++;
12562 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12563 // }
12564 // else
12565 // if( ALLOW_PROD_CRIT(strat) )
12566 // {
12567 // // product criterion for homogeneous case in SCA
12568 // strat->cp++;
12569 // Lp.p = NULL;
12570 // }
12571 // else
12572 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12573 // }
12574 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12575 // }
12576 // else
12577 // {
12578 
12579  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12580  /* p is already in this form, so convert q */
12581  // q = pMove2CurrTail(q, strat);
12582  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12583  // }
12584  }
12585  if (Lp.p == NULL)
12586  {
12587  /*- the case that the s-poly is 0 -*/
12588  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12589 // if (strat->pairtest==NULL) initPairtest(strat);
12590 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12591 // strat->pairtest[strat->sl+1] = TRUE;
12592 // new: visual check how often this happens: ! for the debug situation
12593 #ifdef KDEBUG
12594  Print("!");
12595  //if (TEST_OPT_DEBUG){Print("!");} // option teach
12596 #endif /* KDEBUG */
12597  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12598  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12599  /*
12600  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12601  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12602  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12603  *term of p devides the lcm(s,r)
12604  *(this canceling should be done here because
12605  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12606  *the first case is handeled in chainCrit
12607  */
12608  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12609  }
12610  else
12611  {
12612  /*- the pair (S[i],p) enters B -*/
12613  /* both of them should have their LM in currRing and TAIL in tailring */
12614  Lp.p1 = q; // already in the needed form
12615  Lp.p2 = p; // already in the needed form
12616 
12617  if ( !rIsPluralRing(currRing) )
12618  pNext(Lp.p) = strat->tail;
12619 
12620  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12621  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12622  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12623  {
12624  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12625  Lp.i_r2 = atR;
12626  }
12627  else
12628  {
12629  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12630  Lp.i_r1 = -1;
12631  Lp.i_r2 = -1;
12632  }
12633  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12634 
12636  {
12637  if (!rIsPluralRing(currRing)
12639  && (Lp.p->coef!=NULL))
12640  nDelete(&(Lp.p->coef));
12641  }
12642 
12643  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12644  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12645  }
12646 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:69
class sLObject LObject
Definition: kutil.h:54
int c3
Definition: kutil.h:345
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:711
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
int cv
Definition: kutil.h:367
int Bl
Definition: kutil.h:350
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
#define pHasNotCF(p1, p2)
Definition: polys.h:258
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:100
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305
#define pIsInV(p)
Definition: shiftop.h:50
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
int l
Definition: cfEzgcd.cc:93

◆ enterOnePairSig()

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

Definition at line 2422 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  }
2673 }
polyset sig
Definition: kutil.h:304
char fromT
Definition: kutil.h:377
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
#define pSetm(p)
Definition: polys.h:266
#define Print
Definition: emacs.cc:80
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:289
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int Bl
Definition: kutil.h:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:258
#define pLcm(a, b, m)
Definition: polys.h:290
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:291
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void pWrite(poly p)
Definition: polys.h:303
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
intset fromQ
Definition: kutil.h:317
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6283
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
int sl
Definition: kutil.h:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
#define nInit(i)
Definition: numbers.h:24
int l
Definition: cfEzgcd.cc:93
Definition: nc.h:18
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9778
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ enterOnePairSigRing()

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

Definition at line 2679 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  }
3075 }
polyset sig
Definition: kutil.h:304
const CanonicalForm int s
Definition: facAbsFact.cc:55
char fromT
Definition: kutil.h:377
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
#define pSetm(p)
Definition: polys.h:266
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
#define Print
Definition: emacs.cc:80
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:358
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:996
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int ksCheckCoeff(number *a, number *b)
#define pNeg(p)
Definition: polys.h:193
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:986
#define TRUE
Definition: auxiliary.h:98
#define pLcm(a, b, m)
Definition: polys.h:290
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:291
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void pWrite(poly p)
Definition: polys.h:303
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1965
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define nGreaterZero(n)
Definition: numbers.h:27
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
intset fromQ
Definition: kutil.h:317
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:712
int cp
Definition: kutil.h:345
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:693
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6283
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:181
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
int sl
Definition: kutil.h:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
#define nInit(i)
Definition: numbers.h:24
int l
Definition: cfEzgcd.cc:93
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
Definition: p_polys.h:1563
Definition: nc.h:18
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9778
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ enterOnePairSpecial()

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

Definition at line 3081 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  }
3145 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
#define pHasNotCF(p1, p2)
Definition: polys.h:258
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ enterOneStrongPoly()

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

Definition at line 1528 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;
1674 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
const CanonicalForm int s
Definition: facAbsFact.cc:55
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:986
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:162
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:693
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
unsigned long * sevS
Definition: kutil.h:318
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1007
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971

◆ enterOneStrongPolySig()

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

Definition at line 1734 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;
1922 }
polyset sig
Definition: kutil.h:304
const CanonicalForm int s
Definition: facAbsFact.cc:55
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:358
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:996
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define pNeg(p)
Definition: polys.h:193
int tl
Definition: kutil.h:348
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:986
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define nGreaterZero(n)
Definition: numbers.h:27
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:162
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:693
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1007
int sl
Definition: kutil.h:346
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971

◆ enterOneZeroPairRing()

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

Definition at line 4146 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  }
4254 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
#define pDivComp_EQUAL
Definition: kutil.cc:139
class sLObject LObject
Definition: kutil.h:54
int c3
Definition: kutil.h:345
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
char sugarCrit
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
FILE * f
Definition: checklibs.c:9
poly tail
Definition: kutil.h:332
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:148
int p
Definition: cfModGcd.cc:4019
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
int l
Definition: cfEzgcd.cc:93

◆ enterpairs()

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

Definition at line 4859 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  }
4877 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3769
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ enterpairsShift()

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

Definition at line 12728 of file kutil.cc.

12729 {
12730  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12731  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12732  int j=pos;
12733 
12735  initenterpairsShift(h,k,ecart,0,strat, atR);
12736  if ( (!strat->fromT)
12737  && ((strat->syzComp==0)
12738  ||(pGetComp(h)<=strat->syzComp)))
12739  {
12740  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12741  unsigned long h_sev = pGetShortExpVector(h);
12742  loop
12743  {
12744  if (j > k) break;
12745  clearS(h,h_sev, &j,&k,strat);
12746  j++;
12747  }
12748  //Print("end clearS sl=%d\n",strat->sl);
12749  }
12750  // PrintS("end enterpairs\n");
12751 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
#define assume(x)
Definition: mod2.h:390
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:12655
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ enterpairsSig()

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

Definition at line 4885 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  }
4902 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3834
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ enterpairsSpecial()

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

Definition at line 4908 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  }
4975 }
int j
Definition: facHensel.cc:105
#define FALSE
Definition: auxiliary.h:94
char noClearS
Definition: kutil.h:400
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1326
#define pGetComp(p)
Component.
Definition: polys.h:37
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:3081
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
static Poly * h
Definition: janet.cc:971

◆ enterSBba()

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

Definition at line 9261 of file kutil.cc.

9262 {
9263  strat->news = TRUE;
9264  /*- puts p to the standardbasis s at position at -*/
9265  if (strat->sl == IDELEMS(strat->Shdl)-1)
9266  {
9267  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9268  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9269  (IDELEMS(strat->Shdl)+setmaxTinc)
9270  *sizeof(unsigned long));
9271  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9272  IDELEMS(strat->Shdl)*sizeof(int),
9273  (IDELEMS(strat->Shdl)+setmaxTinc)
9274  *sizeof(int));
9275  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9276  IDELEMS(strat->Shdl)*sizeof(int),
9277  (IDELEMS(strat->Shdl)+setmaxTinc)
9278  *sizeof(int));
9279  if (strat->lenS!=NULL)
9280  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9281  IDELEMS(strat->Shdl)*sizeof(int),
9282  (IDELEMS(strat->Shdl)+setmaxTinc)
9283  *sizeof(int));
9284  if (strat->lenSw!=NULL)
9285  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9286  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9287  (IDELEMS(strat->Shdl)+setmaxTinc)
9288  *sizeof(wlen_type));
9289  if (strat->fromQ!=NULL)
9290  {
9291  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9292  IDELEMS(strat->Shdl)*sizeof(int),
9293  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9294  }
9295  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9296  IDELEMS(strat->Shdl)+=setmaxTinc;
9297  strat->Shdl->m=strat->S;
9298  }
9299  if (atS <= strat->sl)
9300  {
9301 #ifdef ENTER_USE_MEMMOVE
9302  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9303  (strat->sl - atS + 1)*sizeof(poly));
9304  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9305  (strat->sl - atS + 1)*sizeof(int));
9306  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9307  (strat->sl - atS + 1)*sizeof(unsigned long));
9308  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9309  (strat->sl - atS + 1)*sizeof(int));
9310  if (strat->lenS!=NULL)
9311  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9312  (strat->sl - atS + 1)*sizeof(int));
9313  if (strat->lenSw!=NULL)
9314  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9315  (strat->sl - atS + 1)*sizeof(wlen_type));
9316 #else
9317  for (i=strat->sl+1; i>=atS+1; i--)
9318  {
9319  strat->S[i] = strat->S[i-1];
9320  strat->ecartS[i] = strat->ecartS[i-1];
9321  strat->sevS[i] = strat->sevS[i-1];
9322  strat->S_2_R[i] = strat->S_2_R[i-1];
9323  }
9324  if (strat->lenS!=NULL)
9325  for (i=strat->sl+1; i>=atS+1; i--)
9326  strat->lenS[i] = strat->lenS[i-1];
9327  if (strat->lenSw!=NULL)
9328  for (i=strat->sl+1; i>=atS+1; i--)
9329  strat->lenSw[i] = strat->lenSw[i-1];
9330 #endif
9331  }
9332  if (strat->fromQ!=NULL)
9333  {
9334 #ifdef ENTER_USE_MEMMOVE
9335  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9336  (strat->sl - atS + 1)*sizeof(int));
9337 #else
9338  for (i=strat->sl+1; i>=atS+1; i--)
9339  {
9340  strat->fromQ[i] = strat->fromQ[i-1];
9341  }
9342 #endif
9343  strat->fromQ[atS]=0;
9344  }
9345 
9346  /*- save result -*/
9347  poly pp=p.p;
9348  strat->S[atS] = pp;
9349  if (strat->honey) strat->ecartS[atS] = p.ecart;
9350  if (p.sev == 0)
9351  p.sev = pGetShortExpVector(pp);
9352  else
9353  assume(p.sev == pGetShortExpVector(pp));
9354  strat->sevS[atS] = p.sev;
9355  strat->ecartS[atS] = p.ecart;
9356  strat->S_2_R[atS] = atR;
9357  strat->sl++;
9358 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
char news
Definition: kutil.h:398
#define TRUE
Definition: auxiliary.h:98
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
char honey
Definition: kutil.h:375
#define setmaxTinc
Definition: kutil.h:34
int * intset
Definition: kutil.h:49
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299

◆ enterSBbaShift()

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

Definition at line 9361 of file kutil.cc.

9362 {
9363  int toInsert = itoInsert(p.p, strat->tailRing);
9364  for (int i = toInsert; i > 0; i--)
9365  {
9366  LObject qq;
9367  qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order
9368  qq.shift = i;
9369  strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart
9370  enterSBba(qq, atS, strat, -1);
9371  }
9372  enterSBba(p, atS, strat, atR);
9373 }
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
class sLObject LObject
Definition: kutil.h:54
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int i
Definition: cfEzgcd.cc:125
ring tailRing
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ enterSMora()

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

Definition at line 1270 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  }
1316 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char kHEdgeFound
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:107
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:468
char posInLOldFlag
Definition: kutil.h:380
void updateL(kStrategy strat)
Definition: kstd1.cc:1039
int lastAxis
Definition: kutil.h:354
#define TEST_OPT_FINDET
Definition: options.h:110
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:925
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1110
void reorderL(kStrategy strat)
Definition: kstd1.cc:867
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
#define NULL
Definition: omList.c:12
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1203
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char posInLDependsOnLength
Definition: kutil.h:387
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10841
int p
Definition: cfModGcd.cc:4019
#define TEST_OPT_FASTHC
Definition: options.h:108
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ enterSMoraNF()

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

Definition at line 1324 of file kstd1.cc.

1325 {
1326  enterSBba(p, atS, strat, atR);
1327  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;
1332 }
char kHEdgeFound
Definition: kutil.h:374
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:98
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:468
#define NULL
Definition: omList.c:12
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10841
int p
Definition: cfModGcd.cc:4019
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ enterSSba()

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

Definition at line 9380 of file kutil.cc.

9381 {
9382  strat->news = TRUE;
9383  /*- puts p to the standardbasis s at position at -*/
9384  if (strat->sl == IDELEMS(strat->Shdl)-1)
9385  {
9386  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9387  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9388  (IDELEMS(strat->Shdl)+setmax)
9389  *sizeof(unsigned long));
9390  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9391  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9392  (IDELEMS(strat->Shdl)+setmax)
9393  *sizeof(unsigned long));
9394  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9395  IDELEMS(strat->Shdl)*sizeof(int),
9396  (IDELEMS(strat->Shdl)+setmax)
9397  *sizeof(int));
9398  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9399  IDELEMS(strat->Shdl)*sizeof(int),
9400  (IDELEMS(strat->Shdl)+setmax)
9401  *sizeof(int));
9402  if (strat->lenS!=NULL)
9403  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9404  IDELEMS(strat->Shdl)*sizeof(int),
9405  (IDELEMS(strat->Shdl)+setmax)
9406  *sizeof(int));
9407  if (strat->lenSw!=NULL)
9408  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9409  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9410  (IDELEMS(strat->Shdl)+setmax)
9411  *sizeof(wlen_type));
9412  if (strat->fromQ!=NULL)
9413  {
9414  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9415  IDELEMS(strat->Shdl)*sizeof(int),
9416  (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
9417  }
9418  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
9419  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmax);
9420  IDELEMS(strat->Shdl)+=setmax;
9421  strat->Shdl->m=strat->S;
9422  }
9423  // in a signature-based algorithm the following situation will never
9424  // appear due to the fact that the critical pairs are already sorted
9425  // by increasing signature.
9426  // True. However, in the case of integers we need to put the element
9427  // that caused the signature drop on the first position
9428  if (atS <= strat->sl)
9429  {
9430 #ifdef ENTER_USE_MEMMOVE
9431  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9432  (strat->sl - atS + 1)*sizeof(poly));
9433  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9434  (strat->sl - atS + 1)*sizeof(poly));
9435  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9436  (strat->sl - atS + 1)*sizeof(unsigned long));
9437  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9438  (strat->sl - atS + 1)*sizeof(int));
9439  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9440  (strat->sl - atS + 1)*sizeof(unsigned long));
9441  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9442  (strat->sl - atS + 1)*sizeof(int));
9443  if (strat->lenS!=NULL)
9444  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9445  (strat->sl - atS + 1)*sizeof(int));
9446  if (strat->lenSw!=NULL)
9447  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9448  (strat->sl - atS + 1)*sizeof(wlen_type));
9449 #else
9450  for (i=strat->sl+1; i>=atS+1; i--)
9451  {
9452  strat->S[i] = strat->S[i-1];
9453  strat->ecartS[i] = strat->ecartS[i-1];
9454  strat->sevS[i] = strat->sevS[i-1];
9455  strat->S_2_R[i] = strat->S_2_R[i-1];
9456  strat->sig[i] = strat->sig[i-1];
9457  strat->sevSig[i] = strat->sevSig[i-1];
9458  }
9459  if (strat->lenS!=NULL)
9460  for (i=strat->sl+1; i>=atS+1; i--)
9461  strat->lenS[i] = strat->lenS[i-1];
9462  if (strat->lenSw!=NULL)
9463  for (i=strat->sl+1; i>=atS+1; i--)
9464  strat->lenSw[i] = strat->lenSw[i-1];
9465 #endif
9466  }
9467  if (strat->fromQ!=NULL)
9468  {
9469 #ifdef ENTER_USE_MEMMOVE
9470  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9471  (strat->sl - atS + 1)*sizeof(int));
9472 #else
9473  for (i=strat->sl+1; i>=atS+1; i--)
9474  {
9475  strat->fromQ[i] = strat->fromQ[i-1];
9476  }
9477 #endif
9478  strat->fromQ[atS]=0;
9479  }
9480 
9481  /*- save result -*/
9482  strat->S[atS] = p.p;
9483  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9484  if (strat->honey) strat->ecartS[atS] = p.ecart;
9485  if (p.sev == 0)
9486  p.sev = pGetShortExpVector(p.p);
9487  else
9488  assume(p.sev == pGetShortExpVector(p.p));
9489  strat->sevS[atS] = p.sev;
9490  // during the interreduction process of a signature-based algorithm we do not
9491  // compute the signature at this point, but when the whole interreduction
9492  // process finishes, i.e. f5c terminates!
9493  if (p.sig != NULL)
9494  {
9495  if (p.sevSig == 0)
9496  p.sevSig = pGetShortExpVector(p.sig);
9497  else
9498  assume(p.sevSig == pGetShortExpVector(p.sig));
9499  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9500  }
9501  strat->ecartS[atS] = p.ecart;
9502  strat->S_2_R[atS] = atR;
9503  strat->sl++;
9504 #ifdef DEBUGF5
9505  int k;
9506  Print("--- LIST S: %d ---\n",strat->sl);
9507  for(k=0;k<=strat->sl;k++)
9508  {
9509  pWrite(strat->sig[k]);
9510  }
9511  PrintS("--- LIST S END ---\n");
9512 #endif
9513 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:80
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
char news
Definition: kutil.h:398
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:29
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
char honey
Definition: kutil.h:375
int * intset
Definition: kutil.h:49
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299

◆ enterSyz()

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

Definition at line 9778 of file kutil.cc.

9779 {
9780  int i;
9781  strat->newt = TRUE;
9782  if (strat->syzl == strat->syzmax-1)
9783  {
9784  pEnlargeSet(&strat->syz,strat->syzmax,setmax);
9785  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9786  (strat->syzmax)*sizeof(unsigned long),
9787  ((strat->syzmax)+setmax)
9788  *sizeof(unsigned long));
9789  strat->syzmax += setmax;
9790  }
9791  if (atT < strat->syzl)
9792  {
9793 #ifdef ENTER_USE_MEMMOVE
9794  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9795  (strat->syzl-atT+1)*sizeof(poly));
9796  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9797  (strat->syzl-atT+1)*sizeof(unsigned long));
9798 #endif
9799  for (i=strat->syzl; i>=atT+1; i--)
9800  {
9801 #ifndef ENTER_USE_MEMMOVE
9802  strat->syz[i] = strat->syz[i-1];
9803  strat->sevSyz[i] = strat->sevSyz[i-1];
9804 #endif
9805  }
9806  }
9807  //i = strat->syzl;
9808  i = atT;
9809  //Makes sure the syz saves just the signature
9810  #ifdef HAVE_RINGS
9812  pNext(p.sig) = NULL;
9813  #endif
9814  strat->syz[atT] = p.sig;
9815  strat->sevSyz[atT] = p.sevSig;
9816  strat->syzl++;
9817 #if F5DEBUG
9818  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9819  pWrite(strat->syz[atT]);
9820 #endif
9821  // recheck pairs in strat->L with new rule and delete correspondingly
9822  int cc = strat->Ll;
9823  while (cc>-1)
9824  {
9825  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9826  //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);
9827  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9828  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9829  #ifdef HAVE_RINGS
9830  &&((!rField_is_Ring(currRing))
9831  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9832  #endif
9833  )
9834  {
9835  //printf("\nYES!\n");
9836  deleteInL(strat->L,&strat->Ll,cc,strat);
9837  }
9838  cc--;
9839  }
9840 //#if 1
9841 #ifdef DEBUGF5
9842  PrintS("--- Syzygies ---\n");
9843  Print("syzl %d\n",strat->syzl);
9844  Print("syzmax %d\n",strat->syzmax);
9845  PrintS("--------------------------------\n");
9846  for(i=0;i<=strat->syzl-1;i++)
9847  {
9848  Print("%d - ",i);
9849  pWrite(strat->syz[i]);
9850  }
9851  PrintS("--------------------------------\n");
9852 #endif
9853 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:80
int syzmax
Definition: kutil.h:347
int Ll
Definition: kutil.h:349
char newt
Definition: kutil.h:399
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:29
void pWrite(poly p)
Definition: polys.h:303
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int p
Definition: cfModGcd.cc:4019
int syzl
Definition: kutil.h:347

◆ enterT()

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

Definition at line 9576 of file kutil.cc.

9577 {
9578  int i;
9579 
9580 #ifdef PDEBUG
9581 #ifdef HAVE_SHIFTBBA
9582  if (currRing->isLPring && p.shift > 0)
9583  {
9584  // in this case, the order is not correct. test LM and tail separately
9585  p_LmTest(p.p, currRing);
9586  p_Test(pNext(p.p), currRing);
9587  }
9588  else
9589 #endif
9590  {
9591  pp_Test(p.p, currRing, p.tailRing);
9592  }
9593 #endif
9594  assume(strat->tailRing == p.tailRing);
9595  // redMoraNF complains about this -- but, we don't really
9596  // neeed this so far
9597  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9598  assume(p.FDeg == p.pFDeg());
9599  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9600 
9601 #ifdef KDEBUG
9602  // do not put an LObject twice into T:
9603  for(i=strat->tl;i>=0;i--)
9604  {
9605  if (p.p==strat->T[i].p)
9606  {
9607  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9608  return;
9609  }
9610  }
9611 #endif
9612 
9613 #ifdef HAVE_TAIL_RING
9614  if (currRing!=strat->tailRing)
9615  {
9616  p.t_p=p.GetLmTailRing();
9617  }
9618 #endif
9619  strat->newt = TRUE;
9620  if (atT < 0)
9621  atT = strat->posInT(strat->T, strat->tl, p);
9622  if (strat->tl == strat->tmax-1)
9623  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9624  if (atT <= strat->tl)
9625  {
9626 #ifdef ENTER_USE_MEMMOVE
9627  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9628  (strat->tl-atT+1)*sizeof(TObject));
9629  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9630  (strat->tl-atT+1)*sizeof(unsigned long));
9631 #endif
9632  for (i=strat->tl+1; i>=atT+1; i--)
9633  {
9634 #ifndef ENTER_USE_MEMMOVE
9635  strat->T[i] = strat->T[i-1];
9636  strat->sevT[i] = strat->sevT[i-1];
9637 #endif
9638  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9639  }
9640  }
9641 
9642  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9643  {
9644 #ifdef HAVE_SHIFTBBA
9645  // letterplace: if p.shift > 0 then pNext(p.p) is already in the tailBin
9646  if (!(currRing->isLPring && p.shift > 0))
9647 #endif
9648  {
9650  (strat->tailRing != NULL ?
9651  strat->tailRing : currRing),
9652  strat->tailBin);
9653  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9654  }
9655  }
9656  strat->T[atT] = (TObject) p;
9657  //printf("\nenterT: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9658 
9659  if (pNext(p.p) != NULL)
9660  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9661  else
9662  strat->T[atT].max_exp = NULL;
9663 
9664  strat->tl++;
9665  strat->R[strat->tl] = &(strat->T[atT]);
9666  strat->T[atT].i_r = strat->tl;
9667  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9668  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9669  kTest_T(&(strat->T[atT]));
9670 }
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
char newt
Definition: kutil.h:399
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:517
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:883
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define p_LmTest(p, r)
Definition: p_polys.h:163
int tmax
Definition: kutil.h:348
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:655
class sTObject TObject
Definition: kutil.h:53
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:1128

◆ enterT_strong()

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

Definition at line 9676 of file kutil.cc.

9677 {
9679  int i;
9680 
9681  pp_Test(p.p, currRing, p.tailRing);
9682  assume(strat->tailRing == p.tailRing);
9683  // redMoraNF complains about this -- but, we don't really
9684  // neeed this so far
9685  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9686  assume(p.FDeg == p.pFDeg());
9687  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9688 
9689 #ifdef KDEBUG
9690  // do not put an LObject twice into T:
9691  for(i=strat->tl;i>=0;i--)
9692  {
9693  if (p.p==strat->T[i].p)
9694  {
9695  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9696  return;
9697  }
9698  }
9699 #endif
9700 
9701 #ifdef HAVE_TAIL_RING
9702  if (currRing!=strat->tailRing)
9703  {
9704  p.t_p=p.GetLmTailRing();
9705  }
9706 #endif
9707  strat->newt = TRUE;
9708  if (atT < 0)
9709  atT = strat->posInT(strat->T, strat->tl, p);
9710  if (strat->tl == strat->tmax-1)
9711  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9712  if (atT <= strat->tl)
9713  {
9714 #ifdef ENTER_USE_MEMMOVE
9715  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9716  (strat->tl-atT+1)*sizeof(TObject));
9717  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9718  (strat->tl-atT+1)*sizeof(unsigned long));
9719 #endif
9720  for (i=strat->tl+1; i>=atT+1; i--)
9721  {
9722 #ifndef ENTER_USE_MEMMOVE
9723  strat->T[i] = strat->T[i-1];
9724  strat->sevT[i] = strat->sevT[i-1];
9725 #endif
9726  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9727  }
9728  }
9729 
9730  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9731  {
9733  (strat->tailRing != NULL ?
9734  strat->tailRing : currRing),
9735  strat->tailBin);
9736  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9737  }
9738  strat->T[atT] = (TObject) p;
9739  //printf("\nenterT_strong: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9740 
9741  if (pNext(p.p) != NULL)
9742  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9743  else
9744  strat->T[atT].max_exp = NULL;
9745 
9746  strat->tl++;
9747  strat->R[strat->tl] = &(strat->T[atT]);
9748  strat->T[atT].i_r = strat->tl;
9749  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9750  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9751  #if 1
9753  && !n_IsUnit(p.p->coef, currRing->cf))
9754  {
9755  for(i=strat->tl;i>=0;i--)
9756  {
9757  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9758  {
9759  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9760  }
9761  }
9762  }
9763  /*
9764  printf("\nThis is T:\n");
9765  for(i=strat->tl;i>=0;i--)
9766  {
9767  pWrite(strat->T[i].p);
9768  }
9769  //getchar();*/
9770  #endif
9771  kTest_T(&(strat->T[atT]));
9772 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
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:515
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
char newt
Definition: kutil.h:399
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:517
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:883
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
int tmax
Definition: kutil.h:348
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1528
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:655
class sTObject TObject
Definition: kutil.h:53
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:1128

◆ enterTShift()

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

Definition at line 12759 of file kutil.cc.

12760 {
12761  /* determine how many elements we have to insert */
12762  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12763  /* hence, a total number of elt's to add is: */
12764  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12765  pAssume(p.p != NULL);
12766 
12767  int toInsert = itoInsert(p.p, strat->tailRing);
12768 
12769  for (int i = 1; i <= toInsert; i++)
12770  {
12771  LObject qq;
12772  qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order
12773  qq.shift = i;
12774  strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart
12775 
12776  enterT(qq, strat, atT); // enterT is modified, so it doesn't copy and delete the tail of shifted polys
12777  }
12778 }
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
class sLObject LObject
Definition: kutil.h:54
#define pAssume(cond)
Definition: monomials.h:90
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10274 of file kutil.cc.

10275 {
10276  /*- release temp data -*/
10277  cleanT(strat);
10278  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10279  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10280  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10281  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10282  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10283  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10284  /*- set L: should be empty -*/
10285  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10286  /*- set B: should be empty -*/
10287  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10288  pLmFree(&strat->tail);
10289  strat->syzComp=0;
10290 }
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:133
int Bmax
Definition: kutil.h:350
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:538
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
unsigned long * sevS
Definition: kutil.h:318
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:53

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10467 of file kutil.cc.

10468 {
10469  /*- release temp data -*/
10471  cleanTSbaRing(strat);
10472  else
10473  cleanT(strat);
10474  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10475  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10476  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10477  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10478  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10479  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10480  if(strat->syzmax>0)
10481  {
10482  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10483  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10484  if (strat->sbaOrder == 1)
10485  {
10486  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10487  }
10488  }
10489  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10490  /*- set L: should be empty -*/
10491  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10492  /*- set B: should be empty -*/
10493  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10494  /*- set sig: no need for the signatures anymore -*/
10495  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10496  pLmDelete(&strat->tail);
10497  strat->syzComp=0;
10498 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int syzComp
Definition: kutil.h:352
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void cleanTSbaRing(kStrategy strat)
Definition: kutil.cc:597
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:133
int Bmax
Definition: kutil.h:350
unsigned sbaOrder
Definition: kutil.h:312
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
void cleanT(kStrategy strat)
Definition: kutil.cc:538
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
int syzidxmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:53
intset syzIdx
Definition: kutil.h:309

◆ faugereRewCriterion()

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

Definition at line 7129 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;
7167 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
int nrrewcrit
Definition: kutil.h:360
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346

◆ finalReduceByMon()

void finalReduceByMon ( kStrategy  strat)

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

Definition at line 11292 of file kutil.cc.

11293 {
11294  assume(strat->tl<0); /* can only be called with no elements in T:
11295  i.e. after exitBuchMora */
11296  /* do not use strat->S, strat->sl as they may be out of sync*/
11297  if(!nCoeff_is_Z(currRing->cf))
11298  return;
11299  poly p,pp;
11300  for(int j = 0; j<IDELEMS(strat->Shdl); j++)
11301  {
11302  if((strat->Shdl->m[j]!=NULL)&&(pNext(strat->Shdl->m[j]) == NULL))
11303  {
11304  for(int i = 0; i<IDELEMS(strat->Shdl); i++)
11305  {
11306  if((i != j) && (strat->Shdl->m[i] != NULL))
11307  {
11308  p = strat->Shdl->m[i];
11309  while((p!=NULL) && pLmDivisibleBy(strat->Shdl->m[j], p))
11310  {
11311  number dummy = n_IntMod(p->coef, strat->Shdl->m[j]->coef, currRing->cf);
11312  if (!nEqual(dummy,p->coef))
11313  {
11314  if (nIsZero(dummy))
11315  {
11316  nDelete(&dummy);
11317  pLmDelete(&strat->Shdl->m[i]);
11318  p=strat->Shdl->m[i];
11319  }
11320  else
11321  {
11322  p_SetCoeff(p,dummy,currRing);
11323  break;
11324  }
11325  }
11326  else
11327  {
11328  nDelete(&dummy);
11329  break;
11330  }
11331  }
11332  if (p!=NULL)
11333  {
11334  pp = pNext(p);
11335  while(pp != NULL)
11336  {
11337  if(pLmDivisibleBy(strat->Shdl->m[j], pp))
11338  {
11339  number dummy = n_IntMod(pp->coef, strat->Shdl->m[j]->coef, currRing->cf);
11340  if (!nEqual(dummy,pp->coef))
11341  {
11342  p_SetCoeff(pp,dummy,currRing);
11343  if(nIsZero(pp->coef))
11344  {
11345  pLmDelete(&pNext(p));
11346  pp = pNext(p);
11347  }
11348  else
11349  {
11350  p = pp;
11351  pp = pNext(p);
11352  }
11353  }
11354  else
11355  {
11356  nDelete(&dummy);
11357  p = pp;
11358  pp = pNext(p);
11359  }
11360  }
11361  else
11362  {
11363  p = pp;
11364  pp = pNext(p);
11365  }
11366  }
11367  }
11368  }
11369  }
11370  //idPrint(strat->Shdl);
11371  }
11372  }
11373  idSkipZeroes(strat->Shdl);
11374 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:628
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define nEqual(n1, n2)
Definition: numbers.h:20
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299

◆ getIndexRng()

int getIndexRng ( long  coeff)
inline

Definition at line 6524 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;
6535 }

◆ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 468 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;
498 }
#define pIsPurePower(p)
Definition: polys.h:243
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:374
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:515
#define FALSE
Definition: auxiliary.h:94
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ ind2()

long ind2 ( long  arg)

Definition at line 4111 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;
4121 }

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4123 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;
4134 }
long ind2(long arg)
Definition: kutil.cc:4111

◆ initBuchMora()

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

Definition at line 10198 of file kutil.cc.

10199 {
10200  strat->interpt = BTEST1(OPT_INTERRUPT);
10201  strat->kHEdge=NULL;
10203  /*- creating temp data structures------------------- -*/
10204  strat->cp = 0;
10205  strat->c3 = 0;
10206  strat->tail = pInit();
10207  /*- set s -*/
10208  strat->sl = -1;
10209  /*- set L -*/
10210  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10211  strat->Ll = -1;
10212  strat->L = initL(strat->Lmax);
10213  /*- set B -*/
10214  strat->Bmax = setmaxL;
10215  strat->Bl = -1;
10216  strat->B = initL();
10217  /*- set T -*/
10218  strat->tl = -1;
10219  strat->tmax = setmaxT;
10220  strat->T = initT();
10221  strat->R = initR();
10222  strat->sevT = initsevT();
10223  /*- init local data struct.---------------------------------------- -*/
10224  strat->P.ecart=0;
10225  strat->P.length=0;
10226  strat->P.pLength=0;
10228  {
10229  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10230  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10231  }
10233  {
10234  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10235  }
10236  else
10237  {
10238  if(TEST_OPT_SB_1)
10239  {
10240  int i;
10241  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10242  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10243  {
10244  P->m[i-strat->newIdeal] = F->m[i];
10245  F->m[i] = NULL;
10246  }
10247  initSSpecial(F,Q,P,strat);
10248  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10249  {
10250  F->m[i] = P->m[i-strat->newIdeal];
10251  P->m[i-strat->newIdeal] = NULL;
10252  }
10253  idDelete(&P);
10254  }
10255  else
10256  {
10257  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10258  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10259  }
10260  }
10261  strat->fromT = FALSE;
10263  if ((!TEST_OPT_SB_1)
10264  || (rField_is_Ring(currRing))
10265  )
10266  {
10267  updateS(TRUE,strat);
10268  }
10269  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10270  strat->fromQ=NULL;
10271  assume(kTest_TS(strat));
10272 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define TEST_OPT_REDTAIL
Definition: options.h:115
KINLINE TObject ** initR()
Definition: kInline.h:95
char fromT
Definition: kutil.h:377
char kHEdgeFound
Definition: kutil.h:374
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
int c3
Definition: kutil.h:345
char interpt
Definition: kutil.h:369
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8169
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:31
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8571
#define setmaxT
Definition: kutil.h:33
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define TEST_OPT_SB_1
Definition: options.h:117
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9034
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9874 of file kutil.cc.

9875 {
9877  strat->chainCrit=chainCritNormal;
9878  if (TEST_OPT_SB_1)
9879  strat->chainCrit=chainCritOpt_1;
9880 #ifdef HAVE_RINGS
9881  if (rField_is_Ring(currRing))
9882  {
9884  strat->chainCrit=chainCritRing;
9885  }
9886 #endif
9887 #ifdef HAVE_RATGRING
9888  if (rIsRatGRing(currRing))
9889  {
9890  strat->chainCrit=chainCritPart;
9891  /* enterOnePairNormal get rational part in it */
9892  }
9893 #endif
9894  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9895  && (!rIsPluralRing(currRing)))
9897 
9898  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9899  strat->Gebauer = strat->homog || strat->sugarCrit;
9900  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9901  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9902  strat->pairtest = NULL;
9903  /* alway use tailreduction, except:
9904  * - in local rings, - in lex order case, -in ring over extensions */
9906  //if(rHasMixedOrdering(currRing)==2)
9907  //{
9908  // strat->noTailReduction =TRUE;
9909  //}
9910 
9911 #ifdef HAVE_PLURAL
9912  // and r is plural_ring
9913  // hence this holds for r a rational_plural_ring
9914  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9915  { //or it has non-quasi-comm type... later
9916  strat->sugarCrit = FALSE;
9917  strat->Gebauer = FALSE;
9918  strat->honey = FALSE;
9919  }
9920 #endif
9921 
9922  // Coefficient ring?
9923  if (rField_is_Ring(currRing))
9924  {
9925  strat->sugarCrit = FALSE;
9926  strat->Gebauer = FALSE ;
9927  strat->honey = FALSE;
9928  }
9929  #ifdef KDEBUG
9930  if (TEST_OPT_DEBUG)
9931  {
9932  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9933  else PrintS("ideal/module is not homogeneous\n");
9934  }
9935  #endif
9936 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3192
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2210
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
BOOLEAN * pairtest
Definition: kutil.h:331
#define TEST_OPT_DEBUG
Definition: options.h:107
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1326
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1929
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
char sugarCrit
Definition: kutil.h:375
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3956
#define TEST_OPT_NOT_SUGAR
Definition: options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
void PrintS(const char *s)
Definition: reporter.cc:284
#define TEST_OPT_SUGARCRIT
Definition: options.h:106
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:370
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
char z2homog
Definition: kutil.h:372
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
#define TEST_OPT_SB_1
Definition: options.h:117
static bool rIsSCA(const ring r)
Definition: nc.h:190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3405
char Gebauer
Definition: kutil.h:376
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 10025 of file kutil.cc.

10026 {
10028  {
10029  if (strat->honey)
10030  {
10031  strat->posInL = posInL15;
10032  // ok -- here is the deal: from my experiments for Singular-2-0
10033  // I conclude that that posInT_EcartpLength is the best of
10034  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10035  // see the table at the end of this file
10036  if (TEST_OPT_OLDSTD)
10037  strat->posInT = posInT15;
10038  else
10039  strat->posInT = posInT_EcartpLength;
10040  }
10041  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10042  {
10043  strat->posInL = posInL11;
10044  strat->posInT = posInT11;
10045  }
10046  else if (TEST_OPT_INTSTRATEGY)
10047  {
10048  strat->posInL = posInL11;
10049  strat->posInT = posInT11;
10050  }
10051  else
10052  {
10053  strat->posInL = posInL0;
10054  strat->posInT = posInT0;
10055  }
10056  //if (strat->minim>0) strat->posInL =posInLSpecial;
10057  if (strat->homog)
10058  {
10059  strat->posInL = posInL110;
10060  strat->posInT = posInT110;
10061  }
10062  }
10063  else
10064  {
10065  if (strat->homog)
10066  {
10067  strat->posInL = posInL11;
10068  strat->posInT = posInT11;
10069  }
10070  else
10071  {
10072  if ((currRing->order[0]==ringorder_c)
10073  ||(currRing->order[0]==ringorder_C))
10074  {
10075  strat->posInL = posInL17_c;
10076  strat->posInT = posInT17_c;
10077  }
10078  else
10079  {
10080  strat->posInL = posInL17;
10081  strat->posInT = posInT17;
10082  }
10083  }
10084  }
10085  if (strat->minim>0) strat->posInL =posInLSpecial;
10086  // for further tests only
10087  if ((BTEST1(11)) || (BTEST1(12)))
10088  strat->posInL = posInL11;
10089  else if ((BTEST1(13)) || (BTEST1(14)))
10090  strat->posInL = posInL13;
10091  else if ((BTEST1(15)) || (BTEST1(16)))
10092  strat->posInL = posInL15;
10093  else if ((BTEST1(17)) || (BTEST1(18)))
10094  strat->posInL = posInL17;
10095  if (BTEST1(11))
10096  strat->posInT = posInT11;
10097  else if (BTEST1(13))
10098  strat->posInT = posInT13;
10099  else if (BTEST1(15))
10100  strat->posInT = posInT15;
10101  else if ((BTEST1(17)))
10102  strat->posInT = posInT17;
10103  else if ((BTEST1(19)))
10104  strat->posInT = posInT19;
10105  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10106  strat->posInT = posInT1;
10108 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
#define BTEST1(a)
Definition: options.h:34
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:10009
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
char homog
Definition: kutil.h:370
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
char posInLDependsOnLength
Definition: kutil.h:387
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10111 of file kutil.cc.

10112 {
10114  {
10115  if (strat->honey)
10116  {
10117  strat->posInL = posInL15Ring;
10118  // ok -- here is the deal: from my experiments for Singular-2-0
10119  // I conclude that that posInT_EcartpLength is the best of
10120  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10121  // see the table at the end of this file
10122  if (TEST_OPT_OLDSTD)
10123  strat->posInT = posInT15Ring;
10124  else
10125  strat->posInT = posInT_EcartpLength;
10126  }
10127  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10128  {
10129  strat->posInL = posInL11Ring;
10130  strat->posInT = posInT11;
10131  }
10132  else if (TEST_OPT_INTSTRATEGY)
10133  {
10134  strat->posInL = posInL11Ring;
10135  strat->posInT = posInT11;
10136  }
10137  else
10138  {
10139  strat->posInL = posInL0Ring;
10140  strat->posInT = posInT0;
10141  }
10142  //if (strat->minim>0) strat->posInL =posInLSpecial;
10143  if (strat->homog)
10144  {
10145  strat->posInL = posInL110Ring;
10146  strat->posInT = posInT110Ring;
10147  }
10148  }
10149  else
10150  {
10151  if (strat->homog)
10152  {
10153  //printf("\nHere 3\n");
10154  strat->posInL = posInL11Ring;
10155  strat->posInT = posInT11Ring;
10156  }
10157  else
10158  {
10159  if ((currRing->order[0]==ringorder_c)
10160  ||(currRing->order[0]==ringorder_C))
10161  {
10162  strat->posInL = posInL17_cRing;
10163  strat->posInT = posInT17_cRing;
10164  }
10165  else
10166  {
10167  strat->posInL = posInL11Ringls;
10168  strat->posInT = posInT17Ring;
10169  }
10170  }
10171  }
10172  if (strat->minim>0) strat->posInL =posInLSpecial;
10173  // for further tests only
10174  if ((BTEST1(11)) || (BTEST1(12)))
10175  strat->posInL = posInL11Ring;
10176  else if ((BTEST1(13)) || (BTEST1(14)))
10177  strat->posInL = posInL13;
10178  else if ((BTEST1(15)) || (BTEST1(16)))
10179  strat->posInL = posInL15Ring;
10180  else if ((BTEST1(17)) || (BTEST1(18)))
10181  strat->posInL = posInL17Ring;
10182  if (BTEST1(11))
10183  strat->posInT = posInT11Ring;
10184  else if (BTEST1(13))
10185  strat->posInT = posInT13;
10186  else if (BTEST1(15))
10187  strat->posInT = posInT15Ring;
10188  else if ((BTEST1(17)))
10189  strat->posInT = posInT17Ring;
10190  else if ((BTEST1(19)))
10191  strat->posInT = posInT19;
10192  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10193  strat->posInT = posInT1;
10195 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6779
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6864
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6662
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
#define BTEST1(a)
Definition: options.h:34
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6978
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:10009
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5792
char homog
Definition: kutil.h:370
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5521
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6091
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
char posInLDependsOnLength
Definition: kutil.h:387
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5899
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568

◆ initBuchMoraShift()

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

Definition at line 12211 of file kutil.cc.

12212 {
12213  strat->interpt = BTEST1(OPT_INTERRUPT);
12214  strat->kHEdge=NULL;
12216  /*- creating temp data structures------------------- -*/
12217  strat->cp = 0;
12218  strat->c3 = 0;
12219  strat->cv = 0;
12220  strat->tail = pInit();
12221  /*- set s -*/
12222  strat->sl = -1;
12223  /*- set L -*/
12224  strat->Lmax = setmaxL;
12225  strat->Ll = -1;
12226  strat->L = initL();
12227  /*- set B -*/
12228  strat->Bmax = setmaxL;
12229  strat->Bl = -1;
12230  strat->B = initL();
12231  /*- set T -*/
12232  strat->tl = -1;
12233  strat->tmax = setmaxT;
12234  strat->T = initT();
12235  strat->R = initR();
12236  strat->sevT = initsevT();
12237  /*- init local data struct.---------------------------------------- -*/
12238  strat->P.ecart=0;
12239  strat->P.length=0;
12241  {
12242  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12243  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12244  }
12246  {
12247  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12248  }
12249  {
12250  if(TEST_OPT_SB_1)
12251  {
12252  int i;
12253  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12254  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12255  {
12256  P->m[i-strat->newIdeal] = F->m[i];
12257  F->m[i] = NULL;
12258  }
12259  initSSpecial(F,Q,P,strat);
12260  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12261  {
12262  F->m[i] = P->m[i-strat->newIdeal];
12263  P->m[i-strat->newIdeal] = NULL;
12264  }
12265  idDelete(&P);
12266  }
12267  else
12268  {
12269  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12270  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12271  }
12272  }
12273  strat->fromT = FALSE;
12274  if (!TEST_OPT_SB_1)
12275  {
12276  /* the only change: we do not fill the set T*/
12277  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12278  }
12279  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12280  strat->fromQ=NULL;
12281  /* more changes: fill the set T with all the shifts of elts of S*/
12282  /* is done by other procedure */
12283 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
KINLINE TObject ** initR()
Definition: kInline.h:95
char fromT
Definition: kutil.h:377
char kHEdgeFound
Definition: kutil.h:374
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:345
char interpt
Definition: kutil.h:369
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:367
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8169
#define BTEST1(a)
Definition: options.h:34
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8571
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define TEST_OPT_SB_1
Definition: options.h:117
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9034
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ initec()

static intset initec ( const int  maxnr)
inlinestatic

Definition at line 503 of file kutil.cc.

504 {
505  return (intset)omAlloc(maxnr*sizeof(int));
506 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * intset
Definition: kutil.h:49

◆ initEcartBBA()

void initEcartBBA ( TObject h)

Definition at line 1292 of file kutil.cc.

1293 {
1294  h->FDeg = h->pFDeg();
1295  (*h).ecart = 0;
1296  h->length=h->pLength=pLength(h->p);
1297 }
static unsigned pLength(poly a)
Definition: p_polys.h:191
static Poly * h
Definition: janet.cc:971

◆ initEcartNormal()

void initEcartNormal ( TObject h)

Definition at line 1284 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);
1290 }
static unsigned pLength(poly a)
Definition: p_polys.h:191
static Poly * h
Definition: janet.cc:971

◆ initEcartPairBba()

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

Definition at line 1299 of file kutil.cc.

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

◆ initEcartPairMora()

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

Definition at line 1306 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;
1312 }
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:379
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12

◆ initenterpairs()

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

Definition at line 3769 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  }
3827 }
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define pGetComp(p)
Component.
Definition: polys.h:37
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
intset fromQ
Definition: kutil.h:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initenterpairsShift()

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

Definition at line 12655 of file kutil.cc.

12656 {
12657  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12658  // atR = -1;
12659  if ((strat->syzComp==0)
12660  || (pGetComp(h)<=strat->syzComp))
12661  {
12662  int j;
12663  BOOLEAN new_pair=FALSE;
12664 
12665  if (pGetComp(h)==0)
12666  {
12667  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12668  if ((isFromQ)&&(strat->fromQ!=NULL))
12669  {
12670  for (j=0; j<=k; j++)
12671  {
12672  if (!strat->fromQ[j])
12673  {
12674  new_pair=TRUE;
12675  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR);
12676  // other side pairs:
12677  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR);
12678  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12679  }
12680  }
12681  }
12682  else
12683  {
12684  new_pair=TRUE;
12685  for (j=0; j<=k; j++)
12686  {
12687  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR);
12688  // other side pairs
12689  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR);
12690  }
12691  /* HERE we put (h, s*h) pairs */
12692  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
12693  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR);
12694  }
12695  }
12696  else
12697  {
12698  for (j=0; j<=k; j++)
12699  {
12700  if ((pGetComp(h)==pGetComp(strat->S[j]))
12701  || (pGetComp(strat->S[j])==0))
12702  {
12703  new_pair=TRUE;
12704  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR);
12705  // other side pairs
12706  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR);
12707  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12708  }
12709  }
12710  /* HERE we put (h, s*h) pairs */
12711  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR);
12712  }
12713 
12714  if (new_pair)
12715  {
12716  strat->chainCrit(h,ecart,strat);
12717  }
12718  kMergeBintoL(strat);
12719  }
12720 }
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int)
Definition: kutil.cc:12337
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define pGetComp(p)
Component.
Definition: polys.h:37
intset fromQ
Definition: kutil.h:317
static void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:12290
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:12
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85

◆ initenterpairsSig()

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

Definition at line 3834 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  }
3892 }
static void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2422
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define pGetComp(p)
Component.
Definition: polys.h:37
intset fromQ
Definition: kutil.h:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initenterpairsSigRing()

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

Definition at line 3894 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  }
3950 }
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
bool sigdrop
Definition: kutil.h:358
int k
Definition: cfEzgcd.cc:92
static void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2679
#define pGetComp(p)
Component.
Definition: polys.h:37
intset fromQ
Definition: kutil.h:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initenterstrongPairs()

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

Definition at line 4522 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  }
4575 }
int j
Definition: facHensel.cc:105
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pGetComp(p)
Component.
Definition: polys.h:37
intset fromQ
Definition: kutil.h:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:12
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1528
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initenterstrongPairsSig()

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

Definition at line 4577 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  }
4597 }
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
bool sigdrop
Definition: kutil.h:358
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:92
static BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
Definition: kutil.cc:1734
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pGetComp(p)
Component.
Definition: polys.h:37
polyset S
Definition: kutil.h:302
static Poly * h
Definition: janet.cc:971

◆ initenterzeropairsRing()

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

Definition at line 4390 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) );
4450 }
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:80
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4327
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4261
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:547
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
void enterOneZeroPairRing(poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:4146
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
long ind_fact_2(long arg)
Definition: kutil.cc:4123
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long ind2(long arg)
Definition: kutil.cc:4111
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305

◆ initHilbCrit()

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

Definition at line 9856 of file kutil.cc.

9857 {
9858 
9859  //if the ordering is local, then hilb criterion
9860  //can be used also if the ideal is not homogenous
9862  {
9864  *hilb=NULL;
9865  else
9866  return;
9867  }
9868  if (strat->homog!=isHomog)
9869  {
9870  *hilb=NULL;
9871  }
9872 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define FALSE
Definition: auxiliary.h:94
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
char homog
Definition: kutil.h:370
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12

◆ initPairtest()

void initPairtest ( kStrategy  strat)

Definition at line 666 of file kutil.cc.

667 {
668  strat->pairtest = (BOOLEAN *)omAlloc0((strat->sl+2)*sizeof(BOOLEAN));
669 }
BOOLEAN * pairtest
Definition: kutil.h:331
int sl
Definition: kutil.h:346
int BOOLEAN
Definition: auxiliary.h:85
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initS()

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

Definition at line 8075 of file kutil.cc.

8076 {
8077  int i,pos;
8078 
8079  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8080  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8081  strat->ecartS=initec(i);
8082  strat->sevS=initsevS(i);
8083  strat->S_2_R=initS_2_R(i);
8084  strat->fromQ=NULL;
8085  strat->Shdl=idInit(i,F->rank);
8086  strat->S=strat->Shdl->m;
8087  /*- put polys into S -*/
8088  if (Q!=NULL)
8089  {
8090  strat->fromQ=initec(i);
8091  memset(strat->fromQ,0,i*sizeof(int));
8092  for (i=0; i<IDELEMS(Q); i++)
8093  {
8094  if (Q->m[i]!=NULL)
8095  {
8096  LObject h;
8097  h.p = pCopy(Q->m[i]);
8099  {
8100  h.pCleardenom(); // also does remove Content
8101  }
8102  else
8103  {
8104  h.pNorm();
8105  }
8107  {
8108  deleteHC(&h, strat);
8109  }
8110  if (h.p!=NULL)
8111  {
8112  strat->initEcart(&h);
8113  if (strat->sl==-1)
8114  pos =0;
8115  else
8116  {
8117  pos = posInS(strat,strat->sl,h.p,h.ecart);
8118  }
8119  h.sev = pGetShortExpVector(h.p);
8120  strat->enterS(h,pos,strat,-1);
8121  strat->fromQ[pos]=1;
8122  }
8123  }
8124  }
8125  }
8126  for (i=0; i<IDELEMS(F); i++)
8127  {
8128  if (F->m[i]!=NULL)
8129  {
8130  LObject h;
8131  h.p = pCopy(F->m[i]);
8133  {
8134  cancelunit(&h); /*- tries to cancel a unit -*/
8135  deleteHC(&h, strat);
8136  }
8137  if (h.p!=NULL)
8138  // do not rely on the input being a SB!
8139  {
8141  {
8142  h.pCleardenom(); // also does remove Content
8143  }
8144  else
8145  {
8146  h.pNorm();
8147  }
8148  strat->initEcart(&h);
8149  if (strat->sl==-1)
8150  pos =0;
8151  else
8152  pos = posInS(strat,strat->sl,h.p,h.ecart);
8153  h.sev = pGetShortExpVector(h.p);
8154  strat->enterS(h,pos,strat,-1);
8155  }
8156  }
8157  }
8158  /*- test, if a unit is in F -*/
8159  if ((strat->sl>=0)
8160 #ifdef HAVE_RINGS
8161  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8162 #endif
8163  && pIsConstant(strat->S[0]))
8164  {
8165  while (strat->sl>0) deleteInS(strat->sl,strat);
8166  }
8167 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
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:515
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initS_2_R()

static int* initS_2_R ( const int  maxnr)
inlinestatic

Definition at line 512 of file kutil.cc.

513 {
514  return (int*)omAlloc0(maxnr*sizeof(int));
515 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSbaBuchMora()

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

Definition at line 10394 of file kutil.cc.

10395 {
10396  strat->interpt = BTEST1(OPT_INTERRUPT);
10397  strat->kHEdge=NULL;
10399  /*- creating temp data structures------------------- -*/
10400  strat->cp = 0;
10401  strat->c3 = 0;
10402  strat->tail = pInit();
10403  /*- set s -*/
10404  strat->sl = -1;
10405  /*- set ps -*/
10406  strat->syzl = -1;
10407  /*- set L -*/
10408  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10409  strat->Ll = -1;
10410  strat->L = initL(strat->Lmax);
10411  /*- set B -*/
10412  strat->Bmax = setmaxL;
10413  strat->Bl = -1;
10414  strat->B = initL();
10415  /*- set T -*/
10416  strat->tl = -1;
10417  strat->tmax = setmaxT;
10418  strat->T = initT();
10419  strat->R = initR();
10420  strat->sevT = initsevT();
10421  /*- init local data struct.---------------------------------------- -*/
10422  strat->P.ecart=0;
10423  strat->P.length=0;
10425  {
10426  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10427  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10428  }
10430  {
10431  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10432  }
10433  else
10434  {
10435  if(TEST_OPT_SB_1)
10436  {
10437  int i;
10438  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10439  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10440  {
10441  P->m[i-strat->newIdeal] = F->m[i];
10442  F->m[i] = NULL;
10443  }
10444  initSSpecialSba(F,Q,P,strat);
10445  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10446  {
10447  F->m[i] = P->m[i-strat->newIdeal];
10448  P->m[i-strat->newIdeal] = NULL;
10449  }
10450  idDelete(&P);
10451  }
10452  else
10453  {
10454  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10455  }
10456  }
10457  strat->fromT = FALSE;
10458  if (!TEST_OPT_SB_1)
10459  {
10460  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10461  }
10462  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10463  //strat->fromQ=NULL;
10464  assume(kTest_TS(strat));
10465 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
KINLINE TObject ** initR()
Definition: kInline.h:95
char fromT
Definition: kutil.h:377
char kHEdgeFound
Definition: kutil.h:374
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:345
char interpt
Definition: kutil.h:369
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8715
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:31
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8266
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
#define setmaxT
Definition: kutil.h:33
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define TEST_OPT_SB_1
Definition: options.h:117
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9034
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
int newIdeal
Definition: kutil.h:355
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int syzl
Definition: kutil.h:347

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9938 of file kutil.cc.

9939 {
9940  //strat->enterOnePair=enterOnePairNormal;
9942  //strat->chainCrit=chainCritNormal;
9943  strat->chainCrit = chainCritSig;
9944  /******************************************
9945  * rewCrit1 and rewCrit2 are already set in
9946  * kSba() in kstd1.cc
9947  *****************************************/
9948  //strat->rewCrit1 = faugereRewCriterion;
9949  if (strat->sbaOrder == 1)
9950  {
9951  strat->syzCrit = syzCriterionInc;
9952  }
9953  else
9954  {
9955  strat->syzCrit = syzCriterion;
9956  }
9957 #ifdef HAVE_RINGS
9958  if (rField_is_Ring(currRing))
9959  {
9961  strat->chainCrit=chainCritRing;
9962  }
9963 #endif
9964 #ifdef HAVE_RATGRING
9965  if (rIsRatGRing(currRing))
9966  {
9967  strat->chainCrit=chainCritPart;
9968  /* enterOnePairNormal get rational part in it */
9969  }
9970 #endif
9971 
9972  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9973  strat->Gebauer = strat->homog || strat->sugarCrit;
9974  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9975  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9976  strat->pairtest = NULL;
9977  /* alway use tailreduction, except:
9978  * - in local rings, - in lex order case, -in ring over extensions */
9981 
9982 #ifdef HAVE_PLURAL
9983  // and r is plural_ring
9984  // hence this holds for r a rational_plural_ring
9985  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9986  { //or it has non-quasi-comm type... later
9987  strat->sugarCrit = FALSE;
9988  strat->Gebauer = FALSE;
9989  strat->honey = FALSE;
9990  }
9991 #endif
9992 
9993  // Coefficient ring?
9994  if (rField_is_Ring(currRing))
9995  {
9996  strat->sugarCrit = FALSE;
9997  strat->Gebauer = FALSE ;
9998  strat->honey = FALSE;
9999  }
10000  #ifdef KDEBUG
10001  if (TEST_OPT_DEBUG)
10002  {
10003  if (strat->homog) PrintS("ideal/module is homogeneous\n");
10004  else PrintS("ideal/module is not homogeneous\n");
10005  }
10006  #endif
10007 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
BOOLEAN * pairtest
Definition: kutil.h:331
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:107
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1326
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3421
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1929
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
char sugarCrit
Definition: kutil.h:375
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3956
#define TEST_OPT_NOT_SUGAR
Definition: options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
unsigned sbaOrder
Definition: kutil.h:312
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7045
#define TEST_OPT_SUGARCRIT
Definition: options.h:106
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7080
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:370
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
char z2homog
Definition: kutil.h:372
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static bool rIsSCA(const ring r)
Definition: nc.h:190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
char Gebauer
Definition: kutil.h:376
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10292 of file kutil.cc.

10293 {
10295  {
10296  if (strat->honey)
10297  {
10298  strat->posInL = posInL15;
10299  // ok -- here is the deal: from my experiments for Singular-2-0
10300  // I conclude that that posInT_EcartpLength is the best of
10301  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10302  // see the table at the end of this file
10303  if (TEST_OPT_OLDSTD)
10304  strat->posInT = posInT15;
10305  else
10306  strat->posInT = posInT_EcartpLength;
10307  }
10308  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10309  {
10310  strat->posInL = posInL11;
10311  strat->posInT = posInT11;
10312  }
10313  else if (TEST_OPT_INTSTRATEGY)
10314  {
10315  strat->posInL = posInL11;
10316  strat->posInT = posInT11;
10317  }
10318  else
10319  {
10320  strat->posInL = posInL0;
10321  strat->posInT = posInT0;
10322  }
10323  //if (strat->minim>0) strat->posInL =posInLSpecial;
10324  if (strat->homog)
10325  {
10326  strat->posInL = posInL110;
10327  strat->posInT = posInT110;
10328  }
10329  }
10330  else
10331  {
10332  if (strat->homog)
10333  {
10334  strat->posInL = posInL11;
10335  strat->posInT = posInT11;
10336  }
10337  else
10338  {
10339  if ((currRing->order[0]==ringorder_c)
10340  ||(currRing->order[0]==ringorder_C))
10341  {
10342  strat->posInL = posInL17_c;
10343  strat->posInT = posInT17_c;
10344  }
10345  else
10346  {
10347  strat->posInL = posInL17;
10348  strat->posInT = posInT17;
10349  }
10350  }
10351  }
10352  if (strat->minim>0) strat->posInL =posInLSpecial;
10353  // for further tests only
10354  if ((BTEST1(11)) || (BTEST1(12)))
10355  strat->posInL = posInL11;
10356  else if ((BTEST1(13)) || (BTEST1(14)))
10357  strat->posInL = posInL13;
10358  else if ((BTEST1(15)) || (BTEST1(16)))
10359  strat->posInL = posInL15;
10360  else if ((BTEST1(17)) || (BTEST1(18)))
10361  strat->posInL = posInL17;
10362  if (BTEST1(11))
10363  strat->posInT = posInT11;
10364  else if (BTEST1(13))
10365  strat->posInT = posInT13;
10366  else if (BTEST1(15))
10367  strat->posInT = posInT15;
10368  else if ((BTEST1(17)))
10369  strat->posInT = posInT17;
10370  else if ((BTEST1(19)))
10371  strat->posInT = posInT19;
10372  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10373  strat->posInT = posInT1;
10374  if (rField_is_Ring(currRing))
10375  {
10376  strat->posInL = posInL11Ring;
10377  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10378  strat->posInL = posInL11Ringls;
10379  strat->posInT = posInT11;
10380  }
10381  strat->posInLDependsOnLength = FALSE;
10382  strat->posInLSba = posInLSig;
10383  //strat->posInL = posInLSig;
10384  strat->posInL = posInLF5C;
10385  /*
10386  if (rField_is_Ring(currRing))
10387  {
10388  strat->posInLSba = posInLSigRing;
10389  strat->posInL = posInL11Ring;
10390  }*/
10391  //strat->posInT = posInTSig;
10392 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6311
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6123
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
char homog
Definition: kutil.h:370
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
char posInLDependsOnLength
Definition: kutil.h:387
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568

◆ initsevS()

static unsigned long* initsevS ( const int  maxnr)
inlinestatic

Definition at line 508 of file kutil.cc.

509 {
510  return (unsigned long*)omAlloc0(maxnr*sizeof(unsigned long));
511 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSL()

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

Definition at line 8169 of file kutil.cc.

8170 {
8171  int i,pos;
8172 
8173  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8174  else i=setmaxT;
8175  strat->ecartS=initec(i);
8176  strat->sevS=initsevS(i);
8177  strat->S_2_R=initS_2_R(i);
8178  strat->fromQ=NULL;
8179  strat->Shdl=idInit(i,F->rank);
8180  strat->S=strat->Shdl->m;
8181  /*- put polys into S -*/
8182  if (Q!=NULL)
8183  {
8184  strat->fromQ=initec(i);
8185  memset(strat->fromQ,0,i*sizeof(int));
8186  for (i=0; i<IDELEMS(Q); i++)
8187  {
8188  if (Q->m[i]!=NULL)
8189  {
8190  LObject h;
8191  h.p = pCopy(Q->m[i]);
8193  {
8194  deleteHC(&h,strat);
8195  }
8197  {
8198  h.pCleardenom(); // also does remove Content
8199  }
8200  else
8201  {
8202  h.pNorm();
8203  }
8204  if (h.p!=NULL)
8205  {
8206  strat->initEcart(&h);
8207  if (strat->sl==-1)
8208  pos =0;
8209  else
8210  {
8211  pos = posInS(strat,strat->sl,h.p,h.ecart);
8212  }
8213  h.sev = pGetShortExpVector(h.p);
8214  strat->enterS(h,pos,strat,-1);
8215  strat->fromQ[pos]=1;
8216  }
8217  }
8218  }
8219  }
8220  for (i=0; i<IDELEMS(F); i++)
8221  {
8222  if (F->m[i]!=NULL)
8223  {
8224  LObject h;
8225  h.p = pCopy(F->m[i]);
8226  if (h.p!=NULL)
8227  {
8229  {
8230  cancelunit(&h); /*- tries to cancel a unit -*/
8231  deleteHC(&h, strat);
8232  }
8233  if (h.p!=NULL)
8234  {
8236  {
8237  h.pCleardenom(); // also does remove Content
8238  }
8239  else
8240  {
8241  h.pNorm();
8242  }
8243  strat->initEcart(&h);
8244  if (strat->Ll==-1)
8245  pos =0;
8246  else
8247  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8248  h.sev = pGetShortExpVector(h.p);
8249  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8250  }
8251  }
8252  }
8253  }
8254  /*- test, if a unit is in F -*/
8255 
8256  if ((strat->Ll>=0)
8257 #ifdef HAVE_RINGS
8258  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8259 #endif
8260  && pIsConstant(strat->L[strat->Ll].p))
8261  {
8262  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8263  }
8264 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSLSba()

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

Definition at line 8266 of file kutil.cc.

8267 {
8268  int i,pos;
8269  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8270  else i=setmaxT;
8271  strat->ecartS = initec(i);
8272  strat->sevS = initsevS(i);
8273  strat->sevSig = initsevS(i);
8274  strat->S_2_R = initS_2_R(i);
8275  strat->fromQ = NULL;
8276  strat->Shdl = idInit(i,F->rank);
8277  strat->S = strat->Shdl->m;
8278  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8279  if (strat->sbaOrder != 1)
8280  {
8281  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8282  strat->sevSyz = initsevS(i);
8283  strat->syzmax = i;
8284  strat->syzl = 0;
8285  }
8286  /*- put polys into S -*/
8287  if (Q!=NULL)
8288  {
8289  strat->fromQ=initec(i);
8290  memset(strat->fromQ,0,i*sizeof(int));
8291  for (i=0; i<IDELEMS(Q); i++)
8292  {
8293  if (Q->m[i]!=NULL)
8294  {
8295  LObject h;
8296  h.p = pCopy(Q->m[i]);
8298  {
8299  deleteHC(&h,strat);
8300  }
8302  {
8303  h.pCleardenom(); // also does remove Content
8304  }
8305  else
8306  {
8307  h.pNorm();
8308  }
8309  if (h.p!=NULL)
8310  {
8311  strat->initEcart(&h);
8312  if (strat->sl==-1)
8313  pos =0;
8314  else
8315  {
8316  pos = posInS(strat,strat->sl,h.p,h.ecart);
8317  }
8318  h.sev = pGetShortExpVector(h.p);
8319  strat->enterS(h,pos,strat,-1);
8320  strat->fromQ[pos]=1;
8321  }
8322  }
8323  }
8324  }
8325  for (i=0; i<IDELEMS(F); i++)
8326  {
8327  if (F->m[i]!=NULL)
8328  {
8329  LObject h;
8330  h.p = pCopy(F->m[i]);
8331  h.sig = pOne();
8332  //h.sig = pInit();
8333  //p_SetCoeff(h.sig,nInit(1),currRing);
8334  p_SetComp(h.sig,i+1,currRing);
8335  // if we are working with the Schreyer order we generate it
8336  // by multiplying the initial signatures with the leading monomial
8337  // of the corresponding initial polynomials generating the ideal
8338  // => we can keep the underlying monomial order and get a Schreyer
8339  // order without any bigger overhead
8340  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8341  {
8342  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8343  }
8344  h.sevSig = pGetShortExpVector(h.sig);
8345 #ifdef DEBUGF5
8346  pWrite(h.p);
8347  pWrite(h.sig);
8348 #endif
8349  if (h.p!=NULL)
8350  {
8352  {
8353  cancelunit(&h); /*- tries to cancel a unit -*/
8354  deleteHC(&h, strat);
8355  }
8356  if (h.p!=NULL)
8357  {
8359  {
8360  h.pCleardenom(); // also does remove Content
8361  }
8362  else
8363  {
8364  h.pNorm();
8365  }
8366  strat->initEcart(&h);
8367  if (strat->Ll==-1)
8368  pos =0;
8369  else
8370  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8371  h.sev = pGetShortExpVector(h.p);
8372  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8373  }
8374  }
8375  /*
8376  if (strat->sbaOrder != 1)
8377  {
8378  for(j=0;j<i;j++)
8379  {
8380  strat->syz[ctr] = pCopy(F->m[j]);
8381  p_SetCompP(strat->syz[ctr],i+1,currRing);
8382  // add LM(F->m[i]) to the signature to get a Schreyer order
8383  // without changing the underlying polynomial ring at all
8384  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8385  // since p_Add_q() destroys all input
8386  // data we need to recreate help
8387  // each time
8388  poly help = pCopy(F->m[i]);
8389  p_SetCompP(help,j+1,currRing);
8390  pWrite(strat->syz[ctr]);
8391  pWrite(help);
8392  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8393  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8394  printf("%d. SYZ ",ctr);
8395  pWrite(strat->syz[ctr]);
8396  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8397  ctr++;
8398  }
8399  strat->syzl = ps;
8400  }
8401  */
8402  }
8403  }
8404  /*- test, if a unit is in F -*/
8405 
8406  if ((strat->Ll>=0)
8407 #ifdef HAVE_RINGS
8408  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8409 #endif
8410  && pIsConstant(strat->L[strat->Ll].p))
8411  {
8412  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8413  }
8414 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
int syzmax
Definition: kutil.h:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
void pWrite(poly p)
Definition: polys.h:303
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:34
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
int syzl
Definition: kutil.h:347
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSSpecial()

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

Definition at line 8571 of file kutil.cc.

8572 {
8573  int i,pos;
8574 
8575  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8576  else i=setmaxT;
8577  i=((i+IDELEMS(F)+IDELEMS(P)+setmax-1)/setmax)*setmax;
8578  strat->ecartS=initec(i);
8579  strat->sevS=initsevS(i);
8580  strat->S_2_R=initS_2_R(i);
8581  strat->fromQ=NULL;
8582  strat->Shdl=idInit(i,F->rank);
8583  strat->S=strat->Shdl->m;
8584 
8585  /*- put polys into S -*/
8586  if (Q!=NULL)
8587  {
8588  strat->fromQ=initec(i);
8589  memset(strat->fromQ,0,i*sizeof(int));
8590  for (i=0; i<IDELEMS(Q); i++)
8591  {
8592  if (Q->m[i]!=NULL)
8593  {
8594  LObject h;
8595  h.p = pCopy(Q->m[i]);
8596  //if (TEST_OPT_INTSTRATEGY)
8597  //{
8598  // h.pCleardenom(); // also does remove Content
8599  //}
8600  //else
8601  //{
8602  // h.pNorm();
8603  //}
8605  {
8606  deleteHC(&h,strat);
8607  }
8608  if (h.p!=NULL)
8609  {
8610  strat->initEcart(&h);
8611  if (strat->sl==-1)
8612  pos =0;
8613  else
8614  {
8615  pos = posInS(strat,strat->sl,h.p,h.ecart);
8616  }
8617  h.sev = pGetShortExpVector(h.p);
8618  strat->enterS(h,pos,strat, strat->tl+1);
8619  enterT(h, strat);
8620  strat->fromQ[pos]=1;
8621  }
8622  }
8623  }
8624  }
8625  /*- put polys into S -*/
8626  for (i=0; i<IDELEMS(F); i++)
8627  {
8628  if (F->m[i]!=NULL)
8629  {
8630  LObject h;
8631  h.p = pCopy(F->m[i]);
8633  {
8634  deleteHC(&h,strat);
8635  }
8636  else if (TEST_OPT_REDTAIL || TEST_OPT_REDSB)
8637  {
8638  h.p=redtailBba(h.p,strat->sl,strat);
8639  }
8640  if (h.p!=NULL)
8641  {
8642  strat->initEcart(&h);
8643  if (strat->sl==-1)
8644  pos =0;
8645  else
8646  pos = posInS(strat,strat->sl,h.p,h.ecart);
8647  h.sev = pGetShortExpVector(h.p);
8648  strat->enterS(h,pos,strat, strat->tl+1);
8649  enterT(h,strat);
8650  }
8651  }
8652  }
8653  for (i=0; i<IDELEMS(P); i++)
8654  {
8655  if (P->m[i]!=NULL)
8656  {
8657  LObject h;
8658  h.p=pCopy(P->m[i]);
8660  {
8661  h.pCleardenom();
8662  }
8663  else
8664  {
8665  h.pNorm();
8666  }
8667  if(strat->sl>=0)
8668  {
8670  {
8671  h.p=redBba(h.p,strat->sl,strat);
8672  if ((h.p!=NULL)&&(TEST_OPT_REDTAIL || TEST_OPT_REDSB))
8673  {
8674  h.p=redtailBba(h.p,strat->sl,strat);
8675  }
8676  }
8677  else
8678  {
8679  h.p=redMora(h.p,strat->sl,strat);
8680  }
8681  if(h.p!=NULL)
8682  {
8683  strat->initEcart(&h);
8685  {
8686  h.pCleardenom();
8687  }
8688  else
8689  {
8690  h.is_normalized = 0;
8691  h.pNorm();
8692  }
8693  h.sev = pGetShortExpVector(h.p);
8694  h.SetpFDeg();
8695  pos = posInS(strat,strat->sl,h.p,h.ecart);
8696  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8697  strat->enterS(h,pos,strat, strat->tl+1);
8698  enterT(h,strat);
8699  }
8700  }
8701  else
8702  {
8703  h.sev = pGetShortExpVector(h.p);
8704  strat->initEcart(&h);
8705  strat->enterS(h,0,strat, strat->tl+1);
8706  enterT(h,strat);
8707  }
8708  }
8709  }
8710 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define TEST_OPT_REDTAIL
Definition: options.h:115
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4908
#define TEST_OPT_REDSB
Definition: options.h:103
#define setmax
Definition: kutil.h:29
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8965
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8989
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSSpecialSba()

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

Definition at line 8715 of file kutil.cc.

8716 {
8717  int i,pos;
8718 
8719  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8720  else i=setmaxT;
8721  i=((i+IDELEMS(F)+IDELEMS(P)+setmax-1)/setmax)*setmax;
8722  strat->sevS=initsevS(i);
8723  strat->sevSig=initsevS(i);
8724  strat->S_2_R=initS_2_R(i);
8725  strat->fromQ=NULL;
8726  strat->Shdl=idInit(i,F->rank);
8727  strat->S=strat->Shdl->m;
8728  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
8729  /*- put polys into S -*/
8730  if (Q!=NULL)
8731  {
8732  strat->fromQ=initec(i);
8733  memset(strat->fromQ,0,i*sizeof(int));
8734  for (i=0; i<IDELEMS(Q); i++)
8735  {
8736  if (Q->m[i]!=NULL)
8737  {
8738  LObject h;
8739  h.p = pCopy(Q->m[i]);
8740  //if (TEST_OPT_INTSTRATEGY)
8741  //{
8742  // h.pCleardenom(); // also does remove Content
8743  //}
8744  //else
8745  //{
8746  // h.pNorm();
8747  //}
8749  {
8750  deleteHC(&h,strat);
8751  }
8752  if (h.p!=NULL)
8753  {
8754  strat->initEcart(&h);
8755  if (strat->sl==-1)
8756  pos =0;
8757  else
8758  {
8759  pos = posInS(strat,strat->sl,h.p,h.ecart);
8760  }
8761  h.sev = pGetShortExpVector(h.p);
8762  strat->enterS(h,pos,strat, strat->tl+1);
8763  enterT(h, strat);
8764  strat->fromQ[pos]=1;
8765  }
8766  }
8767  }
8768  }
8769  /*- put polys into S -*/
8770  for (i=0; i<IDELEMS(F); i++)
8771  {
8772  if (F->m[i]!=NULL)
8773  {
8774  LObject h;
8775  h.p = pCopy(F->m[i]);
8777  {
8778  deleteHC(&h,strat);
8779  }
8780  else if (TEST_OPT_REDTAIL || TEST_OPT_REDSB)
8781  {
8782  h.p=redtailBba(h.p,strat->sl,strat);
8783  }
8784  if (h.p!=NULL)
8785  {
8786  strat->initEcart(&h);
8787  if (strat->sl==-1)
8788  pos =0;
8789  else
8790  pos = posInS(strat,strat->sl,h.p,h.ecart);
8791  h.sev = pGetShortExpVector(h.p);
8792  strat->enterS(h,pos,strat, strat->tl+1);
8793  enterT(h,strat);
8794  }
8795  }
8796  }
8797  for (i=0; i<IDELEMS(P); i++)
8798  {
8799  if (P->m[i]!=NULL)
8800  {
8801  LObject h;
8802  h.p=pCopy(P->m[i]);
8804  {
8805  h.pCleardenom();
8806  }
8807  else
8808  {
8809  h.pNorm();
8810  }
8811  if(strat->sl>=0)
8812  {
8814  {
8815  h.p=redBba(h.p,strat->sl,strat);
8816  if ((h.p!=NULL)&&(TEST_OPT_REDTAIL || TEST_OPT_REDSB))
8817  {
8818  h.p=redtailBba(h.p,strat->sl,strat);
8819  }
8820  }
8821  else
8822  {
8823  h.p=redMora(h.p,strat->sl,strat);
8824  }
8825  if(h.p!=NULL)
8826  {
8827  strat->initEcart(&h);
8829  {
8830  h.pCleardenom();
8831  }
8832  else
8833  {
8834  h.is_normalized = 0;
8835  h.pNorm();
8836  }
8837  h.sev = pGetShortExpVector(h.p);
8838  h.SetpFDeg();
8839  pos = posInS(strat,strat->sl,h.p,h.ecart);
8840  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8841  strat->enterS(h,pos,strat, strat->tl+1);
8842  enterT(h,strat);
8843  }
8844  }
8845  else
8846  {
8847  h.sev = pGetShortExpVector(h.p);
8848  strat->initEcart(&h);
8849  strat->enterS(h,0,strat, strat->tl+1);
8850  enterT(h,strat);
8851  }
8852  }
8853  }
8854 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define TEST_OPT_REDTAIL
Definition: options.h:115
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4908
#define TEST_OPT_REDSB
Definition: options.h:103
#define setmax
Definition: kutil.h:29
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8965
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8989
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8416 of file kutil.cc.

8417 {
8418  if( strat->S[0] )
8419  {
8420  if( strat->S[1] && !rField_is_Ring(currRing))
8421  {
8422  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8423  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8424  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8425  }
8426  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8427  /************************************************************
8428  * computing the length of the syzygy array needed
8429  ***********************************************************/
8430  for(i=1; i<=strat->sl; i++)
8431  {
8432  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8433  {
8434  ps += i;
8435  }
8436  }
8437  ps += strat->sl+1;
8438  //comp = pGetComp (strat->P.sig);
8439  comp = strat->currIdx;
8440  strat->syzIdx = initec(comp);
8441  strat->sevSyz = initsevS(ps);
8442  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8443  strat->syzmax = ps;
8444  strat->syzl = 0;
8445  strat->syzidxmax = comp;
8446 #if defined(DEBUGF5) || defined(DEBUGF51)
8447  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8448 #endif
8449  i = 1;
8450  j = 0;
8451  /************************************************************
8452  * generating the leading terms of the principal syzygies
8453  ***********************************************************/
8454  while (i <= strat->sl)
8455  {
8456  /**********************************************************
8457  * principal syzygies start with component index 2
8458  * the array syzIdx starts with index 0
8459  * => the rules for a signature with component comp start
8460  * at strat->syz[strat->syzIdx[comp-2]] !
8461  *********************************************************/
8462  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8463  {
8464  comp = pGetComp(strat->sig[i]);
8465  comp_old = pGetComp(strat->sig[i-1]);
8466  diff = comp - comp_old - 1;
8467  // diff should be zero, but sometimes also the initial generating
8468  // elements of the input ideal reduce to zero. then there is an
8469  // index-gap between the signatures. for these inbetween signatures we
8470  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8471  // in the following.
8472  // doing this, we keep the relation "j = comp - 2" alive, which makes
8473  // jumps way easier when checking criteria
8474  while (diff>0)
8475  {
8476  strat->syzIdx[j] = 0;
8477  diff--;
8478  j++;
8479  }
8480  strat->syzIdx[j] = ctr;
8481  j++;
8482  LObject Q;
8483  int pos;
8484  for (k = 0; k<i; k++)
8485  {
8486  Q.sig = pOne();
8488  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8489  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8490  p_SetCompP (Q.sig, comp, currRing);
8491  poly q = p_One(currRing);
8493  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8494  p_ExpVectorCopy(q,strat->S[i],currRing);
8495  q = p_Neg (q, currRing);
8496  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8497  Q.sig = p_Add_q (Q.sig, q, currRing);
8498  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8499  pos = posInSyz(strat, Q.sig);
8500  enterSyz(Q, strat, pos);
8501  ctr++;
8502  }
8503  }
8504  i++;
8505  }
8506  /**************************************************************
8507  * add syzygies for upcoming first element of new iteration step
8508  **************************************************************/
8509  comp = strat->currIdx;
8510  comp_old = pGetComp(strat->sig[i-1]);
8511  diff = comp - comp_old - 1;
8512  // diff should be zero, but sometimes also the initial generating
8513  // elements of the input ideal reduce to zero. then there is an
8514  // index-gap between the signatures. for these inbetween signatures we
8515  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8516  // in the following.
8517  // doing this, we keep the relation "j = comp - 2" alive, which makes
8518  // jumps way easier when checking criteria
8519  while (diff>0)
8520  {
8521  strat->syzIdx[j] = 0;
8522  diff--;
8523  j++;
8524  }
8525  strat->syzIdx[j] = ctr;
8526  LObject Q;
8527  int pos;
8528  for (k = 0; k<strat->sl+1; k++)
8529  {
8530  Q.sig = pOne();
8532  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8533  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8534  p_SetCompP (Q.sig, comp, currRing);
8535  poly q = p_One(currRing);
8537  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8538  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8539  q = p_Neg (q, currRing);
8540  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8541  Q.sig = p_Add_q (Q.sig, q, currRing);
8542  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8543  pos = posInSyz(strat, Q.sig);
8544  enterSyz(Q, strat, pos);
8545  ctr++;
8546  }
8547 //#if 1
8548 #ifdef DEBUGF5
8549  PrintS("Principal syzygies:\n");
8550  Print("syzl %d\n",strat->syzl);
8551  Print("syzmax %d\n",strat->syzmax);
8552  Print("ps %d\n",ps);
8553  PrintS("--------------------------------\n");
8554  for(i=0;i<=strat->syzl-1;i++)
8555  {
8556  Print("%d - ",i);
8557  pWrite(strat->syz[i]);
8558  }
8559  for(i=0;i<strat->currIdx;i++)
8560  {
8561  Print("%d - %d\n",i,strat->syzIdx[i]);
8562  }
8563  PrintS("--------------------------------\n");
8564 #endif
8565  }
8566 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
polyset sig
Definition: kutil.h:304
int j
Definition: facHensel.cc:105
static gmp_float * diff
Definition: mpr_complex.cc:45
#define Print
Definition: emacs.cc:80
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
int currIdx
Definition: kutil.h:313
#define pGetComp(p)
Component.
Definition: polys.h:37
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:253
poly p_One(const ring r)
Definition: p_polys.cc:1303
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1248
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6283
int syzidxmax
Definition: kutil.h:347
#define nCopy(n)
Definition: numbers.h:15
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
#define p_GetCoeff(p, r)
Definition: monomials.h:50
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
int syzl
Definition: kutil.h:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9778
intset syzIdx
Definition: kutil.h:309

◆ isInPairsetB()

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

Definition at line 696 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  }
709 }
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
LSet B
Definition: kutil.h:324
int p
Definition: cfModGcd.cc:4019

◆ isInPairsetL()

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

Definition at line 675 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  }
689 }
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
LSet L
Definition: kutil.h:323
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ kCheckSpolyCreation()

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

Definition at line 10905 of file kutil.cc.

10906 {
10907  if (strat->overflow) return FALSE;
10908  assume(L->p1 != NULL && L->p2 != NULL);
10909  // shift changes: from 0 to -1
10910  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10911  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10912  assume(strat->tailRing != currRing);
10913 
10914  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10915  return FALSE;
10916  // shift changes: extra case inserted
10917  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10918  {
10919  return TRUE;
10920  }
10921  poly p1_max=NULL;
10922  if (L->i_r1>=0) p1_max = (strat->R[L->i_r1])->max_exp;
10923  poly p2_max=NULL;
10924  if (L->i_r2>=0) p2_max = (strat->R[L->i_r2])->max_exp;
10925 
10926  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10927  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10928  {
10929  p_LmFree(m1, strat->tailRing);
10930  p_LmFree(m2, strat->tailRing);
10931  m1 = NULL;
10932  m2 = NULL;
10933  return FALSE;
10934  }
10935  return TRUE;
10936 }
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
#define assume(x)
Definition: mod2.h:390
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12

◆ kCheckStrongCreation()

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

Definition at line 10945 of file kutil.cc.

10946 {
10947  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10948  //assume(strat->tailRing != currRing);
10949 
10950  poly p1_max = (strat->R[atR])->max_exp;
10951  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10952 
10953  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10954  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10955  {
10956  return FALSE;
10957  }
10958  return TRUE;
10959 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:390
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341

◆ kCreateZeroPoly()

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

Definition at line 4327 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;
4382 }
int j
Definition: facHensel.cc:105
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
#define pSetExp(p, i, v)
Definition: polys.h:42
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1455
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
long twoPow(long arg)
Definition: kutil.cc:4138
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
long ind_fact_2(long arg)
Definition: kutil.cc:4123
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1287
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 11923 of file kutil.cc.

11924 {
11925  PrintS("red: ");
11926  if (strat->red==redFirst) PrintS("redFirst\n");
11927  else if (strat->red==redHoney) PrintS("redHoney\n");
11928  else if (strat->red==redEcart) PrintS("redEcart\n");
11929  else if (strat->red==redHomog) PrintS("redHomog\n");
11930  else Print("%p\n",(void*)strat->red);
11931  PrintS("posInT: ");
11932  if (strat->posInT==posInT0) PrintS("posInT0\n");
11933  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11934  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11935  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11936  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11937  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11938  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11939  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11940  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11941  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11942  #ifdef HAVE_RINGS
11943  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11944  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11945  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11946  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11947  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11948  #endif
11949 #ifdef HAVE_MORE_POS_IN_T
11950  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11951  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11952  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11953 #endif
11954  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11955  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11956  else Print("%p\n",(void*)strat->posInT);
11957  PrintS("posInL: ");
11958  if (strat->posInL==posInL0) PrintS("posInL0\n");
11959  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11960  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11961  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11962  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11963  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11964  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11965  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11966  #ifdef HAVE_RINGS
11967  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11968  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11969  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11970  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11971  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11972  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11973  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11974  #endif
11975  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11976  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11977  else Print("%p\n",(void*)strat->posInL);
11978  PrintS("enterS: ");
11979  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11980  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11981  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11982  else Print("%p\n",(void*)strat->enterS);
11983  PrintS("initEcart: ");
11984  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11985  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11986  else Print("%p\n",(void*)strat->initEcart);
11987  PrintS("initEcartPair: ");
11988  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11989  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11990  else Print("%p\n",(void*)strat->initEcartPair);
11991  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11992  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11993  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11994  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11995  PrintS("chainCrit: ");
11996  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11997  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11998  else Print("%p\n",(void*)strat->chainCrit);
11999  Print("posInLDependsOnLength=%d\n",
12000  strat->posInLDependsOnLength);
12001  PrintS(showOption());PrintLn();
12002  PrintS("LDeg: ");
12003  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12004  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12005  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
12006  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12007  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12008  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12009  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12010  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12011  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12012  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12013  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12014  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12015  else Print("? (%lx)", (long)currRing->pLDeg);
12016  PrintS(" / ");
12017  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12018  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12019  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
12020  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12021  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12022  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12023  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12024  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12025  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12026  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12027  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12028  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12029  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
12030  PrintLn();
12031  PrintS("currRing->pFDeg: ");
12032  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
12033  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
12034  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
12035  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
12036  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
12037  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
12038  else Print("? (%lx)", (long)currRing->pFDeg);
12039  PrintLn();
12040  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
12041  if(TEST_OPT_DEGBOUND)
12042  Print(" degBound: %d\n", Kstd1_deg);
12043 
12044  if( ecartWeights != NULL )
12045  {
12046  PrintS("ecartWeights: ");
12047  for (int i = rVar(currRing); i > 0; i--)
12048  Print("%hd ", ecartWeights[i]);
12049  PrintLn();
12051  }
12052 
12053 #ifndef SING_NDEBUG
12055 #endif
12056 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11889
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5403
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1270
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5296
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:831
#define TEST_OPT_DEGBOUND
Definition: options.h:112
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:995
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6779
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:867
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
char noTailReduction
Definition: kutil.h:376
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:217
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3192
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6537
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6864
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6662
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:760
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:723
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:900
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6978
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
char use_buckets
Definition: kutil.h:381
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:931
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
char sugarCrit
Definition: kutil.h:375
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
#define assume(x)
Definition: mod2.h:390
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:586
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5792
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:729
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
void rDebugPrint(const ring r)
Definition: ring.cc:4041
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
int Kstd1_deg
Definition: kutil.cc:237
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11798
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:370
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:801
#define NULL
Definition: omList.c:12
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:965
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:166
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5521
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3405
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:247
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1028
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1058
char posInLDependsOnLength
Definition: kutil.h:387
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:603
char Gebauer
Definition: kutil.h:376
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11852
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006
int LazyDegree
Definition: kutil.h:351
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5899
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ kFindDivisibleByInS_T()

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

Definition at line 7263 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
7402  }
7403 }
int j
Definition: facHensel.cc:105
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:38
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
static unsigned pLength(poly a)
Definition: p_polys.h:191
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30
class sTObject TObject
Definition: kutil.h:53

◆ kFindInT() [1/2]

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

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

Definition at line 711 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;
720 }
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30

◆ kFindInT() [2/2]

int kFindInT ( poly  p,
kStrategy  strat 
)

Definition at line 722 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;
733 }
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:711
int tl
Definition: kutil.h:348
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
kStrategy next
Definition: kutil.h:273

◆ kMergeBintoL()

void kMergeBintoL ( kStrategy  strat)

Definition at line 3150 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;
3166 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
int Bl
Definition: kutil.h:350
#define setmaxLinc
Definition: kutil.h:31
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
int i
Definition: cfEzgcd.cc:125
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:656
LSet L
Definition: kutil.h:323
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349

◆ kMergeBintoLSba()

void kMergeBintoLSba ( kStrategy  strat)

Definition at line 3171 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;
3187 }
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int Bl
Definition: kutil.h:350
#define setmaxLinc
Definition: kutil.h:31
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
int i
Definition: cfEzgcd.cc:125
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:656
LSet L
Definition: kutil.h:323
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349

◆ kPosInLDependsOnLength()

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

Definition at line 10009 of file kutil.cc.

10012 {
10013  if (pos_in_l == posInL110
10014  || pos_in_l == posInL10
10015  #ifdef HAVE_RINGS
10016  || pos_in_l == posInL110Ring
10017  || pos_in_l == posInLRing
10018  #endif
10019  )
10020  return TRUE;
10021 
10022  return FALSE;
10023 }
#define FALSE
Definition: auxiliary.h:94
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6662
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6210
#define TRUE
Definition: auxiliary.h:98
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006

◆ kStratChangeTailRing()

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

Definition at line 11377 of file kutil.cc.

11378 {
11379  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11380  /* initial setup or extending */
11381 
11382  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11383  if (expbound >= currRing->bitmask) return FALSE;
11384  strat->overflow=FALSE;
11385  ring new_tailRing = rModifyRing(currRing,
11386  // Hmmm .. the condition pFDeg == p_Deg
11387  // might be too strong
11388  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11389  (strat->ak==0), // omit_comp if the input is an ideal
11390  expbound); // exp_limit
11391 
11392  if (new_tailRing == currRing) return TRUE;
11393 
11394  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11395  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11396 
11397  if (currRing->pFDeg != currRing->pFDegOrig)
11398  {
11399  new_tailRing->pFDeg = currRing->pFDeg;
11400  new_tailRing->pLDeg = currRing->pLDeg;
11401  }
11402 
11403  if (TEST_OPT_PROT)
11404  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11405  kTest_TS(strat);
11406  assume(new_tailRing != strat->tailRing);
11407  pShallowCopyDeleteProc p_shallow_copy_delete
11408  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11409 
11410  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11411 
11412  int i;
11413  for (i=0; i<=strat->tl; i++)
11414  {
11415  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11416  p_shallow_copy_delete);
11417  }
11418  for (i=0; i<=strat->Ll; i++)
11419  {
11420  assume(strat->L[i].p != NULL);
11421  if (pNext(strat->L[i].p) != strat->tail)
11422  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11423  }
11424  if ((strat->P.t_p != NULL) ||
11425  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11426  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11427 
11428  if ((L != NULL) && (L->tailRing != new_tailRing))
11429  {
11430  if (L->i_r < 0)
11431  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11432  else
11433  {
11434  assume(L->i_r <= strat->tl);
11435  TObject* t_l = strat->R[L->i_r];
11436  assume(t_l != NULL);
11437  L->tailRing = new_tailRing;
11438  L->p = t_l->p;
11439  L->t_p = t_l->t_p;
11440  L->max_exp = t_l->max_exp;
11441  }
11442  }
11443 
11444  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11445  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11446 
11447  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11448  if (strat->tailRing != currRing)
11449  rKillModifiedRing(strat->tailRing);
11450 
11451  strat->tailRing = new_tailRing;
11452  strat->tailBin = new_tailBin;
11453  strat->p_shallow_copy_delete
11454  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11455 
11456  if (strat->kHEdge != NULL)
11457  {
11458  if (strat->t_kHEdge != NULL)
11459  p_LmFree(strat->t_kHEdge, strat->tailRing);
11460  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11461  }
11462 
11463  if (strat->kNoether != NULL)
11464  {
11465  if (strat->t_kNoether != NULL)
11466  p_LmFree(strat->t_kNoether, strat->tailRing);
11468  new_tailRing);
11469  }
11470  kTest_TS(strat);
11471  if (TEST_OPT_PROT)
11472  PrintS("]");
11473  return TRUE;
11474 }
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:80
poly kHEdge
Definition: kutil.h:325
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2638
#define TRUE
Definition: auxiliary.h:98
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
int ak
Definition: kutil.h:351
#define omMergeStickyBinIntoBin(A, B)
Definition: xalloc.h:319
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
poly t_kHEdge
Definition: kutil.h:327
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:44
char homog
Definition: kutil.h:370
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
omBin tailBin
Definition: kutil.h:343
char overflow
Definition: kutil.h:402
#define omGetStickyBinOfBin(B)
Definition: xalloc.h:290
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void rKillModifiedRing(ring r)
Definition: ring.cc:2998
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:30
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:53

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11476 of file kutil.cc.

11477 {
11478  unsigned long l = 0;
11479  int i;
11480  long e;
11481 
11482  assume(strat->tailRing == currRing);
11483 
11484  for (i=0; i<= strat->Ll; i++)
11485  {
11486  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11487  }
11488  for (i=0; i<=strat->tl; i++)
11489  {
11490  // Hmm ... this we could do in one Step
11491  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11492  }
11493  if (rField_is_Ring(currRing))
11494  {
11495  l *= 2;
11496  }
11497  e = p_GetMaxExp(l, currRing);
11498  if (e <= 1) e = 2;
11499 
11500  kStratChangeTailRing(strat, NULL, NULL, e);
11501 }
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:1165
int Ll
Definition: kutil.h:349
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:746
int tl
Definition: kutil.h:348
#define assume(x)
Definition: mod2.h:390
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int i
Definition: cfEzgcd.cc:125
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int l
Definition: cfEzgcd.cc:93

◆ message()

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

Definition at line 7954 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  }
7989  }
7990 }
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:349
#define mflush()
Definition: reporter.h:57
#define TEST_OPT_OLDSTD
Definition: options.h:121
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284

◆ messageStat()

void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7995 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);
8005  #endif
8006 }
#define Print
Definition: emacs.cc:80
int c3
Definition: kutil.h:345
int cv
Definition: kutil.h:367
int cp
Definition: kutil.h:345

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 8008 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);
8019  #endif
8020 }
#define Print
Definition: emacs.cc:80
int cv
Definition: kutil.h:367
int nrsyzcrit
Definition: kutil.h:359
int nrrewcrit
Definition: kutil.h:360

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10841 of file kutil.cc.

10842 {
10843  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10844  return FALSE;
10845  int i,j;
10846  poly newNoether;
10847 
10848 #if 0
10849  if (currRing->weight_all_1)
10850  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10851  else
10852  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10853 #else
10854  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10855 #endif
10856  if (strat->kHEdge==NULL) return FALSE;
10857  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10858  if (strat->tailRing != currRing)
10859  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10860  /* compare old and new noether*/
10861  newNoether = pLmInit(strat->kHEdge);
10862  pSetCoeff0(newNoether,nInit(1));
10863  j = p_FDeg(newNoether,currRing);
10864  for (i=1; i<=(currRing->N); i++)
10865  {
10866  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10867  }
10868  pSetm(newNoether);
10869  if (j < strat->HCord) /*- statistics -*/
10870  {
10871  if (TEST_OPT_PROT)
10872  {
10873  Print("H(%d)",j);
10874  mflush();
10875  }
10876  strat->HCord=j;
10877  #ifdef KDEBUG
10878  if (TEST_OPT_DEBUG)
10879  {
10880  Print("H(%d):",j);
10881  wrp(strat->kHEdge);
10882  PrintLn();
10883  }
10884  #endif
10885  }
10886  if (pCmp(strat->kNoether,newNoether)!=1)
10887  {
10888  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
10889  strat->kNoether=newNoether;
10890  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10891  if (strat->tailRing != currRing)
10892  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10893 
10894  return TRUE;
10895  }
10896  pLmDelete(newNoether);
10897  return FALSE;
10898 }
int j
Definition: facHensel.cc:105
#define pSetm(p)
Definition: polys.h:266
int HCord
Definition: kutil.cc:236
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
poly kHEdge
Definition: kutil.h:325
#define TEST_OPT_PROT
Definition: options.h:102
#define FALSE
Definition: auxiliary.h:94
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:326
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1004
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:351
#define TEST_OPT_DEBUG
Definition: options.h:107
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
int HCord
Definition: kutil.h:353
#define mflush()
Definition: reporter.h:57
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:379
int i
Definition: cfEzgcd.cc:125
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
poly t_kHEdge
Definition: kutil.h:327
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
void wrp(poly p)
Definition: polys.h:305
ideal Shdl
Definition: kutil.h:299
#define nInit(i)
Definition: numbers.h:24

◆ nextZeroSimplexExponent()

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

Definition at line 4261 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;
4316 }
int j
Definition: facHensel.cc:105
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
static unsigned add[]
Definition: misc_ip.cc:117
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
int i
Definition: cfEzgcd.cc:125
long ind2(long arg)
Definition: kutil.cc:4111

◆ 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 2193 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  }
2204 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:80
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125

◆ pCopyL2p()

poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 12090 of file kutil.cc.

12091 {
12092  /* restores a poly in currRing from LObject */
12093  LObject h = H;
12094  h.Copy();
12095  poly p;
12096  if (h.p == NULL)
12097  {
12098  if (h.t_p != NULL)
12099  {
12100  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
12101  return(p);
12102  }
12103  else
12104  {
12105  /* h.tp == NULL -> the object is NULL */
12106  return(NULL);
12107  }
12108  }
12109  /* we're here if h.p != NULL */
12110  if (h.t_p == NULL)
12111  {
12112  /* then h.p is the whole poly in currRing */
12113  p = h.p;
12114  return(p);
12115  }
12116  /* we're here if h.p != NULL and h.t_p != NULL */
12117  // clean h.p, get poly from t_p
12118  pNext(h.p)=NULL;
12119  pLmDelete(&h.p);
12120  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12121  /* dest. ring: */ currRing);
12122  // no need to clean h: we re-used the polys
12123  return(p);
12124 }
class sLObject LObject
Definition: kutil.h:54
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ pDivComp()

static int pDivComp ( poly  p,
poly  q 
)
inlinestatic

Definition at line 187 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;
233 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
#define TRUE
Definition: auxiliary.h:98
CanonicalForm b
Definition: cfModGcd.cc:4044
int i
Definition: cfEzgcd.cc:125
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:1778
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85

◆ pDivCompRing()

static int pDivCompRing ( poly  p,
poly  q 
)
inlinestatic

Definition at line 148 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;
184 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define pDivComp_LESS
Definition: kutil.cc:140
#define pDivComp_EQUAL
Definition: kutil.cc:139
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
CanonicalForm b
Definition: cfModGcd.cc:4044
int i
Definition: cfEzgcd.cc:125
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
#define pDivComp_GREATER
Definition: kutil.cc:141
#define pDivComp_INCOMP
Definition: kutil.cc:142
int BOOLEAN
Definition: auxiliary.h:85

◆ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 12059 of file kutil.cc.

12060 {
12061  /* assume: p is completely in currRing */
12062  /* produces an object with LM in curring
12063  and TAIL in tailring */
12064  if (pNext(p)!=NULL)
12065  {
12066  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
12067  }
12068  return(p);
12069 }
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 12073 of file kutil.cc.

12074 {
12075  /* assume: p has LM in curring and TAIL in tailring */
12076  /* convert it to complete currRing */
12077 
12078  /* check that LM is in currRing */
12080 
12081  if (pNext(p)!=NULL)
12082  {
12083  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
12084  }
12085  return(p);
12086 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:69
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInIdealMonFirst()

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

Definition at line 5213 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  }
5250 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:23
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL0()

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

Definition at line 6065 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  }
6088 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL0Ring()

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

Definition at line 6091 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  }
6114 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL11()

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

Definition at line 6323 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  }
6355 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL110()

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

Definition at line 6621 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  }
6659 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL110Ring()

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

Definition at line 6662 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  }
6700 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL11Ring()

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

Definition at line 6365 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  }
6397 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL11Ringls()

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

Definition at line 6435 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  }
6515 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
int p
Definition: cfModGcd.cc:4019
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInL13()

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

Definition at line 6709 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  }
6736 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL15()

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

Definition at line 6744 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  }
6776 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL15Ring()

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

Definition at line 6779 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  }
6811 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL17()

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

Definition at line 6820 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  }
6861 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL17_c()

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

Definition at line 6914 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  }
6975 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL17_cRing()

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

Definition at line 6978 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  }
7039 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL17Ring()

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

Definition at line 6864 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  }
6905 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInLF5C()

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

Definition at line 6311 of file kutil.cc.

6313 {
6314  return strat->Ll+1;
6315 }
int Ll
Definition: kutil.h:349

◆ posInLF5CRing()

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

Definition at line 6399 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  }
6431 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInLrg0()

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

Definition at line 6537 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  }
6574 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInLRing()

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

Definition at line 6210 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  }
6280 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInLSig()

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

Definition at line 6123 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  }
6145 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInLSigRing()

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

Definition at line 6147 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  }
6208 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInLSpecial()

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

Definition at line 6022 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  }
6058 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInS()

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

Definition at line 5035 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  }
5131 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInSMonFirst()

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

Definition at line 5136 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  }
5209 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:12
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInSyz()

int posInSyz ( const kStrategy  strat,
poly  sig 
)

Definition at line 6283 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  }
6303 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

◆ posInT0()

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

Definition at line 5257 of file kutil.cc.

5258 {
5259  return (length+1);
5260 }
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263

◆ posInT1()

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

Definition at line 5268 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  }
5289 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT11()

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

Definition at line 5326 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  }
5359 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT110()

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

Definition at line 5479 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  }
5518 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT110Ring()

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

Definition at line 5521 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  }
5560 }
#define loop
Definition: structs.h:80
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:125
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT11Ring()

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

Definition at line 5362 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  }
5395 }
#define loop
Definition: structs.h:80
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:125
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT13()

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

Definition at line 5568 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  }
5594 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT15()

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

Definition at line 5636 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  }
5687 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT15Ring()

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

Definition at line 5690 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  }
5723 }
#define loop
Definition: structs.h:80
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:125
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT17()

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

Definition at line 5731 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  }
5789 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT17_c()

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

Definition at line 5838 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  }
5896 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT17_cRing()

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

Definition at line 5899 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  }
5957 }
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:125
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInT17Ring()

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

Definition at line 5792 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  }
5830 }
#define loop
Definition: structs.h:80
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:125
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT19()

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

Definition at line 5965 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  }
6015 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT2()

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

Definition at line 5296 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  }
5319 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_EcartFDegpLength()

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

Definition at line 11798 of file kutil.cc.

11799 {
11800 
11801  if (length==-1) return 0;
11802 
11803  int o = p.ecart;
11804  int op=p.GetpFDeg();
11805  int ol = p.GetpLength();
11806 
11807  if (set[length].ecart < o)
11808  return length+1;
11809  if (set[length].ecart == o)
11810  {
11811  int oo=set[length].GetpFDeg();
11812  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11813  return length+1;
11814  }
11815 
11816  int i;
11817  int an = 0;
11818  int en= length;
11819  loop
11820  {
11821  if (an >= en-1)
11822  {
11823  if (set[an].ecart > o)
11824  return an;
11825  if (set[an].ecart == o)
11826  {
11827  int oo=set[an].GetpFDeg();
11828  if((oo > op)
11829  || ((oo==op) && (set[an].pLength > ol)))
11830  return an;
11831  }
11832  return en;
11833  }
11834  i=(an+en) / 2;
11835  if (set[i].ecart > o)
11836  en=i;
11837  else if (set[i].ecart == o)
11838  {
11839  int oo=set[i].GetpFDeg();
11840  if ((oo > op)
11841  || ((oo == op) && (set[i].pLength > ol)))
11842  en=i;
11843  else
11844  an=i;
11845  }
11846  else
11847  an=i;
11848  }
11849 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_EcartpLength()

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

Definition at line 5597 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  }
5629 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_FDegpLength()

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

Definition at line 11852 of file kutil.cc.

11853 {
11854 
11855  if (length==-1) return 0;
11856 
11857  int op=p.GetpFDeg();
11858  int ol = p.GetpLength();
11859 
11860  int oo=set[length].GetpFDeg();
11861  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11862  return length+1;
11863 
11864  int i;
11865  int an = 0;
11866  int en= length;
11867  loop
11868  {
11869  if (an >= en-1)
11870  {
11871  int oo=set[an].GetpFDeg();
11872  if((oo > op)
11873  || ((oo==op) && (set[an].pLength > ol)))
11874  return an;
11875  return en;
11876  }
11877  i=(an+en) / 2;
11878  int oo=set[i].GetpFDeg();
11879  if ((oo > op)
11880  || ((oo == op) && (set[i].pLength > ol)))
11881  en=i;
11882  else
11883  an=i;
11884  }
11885 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_pLength()

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

Definition at line 11889 of file kutil.cc.

11890 {
11891  int ol = p.GetpLength();
11892  if (length==-1)
11893  return 0;
11894  if (set[length].length<p.length)
11895  return length+1;
11896 
11897  int i;
11898  int an = 0;
11899  int en= length;
11900 
11901  loop
11902  {
11903  if (an >= en-1)
11904  {
11905  if (set[an].pLength>ol) return an;
11906  return en;
11907  }
11908  i=(an+en) / 2;
11909  if (set[i].pLength>ol) en=i;
11910  else an=i;
11911  }
11912 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInTrg0()

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

Definition at line 5403 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  }
5441 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
#define nGreater(a, b)
Definition: numbers.h:28

◆ postReduceByMon()

void postReduceByMon ( LObject h,
kStrategy  strat 
)

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

Definition at line 11135 of file kutil.cc.

11136 {
11137  if(!nCoeff_is_Z(currRing->cf))
11138  return;
11139  poly pH = h->GetP();
11140  poly p,pp;
11141  p = pH;
11142  bool deleted = FALSE, ok = FALSE;
11143  for(int i = 0; i<=strat->sl; i++)
11144  {
11145  p = pH;
11146  if(pNext(strat->S[i]) == NULL)
11147  {
11148  //pWrite(p);
11149  //pWrite(strat->S[i]);
11150  while(ok == FALSE && p != NULL)
11151  {
11152  if(pLmDivisibleBy(strat->S[i], p))
11153  {
11154  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11155  p_SetCoeff(p,dummy,currRing);
11156  }
11157  if(nIsZero(p->coef))
11158  {
11159  pLmDelete(&p);
11160  h->p = p;
11161  deleted = TRUE;
11162  }
11163  else
11164  {
11165  ok = TRUE;
11166  }
11167  }
11168  if (p!=NULL)
11169  {
11170  pp = pNext(p);
11171  while(pp != NULL)
11172  {
11173  if(pLmDivisibleBy(strat->S[i], pp))
11174  {
11175  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11176  p_SetCoeff(pp,dummy,currRing);
11177  if(nIsZero(pp->coef))
11178  {
11179  pLmDelete(&pNext(p));
11180  pp = pNext(p);
11181  deleted = TRUE;
11182  }
11183  else
11184  {
11185  p = pp;
11186  pp = pNext(p);
11187  }
11188  }
11189  else
11190  {
11191  p = pp;
11192  pp = pNext(p);
11193  }
11194  }
11195  }
11196  }
11197  }
11198  h->SetLmCurrRing();
11199  if((deleted)&&(h->p!=NULL))
11200  strat->initEcart(h);
11201 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:628
#define FALSE
Definition: auxiliary.h:94
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
void(* initEcart)(TObject *L)
Definition: kutil.h:276
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11203 of file kutil.cc.

11204 {
11205  if(!nCoeff_is_Z(currRing->cf))
11206  return;
11207  poly hSig = h->sig;
11208  poly pH = h->GetP();
11209  poly p,pp;
11210  p = pH;
11211  bool deleted = FALSE, ok = FALSE;
11212  for(int i = 0; i<=strat->sl; i++)
11213  {
11214  p = pH;
11215  if(pNext(strat->S[i]) == NULL)
11216  {
11217  while(ok == FALSE && p!=NULL)
11218  {
11219  if(pLmDivisibleBy(strat->S[i], p))
11220  {
11221  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11222  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11223  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11224  {
11225  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11226  p_SetCoeff(p,dummy,currRing);
11227  }
11228  pDelete(&sigMult);
11229  }
11230  if(nIsZero(p->coef))
11231  {
11232  pLmDelete(&p);
11233  h->p = p;
11234  deleted = TRUE;
11235  }
11236  else
11237  {
11238  ok = TRUE;
11239  }
11240  }
11241  if(p == NULL)
11242  return;
11243  pp = pNext(p);
11244  while(pp != NULL)
11245  {
11246  if(pLmDivisibleBy(strat->S[i], pp))
11247  {
11248  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11249  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11250  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11251  {
11252  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11253  p_SetCoeff(pp,dummy,currRing);
11254  if(nIsZero(pp->coef))
11255  {
11256  pLmDelete(&pNext(p));
11257  pp = pNext(p);
11258  deleted = TRUE;
11259  }
11260  else
11261  {
11262  p = pp;
11263  pp = pNext(p);
11264  }
11265  }
11266  else
11267  {
11268  p = pp;
11269  pp = pNext(p);
11270  }
11271  pDelete(&sigMult);
11272  }
11273  else
11274  {
11275  p = pp;
11276  pp = pNext(p);
11277  }
11278  }
11279  }
11280  }
11281  h->SetLmCurrRing();
11282  if(deleted)
11283  strat->initEcart(h);
11284 
11285 }
polyset sig
Definition: kutil.h:304
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:628
#define FALSE
Definition: auxiliary.h:94
#define ppMult_mm(p, m)
Definition: polys.h:196
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define pDivideM(a, b)
Definition: polys.h:289
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

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

10969 {
10970  if(!nCoeff_is_Z(currRing->cf))
10971  return NULL;
10972  ideal F = idCopy(Forig);
10973  idSkipZeroes(F);
10974  poly pmon;
10975  ring origR = currRing;
10976  ideal monred = idInit(1,1);
10977  for(int i=0; i<idElem(F); i++)
10978  {
10979  if(pNext(F->m[i]) == NULL)
10980  idInsertPoly(monred, pCopy(F->m[i]));
10981  }
10982  int posconst = idPosConstant(F);
10983  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10984  {
10985  idDelete(&F);
10986  idDelete(&monred);
10987  return NULL;
10988  }
10989  int idelemQ = 0;
10990  if(Q!=NULL)
10991  {
10992  idelemQ = IDELEMS(Q);
10993  for(int i=0; i<idelemQ; i++)
10994  {
10995  if(pNext(Q->m[i]) == NULL)
10996  idInsertPoly(monred, pCopy(Q->m[i]));
10997  }
10998  idSkipZeroes(monred);
10999  posconst = idPosConstant(monred);
11000  //the constant, if found, will be from Q
11001  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
11002  {
11003  pmon = pCopy(monred->m[posconst]);
11004  idDelete(&F);
11005  idDelete(&monred);
11006  return pmon;
11007  }
11008  }
11009  ring QQ_ring = rCopy0(currRing,FALSE);
11010  nKillChar(QQ_ring->cf);
11011  QQ_ring->cf = nInitChar(n_Q, NULL);
11012  rComplete(QQ_ring,1);
11013  QQ_ring = rAssure_c_dp(QQ_ring);
11014  rChangeCurrRing(QQ_ring);
11015  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
11016  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
11017  for(int i = 0, j = 0; i<IDELEMS(F); i++)
11018  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
11019  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
11020  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
11021  ideal one = kStd(II, NULL, isNotHomog, NULL);
11022  idSkipZeroes(one);
11023  if(idIsConstant(one))
11024  {
11025  //one should be <1>
11026  for(int i = IDELEMS(II)-1; i>=0; i--)
11027  if(II->m[i] != NULL)
11028  II->m[i+1] = II->m[i];
11029  II->m[0] = pOne();
11030  ideal syz = idSyzygies(II, isNotHomog, NULL);
11031  poly integer = NULL;
11032  for(int i = IDELEMS(syz)-1;i>=0; i--)
11033  {
11034  if(pGetComp(syz->m[i]) == 1)
11035  {
11036  pSetComp(syz->m[i],0);
11037  if(pIsConstant(pHead(syz->m[i])))
11038  {
11039  integer = pHead(syz->m[i]);
11040  break;
11041  }
11042  }
11043  }
11044  rChangeCurrRing(origR);
11045  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11046  pmon = prMapR(integer, nMap2, QQ_ring, origR);
11047  idDelete(&monred);
11048  idDelete(&F);
11049  id_Delete(&II,QQ_ring);
11050  id_Delete(&one,QQ_ring);
11051  id_Delete(&syz,QQ_ring);
11052  p_Delete(&integer,QQ_ring);
11053  rDelete(QQ_ring);
11054  return pmon;
11055  }
11056  else
11057  {
11058  if(idIs0(monred))
11059  {
11060  poly mindegmon = NULL;
11061  for(int i = 0; i<IDELEMS(one); i++)
11062  {
11063  if(pNext(one->m[i]) == NULL)
11064  {
11065  if(mindegmon == NULL)
11066  mindegmon = pCopy(one->m[i]);
11067  else
11068  {
11069  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
11070  mindegmon = pCopy(one->m[i]);
11071  }
11072  }
11073  }
11074  if(mindegmon != NULL)
11075  {
11076  for(int i = IDELEMS(II)-1; i>=0; i--)
11077  if(II->m[i] != NULL)
11078  II->m[i+1] = II->m[i];
11079  II->m[0] = pCopy(mindegmon);
11080  ideal syz = idSyzygies(II, isNotHomog, NULL);
11081  bool found = FALSE;
11082  for(int i = IDELEMS(syz)-1;i>=0; i--)
11083  {
11084  if(pGetComp(syz->m[i]) == 1)
11085  {
11086  pSetComp(syz->m[i],0);
11087  if(pIsConstant(pHead(syz->m[i])))
11088  {
11089  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
11090  found = TRUE;
11091  break;
11092  }
11093  }
11094  }
11095  id_Delete(&syz,QQ_ring);
11096  if (found == FALSE)
11097  {
11098  rChangeCurrRing(origR);
11099  idDelete(&monred);
11100  idDelete(&F);
11101  id_Delete(&II,QQ_ring);
11102  id_Delete(&one,QQ_ring);
11103  rDelete(QQ_ring);
11104  return NULL;
11105  }
11106  rChangeCurrRing(origR);
11107  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11108  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11109  idDelete(&monred);
11110  idDelete(&F);
11111  id_Delete(&II,QQ_ring);
11112  id_Delete(&one,QQ_ring);
11113  id_Delete(&syz,QQ_ring);
11114  rDelete(QQ_ring);
11115  return pmon;
11116  }
11117  }
11118  }
11119  rChangeCurrRing(origR);
11120  idDelete(&monred);
11121  idDelete(&F);
11122  id_Delete(&II,QQ_ring);
11123  id_Delete(&one,QQ_ring);
11124  rDelete(QQ_ring);
11125  return NULL;
11126 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
int j
Definition: facHensel.cc:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
rational (GMP) numbers
Definition: coeffs.h:31
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:98
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:2088
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4920
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
#define pGetComp(p)
Component.
Definition: polys.h:37
bool found
Definition: facFactorize.cc:56
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:45
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3394
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1365
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
#define pSetComp(p, v)
Definition: polys.h:38
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:310
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:23
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:721
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rChangeCurrRing(ring r)
Definition: polys.cc:14
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:728
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int idElem(const ideal F)
count non-zero elements
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:510
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349
#define idIsConstant(I)
Definition: ideals.h:40

◆ redBba()

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

Definition at line 8965 of file kutil.cc.

8966 {
8967  int j = 0;
8968  unsigned long not_sev = ~ pGetShortExpVector(h);
8969 
8970  while (j <= maxIndex)
8971  {
8972  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
8973  {
8974  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8975  if (h==NULL) return NULL;
8976  j = 0;
8977  not_sev = ~ pGetShortExpVector(h);
8978  }
8979  else j++;
8980  }
8981  return h;
8982 }
int j
Definition: facHensel.cc:105
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:12
unsigned long * sevS
Definition: kutil.h:318
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1120
static Poly * h
Definition: janet.cc:971
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ redBba1()

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

Definition at line 8860 of file kutil.cc.

8861 {
8862  int j = 0;
8863  unsigned long not_sev = ~ pGetShortExpVector(h);
8864 
8865  while (j <= maxIndex)
8866  {
8867  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
8868  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
8869  else j++;
8870  }
8871  return h;
8872 }
int j
Definition: facHensel.cc:105
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
polyset S
Definition: kutil.h:302
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1130
unsigned long * sevS
Definition: kutil.h:318
static Poly * h
Definition: janet.cc:971
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 166 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  }
339 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:116
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
char LDegLast
Definition: kutil.h:383
unsigned long * sevT
Definition: kutil.h:321
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:385
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
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
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:387
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
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971
int LazyDegree
Definition: kutil.h:351

◆ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 528 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  }
655 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
char LDegLast
Definition: kutil.h:383
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:385
#define mflush()
Definition: reporter.h:57
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
#define assume(x)
Definition: mod2.h:390
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
void PrintS(const char *s)
Definition: reporter.cc:284
char homog
Definition: kutil.h:370
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:387
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
void wrp(poly p)
Definition: polys.h:305
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int LazyDegree
Definition: kutil.h:351

◆ redMora()

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

Definition at line 8989 of file kutil.cc.

8990 {
8991  int j=0;
8992  int e,l;
8993  unsigned long not_sev = ~ pGetShortExpVector(h);
8994 
8995  if (maxIndex >= 0)
8996  {
8997  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
8998  do
8999  {
9000  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
9001  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
9002  {
9003 #ifdef KDEBUG
9004  if (TEST_OPT_DEBUG)
9005  {
9006  PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);
9007  }
9008 #endif
9009  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
9010 #ifdef KDEBUG
9011  if(TEST_OPT_DEBUG)
9012  {
9013  PrintS(")\nto "); wrp(h); PrintLn();
9014  }
9015 #endif
9016  // pDelete(&h);
9017  if (h == NULL) return NULL;
9018  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
9019  j = 0;
9020  not_sev = ~ pGetShortExpVector(h);
9021  }
9022  else j++;
9023  }
9024  while (j <= maxIndex);
9025  }
9026  return h;
9027 }
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#define TEST_OPT_DEBUG
Definition: options.h:107
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:379
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1120
void wrp(poly p)
Definition: polys.h:305
static Poly * h
Definition: janet.cc:971
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int l
Definition: cfEzgcd.cc:93

◆ redtail() [1/2]

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

Definition at line 7405 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;
7472  return p;
7473 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:116
char kHEdgeFound
Definition: kutil.h:374
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:80
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int Kstd1_deg
Definition: kutil.cc:237
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
KINLINE poly kNoetherTail()
Definition: kInline.h:66
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
int l
Definition: cfEzgcd.cc:93
class sTObject TObject
Definition: kutil.h:53

◆ redtail() [2/2]

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

Definition at line 7475 of file kutil.cc.

7476 {
7477  LObject L(p, currRing);
7478  return redtail(&L, end_pos, strat);
7479 }
class sLObject LObject
Definition: kutil.h:54
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ redtailBba()

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

Definition at line 7481 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);
7592  return L->GetLmCurrRing();
7593 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:312

◆ redtailBba_Z()

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

Definition at line 7836 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);
7947  return L->GetLmCurrRing();
7948 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:628
#define pAdd(p, q)
Definition: polys.h:198
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define pNeg(p)
Definition: polys.h:193
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define kTest_L(T, R)
Definition: kutil.h:657
int m
Definition: cfEzgcd.cc:121
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:654
#define pNormalize(p)
Definition: polys.h:312

◆ redtailBbaAlsoLC_Z()

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

Definition at line 7711 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);
7833  return;
7834 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int j
Definition: facHensel.cc:105
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition: kstd2.cc:139
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
KINLINE int ksReducePolyTailLC_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
KINLINE int ksReducePolyTail_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1073
char redTailChange
Definition: kutil.h:397
class sTObject TObject
Definition: kutil.h:53

◆ redtailBbaBound()

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

Definition at line 7595 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);
7707  return L->GetLmCurrRing();
7708 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T, R)
Definition: kutil.h:657
#define pJet(p, m)
Definition: polys.h:363
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:312

◆ redtailBbaShift()

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

Definition at line 12782 of file kutil.cc.

12783 {
12784  /* for the shift case need to run it with withT = TRUE */
12785  strat->redTailChange=FALSE;
12786  if (strat->noTailReduction) return L->GetLmCurrRing();
12787  poly h, p;
12788  p = h = L->GetLmTailRing();
12789  if ((h==NULL) || (pNext(h)==NULL))
12790  return L->GetLmCurrRing();
12791 
12792  TObject* With;
12793  // placeholder in case strat->tl < 0
12794  TObject With_s(strat->tailRing);
12795 
12796  LObject Ln(pNext(h), strat->tailRing);
12797  Ln.pLength = L->GetpLength() - 1;
12798 
12799  pNext(h) = NULL;
12800  if (L->p != NULL) pNext(L->p) = NULL;
12801  L->pLength = 1;
12802 
12803  Ln.PrepareRed(strat->use_buckets);
12804 
12805  while(!Ln.IsNull())
12806  {
12807  loop
12808  {
12809  Ln.SetShortExpVector();
12810  if (withT)
12811  {
12812  int j;
12813  j = kFindDivisibleByInT(strat, &Ln);
12814  if (j < 0) break;
12815  With = &(strat->T[j]);
12816  }
12817  else
12818  {
12819  With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
12820  if (With == NULL) break;
12821  }
12822  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12823  {
12824  With->pNorm();
12825  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12826  }
12827  strat->redTailChange=TRUE;
12828  if (ksReducePolyTail(L, With, &Ln))
12829  {
12830  // reducing the tail would violate the exp bound
12831  // set a flag and hope for a retry (in bba)
12832  strat->completeReduce_retry=TRUE;
12833  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12834  do
12835  {
12836  pNext(h) = Ln.LmExtractAndIter();
12837  pIter(h);
12838  L->pLength++;
12839  } while (!Ln.IsNull());
12840  goto all_done;
12841  }
12842  if (Ln.IsNull()) goto all_done;
12843  if (! withT) With_s.Init(currRing);
12844  }
12845  pNext(h) = Ln.LmExtractAndIter();
12846  pIter(h);
12847  L->pLength++;
12848  }
12849 
12850  all_done:
12851  Ln.Delete();
12852  if (L->p != NULL) pNext(L->p) = pNext(p);
12853 
12854  if (strat->redTailChange)
12855  {
12856  L->length = 0;
12857  }
12858  L->Normalize(); // HANNES: should have a test
12859  kTest_L(L,strat->tailRing);
12860  return L->GetLmCurrRing();
12861 }
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T, R)
Definition: kutil.h:657
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 4982 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;
5026 }
int j
Definition: facHensel.cc:105
int * S_2_R
Definition: kutil.h:340
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019

◆ replaceInLAndSAndT()

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

Definition at line 9515 of file kutil.cc.

9516 {
9517  p.GetP(strat->lmBin);
9518  if (strat->homog) strat->initEcart(&p);
9519  strat->redTailChange=FALSE;
9521  p.pCleardenom();
9522  if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) {
9523  p.p = redtailBba(&p,strat->sl,strat, FALSE,!TEST_OPT_CONTENTSB);
9524  p.pCleardenom();
9525  if (strat->redTailChange)
9526  p.t_p=NULL;
9527  }
9528  }
9529 
9530  assume(strat->tailRing == p.tailRing);
9531  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9532 
9533  int i, j, pos;
9534  poly tp = strat->T[tj].p;
9535 
9536  /* enter p to T set */
9537  enterT(p, strat);
9538 
9539  for (j = 0; j <= strat->sl; ++j) {
9540  if (pLtCmp(tp, strat->S[j]) == 0) {
9541  break;
9542  }
9543  }
9544  /* it may be that the exchanged element
9545  * is until now only in T and not in S */
9546  if (j <= strat->sl) {
9547  deleteInS(j, strat);
9548  }
9549 
9550  pos = posInS(strat, strat->sl, p.p, p.ecart);
9551 
9552  pp_Test(p.p, currRing, p.tailRing);
9553  assume(p.FDeg == p.pFDeg());
9554 
9555  /* remove useless pairs from L set */
9556  for (i = 0; i <= strat->Ll; ++i) {
9557  if (strat->L[i].p1 != NULL && pLtCmp(tp, strat->L[i].p1) == 0) {
9558  deleteInL(strat->L, &(strat->Ll), i, strat);
9559  i--;
9560  continue;
9561  }
9562  if (strat->L[i].p2 != NULL && pLtCmp(tp, strat->L[i].p2) == 0) {
9563  deleteInL(strat->L, &(strat->Ll), i, strat);
9564  i--;
9565  }
9566  }
9567  /* generate new pairs with p, probably removing older, now useless pairs */
9568  superenterpairs(p.p, strat->sl, p.ecart, pos, strat, strat->tl);
9569  /* enter p to S set */
9570  strat->enterS(p, pos, strat, strat->tl);
9571 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
#define TEST_OPT_CONTENTSB
Definition: options.h:125
int tl
Definition: kutil.h:348
#define pLtCmp(p, q)
Definition: polys.h:123
#define TEST_OPT_REDSB
Definition: options.h:103
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
polyset S
Definition: kutil.h:302
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
char homog
Definition: kutil.h:370
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4831
ring tailRing
Definition: kutil.h:341
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
omBin lmBin
Definition: kutil.h:342
int p
Definition: cfModGcd.cc:4019
char redTailChange
Definition: kutil.h:397

◆ sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair ( LObject h,
kStrategy  strat 
)

Definition at line 1676 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;
1732 }
polyset sig
Definition: kutil.h:304
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:996
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:986
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:693
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1007
int sl
Definition: kutil.h:346
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971

◆ sbaRing()

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

Definition at line 11503 of file kutil.cc.

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

◆ 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  {
738  StringAppend(" %s",optionStruct[i].name);
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  {
754  StringAppend(" %s",verboseStruct[i].name);
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 }
unsigned si_opt_1
Definition: options.c:5
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:521
unsigned setval
Definition: ipid.h:148
unsigned resetval
Definition: ipid.h:149
char * StringEndS()
Definition: reporter.cc:151
#define BITSET
Definition: structs.h:20
#define Sy_bit(x)
Definition: options.h:32
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:79
int i
Definition: cfEzgcd.cc:125
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:551
char name(const Variable &v)
Definition: factory.h:180
unsigned si_opt_2
Definition: options.c:6

◆ sugarDivisibleBy()

static BOOLEAN sugarDivisibleBy ( int  ecart1,
int  ecart2 
)
inlinestatic

Definition at line 1317 of file kutil.cc.

1318 {
1319  return (ecart1 <= ecart2);
1320 }

◆ superenterpairs()

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

Definition at line 4831 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);
4839 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4805
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3769
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4522
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:482
int k
Definition: cfEzgcd.cc:92
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4604
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971

◆ superenterpairsSig()

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

Definition at line 4841 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);
4852 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4805
bool sigdrop
Definition: kutil.h:358
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3894
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:482
int k
Definition: cfEzgcd.cc:92
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition: kutil.cc:4687
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4577
static Poly * h
Definition: janet.cc:971

◆ syzCriterion()

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

Definition at line 7045 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;
7075 }
#define Print
Definition: emacs.cc:80
#define FALSE
Definition: auxiliary.h:94
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int nrsyzcrit
Definition: kutil.h:359
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

◆ syzCriterionInc()

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

Definition at line 7080 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  }
7124 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define Print
Definition: emacs.cc:80
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:94
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int currIdx
Definition: kutil.h:313
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
int nrsyzcrit
Definition: kutil.h:359
static int max(int a, int b)
Definition: fast_mult.cc:264
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
intset syzIdx
Definition: kutil.h:309

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4138 of file kutil.cc.

4139 {
4140  return 1L << arg;
4141 }

◆ updateResult()

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

Definition at line 10507 of file kutil.cc.

10508 {
10509  int l;
10510  if (strat->ak>0)
10511  {
10512  for (l=IDELEMS(r)-1;l>=0;l--)
10513  {
10514  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10515  {
10516  pDelete(&r->m[l]); // and set it to NULL
10517  }
10518  }
10519  int q;
10520  poly p;
10521  if(!rField_is_Ring(currRing))
10522  {
10523  for (l=IDELEMS(r)-1;l>=0;l--)
10524  {
10525  if ((r->m[l]!=NULL)
10526  //&& (strat->syzComp>0)
10527  //&& (pGetComp(r->m[l])<=strat->syzComp)
10528  )
10529  {
10530  for(q=IDELEMS(Q)-1; q>=0;q--)
10531  {
10532  if ((Q->m[q]!=NULL)
10533  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10534  {
10535  if (TEST_OPT_REDSB)
10536  {
10537  p=r->m[l];
10538  r->m[l]=kNF(Q,NULL,p);
10539  pDelete(&p);
10540  }
10541  else
10542  {
10543  pDelete(&r->m[l]); // and set it to NULL
10544  }
10545  break;
10546  }
10547  }
10548  }
10549  }
10550  }
10551  #ifdef HAVE_RINGS
10552  else
10553  {
10554  for (l=IDELEMS(r)-1;l>=0;l--)
10555  {
10556  if ((r->m[l]!=NULL)
10557  //&& (strat->syzComp>0)
10558  //&& (pGetComp(r->m[l])<=strat->syzComp)
10559  )
10560  {
10561  for(q=IDELEMS(Q)-1; q>=0;q--)
10562  {
10563  if ((Q->m[q]!=NULL)
10564  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10565  {
10566  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10567  {
10568  if (TEST_OPT_REDSB)
10569  {
10570  p=r->m[l];
10571  r->m[l]=kNF(Q,NULL,p);
10572  pDelete(&p);
10573  }
10574  else
10575  {
10576  pDelete(&r->m[l]); // and set it to NULL
10577  }
10578  break;
10579  }
10580  }
10581  }
10582  }
10583  }
10584  }
10585  #endif
10586  }
10587  else
10588  {
10589  int q;
10590  poly p;
10591  BOOLEAN reduction_found=FALSE;
10592  if (!rField_is_Ring(currRing))
10593  {
10594  for (l=IDELEMS(r)-1;l>=0;l--)
10595  {
10596  if (r->m[l]!=NULL)
10597  {
10598  for(q=IDELEMS(Q)-1; q>=0;q--)
10599  {
10600  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10601  {
10602  if (TEST_OPT_REDSB)
10603  {
10604  p=r->m[l];
10605  r->m[l]=kNF(Q,NULL,p);
10606  pDelete(&p);
10607  reduction_found=TRUE;
10608  }
10609  else
10610  {
10611  pDelete(&r->m[l]); // and set it to NULL
10612  }
10613  break;
10614  }
10615  }
10616  }
10617  }
10618  }
10619  #ifdef HAVE_RINGS
10620  //Also need divisibility of the leading coefficients
10621  else
10622  {
10623  for (l=IDELEMS(r)-1;l>=0;l--)
10624  {
10625  if (r->m[l]!=NULL)
10626  {
10627  for(q=IDELEMS(Q)-1; q>=0;q--)
10628  {
10629  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10630  {
10631  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10632  {
10633  if (TEST_OPT_REDSB)
10634  {
10635  p=r->m[l];
10636  r->m[l]=kNF(Q,NULL,p);
10637  pDelete(&p);
10638  reduction_found=TRUE;
10639  }
10640  else
10641  {
10642  pDelete(&r->m[l]); // and set it to NULL
10643  }
10644  break;
10645  }
10646  }
10647  }
10648  }
10649  }
10650  }
10651  #endif
10652  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10653  {
10654  #ifdef HAVE_RINGS
10656  {
10657  for (l=IDELEMS(r)-1;l>=0;l--)
10658  {
10659  if (r->m[l]!=NULL)
10660  {
10661  for(q=IDELEMS(r)-1;q>=0;q--)
10662  {
10663  if ((l!=q)
10664  && (r->m[q]!=NULL)
10665  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10666  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10667  )
10668  {
10669  //If they are equal then take the one with the smallest length
10670  if(pLmDivisibleBy(r->m[q],r->m[l])
10671  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10672  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10673  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10674  {
10675  pDelete(&r->m[l]);
10676  break;
10677  }
10678  else
10679  pDelete(&r->m[q]);
10680  }
10681  }
10682  }
10683  }
10684  }
10685  else
10686  #endif
10687  {
10688  for (l=IDELEMS(r)-1;l>=0;l--)
10689  {
10690  if (r->m[l]!=NULL)
10691  {
10692  for(q=IDELEMS(r)-1;q>=0;q--)
10693  {
10694  if ((l!=q)
10695  && (r->m[q]!=NULL)
10696  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10697  )
10698  {
10699  //If they are equal then take the one with the smallest length
10700  if(pLmDivisibleBy(r->m[q],r->m[l])
10701  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10702  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10703  {
10704  pDelete(&r->m[l]);
10705  break;
10706  }
10707  else
10708  pDelete(&r->m[q]);
10709  }
10710  }
10711  }
10712  }
10713  }
10714  }
10715  }
10716  idSkipZeroes(r);
10717 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:103
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
#define pGetComp(p)
Component.
Definition: polys.h:37
#define nGreaterZero(n)
Definition: numbers.h:27
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define IDELEMS(i)
Definition: simpleideals.h:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9034 of file kutil.cc.

9035 {
9036  LObject h;
9037  int i, suc=0;
9038  poly redSi=NULL;
9039  BOOLEAN change,any_change;
9040 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9041 // for (i=0; i<=(strat->sl); i++)
9042 // {
9043 // Print("s%d:",i);
9044 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9045 // pWrite(strat->S[i]);
9046 // }
9047 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9048  any_change=FALSE;
9050  {
9051  while (suc != -1)
9052  {
9053  i=suc+1;
9054  while (i<=strat->sl)
9055  {
9056  change=FALSE;
9058  any_change = FALSE;
9059  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9060  {
9061  redSi = pHead(strat->S[i]);
9062  strat->S[i] = redBba(strat->S[i],i-1,strat);
9063  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9064  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9065  if (pCmp(redSi,strat->S[i])!=0)
9066  {
9067  change=TRUE;
9068  any_change=TRUE;
9069  #ifdef KDEBUG
9070  if (TEST_OPT_DEBUG)
9071  {
9072  PrintS("reduce:");
9073  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9074  }
9075  #endif
9076  if (TEST_OPT_PROT)
9077  {
9078  if (strat->S[i]==NULL)
9079  PrintS("V");
9080  else
9081  PrintS("v");
9082  mflush();
9083  }
9084  }
9085  pLmDelete(&redSi);
9086  if (strat->S[i]==NULL)
9087  {
9088  deleteInS(i,strat);
9089  i--;
9090  }
9091  else if (change)
9092  {
9094  {
9095  if (TEST_OPT_CONTENTSB)
9096  {
9097  number n;
9098  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
9099  if (!nIsOne(n))
9100  {
9102  denom->n=nInvers(n);
9103  denom->next=DENOMINATOR_LIST;
9104  DENOMINATOR_LIST=denom;
9105  }
9106  nDelete(&n);
9107  }
9108  else
9109  {
9110  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
9111  }
9112  }
9113  else
9114  {
9115  pNorm(strat->S[i]);
9116  }
9117  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9118  }
9119  }
9120  i++;
9121  }
9122  if (any_change) reorderS(&suc,strat);
9123  else break;
9124  }
9125  if (toT)
9126  {
9127  for (i=0; i<=strat->sl; i++)
9128  {
9129  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9130  {
9131  h.p = redtailBba(strat->S[i],i-1,strat);
9133  {
9134  h.pCleardenom();// also does remove Content
9135  }
9136  }
9137  else
9138  {
9139  h.p = strat->S[i];
9140  }
9141  strat->initEcart(&h);
9142  if (strat->honey)
9143  {
9144  strat->ecartS[i] = h.ecart;
9145  }
9146  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9147  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9148  h.sev = strat->sevS[i];
9149  /*puts the elements of S also to T*/
9150  strat->initEcart(&h);
9151  enterT(h,strat);
9152  strat->S_2_R[i] = strat->tl;
9153  }
9154  }
9155  }
9156  else
9157  {
9158  while (suc != -1)
9159  {
9160  i=suc;
9161  while (i<=strat->sl)
9162  {
9163  change=FALSE;
9164  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9165  {
9166  redSi=pHead((strat->S)[i]);
9167  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9168  if ((strat->S)[i]==NULL)
9169  {
9170  deleteInS(i,strat);
9171  i--;
9172  }
9173  else if (pCmp((strat->S)[i],redSi)!=0)
9174  {
9175  any_change=TRUE;
9176  h.p = strat->S[i];
9177  strat->initEcart(&h);
9178  strat->ecartS[i] = h.ecart;
9180  {
9181  if (TEST_OPT_CONTENTSB)
9182  {
9183  number n;
9184  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
9185  if (!nIsOne(n))
9186  {
9188  denom->n=nInvers(n);
9189  denom->next=DENOMINATOR_LIST;
9190  DENOMINATOR_LIST=denom;
9191  }
9192  nDelete(&n);
9193  }
9194  else
9195  {
9196  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
9197  }
9198  }
9199  else
9200  {
9201  pNorm(strat->S[i]); // == h.p
9202  }
9203  h.sev = pGetShortExpVector(h.p);
9204  strat->sevS[i] = h.sev;
9205  }
9206  pLmDelete(&redSi);
9207  kTest(strat);
9208  }
9209  i++;
9210  }
9211 #ifdef KDEBUG
9212  kTest(strat);
9213 #endif
9214  if (any_change) reorderS(&suc,strat);
9215  else { suc=-1; break; }
9216  if (h.p!=NULL)
9217  {
9218  if (!strat->kHEdgeFound)
9219  {
9220  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9221  }
9222  if (strat->kHEdgeFound)
9223  newHEdge(strat);
9224  }
9225  }
9226  for (i=0; i<=strat->sl; i++)
9227  {
9228  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9229  {
9230  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9231  strat->initEcart(&h);
9232  strat->ecartS[i] = h.ecart;
9233  h.sev = pGetShortExpVector(h.p);
9234  strat->sevS[i] = h.sev;
9235  }
9236  else
9237  {
9238  h.p = strat->S[i];
9239  h.ecart=strat->ecartS[i];
9240  h.sev = strat->sevS[i];
9241  h.length = h.pLength = pLength(h.p);
9242  }
9243  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9244  cancelunit1(&h,&suc,strat->sl,strat);
9245  h.SetpFDeg();
9246  /*puts the elements of S also to T*/
9247  enterT(h,strat);
9248  strat->S_2_R[i] = strat->tl;
9249  }
9250  if (suc!= -1) updateS(toT,strat);
9251  }
9252 #ifdef KDEBUG
9253  kTest(strat);
9254 #endif
9255 }
denominator_list_s * denominator_list
Definition: kutil.h:59
char kHEdgeFound
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8877
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4982
#define TEST_OPT_CONTENTSB
Definition: options.h:125
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:88
#define kTest(A)
Definition: kutil.h:653
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
#define TEST_OPT_DEBUG
Definition: options.h:107
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:468
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8965
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2900
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
#define nInvers(a)
Definition: numbers.h:33
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
denominator_list next
Definition: kutil.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9034
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8989
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10841
void wrp(poly p)
Definition: polys.h:305
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2791

◆ updateSShift()

void updateSShift ( kStrategy  strat)

Definition at line 12183 of file kutil.cc.

12184 {
12185  /* to use after updateS(toT=FALSE,strat) */
12186  /* fills T with shifted elt's of S */
12187  int i;
12188  LObject h;
12189  int atT = -1; // or figure out smth better
12190  strat->tl = -1; // init
12191  for (i=0; i<=strat->sl; i++)
12192  {
12193  memset(&h,0,sizeof(h));
12194  h.p = strat->S[i];
12195  strat->initEcart(&h);
12196  h.sev = strat->sevS[i];
12197  h.t_p = NULL;
12198  h.GetTP(); // creates correct t_p
12199  /*puts the elements of S with their shifts to T*/
12200  // int atT, int uptodeg, int lV)
12201  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12202  // need a small check for above; we insert >=1 elements
12203  // insert this check into kTest_TS ?
12204  enterTShift(h,strat,atT);
12205  }
12206  /* what about setting strat->tl? */
12207 }
void enterTShift(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:12759
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:12
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static Poly * h
Definition: janet.cc:971

Variable Documentation

◆ DENOMINATOR_LIST

denominator_list DENOMINATOR_LIST =NULL

Definition at line 88 of file kutil.cc.

◆ HCord

int HCord

Definition at line 236 of file kutil.cc.

◆ Kstd1_deg

int Kstd1_deg

Definition at line 237 of file kutil.cc.

◆ Kstd1_mu

int Kstd1_mu =32000

Definition at line 238 of file kutil.cc.