Data Structures | Macros | Typedefs | Functions | Variables
kutil.h File Reference
#include <string.h>
#include <omalloc/omalloc.h>
#include <omalloc/omallocClass.h>
#include <misc/mylimits.h>
#include <kernel/polys.h>
#include <polys/operations/pShallowCopyDelete.h>
#include <kernel/structs.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/kInline.h>
#include <kernel/GBEngine/shiftgb.h>

Go to the source code of this file.

Data Structures

struct  denominator_list_s
 
class  sTObject
 
class  sLObject
 
class  skStrategy
 

Macros

#define HAVE_TAIL_RING
 
#define setmax   128
 
#define setmaxL   ((4096-12)/sizeof(LObject))
 
#define setmaxLinc   ((4096)/sizeof(LObject))
 
#define setmaxT   ((4096-12)/sizeof(TObject))
 
#define setmaxTinc   ((4096)/sizeof(TObject))
 
#define KINLINE
 
#define NO_KINLINE   1
 
#define ALLOW_PROD_CRIT(A)   (!(A)->no_prod_crit)
 
#define messageSets(s)   do {} while (0)
 
#define kTest(A)   (TRUE)
 
#define kTest_TS(A)   (TRUE)
 
#define kTest_T(T)   (TRUE)
 
#define kTest_S(T)   (TRUE)
 
#define kTest_L(T)   (TRUE)
 

Typedefs

typedef int * intset
 
typedef int64 wlen_type
 
typedef wlen_typewlen_set
 
typedef class sTObject TObject
 
typedef class sLObject LObject
 
typedef TObjectTSet
 
typedef LObjectLSet
 
typedef denominator_list_sdenominator_list
 

Functions

void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext=FALSE)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void cleanT (kStrategy strat)
 
static LSet initL (int nr=setmaxL)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void enterSBba (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSSba (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void initEcartPairBba (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
 
void initEcartPairMora (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
 
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=0, int end=-1)
 
int posInT0 (const TSet set, const int length, LObject &p)
 
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 posInTSig (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
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)
 
void reorderS (int *suc, kStrategy strat)
 
int posInLF5C (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLSig (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLSigRing (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLRing (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInSyz (const kStrategy strat, const poly sig)
 
int posInL0 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *L, const kStrategy strat)
 
int posInL11Ringls (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL13 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL15 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL15Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL17 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL10 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL10Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL110 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
KINLINE poly redtailBba (poly p, int pos, kStrategy strat, BOOLEAN normalize=FALSE)
 
KINLINE poly redtailBbaBound (poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize=FALSE)
 
KINLINE poly redtailBba_Z (poly p, int pos, kStrategy strat)
 
poly redtailBba_Z (LObject *L, int pos, kStrategy strat)
 
poly redtailBba (LObject *L, int pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailBbaBound (LObject *L, int pos, kStrategy strat, int bound, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailSba (LObject *L, int pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailBba (TObject *T, int pos, kStrategy strat)
 
poly redtail (poly p, int pos, kStrategy strat)
 
poly redtail (LObject *L, int pos, kStrategy strat)
 
poly redNF (poly h, int &max_ind, int nonorm, kStrategy strat)
 
int redNF0 (LObject *P, kStrategy strat)
 
poly redNFTail (poly h, const int sl, kStrategy strat)
 
int redHoney (LObject *h, kStrategy strat)
 
int redRing (LObject *h, kStrategy strat)
 
int redRiloc (LObject *h, kStrategy strat)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
void superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
poly kCreateZeroPoly (long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
 
long ind2 (long arg)
 
long ind_fact_2 (long arg)
 
long twoPow (long arg)
 
ideal createG0 ()
 
int redLazy (LObject *h, kStrategy strat)
 
int redHomog (LObject *h, kStrategy strat)
 
int redSig (LObject *h, kStrategy strat)
 
int redSigRing (LObject *h, kStrategy strat)
 
void enterpairsSig (poly h, poly hSig, int from, int k, int ec, int pos, kStrategy strat, int atR=-1)
 
void enterpairs (poly h, int k, int ec, int pos, kStrategy strat, int atR=-1)
 
void entersets (LObject h)
 
void pairs ()
 
BOOLEAN sbaCheckGcdPair (LObject *h, 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 initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
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 updateS (BOOLEAN toT, kStrategy strat)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void enterT (LObject &p, kStrategy strat, int atT=-1)
 
void enterT_strong (LObject &p, kStrategy strat, int atT=-1)
 
void cancelunit (LObject *p, BOOLEAN inNF=FALSE)
 
void HEckeTest (poly pp, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
void initHilbCrit (ideal F, ideal Q, intvec **hilb, kStrategy strat)
 
void initBuchMoraPos (kStrategy strat)
 
void initBuchMoraPosRing (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT=FALSE)
 
void kFreeStrat (kStrategy strat)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void chainCritNormal (poly p, int ecart, kStrategy strat)
 
void chainCritOpt_1 (poly, int, kStrategy strat)
 
void chainCritSig (poly p, int ecart, kStrategy strat)
 
BOOLEAN homogTest (polyset F, int Fmax)
 
BOOLEAN newHEdge (kStrategy strat)
 
BOOLEAN syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
 
KINLINE BOOLEAN arriRewDummy (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN arriRewCriterion (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN faugereRewCriterion (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN findMinLMPair (poly sig, unsigned long not_sevSig, kStrategy strat, int start)
 
int kFindInT (poly p, TSet T, int tlength)
 returns index of p in TSet, or -1 if not found More...
 
int kFindDivisibleByInT (const kStrategy strat, const LObject *L, const int start=0)
 return -1 if no divisor is found number of first divisor in T, otherwise More...
 
int kFindDivisibleByInS (const kStrategy strat, int *max_ind, LObject *L)
 return -1 if no divisor is found number of first divisor in S, otherwise More...
 
int kFindNextDivisibleByInS (const kStrategy strat, int start, int max_ind, LObject *L)
 
TObjectkFindDivisibleByInS (kStrategy strat, int pos, LObject *L, TObject *T, long ecart=LONG_MAX)
 
KINLINE TSet initT ()
 
KINLINE TObject ** initR ()
 
KINLINE unsigned long * initsevT ()
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE BOOLEAN k_GetLeadTerms (const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
 
KINLINE void k_GetStrongLeadTerms (const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring taiRing)
 
poly kFindZeroPoly (poly input_p, ring leadRing, ring tailRing)
 
ideal bba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
ideal sba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF2 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
poly kNF2Bound (ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
 
ideal kNF2Bound (ideal F, ideal Q, ideal q, int bound, kStrategy strat, int lazyReduce)
 
void initBba (kStrategy strat)
 
void initSba (ideal F, kStrategy strat)
 
void f5c (kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
 
int ksReducePoly (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolyBound (LObject *PR, TObject *PW, int bound, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolySig (LObject *PR, TObject *PW, long idx, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolySigRing (LObject *PR, TObject *PW, long idx, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolyTail (LObject *PR, TObject *PW, poly Current, poly spNoether=NULL)
 
KINLINE int ksReducePolyTail (LObject *PR, TObject *PW, LObject *Red)
 
void ksCreateSpoly (LObject *Pair, poly spNoether=NULL, int use_buckets=0, ring tailRing=currRing, poly m1=NULL, poly m2=NULL, TObject **R=NULL)
 
poly ksCreateShortSpoly (poly p1, poly p2, ring tailRing)
 
KINLINE poly ksOldSpolyRed (poly p1, poly p2, poly spNoether=NULL)
 
KINLINE poly ksOldSpolyRedNew (poly p1, poly p2, poly spNoether=NULL)
 
KINLINE poly ksOldCreateSpoly (poly p1, poly p2, poly spNoether=NULL, ring r=currRing)
 
KINLINE void ksOldSpolyTail (poly p1, poly q, poly q2, poly spNoether, ring r=currRing)
 
BOOLEAN kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
 
BOOLEAN kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
 
poly preIntegerCheck (ideal F, 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=NULL, TObject *T=NULL, unsigned long new_expbound=0)
 
void kStratInitChangeTailRing (kStrategy strat)
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
ring sbaRing (kStrategy strat, const ring r=currRing, BOOLEAN complete=TRUE, int sgn=1)
 
KINLINE void clearS (poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject h, kStrategy strat)
 
void enterTShift (LObject p, kStrategy strat, int atT, int uptodeg, int lV)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int uptodeg, int lV)
 
void enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
 
void updateSShift (kStrategy strat, int uptodeg, int lV)
 
void initBbaShift (kStrategy strat)
 
poly redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
int redFirstShift (LObject *h, kStrategy strat)
 
ideal freegb (ideal I, int uptodeg, int lVblock)
 
ideal bbaShift (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
 

Variables

denominator_list DENOMINATOR_LIST
 
int strat_nr
 
int HCord
 
int(* test_PosInT )(const TSet T, const int tl, LObject &h)
 
int(* test_PosInL )(const LSet set, const int length, LObject *L, const kStrategy strat)
 

Data Structure Documentation

◆ denominator_list_s

struct denominator_list_s

Definition at line 59 of file kutil.h.

Data Fields
number n
denominator_list next

Macro Definition Documentation

◆ ALLOW_PROD_CRIT

#define ALLOW_PROD_CRIT (   A)    (!(A)->no_prod_crit)

Definition at line 384 of file kutil.h.

◆ HAVE_TAIL_RING

#define HAVE_TAIL_RING

Definition at line 25 of file kutil.h.

◆ KINLINE

#define KINLINE

Definition at line 43 of file kutil.h.

◆ kTest

#define kTest (   A)    (TRUE)

Definition at line 640 of file kutil.h.

◆ kTest_L

#define kTest_L (   T)    (TRUE)

Definition at line 644 of file kutil.h.

◆ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 643 of file kutil.h.

◆ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 642 of file kutil.h.

◆ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 641 of file kutil.h.

◆ messageSets

#define messageSets (   s)    do {} while (0)

Definition at line 528 of file kutil.h.

◆ NO_KINLINE

#define NO_KINLINE   1

Definition at line 44 of file kutil.h.

◆ setmax

#define setmax   128

Definition at line 27 of file kutil.h.

◆ setmaxL

#define setmaxL   ((4096-12)/sizeof(LObject))

Definition at line 28 of file kutil.h.

◆ setmaxLinc

#define setmaxLinc   ((4096)/sizeof(LObject))

Definition at line 29 of file kutil.h.

◆ setmaxT

#define setmaxT   ((4096-12)/sizeof(TObject))

Definition at line 31 of file kutil.h.

◆ setmaxTinc

#define setmaxTinc   ((4096)/sizeof(TObject))

Definition at line 32 of file kutil.h.

Typedef Documentation

◆ denominator_list

Definition at line 57 of file kutil.h.

◆ intset

typedef int* intset

Definition at line 47 of file kutil.h.

◆ LObject

typedef class sLObject LObject

Definition at line 52 of file kutil.h.

◆ LSet

typedef LObject* LSet

Definition at line 54 of file kutil.h.

◆ TObject

typedef class sTObject TObject

Definition at line 51 of file kutil.h.

◆ TSet

typedef TObject* TSet

Definition at line 53 of file kutil.h.

◆ wlen_set

typedef wlen_type* wlen_set

Definition at line 49 of file kutil.h.

◆ wlen_type

typedef int64 wlen_type

Definition at line 48 of file kutil.h.

Function Documentation

◆ arriRewCriterion()

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

Definition at line 7264 of file kutil.cc.

7265 {
7266  #ifdef ADIDEBUG
7267  printf("\narriRewCrit\n");
7268  #endif
7270  return FALSE;
7271  poly p1 = pOne();
7272  poly p2 = pOne();
7273  for (int ii=strat->sl; ii>start; ii--)
7274  {
7275  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7276  {
7277  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7278  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7279  if (!(pLmCmp(p1,p2) == 1))
7280  {
7281  #ifdef ADIDEBUG
7282  printf("\narriRewCrit deleted: sig, P.sig\n");
7283  #endif
7284  pDelete(&p1);
7285  pDelete(&p2);
7286  return TRUE;
7287  }
7288  }
7289  }
7290  pDelete(&p1);
7291  pDelete(&p2);
7292  return FALSE;
7293 }
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
#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
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
LObject P
Definition: kutil.h:288
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:292
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:336
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10

◆ arriRewCriterionPre()

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

Definition at line 7295 of file kutil.cc.

7296 {
7297  #ifdef ADIDEBUG
7298  printf("\narriRewCritPre\n");
7299  #endif
7300  //Over Rings, there are still some changes to do: considering coeffs
7302  return FALSE;
7303  int found = -1;
7304  for (int i=strat->Bl; i>-1; i--) {
7305  if (pLmEqual(strat->B[i].sig,sig))
7306  {
7307  found = i;
7308  break;
7309  }
7310  }
7311  if (found != -1)
7312  {
7313  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7314  {
7315  deleteInL(strat->B,&strat->Bl,found,strat);
7316  #ifdef ADIDEBUG
7317  printf("\nDelete!\n");
7318  #endif
7319  }
7320  else
7321  {
7322  #ifdef ADIDEBUG
7323  printf("\nDelete this one!\n");
7324  #endif
7325  return TRUE;
7326  }
7327  }
7328  poly p1 = pOne();
7329  poly p2 = pOne();
7330  for (int ii=strat->sl; ii>-1; ii--)
7331  {
7332  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7333  {
7334  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7335  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7336  if (!(pLmCmp(p1,p2) == 1))
7337  {
7338  pDelete(&p1);
7339  pDelete(&p2);
7340  #ifdef ADIDEBUG
7341  printf("\nDelete this one!\n");
7342  #endif
7343  return TRUE;
7344  }
7345  }
7346  }
7347  pDelete(&p1);
7348  pDelete(&p2);
7349  return FALSE;
7350 }
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
#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:340
#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:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:292
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
LSet B
Definition: kutil.h:314
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:336
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10
#define pLmEqual(p1, p2)
Definition: polys.h:111

◆ arriRewDummy()

KINLINE BOOLEAN arriRewDummy ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int  start 
)

Definition at line 1147 of file kInline.h.

1148 {
1149  return FALSE;
1150 }
#define FALSE
Definition: auxiliary.h:94

◆ bba()

ideal bba ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1972 of file kstd2.cc.

1973 {
1974  int red_result = 1;
1975  int olddeg,reduc;
1976  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1977  BOOLEAN withT = FALSE;
1978  BITSET save;
1979  SI_SAVE_OPT1(save);
1980 
1981  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1983  initBuchMoraPosRing(strat);
1984  else
1985  initBuchMoraPos(strat);
1986  initHilbCrit(F,Q,&hilb,strat);
1987  initBba(strat);
1988  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1989  /*Shdl=*/initBuchMora(F, Q,strat);
1990  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1991  reduc = olddeg = 0;
1992 
1993 #ifndef NO_BUCKETS
1994  if (!TEST_OPT_NOT_BUCKETS)
1995  strat->use_buckets = 1;
1996 #endif
1997  // redtailBBa against T for inhomogenous input
1998  if (!TEST_OPT_OLDSTD)
1999  withT = ! strat->homog;
2000 
2001  // strat->posInT = posInT_pLength;
2002  kTest_TS(strat);
2003 
2004 #ifdef HAVE_TAIL_RING
2005  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2006  kStratInitChangeTailRing(strat);
2007 #endif
2008  if (BVERBOSE(23))
2009  {
2010  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
2011  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
2012  kDebugPrint(strat);
2013  }
2014 
2015 
2016 #ifdef KDEBUG
2017  //kDebugPrint(strat);
2018 #endif
2019  /* compute------------------------------------------------------- */
2020  while (strat->Ll >= 0)
2021  {
2022  #ifdef ADIDEBUG
2023  printf("\n ------------------------NEW LOOP\n");
2024  printf("\nShdl = \n");
2025  #if 0
2026  idPrint(strat->Shdl);
2027  #else
2028  for(int ii = 0; ii<=strat->sl;ii++)
2029  p_Write(strat->S[ii],strat->tailRing);
2030  #endif
2031  printf("\n list L\n");
2032  int iii;
2033  #if 1
2034  for(iii = 0; iii<= strat->Ll; iii++)
2035  {
2036  printf("L[%i]:",iii);
2037  p_Write(strat->L[iii].p, currRing);
2038  p_Write(strat->L[iii].p1, currRing);
2039  p_Write(strat->L[iii].p2, currRing);
2040  }
2041  #else
2042  {
2043  printf("L[%i]:",strat->Ll);
2044  p_Write(strat->L[strat->Ll].p, strat->tailRing);
2045  p_Write(strat->L[strat->Ll].p1, strat->tailRing);
2046  p_Write(strat->L[strat->Ll].p2, strat->tailRing);
2047  }
2048  #endif
2049  #if 0
2050  for(iii = 0; iii<= strat->Bl; iii++)
2051  {
2052  printf("B[%i]:",iii);
2053  p_Write(strat->B[iii].p, /*strat->tailRing*/currRing);
2054  p_Write(strat->B[iii].p1, /*strat->tailRing*/currRing);
2055  p_Write(strat->B[iii].p2, strat->tailRing);
2056  }
2057  #endif
2058  //getchar();
2059  #endif
2060  #ifdef KDEBUG
2061  if (TEST_OPT_DEBUG) messageSets(strat);
2062  #endif
2063  if (strat->Ll== 0) strat->interpt=TRUE;
2064  if (TEST_OPT_DEGBOUND
2065  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2066  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2067  {
2068  /*
2069  *stops computation if
2070  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2071  *a predefined number Kstd1_deg
2072  */
2073  while ((strat->Ll >= 0)
2074  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2075  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2076  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2077  )
2078  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2079  if (strat->Ll<0) break;
2080  else strat->noClearS=TRUE;
2081  }
2082  /* picks the last element from the lazyset L */
2083  strat->P = strat->L[strat->Ll];
2084  strat->Ll--;
2085 
2086  if (pNext(strat->P.p) == strat->tail)
2087  {
2088  // deletes the short spoly
2089  if (rField_is_Ring(currRing))
2090  pLmDelete(strat->P.p);
2091  else
2092  pLmFree(strat->P.p);
2093  strat->P.p = NULL;
2094  poly m1 = NULL, m2 = NULL;
2095 
2096  // check that spoly creation is ok
2097  while (strat->tailRing != currRing &&
2098  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2099  {
2100  assume(m1 == NULL && m2 == NULL);
2101  // if not, change to a ring where exponents are at least
2102  // large enough
2103  if (!kStratChangeTailRing(strat))
2104  {
2105  WerrorS("OVERFLOW...");
2106  break;
2107  }
2108  }
2109  // create the real one
2110  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2111  strat->tailRing, m1, m2, strat->R);
2112  }
2113  else if (strat->P.p1 == NULL)
2114  {
2115  if (strat->minim > 0)
2116  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2117  // for input polys, prepare reduction
2118  strat->P.PrepareRed(strat->use_buckets);
2119  }
2120 
2121  if (strat->P.p == NULL && strat->P.t_p == NULL)
2122  {
2123  red_result = 0;
2124  }
2125  else
2126  {
2127  if (TEST_OPT_PROT)
2128  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2129  &olddeg,&reduc,strat, red_result);
2130 
2131  /* reduction of the element chosen from L */
2132  red_result = strat->red(&strat->P,strat);
2133  if (errorreported) break;
2134  }
2135 
2136  if (strat->overflow)
2137  {
2138  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2139  }
2140 
2141  // reduction to non-zero new poly
2142  if (red_result == 1)
2143  {
2144  // get the polynomial (canonicalize bucket, make sure P.p is set)
2145  strat->P.GetP(strat->lmBin);
2146  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2147  // but now, for entering S, T, we reset it
2148  // in the inhomogeneous case: FDeg == pFDeg
2149  if (strat->homog) strat->initEcart(&(strat->P));
2150 
2151  /* statistic */
2152  if (TEST_OPT_PROT) PrintS("s");
2153 
2154  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2155 
2156  // reduce the tail and normalize poly
2157  // in the ring case we cannot expect LC(f) = 1,
2158  // therefore we call pContent instead of pNorm
2160  {
2161  strat->P.pCleardenom();
2163  {
2164  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
2165  strat->P.pCleardenom();
2166  }
2167  }
2168  else
2169  {
2170  strat->P.pNorm();
2172  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2173  }
2174 
2175 #ifdef KDEBUG
2176  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2177 #endif /* KDEBUG */
2178 
2179  // min_std stuff
2180  if ((strat->P.p1==NULL) && (strat->minim>0))
2181  {
2182  if (strat->minim==1)
2183  {
2184  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2185  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2186  }
2187  else
2188  {
2189  strat->M->m[minimcnt]=strat->P.p2;
2190  strat->P.p2=NULL;
2191  }
2192  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2193  pNext(strat->M->m[minimcnt])
2194  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2195  strat->tailRing, currRing,
2196  currRing->PolyBin);
2197  minimcnt++;
2198  }
2199 
2200  // enter into S, L, and T
2201  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2202  {
2203  enterT(strat->P, strat);
2204  if (rField_is_Ring(currRing))
2205  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2206  else
2207  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2208  // posInS only depends on the leading term
2209  strat->enterS(strat->P, pos, strat, strat->tl);
2210  #ifdef ADIDEBUG
2211  printf("\nThis element has been added to S:\n");pWrite(strat->P.p);pWrite(strat->P.p1);pWrite(strat->P.p2);
2212  #endif
2213 #if 0
2214  int pl=pLength(strat->P.p);
2215  if (pl==1)
2216  {
2217  //if (TEST_OPT_PROT)
2218  //PrintS("<1>");
2219  }
2220  else if (pl==2)
2221  {
2222  //if (TEST_OPT_PROT)
2223  //PrintS("<2>");
2224  }
2225 #endif
2226  }
2227  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2228 // Print("[%d]",hilbeledeg);
2229  if (strat->P.lcm!=NULL)
2230  {
2231  if (rField_is_Ring(currRing)) pLmDelete(strat->P.lcm);
2232  else pLmFree(strat->P.lcm);
2233  strat->P.lcm=NULL;
2234  }
2235  if (strat->s_poly!=NULL)
2236  {
2237  // the only valid entries are: strat->P.p,
2238  // strat->tailRing (read-only, keep it)
2239  // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2240  if (strat->s_poly(strat))
2241  {
2242  // we are called AFTER enterS, i.e. if we change P
2243  // we have to add it also to S/T
2244  // and add pairs
2245  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2246  enterT(strat->P, strat);
2247  if (rField_is_Ring(currRing))
2248  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2249  else
2250  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2251  strat->enterS(strat->P, pos, strat, strat->tl);
2252  }
2253  }
2254  }
2255  else if (strat->P.p1 == NULL && strat->minim > 0)
2256  {
2257  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2258  }
2259 
2260 #ifdef KDEBUG
2261  memset(&(strat->P), 0, sizeof(strat->P));
2262 #endif /* KDEBUG */
2263  kTest_TS(strat);
2264  }
2265 #ifdef KDEBUG
2266  if (TEST_OPT_DEBUG) messageSets(strat);
2267 #endif /* KDEBUG */
2268 
2269  if (TEST_OPT_SB_1)
2270  {
2271  if(!rField_is_Ring(currRing))
2272  {
2273  int k=1;
2274  int j;
2275  while(k<=strat->sl)
2276  {
2277  j=0;
2278  loop
2279  {
2280  if (j>=k) break;
2281  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2282  j++;
2283  }
2284  k++;
2285  }
2286  }
2287  }
2288  /* complete reduction of the standard basis--------- */
2289  if (TEST_OPT_REDSB)
2290  {
2291  completeReduce(strat);
2292  if (strat->completeReduce_retry)
2293  {
2294  // completeReduce needed larger exponents, retry
2295  // to reduce with S (instead of T)
2296  // and in currRing (instead of strat->tailRing)
2297 #ifdef HAVE_TAIL_RING
2298  if(currRing->bitmask>strat->tailRing->bitmask)
2299  {
2300  strat->completeReduce_retry=FALSE;
2301  cleanT(strat);strat->tailRing=currRing;
2302  int i;
2303  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2304  completeReduce(strat);
2305  }
2306  if (strat->completeReduce_retry)
2307 #endif
2308  Werror("exponent bound is %ld",currRing->bitmask);
2309  }
2310  }
2311  else if (TEST_OPT_PROT) PrintLn();
2312  if (!errorreported)
2313  {
2315  {
2316  for(int i = 0;i<=strat->sl;i++)
2317  {
2318  if(!nGreaterZero(pGetCoeff(strat->S[i])))
2319  {
2320  strat->S[i] = pNeg(strat->S[i]);
2321  }
2322  }
2323  finalReduceByMon(strat);
2324  for(int i = 0;i<=strat->sl;i++)
2325  {
2326  if(!nGreaterZero(pGetCoeff(strat->S[i])))
2327  {
2328  strat->S[i] = pNeg(strat->S[i]);
2329  }
2330  }
2331  }
2332  else if (rField_is_Ring(currRing))
2333  finalReduceByMon(strat);
2334  }
2335  /* release temp data-------------------------------- */
2336  exitBuchMora(strat);
2337 // if (TEST_OPT_WEIGHTM)
2338 // {
2339 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2340 // if (ecartWeights)
2341 // {
2342 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2343 // ecartWeights=NULL;
2344 // }
2345 // }
2346  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
2347  SI_RESTORE_OPT1(save);
2348  if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
2349 
2350  idTest(strat->Shdl);
2351 
2352  return (strat->Shdl);
2353 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9919
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7915
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7956
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10092
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define pNeg(p)
Definition: polys.h:181
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4926
int Bl
Definition: kutil.h:340
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
char noClearS
Definition: kutil.h:391
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void pWrite(poly p)
Definition: polys.h:290
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
void initBba(kStrategy strat)
Definition: kstd1.cc:1426
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define BITSET
Definition: structs.h:18
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10005
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:346
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11353
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
BOOLEAN interpt
Definition: kutil.h:360
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define idPrint(id)
Definition: ideals.h:46
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:641
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9750
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:528
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
LObject P
Definition: kutil.h:288
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
ideal M
Definition: kutil.h:291
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
static unsigned pLength(poly a)
Definition: p_polys.h:189
polyset S
Definition: kutil.h:292
#define IDELEMS(i)
Definition: simpleideals.h:24
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
#define BVERBOSE(a)
Definition: options.h:33
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:314
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4889
ring tailRing
Definition: kutil.h:331
static BOOLEAN rField_is_Ring_Z(const ring r)
Definition: ring.h:474
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10613
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10401
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
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:82
int sl
Definition: kutil.h:336
BOOLEAN use_buckets
Definition: kutil.h:372
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:83
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:236
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:11188
ideal Shdl
Definition: kutil.h:289
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10168
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11800
#define idTest(id)
Definition: ideals.h:47

◆ bbaShift()

ideal bbaShift ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 4017 of file kstd2.cc.

4018 {
4019  int red_result = 1;
4020  int olddeg,reduc;
4021  int hilbeledeg=1,hilbcount=0,minimcnt=0;
4022  BOOLEAN withT = TRUE; // very important for shifts
4023 
4024  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
4026  initBuchMoraPosRing(strat);
4027  else
4028  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
4029  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
4030  initBbaShift(strat); /* DONE */
4031  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
4032  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
4033  updateSShift(strat,uptodeg,lV); /* initializes T */
4034 
4035  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
4036  reduc = olddeg = 0;
4037  strat->lV=lV;
4038 
4039 #ifndef NO_BUCKETS
4040  if (!TEST_OPT_NOT_BUCKETS)
4041  strat->use_buckets = 1;
4042 #endif
4043 
4044  // redtailBBa against T for inhomogenous input
4045  // if (!TEST_OPT_OLDSTD)
4046  // withT = ! strat->homog;
4047 
4048  // strat->posInT = posInT_pLength;
4049  kTest_TS(strat);
4050 
4051 #ifdef HAVE_TAIL_RING
4052  kStratInitChangeTailRing(strat);
4053 #endif
4054 
4055  /* compute------------------------------------------------------- */
4056  while (strat->Ll >= 0)
4057  {
4058 #ifdef KDEBUG
4059  if (TEST_OPT_DEBUG) messageSets(strat);
4060 #endif
4061  if (strat->Ll== 0) strat->interpt=TRUE;
4062  if (TEST_OPT_DEGBOUND
4063  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4064  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
4065  {
4066  /*
4067  *stops computation if
4068  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
4069  *a predefined number Kstd1_deg
4070  */
4071  while ((strat->Ll >= 0)
4072  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
4073  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4074  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
4075  )
4076  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
4077  if (strat->Ll<0) break;
4078  else strat->noClearS=TRUE;
4079  }
4080  /* picks the last element from the lazyset L */
4081  strat->P = strat->L[strat->Ll];
4082  strat->Ll--;
4083 
4084  if (pNext(strat->P.p) == strat->tail)
4085  {
4086  // deletes the short spoly
4087  pLmFree(strat->P.p);
4088  strat->P.p = NULL;
4089  poly m1 = NULL, m2 = NULL;
4090 
4091  // check that spoly creation is ok
4092  while (strat->tailRing != currRing &&
4093  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
4094  {
4095  assume(m1 == NULL && m2 == NULL);
4096  // if not, change to a ring where exponents are at least
4097  // large enough
4098  kStratChangeTailRing(strat);
4099  }
4100  // create the real one
4101  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
4102  strat->tailRing, m1, m2, strat->R);
4103  }
4104  else if (strat->P.p1 == NULL)
4105  {
4106  if (strat->minim > 0)
4107  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
4108  // for input polys, prepare reduction
4109  strat->P.PrepareRed(strat->use_buckets);
4110  }
4111 
4112  poly qq;
4113 
4114  /* here in the nonhomog case we shrink the new spoly */
4115 
4116  if ( ! strat->homog)
4117  {
4118  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
4119  /* in the nonhomog case we have to shrink the polynomial */
4120  assume(strat->P.t_p!=NULL);
4121  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
4122  if (qq != NULL)
4123  {
4124  /* we're here if Shrink is nonzero */
4125  // strat->P.p = NULL;
4126  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
4127  strat->P.p = NULL; // is not set by Delete
4128  strat->P.t_p = qq;
4129  strat->P.GetP(strat->lmBin);
4130  // update sev and length
4131  strat->initEcart(&(strat->P));
4132  strat->P.sev = pGetShortExpVector(strat->P.p);
4133 // strat->P.FDeg = strat->P.pFDeg();
4134 // strat->P.length = strat->P.pLDeg();
4135 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
4136  }
4137  else
4138  {
4139  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
4140 #ifdef KDEBUG
4141  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
4142 #endif
4143  // strat->P.Delete(); // cause error
4144  strat->P.p = NULL;
4145  strat->P.t_p = NULL;
4146  // strat->P.p = NULL; // or delete strat->P.p ?
4147  }
4148  }
4149  /* end shrinking poly in the nonhomog case */
4150 
4151  if (strat->P.p == NULL && strat->P.t_p == NULL)
4152  {
4153  red_result = 0;
4154  }
4155  else
4156  {
4157  if (TEST_OPT_PROT)
4158  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
4159  &olddeg,&reduc,strat, red_result);
4160 
4161  /* reduction of the element chosen from L */
4162  red_result = strat->red(&strat->P,strat);
4163  }
4164 
4165  // reduction to non-zero new poly
4166  if (red_result == 1)
4167  {
4168  /* statistic */
4169  if (TEST_OPT_PROT) PrintS("s");
4170 
4171  // get the polynomial (canonicalize bucket, make sure P.p is set)
4172  strat->P.GetP(strat->lmBin);
4173 
4174  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4175 
4176  // reduce the tail and normalize poly
4178  {
4179  strat->P.pCleardenom();
4181  {
4182  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4183  strat->P.pCleardenom();
4184  }
4185  }
4186  else
4187  {
4188  strat->P.pNorm();
4190  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4191  }
4192 
4193  // here we must shrink again! and optionally reduce again
4194  // or build shrink into redtailBba!
4195 
4196 #ifdef KDEBUG
4197  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4198 #endif
4199 
4200  // min_std stuff
4201  if ((strat->P.p1==NULL) && (strat->minim>0))
4202  {
4203  if (strat->minim==1)
4204  {
4205  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4206  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4207  }
4208  else
4209  {
4210  strat->M->m[minimcnt]=strat->P.p2;
4211  strat->P.p2=NULL;
4212  }
4213  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4214  pNext(strat->M->m[minimcnt])
4215  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4216  strat->tailRing, currRing,
4217  currRing->PolyBin);
4218  minimcnt++;
4219  }
4220 
4221  /* here in the nonhomog case we shrink the reduced poly AGAIN */
4222 
4223  if ( ! strat->homog)
4224  {
4225  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
4226  /* assume strat->P.t_p != NULL */
4227  /* in the nonhomog case we have to shrink the polynomial */
4228  assume(strat->P.t_p!=NULL); // poly qq defined above
4229  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
4230  if (qq != NULL)
4231  {
4232  /* we're here if Shrink is nonzero */
4233  // strat->P.p = NULL;
4234  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
4235  strat->P.p = NULL; // is not set by Delete
4236  strat->P.t_p = qq;
4237  strat->P.GetP(strat->lmBin);
4238  // update sev and length
4239  strat->initEcart(&(strat->P));
4240  strat->P.sev = pGetShortExpVector(strat->P.p);
4241  }
4242  else
4243  {
4244  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
4245 #ifdef PDEBUG
4246  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
4247 #endif
4248  // strat->P.Delete(); // cause error
4249  strat->P.p = NULL;
4250  strat->P.t_p = NULL;
4251  // strat->P.p = NULL; // or delete strat->P.p ?
4252  goto red_shrink2zero;
4253  }
4254  }
4255  /* end shrinking poly AGAIN in the nonhomog case */
4256 
4257 
4258  // enter into S, L, and T
4259  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4260  // enterT(strat->P, strat); // this was here before Shift stuff
4261  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
4262  // the default value for atT = -1 as in bba
4263  /* strat->P.GetP(); */
4264  // because shifts are counted with .p structure // done before, but ?
4265  int atR=strat->tl+1; // enterTShift introduces T[tl+1], T[tl+2]...
4266  // with T[tl+1]=P.p
4267  enterTShift(strat->P,strat,-1,uptodeg, lV);
4268  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR,uptodeg,lV);
4269  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
4270  // posInS only depends on the leading term
4271  strat->enterS(strat->P, pos, strat, atR);
4272 
4273  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4274 // Print("[%d]",hilbeledeg);
4275  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
4276  }
4277  else
4278  {
4279  red_shrink2zero:
4280  if (strat->P.p1 == NULL && strat->minim > 0)
4281  {
4282  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4283  }
4284  }
4285 #ifdef KDEBUG
4286  memset(&(strat->P), 0, sizeof(strat->P));
4287 #endif
4288  kTest_TS(strat);
4289  }
4290 #ifdef KDEBUG
4291  if (TEST_OPT_DEBUG) messageSets(strat);
4292 #endif
4293  /* complete reduction of the standard basis--------- */
4294  /* shift case: look for elt's in S such that they are divisible by elt in T */
4295  // if (TEST_OPT_SB_1)
4296  if (TEST_OPT_REDSB)
4297  {
4298  int k=0;
4299  int j=-1;
4300  while(k<=strat->sl)
4301  {
4302 // loop
4303 // {
4304 // if (j>=k) break;
4305 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
4306 // j++;
4307 // }
4308  LObject Ln (strat->S[k],currRing, strat->tailRing);
4309  Ln.SetShortExpVector();
4310  j = kFindDivisibleByInT(strat, &Ln, j+1);
4311  if (j<0) { k++; j=-1;}
4312  else
4313  {
4314  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
4315  {
4316  j = kFindDivisibleByInT(strat, &Ln, j+1);
4317  if (j<0) { k++; j=-1;}
4318  else
4319  {
4320  deleteInS(k,strat);
4321  }
4322  }
4323  else
4324  {
4325  deleteInS(k,strat);
4326  }
4327  }
4328  }
4329  }
4330 
4331  if (TEST_OPT_REDSB)
4332  { completeReduce(strat, TRUE); //shift: withT = TRUE
4333  if (strat->completeReduce_retry)
4334  {
4335  // completeReduce needed larger exponents, retry
4336  // to reduce with S (instead of T)
4337  // and in currRing (instead of strat->tailRing)
4338 #ifdef HAVE_TAIL_RING
4339  if(currRing->bitmask>strat->tailRing->bitmask)
4340  {
4341  strat->completeReduce_retry=FALSE;
4342  cleanT(strat);strat->tailRing=currRing;
4343  int i;
4344  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
4345  completeReduce(strat);
4346  }
4347  if (strat->completeReduce_retry)
4348 #endif
4349  Werror("exponent bound is %ld",currRing->bitmask);
4350  }
4351  }
4352  else if (TEST_OPT_PROT) PrintLn();
4353 
4354  /* release temp data-------------------------------- */
4355  exitBuchMora(strat);
4356 // if (TEST_OPT_WEIGHTM)
4357 // {
4358 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
4359 // if (ecartWeights)
4360 // {
4361 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
4362 // ecartWeights=NULL;
4363 // }
4364 // }
4365  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
4366  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
4367  return (strat->Shdl);
4368 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9919
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7915
class sLObject LObject
Definition: kutil.h:52
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7956
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
#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
char noClearS
Definition: kutil.h:391
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
int k
Definition: cfEzgcd.cc:93
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
Definition: kutil.cc:12666
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10005
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
int minim
Definition: kutil.h:346
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11353
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void updateSShift(kStrategy strat, int uptodeg, int lV)
Definition: kutil.cc:12060
BOOLEAN interpt
Definition: kutil.h:360
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12697
int lV
Definition: kutil.h:357
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:641
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9750
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:528
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
LObject P
Definition: kutil.h:288
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
ideal M
Definition: kutil.h:291
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:12088
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
void initBbaShift(kStrategy strat)
Definition: kstd2.cc:4532
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:552
ring tailRing
Definition: kutil.h:331
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10613
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10401
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
omBin lmBin
Definition: kutil.h:332
BOOLEAN use_buckets
Definition: kutil.h:372
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:88
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:236
int BOOLEAN
Definition: auxiliary.h:85
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10168
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ cancelunit()

void cancelunit ( LObject p,
BOOLEAN  inNF = FALSE 
)

Definition at line 332 of file kutil.cc.

333 {
334  int i;
335  poly h;
336  number lc;
337 
338  if(rHasGlobalOrdering (currRing)) return;
339  if(TEST_OPT_CANCELUNIT) return;
340 
341  ring r = L->tailRing;
342  poly p = L->GetLmTailRing();
343 
344  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
345  lc = pGetCoeff(p);
346  #ifdef ADIDEBUG
347  printf("\n cancelunit\n");
348  pWrite(p);
349  #endif
350 #ifdef HAVE_RINGS
351  // Leading coef have to be a unit
352  // example 2x+4x2 should be simplified to 2x*(1+2x)
353  // and 2 is not a unit in Z
354  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
355 #endif
356 
357  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
358 
359 // for(i=r->N;i>0;i--)
360 // {
361 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
362 // }
363  h = pNext(p);
364 
366  {
367  loop
368  {
369  if (h==NULL)
370  {
371  p_Delete(&pNext(p), r);
372  if (!inNF)
373  {
374  number eins= nCopy(lc);
375  if (L->p != NULL)
376  {
377  pSetCoeff(L->p,eins);
378  if (L->t_p != NULL)
379  pSetCoeff0(L->t_p,eins);
380  }
381  else
382  pSetCoeff(L->t_p,eins);
383  /* p and t_p share the same coeff, if both are !=NULL */
384  /* p==NULL==t_p cannot happen here */
385  }
386  L->ecart = 0;
387  L->length = 1;
388  //if (L->pLength > 0)
389  L->pLength = 1;
390  L->max_exp = NULL;
391 
392  if (L->t_p != NULL && pNext(L->t_p) != NULL)
393  p_Delete(&pNext(L->t_p),r);
394  if (L->p != NULL && pNext(L->p) != NULL)
395  pNext(L->p) = NULL;
396 
397  return;
398  }
399  i = rVar(r);
400  loop
401  {
402  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
403  i--;
404  if (i == 0) break; // does divide, try next monom
405  }
406  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
407  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
408  // domains), no zerodivisor test needed CAUTION
409  #ifdef ADIDEBUG
410  pWrite(h);
411  #endif
412  if (!n_DivBy(pGetCoeff(h),lc,r->cf))
413  {
414  #ifdef ADIDEBUG
415  printf("\nDoes not divide\n");
416  #endif
417  return;
418  }
419  #ifdef ADIDEBUG
420  printf("\nDivides. Go On\n");
421  #endif
422  pIter(h);
423  }
424  }
425  else
426  {
427  loop
428  {
429  if (h==NULL)
430  {
431  p_Delete(&pNext(p), r);
432  if (!inNF)
433  {
434  number eins=nInit(1);
435  if (L->p != NULL)
436  {
437  pSetCoeff(L->p,eins);
438  if (L->t_p != NULL)
439  pSetCoeff0(L->t_p,eins);
440  }
441  else
442  pSetCoeff(L->t_p,eins);
443  /* p and t_p share the same coeff, if both are !=NULL */
444  /* p==NULL==t_p cannot happen here */
445  }
446  L->ecart = 0;
447  L->length = 1;
448  //if (L->pLength > 0)
449  L->pLength = 1;
450  L->max_exp = NULL;
451 
452  if (L->t_p != NULL && pNext(L->t_p) != NULL)
453  p_Delete(&pNext(L->t_p),r);
454  if (L->p != NULL && pNext(L->p) != NULL)
455  pNext(L->p) = NULL;
456 
457  return;
458  }
459  i = rVar(r);
460  loop
461  {
462  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
463  i--;
464  if (i == 0) break; // does divide, try next monom
465  }
466  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
467  pIter(h);
468  }
469  }
470 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
CanonicalForm lc(const CanonicalForm &f)
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_CANCELUNIT
Definition: options.h:122
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1209

◆ chainCritNormal()

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

Definition at line 3247 of file kutil.cc.

3248 {
3249  int i,j,l;
3250 
3251  /*
3252  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3253  *In this case all elements in B such
3254  *that their lcm is divisible by the leading term of S[i] can be canceled
3255  */
3256  if (strat->pairtest!=NULL)
3257  {
3258  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3259  for (j=0; j<=strat->sl; j++)
3260  {
3261  if (strat->pairtest[j])
3262  {
3263  for (i=strat->Bl; i>=0; i--)
3264  {
3265  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3266  {
3267  deleteInL(strat->B,&strat->Bl,i,strat);
3268  strat->c3++;
3269  }
3270  }
3271  }
3272  }
3273  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3274  strat->pairtest=NULL;
3275  }
3276  if (strat->Gebauer || strat->fromT)
3277  {
3278  if (strat->sugarCrit)
3279  {
3280  /*
3281  *suppose L[j] == (s,r) and p/lcm(s,r)
3282  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3283  *and in case the sugar is o.k. then L[j] can be canceled
3284  */
3285  for (j=strat->Ll; j>=0; j--)
3286  {
3287  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3288  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3289  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3290  {
3291  if (strat->L[j].p == strat->tail)
3292  {
3293  deleteInL(strat->L,&strat->Ll,j,strat);
3294  strat->c3++;
3295  }
3296  }
3297  }
3298  /*
3299  *this is GEBAUER-MOELLER:
3300  *in B all elements with the same lcm except the "best"
3301  *(i.e. the last one in B with this property) will be canceled
3302  */
3303  j = strat->Bl;
3304  loop /*cannot be changed into a for !!! */
3305  {
3306  if (j <= 0) break;
3307  i = j-1;
3308  loop
3309  {
3310  if (i < 0) break;
3311  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3312  {
3313  strat->c3++;
3314  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3315  {
3316  deleteInL(strat->B,&strat->Bl,i,strat);
3317  j--;
3318  }
3319  else
3320  {
3321  deleteInL(strat->B,&strat->Bl,j,strat);
3322  break;
3323  }
3324  }
3325  i--;
3326  }
3327  j--;
3328  }
3329  }
3330  else /*sugarCrit*/
3331  {
3332  /*
3333  *suppose L[j] == (s,r) and p/lcm(s,r)
3334  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3335  *and in case the sugar is o.k. then L[j] can be canceled
3336  */
3337  for (j=strat->Ll; j>=0; j--)
3338  {
3339  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3340  {
3341  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3342  {
3343  deleteInL(strat->L,&strat->Ll,j,strat);
3344  strat->c3++;
3345  }
3346  }
3347  }
3348  /*
3349  *this is GEBAUER-MOELLER:
3350  *in B all elements with the same lcm except the "best"
3351  *(i.e. the last one in B with this property) will be canceled
3352  */
3353  j = strat->Bl;
3354  loop /*cannot be changed into a for !!! */
3355  {
3356  if (j <= 0) break;
3357  for(i=j-1; i>=0; i--)
3358  {
3359  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3360  {
3361  strat->c3++;
3362  deleteInL(strat->B,&strat->Bl,i,strat);
3363  j--;
3364  }
3365  }
3366  j--;
3367  }
3368  }
3369  /*
3370  *the elements of B enter L
3371  */
3372  kMergeBintoL(strat);
3373  }
3374  else
3375  {
3376  for (j=strat->Ll; j>=0; j--)
3377  {
3378  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3379  {
3380  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3381  {
3382  deleteInL(strat->L,&strat->Ll,j,strat);
3383  strat->c3++;
3384  }
3385  }
3386  }
3387  /*
3388  *this is our MODIFICATION of GEBAUER-MOELLER:
3389  *First the elements of B enter L,
3390  *then we fix a lcm and the "best" element in L
3391  *(i.e the last in L with this lcm and of type (s,p))
3392  *and cancel all the other elements of type (r,p) with this lcm
3393  *except the case the element (s,r) has also the same lcm
3394  *and is on the worst position with respect to (s,p) and (r,p)
3395  */
3396  /*
3397  *B enters to L/their order with respect to B is permutated for elements
3398  *B[i].p with the same leading term
3399  */
3400  kMergeBintoL(strat);
3401  j = strat->Ll;
3402  loop /*cannot be changed into a for !!! */
3403  {
3404  if (j <= 0)
3405  {
3406  /*now L[0] cannot be canceled any more and the tail can be removed*/
3407  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3408  break;
3409  }
3410  if (strat->L[j].p2 == p)
3411  {
3412  i = j-1;
3413  loop
3414  {
3415  if (i < 0) break;
3416  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3417  {
3418  /*L[i] could be canceled but we search for a better one to cancel*/
3419  strat->c3++;
3420  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3421  && (pNext(strat->L[l].p) == strat->tail)
3422  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3423  && pDivisibleBy(p,strat->L[l].lcm))
3424  {
3425  /*
3426  *"NOT equal(...)" because in case of "equal" the element L[l]
3427  *is "older" and has to be from theoretical point of view behind
3428  *L[i], but we do not want to reorder L
3429  */
3430  strat->L[i].p2 = strat->tail;
3431  /*
3432  *L[l] will be canceled, we cannot cancel L[i] later on,
3433  *so we mark it with "tail"
3434  */
3435  deleteInL(strat->L,&strat->Ll,l,strat);
3436  i--;
3437  }
3438  else
3439  {
3440  deleteInL(strat->L,&strat->Ll,i,strat);
3441  }
3442  j--;
3443  }
3444  i--;
3445  }
3446  }
3447  else if (strat->L[j].p2 == strat->tail)
3448  {
3449  /*now L[j] cannot be canceled any more and the tail can be removed*/
3450  strat->L[j].p2 = p;
3451  }
3452  j--;
3453  }
3454  }
3455 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:335
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:321
int Bl
Definition: kutil.h:340
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:681
BOOLEAN Gebauer
Definition: kutil.h:367
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:20
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
polyset S
Definition: kutil.h:292
BOOLEAN sugarCrit
Definition: kutil.h:366
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
LSet B
Definition: kutil.h:314
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:336
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3205
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ chainCritOpt_1()

void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 3460 of file kutil.cc.

3461 {
3462  if (strat->pairtest!=NULL)
3463  {
3464  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3465  strat->pairtest=NULL;
3466  }
3467  /*
3468  *the elements of B enter L
3469  */
3470  kMergeBintoL(strat);
3471 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:336
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3205
int BOOLEAN
Definition: auxiliary.h:85

◆ chainCritSig()

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

Definition at line 3476 of file kutil.cc.

3477 {
3478  int i,j,l;
3479  kMergeBintoLSba(strat);
3480  j = strat->Ll;
3481  loop /*cannot be changed into a for !!! */
3482  {
3483  if (j <= 0)
3484  {
3485  /*now L[0] cannot be canceled any more and the tail can be removed*/
3486  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3487  break;
3488  }
3489  if (strat->L[j].p2 == p)
3490  {
3491  i = j-1;
3492  loop
3493  {
3494  if (i < 0) break;
3495  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3496  {
3497  /*L[i] could be canceled but we search for a better one to cancel*/
3498  strat->c3++;
3499  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3500  && (pNext(strat->L[l].p) == strat->tail)
3501  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3502  && pDivisibleBy(p,strat->L[l].lcm))
3503  {
3504  /*
3505  *"NOT equal(...)" because in case of "equal" the element L[l]
3506  *is "older" and has to be from theoretical point of view behind
3507  *L[i], but we do not want to reorder L
3508  */
3509  strat->L[i].p2 = strat->tail;
3510  /*
3511  *L[l] will be canceled, we cannot cancel L[i] later on,
3512  *so we mark it with "tail"
3513  */
3514  deleteInL(strat->L,&strat->Ll,l,strat);
3515  i--;
3516  }
3517  else
3518  {
3519  deleteInL(strat->L,&strat->Ll,i,strat);
3520  }
3521  j--;
3522  }
3523  i--;
3524  }
3525  }
3526  else if (strat->L[j].p2 == strat->tail)
3527  {
3528  /*now L[j] cannot be canceled any more and the tail can be removed*/
3529  strat->L[j].p2 = p;
3530  }
3531  j--;
3532  }
3533 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:335
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:681
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3226
LSet L
Definition: kutil.h:313
#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:43
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ cleanT()

void cleanT ( kStrategy  strat)

Definition at line 552 of file kutil.cc.

553 {
554  int i,j;
555  poly p;
556  assume(currRing == strat->tailRing || strat->tailRing != NULL);
557 
558  pShallowCopyDeleteProc p_shallow_copy_delete =
559  (strat->tailRing != currRing ?
561  NULL);
562  for (j=0; j<=strat->tl; j++)
563  {
564  p = strat->T[j].p;
565  strat->T[j].p=NULL;
566  if (strat->T[j].max_exp != NULL)
567  {
568  p_LmFree(strat->T[j].max_exp, strat->tailRing);
569  }
570  i = -1;
571  loop
572  {
573  i++;
574  if (i>strat->sl)
575  {
576  if (strat->T[j].t_p != NULL)
577  {
578  p_Delete(&(strat->T[j].t_p), strat->tailRing);
579  p_LmFree(p, currRing);
580  }
581  else
582  {
583  pDelete(&p);
584  }
585  break;
586  }
587  if (p == strat->S[i])
588  {
589  if (strat->T[j].t_p != NULL)
590  {
591  assume(p_shallow_copy_delete != NULL);
592  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
593  currRing->PolyBin);
594  p_LmFree(strat->T[j].t_p, strat->tailRing);
595  }
596  break;
597  }
598  }
599  }
600  strat->tl=-1;
601 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:338
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
polyrec * poly
Definition: hilb.h:10

◆ clearS()

KINLINE void clearS ( poly  p,
unsigned long  p_sev,
int *  at,
int *  k,
kStrategy  strat 
)

Definition at line 1122 of file kInline.h.

1124 {
1125  assume(p_sev == pGetShortExpVector(p));
1126  if (strat->noClearS) return;
1127  #ifdef HAVE_RINGS
1129  {
1130  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1131  return;
1132  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1133  return;
1134  }
1135  else
1136  #endif
1137  {
1138  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1139  }
1140  deleteInS((*at),strat);
1141  (*at)--;
1142  (*k)--;
1143 }
return P p
Definition: myNF.cc:203
char noClearS
Definition: kutil.h:391
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#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:787
#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:292
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevS
Definition: kutil.h:308

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 10613 of file kutil.cc.

10614 {
10615  int i;
10616  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10617  LObject L;
10618 
10619 #ifdef KDEBUG
10620  // need to set this: during tailreductions of T[i], T[i].max is out of
10621  // sync
10622  sloppy_max = TRUE;
10623 #endif
10624 
10625  strat->noTailReduction = FALSE;
10626  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10627  if (TEST_OPT_PROT)
10628  {
10629  PrintLn();
10630 // if (timerv) writeTime("standard base computed:");
10631  }
10632  if (TEST_OPT_PROT)
10633  {
10634  Print("(S:%d)",strat->sl);mflush();
10635  }
10636  for (i=strat->sl; i>=low; i--)
10637  {
10638  int end_pos=strat->sl;
10639  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10640  if (strat->ak==0) end_pos=i-1;
10641  TObject* T_j = strat->s_2_t(i);
10642  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10643  {
10644  L = *T_j;
10645  #ifdef KDEBUG
10646  if (TEST_OPT_DEBUG)
10647  {
10648  Print("test S[%d]:",i);
10649  p_wrp(L.p,currRing,strat->tailRing);
10650  PrintLn();
10651  }
10652  #endif
10654  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10655  else
10656  strat->S[i] = redtail(&L, strat->sl, strat);
10657  #ifdef KDEBUG
10658  if (TEST_OPT_DEBUG)
10659  {
10660  Print("to (tailR) S[%d]:",i);
10661  p_wrp(strat->S[i],currRing,strat->tailRing);
10662  PrintLn();
10663  }
10664  #endif
10665 
10666  if (strat->redTailChange)
10667  {
10668  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10669  if (pNext(T_j->p) != NULL)
10670  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10671  else
10672  T_j->max_exp = NULL;
10673  }
10675  T_j->pCleardenom();
10676  }
10677  else
10678  {
10679  assume(currRing == strat->tailRing);
10680  #ifdef KDEBUG
10681  if (TEST_OPT_DEBUG)
10682  {
10683  Print("test S[%d]:",i);
10684  p_wrp(strat->S[i],currRing,strat->tailRing);
10685  PrintLn();
10686  }
10687  #endif
10689  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10690  else
10691  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10693  {
10694  if (TEST_OPT_CONTENTSB)
10695  {
10696  number n;
10697  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10698  if (!nIsOne(n))
10699  {
10701  denom->n=nInvers(n);
10702  denom->next=DENOMINATOR_LIST;
10703  DENOMINATOR_LIST=denom;
10704  }
10705  nDelete(&n);
10706  }
10707  else
10708  {
10709  //pContent(strat->S[i]);
10710  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10711  }
10712  }
10713  #ifdef KDEBUG
10714  if (TEST_OPT_DEBUG)
10715  {
10716  Print("to (-tailR) S[%d]:",i);
10717  p_wrp(strat->S[i],currRing,strat->tailRing);
10718  PrintLn();
10719  }
10720  #endif
10721  }
10722  if (TEST_OPT_PROT)
10723  PrintS("-");
10724  }
10725  if (TEST_OPT_PROT) PrintLn();
10726 #ifdef KDEBUG
10727  sloppy_max = FALSE;
10728 #endif
10729 }
denominator_list_s * denominator_list
Definition: kutil.h:57
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:52
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
int ak
Definition: kutil.h:341
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7572
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2883
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:292
#define nDelete(n)
Definition: numbers.h:16
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
ring tailRing
Definition: kutil.h:331
denominator_list next
Definition: kutil.h:59
#define pNext(p)
Definition: monomials.h:43
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:336
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2755
char redTailChange
Definition: kutil.h:388
class sTObject TObject
Definition: kutil.h:51
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:1139

◆ createG0()

ideal createG0 ( )

Definition at line 4535 of file kutil.cc.

4536 {
4537  // Initialize
4538  long exp[50]; // The exponent of \hat{X} (basepoint)
4539  long cexp[50]; // The current exponent for iterating over all
4540  long ind[50]; // The power of 2 in the i-th component of exp
4541  long cind[50]; // analog for cexp
4542  long mult[50]; // How to multiply the elements of G
4543  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4544  long habsind = 0; // The abs. index of the coefficient of h
4545  long step[50]; // The last increases
4546  for (int i = 1; i <= currRing->N; i++)
4547  {
4548  exp[i] = 0;
4549  cexp[i] = exp[i];
4550  ind[i] = 0;
4551  step[i] = 500000;
4552  cind[i] = ind[i];
4553  }
4554  long bound = currRing->ch;
4555  step[1] = 500000;
4556 #ifdef OLI_DEBUG
4557  PrintS("-------------\npoly :");
4558 // wrp(p);
4559  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4560  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4561  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4562  Print("bound : %d\n", bound);
4563  Print("cind : %d\n", cabsind);
4564 #endif
4565  if (cabsind == 0)
4566  {
4567  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4568  {
4569  return idInit(1, 1);
4570  }
4571  }
4572  ideal G0 = idInit(1, 1);
4573  // Now the whole simplex
4574  do
4575  {
4576  // Build s-polynomial
4577  // 2**ind-def * mult * g - exp-def * h
4578  poly t_p;
4579  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4580 #ifdef OLI_DEBUG
4581  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4582  PrintS("zPoly : ");
4583  wrp(zeroPoly);
4584  PrintLn();
4585 #endif
4586  // Add to ideal
4587  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4588  IDELEMS(G0) += 1;
4589  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4590  }
4591  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4592  idSkipZeroes(G0);
4593  return G0;
4594 }
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4406
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4340
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:649
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10

◆ deleteHC() [1/2]

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

Definition at line 318 of file kutil.cc.

319 {
320  LObject L(*p, currRing, strat->tailRing);
321 
322  deleteHC(&L, strat);
323  *p = L.p;
324  *e = L.ecart;
325  *l = L.length;
326  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
327 }
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
int l
Definition: cfEzgcd.cc:94

◆ deleteHC() [2/2]

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

Definition at line 243 of file kutil.cc.

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

◆ deleteInL()

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

Definition at line 1165 of file kutil.cc.

1166 {
1167  if (set[j].lcm!=NULL)
1168  {
1169 #ifdef HAVE_RINGS
1170  if (pGetCoeff(set[j].lcm) != NULL)
1171  pLmDelete(set[j].lcm);
1172  else
1173 #endif
1174  pLmFree(set[j].lcm);
1175  }
1176  if (set[j].sig!=NULL)
1177  {
1178 #ifdef HAVE_RINGS
1179  if (pGetCoeff(set[j].sig) != NULL)
1180  pLmDelete(set[j].sig);
1181  else
1182 #endif
1183  pLmFree(set[j].sig);
1184  }
1185  if (set[j].p!=NULL)
1186  {
1187  if (pNext(set[j].p) == strat->tail)
1188  {
1189 #ifdef HAVE_RINGS
1190  if (pGetCoeff(set[j].p) != NULL)
1191  pLmDelete(set[j].p);
1192  else
1193 #endif
1194  pLmFree(set[j].p);
1195  /*- tail belongs to several int spolys -*/
1196  }
1197  else
1198  {
1199  // search p in T, if it is there, do not delete it
1200  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1201  {
1202  // assure that for global orderings kFindInT fails
1203  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1204  set[j].Delete();
1205  }
1206  }
1207  }
1208  if (*length > 0 && j < *length)
1209  {
1210 #ifdef ENTER_USE_MEMMOVE
1211  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1212 #else
1213  int i;
1214  for (i=j; i < (*length); i++)
1215  set[i] = set[i+1];
1216 #endif
1217  }
1218 #ifdef KDEBUG
1219  memset(&(set[*length]),0,sizeof(LObject));
1220 #endif
1221  (*length)--;
1222 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:717
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70

◆ deleteInS()

void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 1058 of file kutil.cc.

1059 {
1060 #ifdef ENTER_USE_MEMMOVE
1061  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1062  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1063  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1064  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1065 #else
1066  int j;
1067  for (j=i; j<strat->sl; j++)
1068  {
1069  strat->S[j] = strat->S[j+1];
1070  strat->ecartS[j] = strat->ecartS[j+1];
1071  strat->sevS[j] = strat->sevS[j+1];
1072  strat->S_2_R[j] = strat->S_2_R[j+1];
1073  }
1074 #endif
1075  if (strat->lenS!=NULL)
1076  {
1077 #ifdef ENTER_USE_MEMMOVE
1078  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1079 #else
1080  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1081 #endif
1082  }
1083  if (strat->lenSw!=NULL)
1084  {
1085 #ifdef ENTER_USE_MEMMOVE
1086  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1087 #else
1088  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1089 #endif
1090  }
1091  if (strat->fromQ!=NULL)
1092  {
1093 #ifdef ENTER_USE_MEMMOVE
1094  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1095 #else
1096  for (j=i; j<strat->sl; j++)
1097  {
1098  strat->fromQ[j] = strat->fromQ[j+1];
1099  }
1100 #endif
1101  }
1102  strat->S[strat->sl] = NULL;
1103  strat->sl--;
1104 }
wlen_set lenSw
Definition: kutil.h:306
int * S_2_R
Definition: kutil.h:330
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:307
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
intset lenS
Definition: kutil.h:305
intset ecartS
Definition: kutil.h:295
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:48
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10

◆ deleteInSSba()

void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 1110 of file kutil.cc.

1111 {
1112 #ifdef ENTER_USE_MEMMOVE
1113  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1114  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1115  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1116  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1117  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1118  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1119 #else
1120  int j;
1121  for (j=i; j<strat->sl; j++)
1122  {
1123  strat->S[j] = strat->S[j+1];
1124  strat->sig[j] = strat->sig[j+1];
1125  strat->ecartS[j] = strat->ecartS[j+1];
1126  strat->sevS[j] = strat->sevS[j+1];
1127  strat->sevSig[j] = strat->sevSig[j+1];
1128  strat->S_2_R[j] = strat->S_2_R[j+1];
1129  }
1130 #endif
1131  if (strat->lenS!=NULL)
1132  {
1133 #ifdef ENTER_USE_MEMMOVE
1134  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1135 #else
1136  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1137 #endif
1138  }
1139  if (strat->lenSw!=NULL)
1140  {
1141 #ifdef ENTER_USE_MEMMOVE
1142  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1143 #else
1144  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1145 #endif
1146  }
1147  if (strat->fromQ!=NULL)
1148  {
1149 #ifdef ENTER_USE_MEMMOVE
1150  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1151 #else
1152  for (j=i; j<strat->sl; j++)
1153  {
1154  strat->fromQ[j] = strat->fromQ[j+1];
1155  }
1156 #endif
1157  }
1158  strat->S[strat->sl] = NULL;
1159  strat->sl--;
1160 }
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
wlen_set lenSw
Definition: kutil.h:306
int * S_2_R
Definition: kutil.h:330
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:307
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
intset lenS
Definition: kutil.h:305
intset ecartS
Definition: kutil.h:295
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:48
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4650 of file kutil.cc.

4651 {
4652  if (nIsOne(pGetCoeff(h))) return;
4653  number gcd;
4654  bool go = false;
4655  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4656  {
4657  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4658  go = true;
4659  }
4660  else
4661  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4662  if (go || !nIsOne(gcd))
4663  {
4664  poly p = h->next;
4665  if (!go)
4666  {
4667  number tmp = gcd;
4668  gcd = n_Ann(gcd,currRing->cf);
4669  nDelete(&tmp);
4670  }
4671  p_Test(p,strat->tailRing);
4672  p = pp_Mult_nn(p, gcd, strat->tailRing);
4673  nDelete(&gcd);
4674 
4675  if (p != NULL)
4676  {
4677  if (TEST_OPT_PROT)
4678  {
4679  PrintS("Z");
4680  }
4681 #ifdef KDEBUG
4682  if (TEST_OPT_DEBUG)
4683  {
4684  PrintS("--- create zero spoly: ");
4685  p_wrp(h,currRing,strat->tailRing);
4686  PrintS(" ---> ");
4687  }
4688 #endif
4689  poly tmp = pInit();
4690  pSetCoeff0(tmp, pGetCoeff(p));
4691  for (int i = 1; i <= rVar(currRing); i++)
4692  {
4693  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4694  }
4696  {
4697  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4698  }
4699  p_Setm(tmp, currRing);
4700  p = p_LmFreeAndNext(p, strat->tailRing);
4701  pNext(tmp) = p;
4702  LObject Lp;
4703  Lp.Init();
4704  Lp.p = tmp;
4705  Lp.tailRing = strat->tailRing;
4706  int posx;
4707  if (Lp.p!=NULL)
4708  {
4709  strat->initEcart(&Lp);
4710  if (strat->Ll==-1)
4711  posx =0;
4712  else
4713  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4714  Lp.sev = pGetShortExpVector(Lp.p);
4715  if (strat->tailRing != currRing)
4716  {
4717  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4718  }
4719 #ifdef KDEBUG
4720  if (TEST_OPT_DEBUG)
4721  {
4722  p_wrp(tmp,currRing,strat->tailRing);
4723  PrintLn();
4724  }
4725 #endif
4726  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4727  }
4728  }
4729  }
4730  nDelete(&gcd);
4731 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
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:690
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:52
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL ...
Definition: coeffs.h:705
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h: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:787
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:698
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ enterExtendedSpolySig()

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

Definition at line 4733 of file kutil.cc.

4734 {
4735  if (nIsOne(pGetCoeff(h))) return;
4736  number gcd;
4737  bool go = false;
4738  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4739  {
4740  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4741  go = true;
4742  }
4743  else
4744  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4745  if (go || !nIsOne(gcd))
4746  {
4747  poly p = h->next;
4748  if (!go)
4749  {
4750  number tmp = gcd;
4751  gcd = n_Ann(gcd,currRing->cf);
4752  nDelete(&tmp);
4753  }
4754  p_Test(p,strat->tailRing);
4755  p = pp_Mult_nn(p, gcd, strat->tailRing);
4756 
4757  if (p != NULL)
4758  {
4759  if (TEST_OPT_PROT)
4760  {
4761  PrintS("Z");
4762  }
4763 #ifdef KDEBUG
4764  if (TEST_OPT_DEBUG)
4765  {
4766  PrintS("--- create zero spoly: ");
4767  p_wrp(h,currRing,strat->tailRing);
4768  PrintS(" ---> ");
4769  }
4770 #endif
4771  poly tmp = pInit();
4772  pSetCoeff0(tmp, pGetCoeff(p));
4773  for (int i = 1; i <= rVar(currRing); i++)
4774  {
4775  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4776  }
4778  {
4779  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4780  }
4781  p_Setm(tmp, currRing);
4782  p = p_LmFreeAndNext(p, strat->tailRing);
4783  pNext(tmp) = p;
4784  LObject Lp;
4785  Lp.Init();
4786  Lp.p = tmp;
4787  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4788  #if EXT_POLY_NEW
4789  Lp.sig = pp_Mult_nn(hSig, gcd, currRing);
4790  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4791  {
4792  #ifdef ADIDEBUG
4793  printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig);
4794  #endif
4795  strat->sigdrop = TRUE;
4796  //Try to reduce it as far as we can via redRing
4797  int red_result = redRing(&Lp,strat);
4798  #ifdef ADIDEBUG
4799  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
4800  #endif
4801  if(red_result == 0)
4802  {
4803  // Cancel the sigdrop
4804  #ifdef ADIDEBUG
4805  printf("\nCancel the sigdrop. It reduced to 0\n");
4806  #endif
4807  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4808  strat->sigdrop = FALSE;
4809  return;
4810  }
4811  else
4812  {
4813  #ifdef ADIDEBUG
4814  printf("\nSigdrop. end\n");
4815  #endif
4816  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4817  #if 1
4818  strat->enterS(Lp,0,strat,strat->tl);
4819  #endif
4820  return;
4821  }
4822 
4823  }
4824  #else
4825  Lp.sig = pOne();
4826  if(strat->Ll >= 0)
4827  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4828  else
4829  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4830  #endif
4831  Lp.tailRing = strat->tailRing;
4832  int posx;
4833  if (Lp.p!=NULL)
4834  {
4835  strat->initEcart(&Lp);
4836  if (strat->Ll==-1)
4837  posx =0;
4838  else
4839  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4840  Lp.sev = pGetShortExpVector(Lp.p);
4841  if (strat->tailRing != currRing)
4842  {
4843  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4844  }
4845 #ifdef KDEBUG
4846  if (TEST_OPT_DEBUG)
4847  {
4848  p_wrp(tmp,currRing,strat->tailRing);
4849  PrintLn();
4850  }
4851 #endif
4852  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4853  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4854  }
4855  }
4856  nDelete(&gcd);
4857  }
4858  nDelete(&gcd);
4859 }
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:690
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:52
bool sigdrop
Definition: kutil.h:348
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:268
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
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:705
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h: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:787
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
LObject P
Definition: kutil.h:288
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:297
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:698
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
LSet L
Definition: kutil.h:313
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
int sl
Definition: kutil.h:336
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ enterL()

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

Definition at line 1227 of file kutil.cc.

1228 {
1229  // this should be corrected
1230  assume(p.FDeg == p.pFDeg());
1231 
1232  if ((*length)>=0)
1233  {
1234  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1235  if (at <= (*length))
1236 #ifdef ENTER_USE_MEMMOVE
1237  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1238 #else
1239  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1240 #endif
1241  }
1242  else at = 0;
1243  (*set)[at] = p;
1244  (*length)++;
1245 }
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:29
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:662
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:52

◆ enterOnePairNormal()

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

Definition at line 1952 of file kutil.cc.

1953 {
1954  assume(i<=strat->sl);
1955 
1956  int l,j,compare;
1957  LObject Lp;
1958  Lp.i_r = -1;
1959 
1960 #ifdef KDEBUG
1961  Lp.ecart=0; Lp.length=0;
1962 #endif
1963  /*- computes the lcm(s[i],p) -*/
1964  Lp.lcm = pInit();
1965 
1966 #ifndef HAVE_RATGRING
1967  pLcm(p,strat->S[i],Lp.lcm);
1968 #elif defined(HAVE_RATGRING)
1969  if (rIsRatGRing(currRing))
1970  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1971  else
1972  pLcm(p,strat->S[i],Lp.lcm);
1973 #endif
1974  pSetm(Lp.lcm);
1975 
1976 
1977  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1978  {
1979  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1980  && pHasNotCF(p,strat->S[i]))
1981  {
1982  /*
1983  *the product criterion has applied for (s,p),
1984  *i.e. lcm(s,p)=product of the leading terms of s and p.
1985  *Suppose (s,r) is in L and the leading term
1986  *of p divides lcm(s,r)
1987  *(==> the leading term of p divides the leading term of r)
1988  *but the leading term of s does not divide the leading term of r
1989  *(notice that tis condition is automatically satisfied if r is still
1990  *in S), then (s,r) can be cancelled.
1991  *This should be done here because the
1992  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1993  *
1994  *Moreover, skipping (s,r) holds also for the noncommutative case.
1995  */
1996  strat->cp++;
1997  pLmFree(Lp.lcm);
1998  return;
1999  }
2000  else
2001  Lp.ecart = si_max(ecart,strat->ecartS[i]);
2002  if (strat->fromT && (strat->ecartS[i]>ecart))
2003  {
2004  pLmFree(Lp.lcm);
2005  return;
2006  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2007  }
2008  /*
2009  *the set B collects the pairs of type (S[j],p)
2010  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2011  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2012  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2013  */
2014  {
2015  j = strat->Bl;
2016  loop
2017  {
2018  if (j < 0) break;
2019  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2020  if ((compare==1)
2021  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2022  {
2023  strat->c3++;
2024  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2025  {
2026  pLmFree(Lp.lcm);
2027  return;
2028  }
2029  break;
2030  }
2031  else
2032  if ((compare ==-1)
2033  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2034  {
2035  deleteInL(strat->B,&strat->Bl,j,strat);
2036  strat->c3++;
2037  }
2038  j--;
2039  }
2040  }
2041  }
2042  else /*sugarcrit*/
2043  {
2044  if (ALLOW_PROD_CRIT(strat))
2045  {
2046  // if currRing->nc_type!=quasi (or skew)
2047  // TODO: enable productCrit for super commutative algebras...
2048  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2049  pHasNotCF(p,strat->S[i]))
2050  {
2051  /*
2052  *the product criterion has applied for (s,p),
2053  *i.e. lcm(s,p)=product of the leading terms of s and p.
2054  *Suppose (s,r) is in L and the leading term
2055  *of p devides lcm(s,r)
2056  *(==> the leading term of p devides the leading term of r)
2057  *but the leading term of s does not devide the leading term of r
2058  *(notice that tis condition is automatically satisfied if r is still
2059  *in S), then (s,r) can be canceled.
2060  *This should be done here because the
2061  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2062  */
2063  strat->cp++;
2064  pLmFree(Lp.lcm);
2065  return;
2066  }
2067  if (strat->fromT && (strat->ecartS[i]>ecart))
2068  {
2069  pLmFree(Lp.lcm);
2070  return;
2071  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2072  }
2073  /*
2074  *the set B collects the pairs of type (S[j],p)
2075  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2076  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2077  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2078  */
2079  for(j = strat->Bl;j>=0;j--)
2080  {
2081  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2082  if (compare==1)
2083  {
2084  strat->c3++;
2085  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2086  {
2087  pLmFree(Lp.lcm);
2088  return;
2089  }
2090  break;
2091  }
2092  else
2093  if (compare ==-1)
2094  {
2095  deleteInL(strat->B,&strat->Bl,j,strat);
2096  strat->c3++;
2097  }
2098  }
2099  }
2100  }
2101  /*
2102  *the pair (S[i],p) enters B if the spoly != 0
2103  */
2104  /*- compute the short s-polynomial -*/
2105  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2106  pNorm(p);
2107 
2108  if ((strat->S[i]==NULL) || (p==NULL))
2109  return;
2110 
2111  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2112  Lp.p=NULL;
2113  else
2114  {
2115  #ifdef HAVE_PLURAL
2116  if ( rIsPluralRing(currRing) )
2117  {
2118  if(pHasNotCF(p, strat->S[i]))
2119  {
2120  if(ncRingType(currRing) == nc_lie)
2121  {
2122  // generalized prod-crit for lie-type
2123  strat->cp++;
2124  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2125  }
2126  else
2127  if( ALLOW_PROD_CRIT(strat) )
2128  {
2129  // product criterion for homogeneous case in SCA
2130  strat->cp++;
2131  Lp.p = NULL;
2132  }
2133  else
2134  {
2135  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2136  nc_CreateShortSpoly(strat->S[i], p, currRing);
2137  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2138  pNext(Lp.p) = strat->tail; // !!!
2139  }
2140  }
2141  else
2142  {
2143  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2144  nc_CreateShortSpoly(strat->S[i], p, currRing);
2145 
2146  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2147  pNext(Lp.p) = strat->tail; // !!!
2148  }
2149  }
2150  else
2151  #endif
2152  {
2154  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2155  }
2156  }
2157  if (Lp.p == NULL)
2158  {
2159  /*- the case that the s-poly is 0 -*/
2160  if (strat->pairtest==NULL) initPairtest(strat);
2161  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2162  strat->pairtest[strat->sl+1] = TRUE;
2163  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2164  /*
2165  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2166  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2167  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2168  *term of p devides the lcm(s,r)
2169  *(this canceling should be done here because
2170  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2171  *the first case is handeled in chainCrit
2172  */
2173  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2174  }
2175  else
2176  {
2177  /*- the pair (S[i],p) enters B -*/
2178  Lp.p1 = strat->S[i];
2179  Lp.p2 = p;
2180 
2181  if (
2183 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2184  )
2185  {
2186  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2187  pNext(Lp.p) = strat->tail; // !!!
2188  }
2189 
2190  if (atR >= 0)
2191  {
2192  Lp.i_r1 = strat->S_2_R[i];
2193  Lp.i_r2 = atR;
2194  }
2195  else
2196  {
2197  Lp.i_r1 = -1;
2198  Lp.i_r2 = -1;
2199  }
2200  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2201 
2203  {
2204  if (!rIsPluralRing(currRing))
2205  nDelete(&(Lp.p->coef));
2206  }
2207 
2208  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2209  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2210  }
2211 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2254
#define pSetm(p)
Definition: polys.h:253
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:335
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:321
int Bl
Definition: kutil.h:340
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1885
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:340
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:307
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
polyset S
Definition: kutil.h:292
BOOLEAN sugarCrit
Definition: kutil.h:366
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:335
intset ecartS
Definition: kutil.h:295
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
ring tailRing
Definition: kutil.h:331
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
int sl
Definition: kutil.h:336
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:384
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ enterOnePairSelfShifts()

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

Definition at line 12243 of file kutil.cc.

12244 {
12245 
12246  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12247  /* for true self pairs qq ==p */
12248  /* we test both qq and p */
12250  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12253 
12254  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12255 
12256  // int j = 0;
12257  int j = 1;
12258 
12259  /* for such self pairs start with 1, not with 0 */
12260  if (qq == p) j=1;
12261 
12262  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12263  /* that is create the pairs (f, s \dot g) */
12264 
12265  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12266 
12267 #ifdef KDEBUG
12268  //if (TEST_OPT_DEBUG)
12269  //{
12270  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12271  //}
12272 #endif
12273 
12274  poly q;
12275 
12276  /* these vars hold for all shifts of s[i] */
12277  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12278  int qfromQ = 0; // strat->fromQ[i];
12279 
12280  for (; j<= toInsert; j++)
12281  {
12282  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12283  /* we increase shifts by one; must delete q there*/
12284  // q = qq; q = pMoveCurrTail2poly(q,strat);
12285  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12286  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12287  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12288  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12289  // pNext(q) = s; // in tailRing
12290  /* here we need to call enterOnePair with two polys ... */
12291 #ifdef KDEBUG
12292  //if (TEST_OPT_DEBUG)
12293  //{
12294  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12295  //}
12296 #endif
12297  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12298  }
12299 }
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int, int lV)
Definition: kutil.cc:12306
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ enterOnePairShift()

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

Definition at line 12306 of file kutil.cc.

12307 {
12308 
12309  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12310 
12311  /* check this Formats: */
12313  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12316 
12317 #ifdef KDEBUG
12318 // if (TEST_OPT_DEBUG)
12319 // {
12320 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12321 // wrp(q); // wrp(pHead(q));
12322 // PrintS(", p = ");
12323 // wrp(p); //wrp(pHead(p));
12324 // PrintLn();
12325 // }
12326 #endif
12327 
12328  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12329 
12330  int qfromQ = qisFromQ;
12331 
12332  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12333 
12334  int l,j,compare;
12335  LObject Lp;
12336  Lp.i_r = -1;
12337 
12338 #ifdef KDEBUG
12339  Lp.ecart=0; Lp.length=0;
12340 #endif
12341  /*- computes the lcm(s[i],p) -*/
12342  Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation
12343 
12344  /* apply the V criterion */
12345  if (!isInV(Lp.lcm, lV))
12346  {
12347 #ifdef KDEBUG
12348  if (TEST_OPT_DEBUG)
12349  {
12350  PrintS("V crit applied to q = ");
12351  wrp(q); // wrp(pHead(q));
12352  PrintS(", p = ");
12353  wrp(p); //wrp(pHead(p));
12354  PrintLn();
12355  }
12356 #endif
12357  pLmFree(Lp.lcm);
12358  /* + counter for applying the V criterion */
12359  strat->cv++;
12360  return;
12361  }
12362 
12363  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12364  {
12365  if((!((ecartq>0)&&(ecart>0)))
12366  && pHasNotCF(p,q))
12367  {
12368  /*
12369  *the product criterion has applied for (s,p),
12370  *i.e. lcm(s,p)=product of the leading terms of s and p.
12371  *Suppose (s,r) is in L and the leading term
12372  *of p divides lcm(s,r)
12373  *(==> the leading term of p divides the leading term of r)
12374  *but the leading term of s does not divide the leading term of r
12375  *(notice that this condition is automatically satisfied if r is still
12376  *in S), then (s,r) can be cancelled.
12377  *This should be done here because the
12378  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12379  *
12380  *Moreover, skipping (s,r) holds also for the noncommutative case.
12381  */
12382  strat->cp++;
12383  pLmFree(Lp.lcm);
12384  return;
12385  }
12386  else
12387  Lp.ecart = si_max(ecart,ecartq);
12388  if (strat->fromT && (ecartq>ecart))
12389  {
12390  pLmFree(Lp.lcm);
12391  return;
12392  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12393  }
12394  /*
12395  *the set B collects the pairs of type (S[j],p)
12396  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12397  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12398  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12399  */
12400  {
12401  j = strat->Bl;
12402  loop
12403  {
12404  if (j < 0) break;
12405  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12406  if ((compare==1)
12407  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12408  {
12409  strat->c3++;
12410  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12411  {
12412  pLmFree(Lp.lcm);
12413  return;
12414  }
12415  break;
12416  }
12417  else
12418  if ((compare ==-1)
12419  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12420  {
12421  deleteInL(strat->B,&strat->Bl,j,strat);
12422  strat->c3++;
12423  }
12424  j--;
12425  }
12426  }
12427  }
12428  else /*sugarcrit*/
12429  {
12430  if (ALLOW_PROD_CRIT(strat))
12431  {
12432  // if currRing->nc_type!=quasi (or skew)
12433  // TODO: enable productCrit for super commutative algebras...
12434  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12435  pHasNotCF(p,q))
12436  {
12437  /*
12438  *the product criterion has applied for (s,p),
12439  *i.e. lcm(s,p)=product of the leading terms of s and p.
12440  *Suppose (s,r) is in L and the leading term
12441  *of p devides lcm(s,r)
12442  *(==> the leading term of p devides the leading term of r)
12443  *but the leading term of s does not devide the leading term of r
12444  *(notice that tis condition is automatically satisfied if r is still
12445  *in S), then (s,r) can be canceled.
12446  *This should be done here because the
12447  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12448  */
12449  strat->cp++;
12450  pLmFree(Lp.lcm);
12451  return;
12452  }
12453  if (strat->fromT && (ecartq>ecart))
12454  {
12455  pLmFree(Lp.lcm);
12456  return;
12457  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12458  }
12459  /*
12460  *the set B collects the pairs of type (S[j],p)
12461  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12462  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12463  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12464  */
12465  for(j = strat->Bl;j>=0;j--)
12466  {
12467  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12468  if (compare==1)
12469  {
12470  strat->c3++;
12471  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12472  {
12473  pLmFree(Lp.lcm);
12474  return;
12475  }
12476  break;
12477  }
12478  else
12479  if (compare ==-1)
12480  {
12481  deleteInL(strat->B,&strat->Bl,j,strat);
12482  strat->c3++;
12483  }
12484  }
12485  }
12486  }
12487  /*
12488  *the pair (S[i],p) enters B if the spoly != 0
12489  */
12490  /*- compute the short s-polynomial -*/
12491  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12492  pNorm(p);
12493  if ((q==NULL) || (p==NULL))
12494  return;
12495  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12496  Lp.p=NULL;
12497  else
12498  {
12499 // if ( rIsPluralRing(currRing) )
12500 // {
12501 // if(pHasNotCF(p, q))
12502 // {
12503 // if(ncRingType(currRing) == nc_lie)
12504 // {
12505 // // generalized prod-crit for lie-type
12506 // strat->cp++;
12507 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12508 // }
12509 // else
12510 // if( ALLOW_PROD_CRIT(strat) )
12511 // {
12512 // // product criterion for homogeneous case in SCA
12513 // strat->cp++;
12514 // Lp.p = NULL;
12515 // }
12516 // else
12517 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12518 // }
12519 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12520 // }
12521 // else
12522 // {
12523 
12524  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12525  /* p is already in this form, so convert q */
12526  // q = pMove2CurrTail(q, strat);
12527  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12528  // }
12529  }
12530  if (Lp.p == NULL)
12531  {
12532  /*- the case that the s-poly is 0 -*/
12533  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12534 // if (strat->pairtest==NULL) initPairtest(strat);
12535 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12536 // strat->pairtest[strat->sl+1] = TRUE;
12537  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12538  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12539  /*
12540  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12541  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12542  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12543  *term of p devides the lcm(s,r)
12544  *(this canceling should be done here because
12545  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12546  *the first case is handeled in chainCrit
12547  */
12548  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12549  }
12550  else
12551  {
12552  /*- the pair (S[i],p) enters B -*/
12553  /* both of them should have their LM in currRing and TAIL in tailring */
12554  Lp.p1 = q; // already in the needed form
12555  Lp.p2 = p; // already in the needed form
12556 
12557  if ( !rIsPluralRing(currRing) )
12558  pNext(Lp.p) = strat->tail;
12559 
12560  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12561  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12562  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12563  {
12564  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12565  Lp.i_r2 = atR;
12566  }
12567  else
12568  {
12569  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12570  Lp.i_r1 = -1;
12571  Lp.i_r2 = -1;
12572  }
12573  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12574 
12576  {
12577  if (!rIsPluralRing(currRing))
12578  nDelete(&(Lp.p->coef));
12579  }
12580 
12581  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12582  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12583  }
12584 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:335
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:717
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
int cv
Definition: kutil.h:358
int Bl
Definition: kutil.h:340
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1616
#define pHasNotCF(p1, p2)
Definition: polys.h:245
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:340
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:307
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
void PrintS(const char *s)
Definition: reporter.cc:284
int isInV(poly p, int lV)
Definition: shiftgb.cc:241
poly tail
Definition: kutil.h:322
BOOLEAN sugarCrit
Definition: kutil.h:366
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:335
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
ring tailRing
Definition: kutil.h:331
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:384
void wrp(poly p)
Definition: polys.h:292
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
int l
Definition: cfEzgcd.cc:94

◆ enterpairs()

void enterpairs ( poly  h,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4926 of file kutil.cc.

4927 {
4928  int j=pos;
4929 
4931  initenterpairs(h,k,ecart,0,strat, atR);
4932  if ( (!strat->fromT)
4933  && ((strat->syzComp==0)
4934  ||(pGetComp(h)<=strat->syzComp)))
4935  {
4936  unsigned long h_sev = pGetShortExpVector(h);
4937  loop
4938  {
4939  if (j > k) break;
4940  clearS(h,h_sev, &j,&k,strat);
4941  j++;
4942  }
4943  }
4944 }
int syzComp
Definition: kutil.h:342
loop
Definition: myNF.cc:98
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3824
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#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:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ enterpairsShift()

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

Definition at line 12666 of file kutil.cc.

12667 {
12668  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12669  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12670  int j=pos;
12671 
12673  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12674  if ( (!strat->fromT)
12675  && ((strat->syzComp==0)
12676  ||(pGetComp(h)<=strat->syzComp)))
12677  {
12678  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12679  unsigned long h_sev = pGetShortExpVector(h);
12680  loop
12681  {
12682  if (j > k) break;
12683  clearS(h,h_sev, &j,&k,strat);
12684  j++;
12685  }
12686  //Print("end clearS sl=%d\n",strat->sl);
12687  }
12688  // PrintS("end enterpairs\n");
12689 }
int syzComp
Definition: kutil.h:342
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
Definition: kutil.cc:12593
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#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:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ enterpairsSig()

void enterpairsSig ( poly  h,
poly  hSig,
int  from,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4952 of file kutil.cc.

4953 {
4954  int j=pos;
4956  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4957  if ( (!strat->fromT)
4958  && ((strat->syzComp==0)
4959  ||(pGetComp(h)<=strat->syzComp)))
4960  {
4961  unsigned long h_sev = pGetShortExpVector(h);
4962  loop
4963  {
4964  if (j > k) break;
4965  clearS(h,h_sev, &j,&k,strat);
4966  j++;
4967  }
4968  }
4969 }
int syzComp
Definition: kutil.h:342
loop
Definition: myNF.cc:98
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3894
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#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:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ enterSBba()

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

Definition at line 9229 of file kutil.cc.

9230 {
9231  strat->news = TRUE;
9232  /*- puts p to the standardbasis s at position at -*/
9233  if (strat->sl == IDELEMS(strat->Shdl)-1)
9234  {
9235  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9236  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9237  (IDELEMS(strat->Shdl)+setmaxTinc)
9238  *sizeof(unsigned long));
9239  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9240  IDELEMS(strat->Shdl)*sizeof(int),
9241  (IDELEMS(strat->Shdl)+setmaxTinc)
9242  *sizeof(int));
9243  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9244  IDELEMS(strat->Shdl)*sizeof(int),
9245  (IDELEMS(strat->Shdl)+setmaxTinc)
9246  *sizeof(int));
9247  if (strat->lenS!=NULL)
9248  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9249  IDELEMS(strat->Shdl)*sizeof(int),
9250  (IDELEMS(strat->Shdl)+setmaxTinc)
9251  *sizeof(int));
9252  if (strat->lenSw!=NULL)
9253  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9254  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9255  (IDELEMS(strat->Shdl)+setmaxTinc)
9256  *sizeof(wlen_type));
9257  if (strat->fromQ!=NULL)
9258  {
9259  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9260  IDELEMS(strat->Shdl)*sizeof(int),
9261  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9262  }
9263  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9264  IDELEMS(strat->Shdl)+=setmaxTinc;
9265  strat->Shdl->m=strat->S;
9266  }
9267  if (atS <= strat->sl)
9268  {
9269 #ifdef ENTER_USE_MEMMOVE
9270  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9271  (strat->sl - atS + 1)*sizeof(poly));
9272  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9273  (strat->sl - atS + 1)*sizeof(int));
9274  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9275  (strat->sl - atS + 1)*sizeof(unsigned long));
9276  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9277  (strat->sl - atS + 1)*sizeof(int));
9278  if (strat->lenS!=NULL)
9279  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9280  (strat->sl - atS + 1)*sizeof(int));
9281  if (strat->lenSw!=NULL)
9282  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9283  (strat->sl - atS + 1)*sizeof(wlen_type));
9284 #else
9285  for (i=strat->sl+1; i>=atS+1; i--)
9286  {
9287  strat->S[i] = strat->S[i-1];
9288  strat->ecartS[i] = strat->ecartS[i-1];
9289  strat->sevS[i] = strat->sevS[i-1];
9290  strat->S_2_R[i] = strat->S_2_R[i-1];
9291  }
9292  if (strat->lenS!=NULL)
9293  for (i=strat->sl+1; i>=atS+1; i--)
9294  strat->lenS[i] = strat->lenS[i-1];
9295  if (strat->lenSw!=NULL)
9296  for (i=strat->sl+1; i>=atS+1; i--)
9297  strat->lenSw[i] = strat->lenSw[i-1];
9298 #endif
9299  }
9300  if (strat->fromQ!=NULL)
9301  {
9302 #ifdef ENTER_USE_MEMMOVE
9303  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9304  (strat->sl - atS + 1)*sizeof(int));
9305 #else
9306  for (i=strat->sl+1; i>=atS+1; i--)
9307  {
9308  strat->fromQ[i] = strat->fromQ[i-1];
9309  }
9310 #endif
9311  strat->fromQ[atS]=0;
9312  }
9313 
9314  /*- save result -*/
9315  strat->S[atS] = p.p;
9316  if (strat->honey) strat->ecartS[atS] = p.ecart;
9317  if (p.sev == 0)
9318  p.sev = pGetShortExpVector(p.p);
9319  else
9320  assume(p.sev == pGetShortExpVector(p.p));
9321  strat->sevS[atS] = p.sev;
9322  strat->ecartS[atS] = p.ecart;
9323  strat->S_2_R[atS] = atR;
9324  strat->sl++;
9325 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:366
wlen_set lenSw
Definition: kutil.h:306
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:389
#define TRUE
Definition: auxiliary.h:98
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
#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:123
polyset S
Definition: kutil.h:292
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:305
intset ecartS
Definition: kutil.h:295
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
int64 wlen_type
Definition: kutil.h:48
unsigned long * sevS
Definition: kutil.h:308
#define setmaxTinc
Definition: kutil.h:32
int * intset
Definition: kutil.h:47
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289

◆ entersets()

void entersets ( LObject  h)

◆ enterSSba()

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

Definition at line 9331 of file kutil.cc.

9332 {
9333  strat->news = TRUE;
9334  /*- puts p to the standardbasis s at position at -*/
9335  if (strat->sl == IDELEMS(strat->Shdl)-1)
9336  {
9337  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9338  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9339  (IDELEMS(strat->Shdl)+setmax)
9340  *sizeof(unsigned long));
9341  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9342  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9343  (IDELEMS(strat->Shdl)+setmax)
9344  *sizeof(unsigned long));
9345  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9346  IDELEMS(strat->Shdl)*sizeof(int),
9347  (IDELEMS(strat->Shdl)+setmax)
9348  *sizeof(int));
9349  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9350  IDELEMS(strat->Shdl)*sizeof(int),
9351  (IDELEMS(strat->Shdl)+setmax)
9352  *sizeof(int));
9353  if (strat->lenS!=NULL)
9354  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9355  IDELEMS(strat->Shdl)*sizeof(int),
9356  (IDELEMS(strat->Shdl)+setmax)
9357  *sizeof(int));
9358  if (strat->lenSw!=NULL)
9359  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9360  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9361  (IDELEMS(strat->Shdl)+setmax)
9362  *sizeof(wlen_type));
9363  if (strat->fromQ!=NULL)
9364  {
9365  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9366  IDELEMS(strat->Shdl)*sizeof(int),
9367  (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
9368  }
9369  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
9370  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmax);
9371  IDELEMS(strat->Shdl)+=setmax;
9372  strat->Shdl->m=strat->S;
9373  }
9374  // in a signature-based algorithm the following situation will never
9375  // appear due to the fact that the critical pairs are already sorted
9376  // by increasing signature.
9377  // True. However, in the case of integers we need to put the element
9378  // that caused the signature drop on the first position
9379  if (atS <= strat->sl)
9380  {
9381 #ifdef ENTER_USE_MEMMOVE
9382  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9383  (strat->sl - atS + 1)*sizeof(poly));
9384  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9385  (strat->sl - atS + 1)*sizeof(poly));
9386  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9387  (strat->sl - atS + 1)*sizeof(unsigned long));
9388  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9389  (strat->sl - atS + 1)*sizeof(int));
9390  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9391  (strat->sl - atS + 1)*sizeof(unsigned long));
9392  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9393  (strat->sl - atS + 1)*sizeof(int));
9394  if (strat->lenS!=NULL)
9395  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9396  (strat->sl - atS + 1)*sizeof(int));
9397  if (strat->lenSw!=NULL)
9398  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9399  (strat->sl - atS + 1)*sizeof(wlen_type));
9400 #else
9401  for (i=strat->sl+1; i>=atS+1; i--)
9402  {
9403  strat->S[i] = strat->S[i-1];
9404  strat->ecartS[i] = strat->ecartS[i-1];
9405  strat->sevS[i] = strat->sevS[i-1];
9406  strat->S_2_R[i] = strat->S_2_R[i-1];
9407  strat->sig[i] = strat->sig[i-1];
9408  strat->sevSig[i] = strat->sevSig[i-1];
9409  }
9410  if (strat->lenS!=NULL)
9411  for (i=strat->sl+1; i>=atS+1; i--)
9412  strat->lenS[i] = strat->lenS[i-1];
9413  if (strat->lenSw!=NULL)
9414  for (i=strat->sl+1; i>=atS+1; i--)
9415  strat->lenSw[i] = strat->lenSw[i-1];
9416 #endif
9417  }
9418  if (strat->fromQ!=NULL)
9419  {
9420 #ifdef ENTER_USE_MEMMOVE
9421  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9422  (strat->sl - atS + 1)*sizeof(int));
9423 #else
9424  for (i=strat->sl+1; i>=atS+1; i--)
9425  {
9426  strat->fromQ[i] = strat->fromQ[i-1];
9427  }
9428 #endif
9429  strat->fromQ[atS]=0;
9430  }
9431 
9432  /*- save result -*/
9433  strat->S[atS] = p.p;
9434  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9435  if (strat->honey) strat->ecartS[atS] = p.ecart;
9436  if (p.sev == 0)
9437  p.sev = pGetShortExpVector(p.p);
9438  else
9439  assume(p.sev == pGetShortExpVector(p.p));
9440  strat->sevS[atS] = p.sev;
9441  // during the interreduction process of a signature-based algorithm we do not
9442  // compute the signature at this point, but when the whole interreduction
9443  // process finishes, i.e. f5c terminates!
9444  if (p.sig != NULL)
9445  {
9446  if (p.sevSig == 0)
9447  p.sevSig = pGetShortExpVector(p.sig);
9448  else
9449  assume(p.sevSig == pGetShortExpVector(p.sig));
9450  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9451  }
9452  strat->ecartS[atS] = p.ecart;
9453  strat->S_2_R[atS] = atR;
9454  strat->sl++;
9455 #ifdef DEBUGF5
9456  int k;
9457  Print("--- LIST S: %d ---\n",strat->sl);
9458  for(k=0;k<=strat->sl;k++)
9459  {
9460  pWrite(strat->sig[k]);
9461  }
9462  PrintS("--- LIST S END ---\n");
9463 #endif
9464 }
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:366
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:306
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:389
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:27
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
#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:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:292
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:305
intset ecartS
Definition: kutil.h:295
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
int64 wlen_type
Definition: kutil.h:48
unsigned long * sevS
Definition: kutil.h:308
int * intset
Definition: kutil.h:47
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289

◆ enterSyz()

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

Definition at line 9666 of file kutil.cc.

9667 {
9668  #ifdef ADIDEBUG
9669  printf("\n Entersyz:\n");pWrite(p.sig);
9670  #endif
9671  int i;
9672  strat->newt = TRUE;
9673  if (strat->syzl == strat->syzmax-1)
9674  {
9675  pEnlargeSet(&strat->syz,strat->syzmax,setmax);
9676  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9677  (strat->syzmax)*sizeof(unsigned long),
9678  ((strat->syzmax)+setmax)
9679  *sizeof(unsigned long));
9680  strat->syzmax += setmax;
9681  }
9682  if (atT < strat->syzl)
9683  {
9684 #ifdef ENTER_USE_MEMMOVE
9685  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9686  (strat->syzl-atT+1)*sizeof(poly));
9687  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9688  (strat->syzl-atT+1)*sizeof(unsigned long));
9689 #endif
9690  for (i=strat->syzl; i>=atT+1; i--)
9691  {
9692 #ifndef ENTER_USE_MEMMOVE
9693  strat->syz[i] = strat->syz[i-1];
9694  strat->sevSyz[i] = strat->sevSyz[i-1];
9695 #endif
9696  }
9697  }
9698  //i = strat->syzl;
9699  i = atT;
9700  //Makes sure the syz saves just the signature
9701  #ifdef HAVE_RINGS
9703  pNext(p.sig) = NULL;
9704  #endif
9705  strat->syz[atT] = p.sig;
9706  strat->sevSyz[atT] = p.sevSig;
9707  strat->syzl++;
9708 #if F5DEBUG
9709  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9710  pWrite(strat->syz[atT]);
9711 #endif
9712  // recheck pairs in strat->L with new rule and delete correspondingly
9713  int cc = strat->Ll;
9714  while (cc>-1)
9715  {
9716  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9717  //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);
9718  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9719  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9720  #ifdef HAVE_RINGS
9721  &&((!rField_is_Ring(currRing))
9722  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9723  #endif
9724  )
9725  {
9726  //printf("\nYES!\n");
9727  #ifdef ADIDEBUG
9728  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9729  #endif
9730  deleteInL(strat->L,&strat->Ll,cc,strat);
9731  }
9732  cc--;
9733  }
9734 //#if 1
9735 #ifdef DEBUGF5
9736  PrintS("--- Syzygies ---\n");
9737  Print("syzl %d\n",strat->syzl);
9738  Print("syzmax %d\n",strat->syzmax);
9739  PrintS("--------------------------------\n");
9740  for(i=0;i<=strat->syzl-1;i++)
9741  {
9742  Print("%d - ",i);
9743  pWrite(strat->syz[i]);
9744  }
9745  PrintS("--------------------------------\n");
9746 #endif
9747 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:337
int Ll
Definition: kutil.h:339
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:390
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:27
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:309
polyset syz
Definition: kutil.h:293
polyrec * poly
Definition: hilb.h:10
int syzl
Definition: kutil.h:337

◆ enterT()

void enterT ( LObject p,
kStrategy  strat,
int  atT = -1 
)

Definition at line 9469 of file kutil.cc.

9470 {
9471  int i;
9472 
9473  pp_Test(p.p, currRing, p.tailRing);
9474  assume(strat->tailRing == p.tailRing);
9475  // redMoraNF complains about this -- but, we don't really
9476  // neeed this so far
9477  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9478  assume(p.FDeg == p.pFDeg());
9479  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9480 
9481 #ifdef KDEBUG
9482  // do not put an LObject twice into T:
9483  for(i=strat->tl;i>=0;i--)
9484  {
9485  if (p.p==strat->T[i].p)
9486  {
9487  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9488  return;
9489  }
9490  }
9491 #endif
9492 
9493 #ifdef HAVE_TAIL_RING
9494  if (currRing!=strat->tailRing)
9495  {
9496  p.t_p=p.GetLmTailRing();
9497  }
9498 #endif
9499  strat->newt = TRUE;
9500  if (atT < 0)
9501  atT = strat->posInT(strat->T, strat->tl, p);
9502  if (strat->tl == strat->tmax-1)
9503  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9504  if (atT <= strat->tl)
9505  {
9506 #ifdef ENTER_USE_MEMMOVE
9507  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9508  (strat->tl-atT+1)*sizeof(TObject));
9509  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9510  (strat->tl-atT+1)*sizeof(unsigned long));
9511 #endif
9512  for (i=strat->tl+1; i>=atT+1; i--)
9513  {
9514 #ifndef ENTER_USE_MEMMOVE
9515  strat->T[i] = strat->T[i-1];
9516  strat->sevT[i] = strat->sevT[i-1];
9517 #endif
9518  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9519  }
9520  }
9521 
9522  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9523  {
9525  (strat->tailRing != NULL ?
9526  strat->tailRing : currRing),
9527  strat->tailBin);
9528  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9529  }
9530  strat->T[atT] = (TObject) p;
9531  #ifdef ADIDEBUG
9532  printf("\nenterT: add in position %i\n",atT);
9533  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9534  #endif
9535  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9536 
9537  if (pNext(p.p) != NULL)
9538  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9539  else
9540  strat->T[atT].max_exp = NULL;
9541 
9542  strat->tl++;
9543  strat->R[strat->tl] = &(strat->T[atT]);
9544  strat->T[atT].i_r = strat->tl;
9545  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9546  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9547  kTest_T(&(strat->T[atT]));
9548 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:390
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:311
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:531
#define assume(x)
Definition: mod2.h:394
#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:162
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:869
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:328
static unsigned pLength(poly a)
Definition: p_polys.h:189
int tmax
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
omBin tailBin
Definition: kutil.h:333
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:32
TSet T
Definition: kutil.h:312
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
#define kTest_T(T)
Definition: kutil.h:642
class sTObject TObject
Definition: kutil.h:51
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:1139

◆ enterT_strong()

void enterT_strong ( LObject p,
kStrategy  strat,
int  atT = -1 
)

Definition at line 9554 of file kutil.cc.

9555 {
9557  int i;
9558 
9559  pp_Test(p.p, currRing, p.tailRing);
9560  assume(strat->tailRing == p.tailRing);
9561  // redMoraNF complains about this -- but, we don't really
9562  // neeed this so far
9563  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9564  assume(p.FDeg == p.pFDeg());
9565  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9566 
9567 #ifdef KDEBUG
9568  // do not put an LObject twice into T:
9569  for(i=strat->tl;i>=0;i--)
9570  {
9571  if (p.p==strat->T[i].p)
9572  {
9573  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9574  return;
9575  }
9576  }
9577 #endif
9578 
9579 #ifdef HAVE_TAIL_RING
9580  if (currRing!=strat->tailRing)
9581  {
9582  p.t_p=p.GetLmTailRing();
9583  }
9584 #endif
9585  strat->newt = TRUE;
9586  if (atT < 0)
9587  atT = strat->posInT(strat->T, strat->tl, p);
9588  if (strat->tl == strat->tmax-1)
9589  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9590  if (atT <= strat->tl)
9591  {
9592 #ifdef ENTER_USE_MEMMOVE
9593  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9594  (strat->tl-atT+1)*sizeof(TObject));
9595  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9596  (strat->tl-atT+1)*sizeof(unsigned long));
9597 #endif
9598  for (i=strat->tl+1; i>=atT+1; i--)
9599  {
9600 #ifndef ENTER_USE_MEMMOVE
9601  strat->T[i] = strat->T[i-1];
9602  strat->sevT[i] = strat->sevT[i-1];
9603 #endif
9604  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9605  }
9606  }
9607 
9608  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9609  {
9611  (strat->tailRing != NULL ?
9612  strat->tailRing : currRing),
9613  strat->tailBin);
9614  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9615  }
9616  strat->T[atT] = (TObject) p;
9617  #ifdef ADIDEBUG
9618  printf("\nenterT_strong: add in position %i\n",atT);
9619  pWrite(p.p);
9620  #endif
9621  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9622 
9623  if (pNext(p.p) != NULL)
9624  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9625  else
9626  strat->T[atT].max_exp = NULL;
9627 
9628  strat->tl++;
9629  strat->R[strat->tl] = &(strat->T[atT]);
9630  strat->T[atT].i_r = strat->tl;
9631  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9632  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9633  #if 1
9635  && !n_IsUnit(p.p->coef, currRing->cf))
9636  {
9637  #ifdef ADIDEBUG
9638  printf("\nDas ist p:\n");pWrite(p.p);
9639  #endif
9640  for(i=strat->tl;i>=0;i--)
9641  {
9642  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9643  {
9644  #ifdef ADIDEBUG
9645  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9646  #endif
9647  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9648  }
9649  }
9650  }
9651  /*
9652  printf("\nThis is T:\n");
9653  for(i=strat->tl;i>=0;i--)
9654  {
9655  pWrite(strat->T[i].p);
9656  }
9657  //getchar();*/
9658  #endif
9659  kTest_T(&(strat->T[atT]));
9660 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:390
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:311
void pWrite(poly p)
Definition: polys.h:290
#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:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:531
#define assume(x)
Definition: mod2.h:394
#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:162
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:869
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:328
static unsigned pLength(poly a)
Definition: p_polys.h:189
int tmax
Definition: kutil.h:338
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1531
ring tailRing
Definition: kutil.h:331
omBin tailBin
Definition: kutil.h:333
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:32
TSet T
Definition: kutil.h:312
#define kTest_T(T)
Definition: kutil.h:642
class sTObject TObject
Definition: kutil.h:51
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:1139

◆ enterTShift()

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

Definition at line 12697 of file kutil.cc.

12698 {
12699  /* determine how many elements we have to insert */
12700  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12701  /* hence, a total number of elt's to add is: */
12702  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12703 
12704  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12705 
12706 #ifdef PDEBUG
12707  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12708 #endif
12709  int i;
12710 
12711  if (atT < 0)
12712  atT = strat->posInT(strat->T, strat->tl, p);
12713 
12714  /* can call enterT in a sequence, e.g. */
12715 
12716  /* shift0 = it's our model for further shifts */
12717  enterT(p,strat,atT);
12718  LObject qq;
12719  for (i=1; i<=toInsert; i++) // toIns - 1?
12720  {
12721  qq = p; //qq.Copy();
12722  qq.p = NULL;
12723  qq.max_exp = NULL;
12724  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12725  qq.GetP();
12726  // update q.sev
12727  qq.sev = pGetShortExpVector(qq.p);
12728  /* enter it into T, first el't is with the shift 0 */
12729  // compute the position for qq
12730  atT = strat->posInT(strat->T, strat->tl, qq);
12731  enterT(qq,strat,atT);
12732  }
12733 /* Q: what to do with this one in the orig enterT ? */
12734 /* strat->R[strat->tl] = &(strat->T[atT]); */
12735 /* Solution: it is done by enterT each time separately */
12736 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:338
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:77
#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:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
TSet T
Definition: kutil.h:312

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10168 of file kutil.cc.

10169 {
10170  /*- release temp data -*/
10171  cleanT(strat);
10172  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10173  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10174  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10175  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10176  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10177  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10178  /*- set L: should be empty -*/
10179  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10180  /*- set B: should be empty -*/
10181  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10182  pLmDelete(&strat->tail);
10183  strat->syzComp=0;
10184 }
int syzComp
Definition: kutil.h:342
class sLObject LObject
Definition: kutil.h:52
int * S_2_R
Definition: kutil.h:330
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:311
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:340
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
intset ecartS
Definition: kutil.h:295
LSet L
Definition: kutil.h:313
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:314
int Lmax
Definition: kutil.h:339
unsigned long * sevS
Definition: kutil.h:308
TSet T
Definition: kutil.h:312
ideal Shdl
Definition: kutil.h:289
class sTObject TObject
Definition: kutil.h:51

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10361 of file kutil.cc.

10362 {
10363  /*- release temp data -*/
10365  cleanTSbaRing(strat);
10366  else
10367  cleanT(strat);
10368  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10369  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10370  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10371  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10372  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10373  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10374  if(strat->syzmax>0)
10375  {
10376  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10377  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10378  if (strat->sbaOrder == 1)
10379  {
10380  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10381  }
10382  }
10383  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10384  /*- set L: should be empty -*/
10385  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10386  /*- set B: should be empty -*/
10387  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10388  /*- set sig: no need for the signatures anymore -*/
10389  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10390  pLmDelete(&strat->tail);
10391  strat->syzComp=0;
10392 }
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
int syzComp
Definition: kutil.h:342
int syzmax
Definition: kutil.h:337
class sLObject LObject
Definition: kutil.h:52
int * S_2_R
Definition: kutil.h:330
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void cleanTSbaRing(kStrategy strat)
Definition: kutil.cc:603
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:311
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:340
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
unsigned sbaOrder
Definition: kutil.h:302
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
intset ecartS
Definition: kutil.h:295
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:314
int Lmax
Definition: kutil.h:339
int syzidxmax
Definition: kutil.h:337
unsigned long * sevS
Definition: kutil.h:308
unsigned long * sevSyz
Definition: kutil.h:309
polyset syz
Definition: kutil.h:293
TSet T
Definition: kutil.h:312
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289
class sTObject TObject
Definition: kutil.h:51
intset syzIdx
Definition: kutil.h:299

◆ f5c()

void f5c ( kStrategy  strat,
int &  olddeg,
int &  minimcnt,
int &  hilbeledeg,
int &  hilbcount,
int &  srmax,
int &  lrmax,
int &  reduc,
ideal  Q,
intvec w,
intvec hilb 
)

Definition at line 3696 of file kstd2.cc.

3699 {
3700  int Ll_old, red_result = 1;
3701  int pos = 0;
3702  hilbeledeg=1;
3703  hilbcount=0;
3704  minimcnt=0;
3705  srmax = 0; // strat->sl is 0 at this point
3706  reduc = olddeg = lrmax = 0;
3707  // we cannot use strat->T anymore
3708  //cleanT(strat);
3709  //strat->tl = -1;
3710  Ll_old = strat->Ll;
3711  while (strat->tl >= 0)
3712  {
3713  if(!strat->T[strat->tl].is_redundant)
3714  {
3715  LObject h;
3716  h.p = strat->T[strat->tl].p;
3717  h.tailRing = strat->T[strat->tl].tailRing;
3718  h.t_p = strat->T[strat->tl].t_p;
3719  if (h.p!=NULL)
3720  {
3721  if (currRing->OrdSgn==-1)
3722  {
3723  cancelunit(&h);
3724  deleteHC(&h, strat);
3725  }
3726  if (h.p!=NULL)
3727  {
3729  {
3730  //pContent(h.p);
3731  h.pCleardenom(); // also does a pContent
3732  }
3733  else
3734  {
3735  h.pNorm();
3736  }
3737  strat->initEcart(&h);
3739  pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
3740  else
3741  pos = strat->Ll+1;
3742  h.sev = pGetShortExpVector(h.p);
3743  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
3744  }
3745  }
3746  }
3747  strat->tl--;
3748  }
3749  strat->sl = -1;
3750 #if 0
3751 //#ifdef HAVE_TAIL_RING
3752  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
3753  kStratInitChangeTailRing(strat);
3754 #endif
3755  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
3756  //strat->sl = -1;
3757  /* picks the last element from the lazyset L */
3758  while (strat->Ll>Ll_old)
3759  {
3760  strat->P = strat->L[strat->Ll];
3761  strat->Ll--;
3762 //#if 1
3763 #ifdef DEBUGF5
3764  PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3765  PrintS("-------------------------------------------------\n");
3766  pWrite(pHead(strat->P.p));
3767  pWrite(pHead(strat->P.p1));
3768  pWrite(pHead(strat->P.p2));
3769  printf("%d\n",strat->tl);
3770  PrintS("-------------------------------------------------\n");
3771 #endif
3772  if (pNext(strat->P.p) == strat->tail)
3773  {
3774  // deletes the short spoly
3775  if (rField_is_Ring(currRing))
3776  pLmDelete(strat->P.p);
3777  else
3778  pLmFree(strat->P.p);
3779 
3780  // TODO: needs some masking
3781  // TODO: masking needs to vanish once the signature
3782  // sutff is completely implemented
3783  strat->P.p = NULL;
3784  poly m1 = NULL, m2 = NULL;
3785 
3786  // check that spoly creation is ok
3787  while (strat->tailRing != currRing &&
3788  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3789  {
3790  assume(m1 == NULL && m2 == NULL);
3791  // if not, change to a ring where exponents are at least
3792  // large enough
3793  if (!kStratChangeTailRing(strat))
3794  {
3795  WerrorS("OVERFLOW...");
3796  break;
3797  }
3798  }
3799  // create the real one
3800  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3801  strat->tailRing, m1, m2, strat->R);
3802  }
3803  else if (strat->P.p1 == NULL)
3804  {
3805  if (strat->minim > 0)
3806  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3807  // for input polys, prepare reduction
3808  if(!rField_is_Ring(currRing))
3809  strat->P.PrepareRed(strat->use_buckets);
3810  }
3811 
3812  if (strat->P.p == NULL && strat->P.t_p == NULL)
3813  {
3814  red_result = 0;
3815  }
3816  else
3817  {
3818  if (TEST_OPT_PROT)
3819  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3820  &olddeg,&reduc,strat, red_result);
3821 
3822 #ifdef DEBUGF5
3823  PrintS("Poly before red: ");
3824  pWrite(strat->P.p);
3825 #endif
3826  /* complete reduction of the element chosen from L */
3827  red_result = strat->red2(&strat->P,strat);
3828  if (errorreported) break;
3829  }
3830 
3831  if (strat->overflow)
3832  {
3833  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
3834  }
3835 
3836  // reduction to non-zero new poly
3837  if (red_result == 1)
3838  {
3839  // get the polynomial (canonicalize bucket, make sure P.p is set)
3840  strat->P.GetP(strat->lmBin);
3841  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
3842  // but now, for entering S, T, we reset it
3843  // in the inhomogeneous case: FDeg == pFDeg
3844  if (strat->homog) strat->initEcart(&(strat->P));
3845 
3846  /* statistic */
3847  if (TEST_OPT_PROT) PrintS("s");
3848  int pos;
3849  #if 1
3850  if(!rField_is_Ring(currRing))
3851  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3852  else
3853  pos = posInSMonFirst(strat,strat->sl,strat->P.p);
3854  #else
3855  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3856  #endif
3857  // reduce the tail and normalize poly
3858  // in the ring case we cannot expect LC(f) = 1,
3859  // therefore we call pContent instead of pNorm
3860 #if F5CTAILRED
3861  BOOLEAN withT = TRUE;
3863  {
3864  strat->P.pCleardenom();
3866  {
3867  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3868  strat->P.pCleardenom();
3869  }
3870  }
3871  else
3872  {
3873  strat->P.pNorm();
3875  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3876  }
3877 #endif
3878 #ifdef KDEBUG
3879  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3880 #endif /* KDEBUG */
3881 
3882  // min_std stuff
3883  if ((strat->P.p1==NULL) && (strat->minim>0))
3884  {
3885  if (strat->minim==1)
3886  {
3887  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3888  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3889  }
3890  else
3891  {
3892  strat->M->m[minimcnt]=strat->P.p2;
3893  strat->P.p2=NULL;
3894  }
3895  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3896  pNext(strat->M->m[minimcnt])
3897  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3898  strat->tailRing, currRing,
3899  currRing->PolyBin);
3900  minimcnt++;
3901  }
3902 
3903  // enter into S, L, and T
3904  // here we need to recompute new signatures, but those are trivial ones
3905  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3906  {
3907  enterT(strat->P, strat);
3908  // posInS only depends on the leading term
3909  strat->enterS(strat->P, pos, strat, strat->tl);
3910 //#if 1
3911 #ifdef DEBUGF5
3912  PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
3913  pWrite(pHead(strat->S[strat->sl]));
3914  pWrite(strat->sig[strat->sl]);
3915 #endif
3916  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3917  }
3918  // Print("[%d]",hilbeledeg);
3919  if (strat->P.lcm!=NULL)
3920 #ifdef HAVE_RINGS
3921  pLmDelete(strat->P.lcm);
3922 #else
3923  pLmFree(strat->P.lcm);
3924 #endif
3925  if (strat->sl>srmax) srmax = strat->sl;
3926  }
3927  else
3928  {
3929  // adds signature of the zero reduction to
3930  // strat->syz. This is the leading term of
3931  // syzygy and can be used in syzCriterion()
3932  // the signature is added if and only if the
3933  // pair was not detected by the rewritten criterion in strat->red = redSig
3934  if (strat->P.p1 == NULL && strat->minim > 0)
3935  {
3936  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3937  }
3938  }
3939 
3940 #ifdef KDEBUG
3941  memset(&(strat->P), 0, sizeof(strat->P));
3942 #endif /* KDEBUG */
3943  }
3944  int cc = 0;
3945  while (cc<strat->tl+1)
3946  {
3947  strat->T[cc].sig = pOne();
3948  p_SetComp(strat->T[cc].sig,cc+1,currRing);
3949  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
3950  strat->sig[cc] = strat->T[cc].sig;
3951  strat->sevSig[cc] = strat->T[cc].sevSig;
3952  strat->T[cc].is_sigsafe = TRUE;
3953  cc++;
3954  }
3955  strat->max_lower_index = strat->tl;
3956  // set current signature index of upcoming iteration step
3957  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
3958  // the corresponding syzygy rules correctly
3959  strat->currIdx = cc+1;
3960  for (int cd=strat->Ll; cd>=0; cd--)
3961  {
3962  p_SetComp(strat->L[cd].sig,cc+1,currRing);
3963  cc++;
3964  }
3965  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
3966  strat->Shdl->m[cc] = NULL;
3967  #if 0
3968  printf("\nAfter f5c sorting\n");
3969  for(int i=0;i<=strat->sl;i++)
3970  pWrite(pHead(strat->S[i]));
3971  getchar();
3972  #endif
3973 //#if 1
3974 #if DEBUGF5
3975  PrintS("------------------- STRAT S ---------------------\n");
3976  cc = 0;
3977  while (cc<strat->tl+1)
3978  {
3979  pWrite(pHead(strat->S[cc]));
3980  pWrite(strat->sig[cc]);
3981  printf("- - - - - -\n");
3982  cc++;
3983  }
3984  PrintS("-------------------------------------------------\n");
3985  PrintS("------------------- STRAT T ---------------------\n");
3986  cc = 0;
3987  while (cc<strat->tl+1)
3988  {
3989  pWrite(pHead(strat->T[cc].p));
3990  pWrite(strat->T[cc].sig);
3991  printf("- - - - - -\n");
3992  cc++;
3993  }
3994  PrintS("-------------------------------------------------\n");
3995  PrintS("------------------- STRAT L ---------------------\n");
3996  cc = 0;
3997  while (cc<strat->Ll+1)
3998  {
3999  pWrite(pHead(strat->L[cc].p));
4000  pWrite(pHead(strat->L[cc].p1));
4001  pWrite(pHead(strat->L[cc].p2));
4002  pWrite(strat->L[cc].sig);
4003  printf("- - - - - -\n");
4004  cc++;
4005  }
4006  PrintS("-------------------------------------------------\n");
4007  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
4008 #endif
4009 
4010 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
Definition: kutil.cc:5203
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7915
CanonicalForm cd(bCommonDen(FF))
Definition: cfModGcd.cc:4030
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6466
class sLObject LObject
Definition: kutil.h:52
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
void pWrite(poly p)
Definition: polys.h:290
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define Q
Definition: sirandom.c:25
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:346
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11353
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
LObject P
Definition: kutil.h:288
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:322
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define pOne()
Definition: polys.h:297
TObject ** R
Definition: kutil.h:328
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85

◆ faugereRewCriterion()

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

Definition at line 7202 of file kutil.cc.

7203 {
7204  //printf("Faugere Rewritten Criterion\n");
7206  return FALSE;
7207 //#if 1
7208 #ifdef DEBUGF5
7209  PrintS("rewritten criterion checks: ");
7210  pWrite(sig);
7211 #endif
7212  for(int k = strat->sl; k>=start; k--)
7213  {
7214 //#if 1
7215 #ifdef DEBUGF5
7216  PrintS("checking with: ");
7217  pWrite(strat->sig[k]);
7218  pWrite(pHead(strat->S[k]));
7219 #endif
7220  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7221  {
7222 //#if 1
7223 #ifdef DEBUGF5
7224  PrintS("DELETE!\n");
7225 #endif
7226  #ifdef ADIDEBUG
7227  printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
7228  #endif
7229  strat->nrrewcrit++;
7230  return TRUE;
7231  }
7232  //k--;
7233  }
7234 #ifdef DEBUGF5
7235  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7236  for(int kk = 0; kk<strat->sl+1; kk++)
7237  {
7238  pWrite(pHead(strat->S[kk]));
7239  }
7240  PrintS("------------------------------\n");
7241 #endif
7242  return FALSE;
7243 }
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrrewcrit
Definition: kutil.h:350
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:292
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int sl
Definition: kutil.h:336

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

11189 {
11190  if(!nCoeff_is_Ring_Z(currRing->cf))
11191  return;
11192  poly p,pp;
11193  for(int j = 0; j<=strat->sl; j++)
11194  {
11195  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11196  {
11197  for(int i = 0; i<=strat->sl; i++)
11198  {
11199  if((i != j) && (strat->S[i] != NULL))
11200  {
11201  p = strat->S[i];
11202  if(pLmDivisibleBy(strat->S[j], p))
11203  {
11204  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11205  p_SetCoeff(p,dummy,currRing);
11206  }
11207  pp = pNext(p);
11208  if((pp == NULL) && (nIsZero(p->coef)))
11209  {
11210  deleteInS(i, strat);
11211  }
11212  else
11213  {
11214  while(pp != NULL)
11215  {
11216  if(pLmDivisibleBy(strat->S[j], pp))
11217  {
11218  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11219  p_SetCoeff(pp,dummy,currRing);
11220  if(nIsZero(pp->coef))
11221  {
11222  pLmDelete(&pNext(p));
11223  pp = pNext(p);
11224  }
11225  else
11226  {
11227  p = pp;
11228  pp = pNext(p);
11229  }
11230  }
11231  else
11232  {
11233  p = pp;
11234  pp = pNext(p);
11235  }
11236  }
11237  }
11238  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11239  {
11240  if(pNext(strat->S[i]) == NULL)
11241  strat->S[i]=NULL;
11242  else
11243  strat->S[i]=pNext(strat->S[i]);
11244  }
11245  }
11246  }
11247  //idPrint(strat->Shdl);
11248  }
11249  }
11250  //idSkipZeroes(strat->Shdl);
11251 }
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:632
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
#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:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10

◆ findMinLMPair()

BOOLEAN findMinLMPair ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat,
int  start 
)

◆ freegb()

ideal freegb ( ideal  I,
int  uptodeg,
int  lVblock 
)

Definition at line 4371 of file kstd2.cc.

4372 {
4373  /* todo main call */
4374 
4375  /* assume: ring is prepared, ideal is copied into shifted ring */
4376  /* uptodeg and lVblock are correct - test them! */
4377 
4378  /* check whether the ideal is in V */
4379 
4380 // if (0)
4381  if (! ideal_isInV(I,lVblock) )
4382  {
4383  WerrorS("The input ideal contains incorrectly encoded elements! ");
4384  return(NULL);
4385  }
4386 
4387  // kStrategy strat = new skStrategy;
4388  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
4389  /* at the moment:
4390 - no quotient (check)
4391 - no *w, no *hilb
4392  */
4393  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
4394  int newIdeal, intvec *vw) */
4395  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
4396  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
4397  idSkipZeroes(RS);
4398  return(RS);
4399 }
int ideal_isInV(ideal I, int lV)
Definition: shiftgb.cc:308
void WerrorS(const char *s)
Definition: feFopen.cc:24
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, int uptodeg, int lV)
Definition: kstd1.cc:2722
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:10

◆ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 482 of file kutil.cc.

483 {
484  int j,/*k,*/p;
485 
486  strat->kHEdgeFound=FALSE;
487  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
488  {
489  return;
490  }
491  if (strat->ak > 1) /*we are in the module case*/
492  {
493  return; // until ....
494  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
495  // return FALSE;
496  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
497  // return FALSE;
498  }
499  // k = 0;
500  p=pIsPurePower(pp);
501  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(pp),currRing->cf))) return;
502  if (p!=0) strat->NotUsedAxis[p] = FALSE;
503  /*- the leading term of pp is a power of the p-th variable -*/
504  for (j=(currRing->N);j>0; j--)
505  {
506  if (strat->NotUsedAxis[j])
507  {
508  return;
509  }
510  }
511  strat->kHEdgeFound=TRUE;
512 }
#define pIsPurePower(p)
Definition: polys.h:231
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:320
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:341
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly pp
Definition: myNF.cc:296
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
BOOLEAN kHEdgeFound
Definition: kutil.h:365
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477

◆ homogTest()

BOOLEAN homogTest ( polyset  F,
int  Fmax 
)

◆ ind2()

long ind2 ( long  arg)

Definition at line 4190 of file kutil.cc.

4191 {
4192  long ind = 0;
4193  if (arg <= 0) return 0;
4194  while (arg%2 == 0)
4195  {
4196  arg = arg / 2;
4197  ind++;
4198  }
4199  return ind;
4200 }

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4202 of file kutil.cc.

4203 {
4204  long ind = 0;
4205  if (arg <= 0) return 0;
4206  if (arg%2 == 1) { arg--; }
4207  while (arg > 0)
4208  {
4209  ind += ind2(arg);
4210  arg = arg - 2;
4211  }
4212  return ind;
4213 }
long ind2(long arg)
Definition: kutil.cc:4190

◆ initBba()

void initBba ( kStrategy  strat)

Definition at line 1426 of file kstd1.cc.

1427 {
1428  /* setting global variables ------------------- */
1429  strat->enterS = enterSBba;
1430  strat->red = redHoney;
1431  if (strat->honey)
1432  strat->red = redHoney;
1433  else if (currRing->pLexOrder && !strat->homog)
1434  strat->red = redLazy;
1435  else
1436  {
1437  strat->LazyPass *=4;
1438  strat->red = redHomog;
1439  }
1440  if (rField_is_Ring(currRing))
1441  {
1442  strat->red = redRing;
1443  }
1444  if (currRing->pLexOrder && strat->honey)
1445  strat->initEcart = initEcartNormal;
1446  else
1447  strat->initEcart = initEcartBBA;
1448  if (strat->honey)
1450  else
1452 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1453 // {
1454 // //interred machen Aenderung
1455 // strat->pOrigFDeg=pFDeg;
1456 // strat->pOrigLDeg=pLDeg;
1457 // //h=ggetid("ecart");
1458 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1459 // //{
1460 // // ecartWeights=iv2array(IDINTVEC(h));
1461 // //}
1462 // //else
1463 // {
1464 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1465 // /*uses automatic computation of the ecartWeights to set them*/
1466 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1467 // }
1468 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1469 // if (TEST_OPT_PROT)
1470 // {
1471 // for(i=1; i<=(currRing->N); i++)
1472 // Print(" %d",ecartWeights[i]);
1473 // PrintLn();
1474 // mflush();
1475 // }
1476 // }
1477 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:366
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1296
BOOLEAN homog
Definition: kutil.h:361
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:341
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ initBbaShift()

void initBbaShift ( kStrategy  strat)

Definition at line 4532 of file kstd2.cc.

4533 {
4534  /* setting global variables ------------------- */
4535  strat->enterS = enterSBba; /* remains as is, we change enterT! */
4536 
4537  strat->red = redFirstShift; /* no redHomog ! */
4538 
4539  if (currRing->pLexOrder && strat->honey)
4540  strat->initEcart = initEcartNormal;
4541  else
4542  strat->initEcart = initEcartBBA;
4543  if (strat->honey)
4545  else
4547 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
4548 // {
4549 // //interred machen Aenderung
4550 // pFDegOld=currRing->pFDeg;
4551 // pLDegOld=pLDeg;
4552 // //h=ggetid("ecart");
4553 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
4554 // //{
4555 // // ecartWeights=iv2array(IDINTVEC(h));
4556 // //}
4557 // //else
4558 // {
4559 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
4560 // /*uses automatic computation of the ecartWeights to set them*/
4561 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
4562 // }
4563 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
4564 // if (TEST_OPT_PROT)
4565 // {
4566 // for(int i=1; i<=rVar(currRing); i++)
4567 // Print(" %d",ecartWeights[i]);
4568 // PrintLn();
4569 // mflush();
4570 // }
4571 // }
4572 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:366
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:4405
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ initBuchMora()

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

Definition at line 10092 of file kutil.cc.

10093 {
10094  strat->interpt = BTEST1(OPT_INTERRUPT);
10095  strat->kHEdge=NULL;
10097  /*- creating temp data structures------------------- -*/
10098  strat->cp = 0;
10099  strat->c3 = 0;
10100  strat->tail = pInit();
10101  /*- set s -*/
10102  strat->sl = -1;
10103  /*- set L -*/
10104  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10105  strat->Ll = -1;
10106  strat->L = initL(strat->Lmax);
10107  /*- set B -*/
10108  strat->Bmax = setmaxL;
10109  strat->Bl = -1;
10110  strat->B = initL();
10111  /*- set T -*/
10112  strat->tl = -1;
10113  strat->tmax = setmaxT;
10114  strat->T = initT();
10115  strat->R = initR();
10116  strat->sevT = initsevT();
10117  /*- init local data struct.---------------------------------------- -*/
10118  strat->P.ecart=0;
10119  strat->P.length=0;
10120  strat->P.pLength=0;
10122  {
10123  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10124  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10125  }
10127  {
10128  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10129  }
10130  else
10131  {
10132  if(TEST_OPT_SB_1)
10133  {
10134  int i;
10135  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10136  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10137  {
10138  P->m[i-strat->newIdeal] = F->m[i];
10139  F->m[i] = NULL;
10140  }
10141  initSSpecial(F,Q,P,strat);
10142  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10143  {
10144  F->m[i] = P->m[i-strat->newIdeal];
10145  P->m[i-strat->newIdeal] = NULL;
10146  }
10147  idDelete(&P);
10148  }
10149  else
10150  {
10151  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10152  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10153  }
10154  }
10155  strat->fromT = FALSE;
10157  if ((!TEST_OPT_SB_1)
10158  || (rField_is_Ring(currRing))
10159  )
10160  {
10161  updateS(TRUE,strat);
10162  }
10163  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10164  strat->fromQ=NULL;
10165  assume(kTest_TS(strat));
10166 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:28
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:315
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
int c3
Definition: kutil.h:335
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:316
int tl
Definition: kutil.h:338
int Bl
Definition: kutil.h:340
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8129
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
int ak
Definition: kutil.h:341
#define setmaxLinc
Definition: kutil.h:29
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:340
BOOLEAN interpt
Definition: kutil.h:360
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8535
#define setmaxT
Definition: kutil.h:31
#define kTest_TS(A)
Definition: kutil.h:641
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:288
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
int cp
Definition: kutil.h:335
BOOLEAN kHEdgeFound
Definition: kutil.h:365
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
int Lmax
Definition: kutil.h:339
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9000
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:410
int newIdeal
Definition: kutil.h:345
ideal Shdl
Definition: kutil.h:289
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9768 of file kutil.cc.

9769 {
9771  strat->chainCrit=chainCritNormal;
9772  if (TEST_OPT_SB_1)
9773  strat->chainCrit=chainCritOpt_1;
9774 #ifdef HAVE_RINGS
9775  if (rField_is_Ring(currRing))
9776  {
9778  strat->chainCrit=chainCritRing;
9779  }
9780 #endif
9781 #ifdef HAVE_RATGRING
9782  if (rIsRatGRing(currRing))
9783  {
9784  strat->chainCrit=chainCritPart;
9785  /* enterOnePairNormal get rational part in it */
9786  }
9787 #endif
9788  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9789  && (!rIsPluralRing(currRing)))
9791 
9792  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9793  strat->Gebauer = strat->homog || strat->sugarCrit;
9794  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9795  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9796  strat->pairtest = NULL;
9797  /* alway use tailreduction, except:
9798  * - in local rings, - in lex order case, -in ring over extensions */
9800  //if(rHasMixedOrdering(currRing)==2)
9801  //{
9802  // strat->noTailReduction =TRUE;
9803  //}
9804 
9805 #ifdef HAVE_PLURAL
9806  // and r is plural_ring
9807  // hence this holds for r a rational_plural_ring
9808  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9809  { //or it has non-quasi-comm type... later
9810  strat->sugarCrit = FALSE;
9811  strat->Gebauer = FALSE;
9812  strat->honey = FALSE;
9813  }
9814 #endif
9815 
9816  // Coefficient ring?
9817  if (rField_is_Ring(currRing))
9818  {
9819  strat->sugarCrit = FALSE;
9820  strat->Gebauer = FALSE ;
9821  strat->honey = FALSE;
9822  }
9823  #ifdef KDEBUG
9824  if (TEST_OPT_DEBUG)
9825  {
9826  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9827  else PrintS("ideal/module is not homogeneous\n");
9828  }
9829  #endif
9830 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:366
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3247
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2231
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:321
BOOLEAN z2homog
Definition: kutil.h:363
#define TEST_OPT_DEBUG
Definition: options.h:103
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1293
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1952
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:276
BOOLEAN homog
Definition: kutil.h:361
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4017
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:367
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:366
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:277
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
#define TEST_OPT_SB_1
Definition: options.h:113
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3460
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3535

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9919 of file kutil.cc.

9920 {
9922  {
9923  if (strat->honey)
9924  {
9925  strat->posInL = posInL15;
9926  // ok -- here is the deal: from my experiments for Singular-2-0
9927  // I conclude that that posInT_EcartpLength is the best of
9928  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9929  // see the table at the end of this file
9930  if (TEST_OPT_OLDSTD)
9931  strat->posInT = posInT15;
9932  else
9933  strat->posInT = posInT_EcartpLength;
9934  }
9935  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9936  {
9937  strat->posInL = posInL11;
9938  strat->posInT = posInT11;
9939  }
9940  else if (TEST_OPT_INTSTRATEGY)
9941  {
9942  strat->posInL = posInL11;
9943  strat->posInT = posInT11;
9944  }
9945  else
9946  {
9947  strat->posInL = posInL0;
9948  strat->posInT = posInT0;
9949  }
9950  //if (strat->minim>0) strat->posInL =posInLSpecial;
9951  if (strat->homog)
9952  {
9953  strat->posInL = posInL110;
9954  strat->posInT = posInT110;
9955  }
9956  }
9957  else
9958  {
9959  if (strat->homog)
9960  {
9961  strat->posInL = posInL11;
9962  strat->posInT = posInT11;
9963  }
9964  else
9965  {
9966  if ((currRing->order[0]==ringorder_c)
9967  ||(currRing->order[0]==ringorder_C))
9968  {
9969  strat->posInL = posInL17_c;
9970  strat->posInT = posInT17_c;
9971  }
9972  else
9973  {
9974  strat->posInL = posInL17;
9975  strat->posInT = posInT17;
9976  }
9977  }
9978  }
9979  if (strat->minim>0) strat->posInL =posInLSpecial;
9980  // for further tests only
9981  if ((BTEST1(11)) || (BTEST1(12)))
9982  strat->posInL = posInL11;
9983  else if ((BTEST1(13)) || (BTEST1(14)))
9984  strat->posInL = posInL13;
9985  else if ((BTEST1(15)) || (BTEST1(16)))
9986  strat->posInL = posInL15;
9987  else if ((BTEST1(17)) || (BTEST1(18)))
9988  strat->posInL = posInL17;
9989  if (BTEST1(11))
9990  strat->posInT = posInT11;
9991  else if (BTEST1(13))
9992  strat->posInT = posInT13;
9993  else if (BTEST1(15))
9994  strat->posInT = posInT15;
9995  else if ((BTEST1(17)))
9996  strat->posInT = posInT17;
9997  else if ((BTEST1(19)))
9998  strat->posInT = posInT19;
9999  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10000  strat->posInT = posInT1;
10002 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6390
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6887
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5335
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6811
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6776
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
#define BTEST1(a)
Definition: options.h:32
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5703
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6688
int minim
Definition: kutil.h:346
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5324
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9903
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5393
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5905
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6132
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6981
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5798
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5546
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6089
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6032
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5664
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5635

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10005 of file kutil.cc.

10006 {
10008  {
10009  if (strat->honey)
10010  {
10011  strat->posInL = posInL15Ring;
10012  // ok -- here is the deal: from my experiments for Singular-2-0
10013  // I conclude that that posInT_EcartpLength is the best of
10014  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10015  // see the table at the end of this file
10016  if (TEST_OPT_OLDSTD)
10017  strat->posInT = posInT15Ring;
10018  else
10019  strat->posInT = posInT_EcartpLength;
10020  }
10021  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10022  {
10023  strat->posInL = posInL11Ring;
10024  strat->posInT = posInT11;
10025  }
10026  else if (TEST_OPT_INTSTRATEGY)
10027  {
10028  strat->posInL = posInL11Ring;
10029  strat->posInT = posInT11;
10030  }
10031  else
10032  {
10033  strat->posInL = posInL0Ring;
10034  strat->posInT = posInT0;
10035  }
10036  //if (strat->minim>0) strat->posInL =posInLSpecial;
10037  if (strat->homog)
10038  {
10039  strat->posInL = posInL110Ring;
10040  strat->posInT = posInT110Ring;
10041  }
10042  }
10043  else
10044  {
10045  if (strat->homog)
10046  {
10047  //printf("\nHere 3\n");
10048  strat->posInL = posInL11Ring;
10049  strat->posInT = posInT11Ring;
10050  }
10051  else
10052  {
10053  if ((currRing->order[0]==ringorder_c)
10054  ||(currRing->order[0]==ringorder_C))
10055  {
10056  strat->posInL = posInL17_cRing;
10057  strat->posInT = posInT17_cRing;
10058  }
10059  else
10060  {
10061  strat->posInL = posInL11Ringls;
10062  strat->posInT = posInT17Ring;
10063  }
10064  }
10065  }
10066  if (strat->minim>0) strat->posInL =posInLSpecial;
10067  // for further tests only
10068  if ((BTEST1(11)) || (BTEST1(12)))
10069  strat->posInL = posInL11Ring;
10070  else if ((BTEST1(13)) || (BTEST1(14)))
10071  strat->posInL = posInL13;
10072  else if ((BTEST1(15)) || (BTEST1(16)))
10073  strat->posInL = posInL15Ring;
10074  else if ((BTEST1(17)) || (BTEST1(18)))
10075  strat->posInL = posInL17Ring;
10076  if (BTEST1(11))
10077  strat->posInT = posInT11Ring;
10078  else if (BTEST1(13))
10079  strat->posInT = posInT13;
10080  else if (BTEST1(15))
10081  strat->posInT = posInT15Ring;
10082  else if ((BTEST1(17)))
10083  strat->posInT = posInT17Ring;
10084  else if ((BTEST1(19)))
10085  strat->posInT = posInT19;
10086  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10087  strat->posInT = posInT1;
10089 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6432
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6502
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6846
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5335
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6931
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6776
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6729
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5757
#define BTEST1(a)
Definition: options.h:32
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7045
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int minim
Definition: kutil.h:346
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5324
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9903
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5393
BOOLEAN homog
Definition: kutil.h:361
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5429
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5859
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5588
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6158
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6089
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6032
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5664
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5966
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5635

◆ initBuchMoraShift()

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

Definition at line 12088 of file kutil.cc.

12089 {
12090  strat->interpt = BTEST1(OPT_INTERRUPT);
12091  strat->kHEdge=NULL;
12093  /*- creating temp data structures------------------- -*/
12094  strat->cp = 0;
12095  strat->c3 = 0;
12096  strat->cv = 0;
12097  strat->tail = pInit();
12098  /*- set s -*/
12099  strat->sl = -1;
12100  /*- set L -*/
12101  strat->Lmax = setmaxL;
12102  strat->Ll = -1;
12103  strat->L = initL();
12104  /*- set B -*/
12105  strat->Bmax = setmaxL;
12106  strat->Bl = -1;
12107  strat->B = initL();
12108  /*- set T -*/
12109  strat->tl = -1;
12110  strat->tmax = setmaxT;
12111  strat->T = initT();
12112  strat->R = initR();
12113  strat->sevT = initsevT();
12114  /*- init local data struct.---------------------------------------- -*/
12115  strat->P.ecart=0;
12116  strat->P.length=0;
12118  {
12119  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12120  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12121  }
12123  {
12124  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12125  }
12126  {
12127  if(TEST_OPT_SB_1)
12128  {
12129  int i;
12130  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12131  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12132  {
12133  P->m[i-strat->newIdeal] = F->m[i];
12134  F->m[i] = NULL;
12135  }
12136  initSSpecial(F,Q,P,strat);
12137  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12138  {
12139  F->m[i] = P->m[i-strat->newIdeal];
12140  P->m[i-strat->newIdeal] = NULL;
12141  }
12142  idDelete(&P);
12143  }
12144  else
12145  {
12146  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12147  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12148  }
12149  }
12150  strat->fromT = FALSE;
12151  if (!TEST_OPT_SB_1)
12152  {
12153  /* the only change: we do not fill the set T*/
12154  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12155  }
12156  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12157  strat->fromQ=NULL;
12158  /* more changes: fill the set T with all the shifts of elts of S*/
12159  /* is done by other procedure */
12160 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:28
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:315
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:335
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:358
poly kNoether
Definition: kutil.h:316
int tl
Definition: kutil.h:338
int Bl
Definition: kutil.h:340
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8129
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:311
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:340
BOOLEAN interpt
Definition: kutil.h:360
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8535
#define setmaxT
Definition: kutil.h:31
intset fromQ
Definition: kutil.h:307
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:288
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
int cp
Definition: kutil.h:335
BOOLEAN kHEdgeFound
Definition: kutil.h:365
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
int Lmax
Definition: kutil.h:339
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9000
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:410
int newIdeal
Definition: kutil.h:345
ideal Shdl
Definition: kutil.h:289
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initEcartBBA()

void initEcartBBA ( TObject h)

Definition at line 1259 of file kutil.cc.

1260 {
1261  h->FDeg = h->pFDeg();
1262  (*h).ecart = 0;
1263  h->length=h->pLength=pLength(h->p);
1264 }
static unsigned pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978

◆ initEcartNormal()

void initEcartNormal ( TObject h)

Definition at line 1251 of file kutil.cc.

1252 {
1253  h->FDeg = h->pFDeg();
1254  h->ecart = h->pLDeg() - h->FDeg;
1255  // h->length is set by h->pLDeg
1256  h->length=h->pLength=pLength(h->p);
1257 }
static unsigned pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978

◆ initEcartPairBba()

void initEcartPairBba ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1266 of file kutil.cc.

1267 {
1268  Lp->FDeg = Lp->pFDeg();
1269  (*Lp).ecart = 0;
1270  (*Lp).length = 0;
1271 }

◆ initEcartPairMora()

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

Definition at line 1273 of file kutil.cc.

1274 {
1275  Lp->FDeg = Lp->pFDeg();
1276  (*Lp).ecart = si_max(ecartF,ecartG);
1277  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1278  (*Lp).length = 0;
1279 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
static int si_max(const int a, const int b)
Definition: auxiliary.h:120

◆ initHilbCrit()

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

Definition at line 9750 of file kutil.cc.

9751 {
9752 
9753  //if the ordering is local, then hilb criterion
9754  //can be used also if the ideal is not homogenous
9756  {
9758  *hilb=NULL;
9759  else
9760  return;
9761  }
9762  if (strat->homog!=isHomog)
9763  {
9764  *hilb=NULL;
9765  }
9766 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
#define FALSE
Definition: auxiliary.h:94
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10

◆ initL()

static LSet initL ( int  nr = setmaxL)
inlinestatic

Definition at line 410 of file kutil.h.

411 { return (LSet)omAlloc(nr*sizeof(LObject)); }
class sLObject LObject
Definition: kutil.h:52
#define omAlloc(size)
Definition: omAllocDecl.h:210
LObject * LSet
Definition: kutil.h:54

◆ initR()

KINLINE TObject** initR ( )

Definition at line 92 of file kInline.h.

93 {
94  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
95 }
#define setmaxT
Definition: kutil.h:31
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:51

◆ initS()

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

Definition at line 8033 of file kutil.cc.

8034 {
8035  int i,pos;
8036 
8037  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8038  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8039  strat->ecartS=initec(i);
8040  strat->sevS=initsevS(i);
8041  strat->S_2_R=initS_2_R(i);
8042  strat->fromQ=NULL;
8043  strat->Shdl=idInit(i,F->rank);
8044  strat->S=strat->Shdl->m;
8045  /*- put polys into S -*/
8046  if (Q!=NULL)
8047  {
8048  strat->fromQ=initec(i);
8049  memset(strat->fromQ,0,i*sizeof(int));
8050  for (i=0; i<IDELEMS(Q); i++)
8051  {
8052  if (Q->m[i]!=NULL)
8053  {
8054  LObject h;
8055  h.p = pCopy(Q->m[i]);
8057  {
8058  //pContent(h.p);
8059  h.pCleardenom(); // also does a pContent
8060  }
8061  else
8062  {
8063  h.pNorm();
8064  }
8066  {
8067  deleteHC(&h, strat);
8068  }
8069  if (h.p!=NULL)
8070  {
8071  strat->initEcart(&h);
8072  if (strat->sl==-1)
8073  pos =0;
8074  else
8075  {
8076  pos = posInS(strat,strat->sl,h.p,h.ecart);
8077  }
8078  h.sev = pGetShortExpVector(h.p);
8079  strat->enterS(h,pos,strat,-1);
8080  strat->fromQ[pos]=1;
8081  }
8082  }
8083  }
8084  }
8085  for (i=0; i<IDELEMS(F); i++)
8086  {
8087  if (F->m[i]!=NULL)
8088  {
8089  LObject h;
8090  h.p = pCopy(F->m[i]);
8092  {
8093  cancelunit(&h); /*- tries to cancel a unit -*/
8094  deleteHC(&h, strat);
8095  }
8096  if (h.p!=NULL)
8097  // do not rely on the input being a SB!
8098  {
8100  {
8101  //pContent(h.p);
8102  h.pCleardenom(); // also does a pContent
8103  }
8104  else
8105  {
8106  h.pNorm();
8107  }
8108  strat->initEcart(&h);
8109  if (strat->sl==-1)
8110  pos =0;
8111  else
8112  pos = posInS(strat,strat->sl,h.p,h.ecart);
8113  h.sev = pGetShortExpVector(h.p);
8114  strat->enterS(h,pos,strat,-1);
8115  }
8116  }
8117  }
8118  /*- test, if a unit is in F -*/
8119  if ((strat->sl>=0)
8120 #ifdef HAVE_RINGS
8121  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8122 #endif
8123  && pIsConstant(strat->S[0]))
8124  {
8125  while (strat->sl>0) deleteInS(strat->sl,strat);
8126  }
8127 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:52
int * S_2_R
Definition: kutil.h:330
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
intset fromQ
Definition: kutil.h:307
#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:272
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:292
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:295
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
unsigned long * sevS
Definition: kutil.h:308
#define setmaxTinc
Definition: kutil.h:32
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:336
ideal Shdl
Definition: kutil.h:289
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSba()

void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1479 of file kstd1.cc.

1480 {
1481  int i;
1482  //idhdl h;
1483  /* setting global variables ------------------- */
1484  strat->enterS = enterSSba;
1485  strat->red2 = redHoney;
1486  if (strat->honey)
1487  strat->red2 = redHoney;
1488  else if (currRing->pLexOrder && !strat->homog)
1489  strat->red2 = redLazy;
1490  else
1491  {
1492  strat->LazyPass *=4;
1493  strat->red2 = redHomog;
1494  }
1495  if (rField_is_Ring(currRing))
1496  {
1498  {strat->red2 = redRiloc;}
1499  else
1500  {strat->red2 = redRing;}
1501  }
1502  if (currRing->pLexOrder && strat->honey)
1503  strat->initEcart = initEcartNormal;
1504  else
1505  strat->initEcart = initEcartBBA;
1506  if (strat->honey)
1508  else
1510  //strat->kIdeal = NULL;
1511  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1512  //else strat->kIdeal->rtyp=MODUL_CMD;
1513  //strat->kIdeal->data=(void *)strat->Shdl;
1514  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1515  {
1516  //interred machen Aenderung
1517  strat->pOrigFDeg = currRing->pFDeg;
1518  strat->pOrigLDeg = currRing->pLDeg;
1519  //h=ggetid("ecart");
1520  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1521  //{
1522  // ecartWeights=iv2array(IDINTVEC(h));
1523  //}
1524  //else
1525  {
1526  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1527  /*uses automatic computation of the ecartWeights to set them*/
1529  }
1531  if (TEST_OPT_PROT)
1532  {
1533  for(i=1; i<=(currRing->N); i++)
1534  Print(" %d",ecartWeights[i]);
1535  PrintLn();
1536  mflush();
1537  }
1538  }
1539  // for sig-safe reductions in signature-based
1540  // standard basis computations
1542  strat->red = redSigRing;
1543  else
1544  strat->red = redSig;
1545  //strat->sbaOrder = 1;
1546  strat->currIdx = 1;
1547 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:366
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9331
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:190
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
short * ecartWeights
Definition: weight0.c:28
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:703
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int currIdx
Definition: kutil.h:303
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
pFDegProc pOrigFDeg
Definition: kutil.h:282
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:348
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1296
pLDegProc pOrigLDeg
Definition: kutil.h:283
BOOLEAN homog
Definition: kutil.h:361
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
int i
Definition: cfEzgcd.cc:123
int redSigRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:871
#define IDELEMS(i)
Definition: simpleideals.h:24
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3555
#define TEST_OPT_WEIGHTM
Definition: options.h:115
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:341
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:265

◆ initSbaBuchMora()

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

Definition at line 10288 of file kutil.cc.

10289 {
10290  strat->interpt = BTEST1(OPT_INTERRUPT);
10291  strat->kHEdge=NULL;
10293  /*- creating temp data structures------------------- -*/
10294  strat->cp = 0;
10295  strat->c3 = 0;
10296  strat->tail = pInit();
10297  /*- set s -*/
10298  strat->sl = -1;
10299  /*- set ps -*/
10300  strat->syzl = -1;
10301  /*- set L -*/
10302  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10303  strat->Ll = -1;
10304  strat->L = initL(strat->Lmax);
10305  /*- set B -*/
10306  strat->Bmax = setmaxL;
10307  strat->Bl = -1;
10308  strat->B = initL();
10309  /*- set T -*/
10310  strat->tl = -1;
10311  strat->tmax = setmaxT;
10312  strat->T = initT();
10313  strat->R = initR();
10314  strat->sevT = initsevT();
10315  /*- init local data struct.---------------------------------------- -*/
10316  strat->P.ecart=0;
10317  strat->P.length=0;
10319  {
10320  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10321  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10322  }
10324  {
10325  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10326  }
10327  else
10328  {
10329  if(TEST_OPT_SB_1)
10330  {
10331  int i;
10332  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10333  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10334  {
10335  P->m[i-strat->newIdeal] = F->m[i];
10336  F->m[i] = NULL;
10337  }
10338  initSSpecialSba(F,Q,P,strat);
10339  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10340  {
10341  F->m[i] = P->m[i-strat->newIdeal];
10342  P->m[i-strat->newIdeal] = NULL;
10343  }
10344  idDelete(&P);
10345  }
10346  else
10347  {
10348  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10349  }
10350  }
10351  strat->fromT = FALSE;
10352  if (!TEST_OPT_SB_1)
10353  {
10354  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10355  }
10356  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10357  //strat->fromQ=NULL;
10358  assume(kTest_TS(strat));
10359 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:28
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:315
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:335
poly kNoether
Definition: kutil.h:316
int tl
Definition: kutil.h:338
int Bl
Definition: kutil.h:340
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8680
unsigned long * sevT
Definition: kutil.h:311
int ak
Definition: kutil.h:341
#define setmaxLinc
Definition: kutil.h:29
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8228
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:340
BOOLEAN interpt
Definition: kutil.h:360
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
#define setmaxT
Definition: kutil.h:31
#define kTest_TS(A)
Definition: kutil.h:641
#define assume(x)
Definition: mod2.h:394
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:288
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
int cp
Definition: kutil.h:335
BOOLEAN kHEdgeFound
Definition: kutil.h:365
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
int Lmax
Definition: kutil.h:339
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9000
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:410
int newIdeal
Definition: kutil.h:345
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:337

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9832 of file kutil.cc.

9833 {
9834  //strat->enterOnePair=enterOnePairNormal;
9836  //strat->chainCrit=chainCritNormal;
9837  strat->chainCrit = chainCritSig;
9838  /******************************************
9839  * rewCrit1 and rewCrit2 are already set in
9840  * kSba() in kstd1.cc
9841  *****************************************/
9842  //strat->rewCrit1 = faugereRewCriterion;
9843  if (strat->sbaOrder == 1)
9844  {
9845  strat->syzCrit = syzCriterionInc;
9846  }
9847  else
9848  {
9849  strat->syzCrit = syzCriterion;
9850  }
9851 #ifdef HAVE_RINGS
9852  if (rField_is_Ring(currRing))
9853  {
9855  strat->chainCrit=chainCritRing;
9856  }
9857 #endif
9858 #ifdef HAVE_RATGRING
9859  if (rIsRatGRing(currRing))
9860  {
9861  strat->chainCrit=chainCritPart;
9862  /* enterOnePairNormal get rational part in it */
9863  }
9864 #endif
9865 
9866  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9867  strat->Gebauer = strat->homog || strat->sugarCrit;
9868  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9869  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9870  strat->pairtest = NULL;
9871  /* alway use tailreduction, except:
9872  * - in local rings, - in lex order case, -in ring over extensions */
9875 
9876 #ifdef HAVE_PLURAL
9877  // and r is plural_ring
9878  // hence this holds for r a rational_plural_ring
9879  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9880  { //or it has non-quasi-comm type... later
9881  strat->sugarCrit = FALSE;
9882  strat->Gebauer = FALSE;
9883  strat->honey = FALSE;
9884  }
9885 #endif
9886 
9887  // Coefficient ring?
9888  if (rField_is_Ring(currRing))
9889  {
9890  strat->sugarCrit = FALSE;
9891  strat->Gebauer = FALSE ;
9892  strat->honey = FALSE;
9893  }
9894  #ifdef KDEBUG
9895  if (TEST_OPT_DEBUG)
9896  {
9897  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9898  else PrintS("ideal/module is not homogeneous\n");
9899  }
9900  #endif
9901 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:366
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:321
BOOLEAN z2homog
Definition: kutil.h:363
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:103
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1293
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3476
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1952
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:278
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:276
BOOLEAN homog
Definition: kutil.h:361
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4017
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:367
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
unsigned sbaOrder
Definition: kutil.h:302
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:366
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7112
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7150
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:277
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3535

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10186 of file kutil.cc.

10187 {
10189  {
10190  if (strat->honey)
10191  {
10192  strat->posInL = posInL15;
10193  // ok -- here is the deal: from my experiments for Singular-2-0
10194  // I conclude that that posInT_EcartpLength is the best of
10195  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10196  // see the table at the end of this file
10197  if (TEST_OPT_OLDSTD)
10198  strat->posInT = posInT15;
10199  else
10200  strat->posInT = posInT_EcartpLength;
10201  }
10202  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10203  {
10204  strat->posInL = posInL11;
10205  strat->posInT = posInT11;
10206  }
10207  else if (TEST_OPT_INTSTRATEGY)
10208  {
10209  strat->posInL = posInL11;
10210  strat->posInT = posInT11;
10211  }
10212  else
10213  {
10214  strat->posInL = posInL0;
10215  strat->posInT = posInT0;
10216  }
10217  //if (strat->minim>0) strat->posInL =posInLSpecial;
10218  if (strat->homog)
10219  {
10220  strat->posInL = posInL110;
10221  strat->posInT = posInT110;
10222  }
10223  }
10224  else
10225  {
10226  if (strat->homog)
10227  {
10228  strat->posInL = posInL11;
10229  strat->posInT = posInT11;
10230  }
10231  else
10232  {
10233  if ((currRing->order[0]==ringorder_c)
10234  ||(currRing->order[0]==ringorder_C))
10235  {
10236  strat->posInL = posInL17_c;
10237  strat->posInT = posInT17_c;
10238  }
10239  else
10240  {
10241  strat->posInL = posInL17;
10242  strat->posInT = posInT17;
10243  }
10244  }
10245  }
10246  if (strat->minim>0) strat->posInL =posInLSpecial;
10247  // for further tests only
10248  if ((BTEST1(11)) || (BTEST1(12)))
10249  strat->posInL = posInL11;
10250  else if ((BTEST1(13)) || (BTEST1(14)))
10251  strat->posInL = posInL13;
10252  else if ((BTEST1(15)) || (BTEST1(16)))
10253  strat->posInL = posInL15;
10254  else if ((BTEST1(17)) || (BTEST1(18)))
10255  strat->posInL = posInL17;
10256  if (BTEST1(11))
10257  strat->posInT = posInT11;
10258  else if (BTEST1(13))
10259  strat->posInT = posInT13;
10260  else if (BTEST1(15))
10261  strat->posInT = posInT15;
10262  else if ((BTEST1(17)))
10263  strat->posInT = posInT17;
10264  else if ((BTEST1(19)))
10265  strat->posInT = posInT19;
10266  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10267  strat->posInT = posInT1;
10268  if (rField_is_Ring(currRing))
10269  {
10270  strat->posInL = posInL11Ring;
10271  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10272  strat->posInL = posInL11Ringls;
10273  strat->posInT = posInT11;
10274  }
10275  strat->posInLDependsOnLength = FALSE;
10276  strat->posInLSba = posInLSig;
10277  //strat->posInL = posInLSig;
10278  strat->posInL = posInLF5C;
10279  /*
10280  if (rField_is_Ring(currRing))
10281  {
10282  strat->posInLSba = posInLSigRing;
10283  strat->posInL = posInL11Ring;
10284  }*/
10285  //strat->posInT = posInTSig;
10286 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6390
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6887
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6432
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6502
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5335
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6811
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6776
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:268
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6378
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5703
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6688
int minim
Definition: kutil.h:346
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5324
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5393
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5905
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6132
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6981
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5798
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5546
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6089
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6032
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5664
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5635

◆ initsevT()

KINLINE unsigned long* initsevT ( )

Definition at line 97 of file kInline.h.

98 {
99  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
100 }
#define setmaxT
Definition: kutil.h:31
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSL()

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

Definition at line 8129 of file kutil.cc.

8130 {
8131  int i,pos;
8132 
8133  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8134  else i=setmaxT;
8135  strat->ecartS=initec(i);
8136  strat->sevS=initsevS(i);
8137  strat->S_2_R=initS_2_R(i);
8138  strat->fromQ=NULL;
8139  strat->Shdl=idInit(i,F->rank);
8140  strat->S=strat->Shdl->m;
8141  /*- put polys into S -*/
8142  if (Q!=NULL)
8143  {
8144  strat->fromQ=initec(i);
8145  memset(strat->fromQ,0,i*sizeof(int));
8146  for (i=0; i<IDELEMS(Q); i++)
8147  {
8148  if (Q->m[i]!=NULL)
8149  {
8150  LObject h;
8151  h.p = pCopy(Q->m[i]);
8153  {
8154  deleteHC(&h,strat);
8155  }
8157  {
8158  //pContent(h.p);
8159  h.pCleardenom(); // also does a pContent
8160  }
8161  else
8162  {
8163  h.pNorm();
8164  }
8165  if (h.p!=NULL)
8166  {
8167  strat->initEcart(&h);
8168  if (strat->sl==-1)
8169  pos =0;
8170  else
8171  {
8172  pos = posInS(strat,strat->sl,h.p,h.ecart);
8173  }
8174  h.sev = pGetShortExpVector(h.p);
8175  strat->enterS(h,pos,strat,-1);
8176  strat->fromQ[pos]=1;
8177  }
8178  }
8179  }
8180  }
8181  for (i=0; i<IDELEMS(F); i++)
8182  {
8183  if (F->m[i]!=NULL)
8184  {
8185  LObject h;
8186  h.p = pCopy(F->m[i]);
8187  if (h.p!=NULL)
8188  {
8190  {
8191  cancelunit(&h); /*- tries to cancel a unit -*/
8192  deleteHC(&h, strat);
8193  }
8194  if (h.p!=NULL)
8195  {
8197  {
8198  //pContent(h.p);
8199  h.pCleardenom(); // also does a pContent
8200  }
8201  else
8202  {
8203  h.pNorm();
8204  }
8205  strat->initEcart(&h);
8206  if (strat->Ll==-1)
8207  pos =0;
8208  else
8209  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8210  h.sev = pGetShortExpVector(h.p);
8211  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8212  }
8213  }
8214  }
8215  }
8216  /*- test, if a unit is in F -*/
8217 
8218  if ((strat->Ll>=0)
8219 #ifdef HAVE_RINGS
8220  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8221 #endif
8222  && pIsConstant(strat->L[strat->Ll].p))
8223  {
8224  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8225  }
8226 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:52
int Ll
Definition: kutil.h:339
int * S_2_R
Definition: kutil.h:330
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:31
intset fromQ
Definition: kutil.h:307
#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:272
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:292
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:295
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
unsigned long * sevS
Definition: kutil.h:308
#define setmaxTinc
Definition: kutil.h:32
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:336
ideal Shdl
Definition: kutil.h:289
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSLSba()

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

Definition at line 8228 of file kutil.cc.

8229 {
8230  int i,pos;
8231  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8232  else i=setmaxT;
8233  strat->ecartS = initec(i);
8234  strat->sevS = initsevS(i);
8235  strat->sevSig = initsevS(i);
8236  strat->S_2_R = initS_2_R(i);
8237  strat->fromQ = NULL;
8238  strat->Shdl = idInit(i,F->rank);
8239  strat->S = strat->Shdl->m;
8240  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8241  if (strat->sbaOrder != 1)
8242  {
8243  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8244  strat->sevSyz = initsevS(i);
8245  strat->syzmax = i;
8246  strat->syzl = 0;
8247  }
8248  /*- put polys into S -*/
8249  if (Q!=NULL)
8250  {
8251  strat->fromQ=initec(i);
8252  memset(strat->fromQ,0,i*sizeof(int));
8253  for (i=0; i<IDELEMS(Q); i++)
8254  {
8255  if (Q->m[i]!=NULL)
8256  {
8257  LObject h;
8258  h.p = pCopy(Q->m[i]);
8260  {
8261  deleteHC(&h,strat);
8262  }
8264  {
8265  //pContent(h.p);
8266  h.pCleardenom(); // also does a pContent
8267  }
8268  else
8269  {
8270  h.pNorm();
8271  }
8272  if (h.p!=NULL)
8273  {
8274  strat->initEcart(&h);
8275  if (strat->sl==-1)
8276  pos =0;
8277  else
8278  {
8279  pos = posInS(strat,strat->sl,h.p,h.ecart);
8280  }
8281  h.sev = pGetShortExpVector(h.p);
8282  strat->enterS(h,pos,strat,-1);
8283  strat->fromQ[pos]=1;
8284  }
8285  }
8286  }
8287  }
8288  for (i=0; i<IDELEMS(F); i++)
8289  {
8290  if (F->m[i]!=NULL)
8291  {
8292  LObject h;
8293  h.p = pCopy(F->m[i]);
8294  h.sig = pOne();
8295  //h.sig = pInit();
8296  //p_SetCoeff(h.sig,nInit(1),currRing);
8297  p_SetComp(h.sig,i+1,currRing);
8298  // if we are working with the Schreyer order we generate it
8299  // by multiplying the initial signatures with the leading monomial
8300  // of the corresponding initial polynomials generating the ideal
8301  // => we can keep the underlying monomial order and get a Schreyer
8302  // order without any bigger overhead
8303  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8304  {
8305  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8306  }
8307  h.sevSig = pGetShortExpVector(h.sig);
8308 #ifdef DEBUGF5
8309  pWrite(h.p);
8310  pWrite(h.sig);
8311 #endif
8312  if (h.p!=NULL)
8313  {
8315  {
8316  cancelunit(&h); /*- tries to cancel a unit -*/
8317  deleteHC(&h, strat);
8318  }
8319  if (h.p!=NULL)
8320  {
8322  {
8323  //pContent(h.p);
8324  h.pCleardenom(); // also does a pContent
8325  }
8326  else
8327  {
8328  h.pNorm();
8329  }
8330  strat->initEcart(&h);
8331  if (strat->Ll==-1)
8332  pos =0;
8333  else
8334  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8335  h.sev = pGetShortExpVector(h.p);
8336  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8337  }
8338  }
8339  /*
8340  if (strat->sbaOrder != 1)
8341  {
8342  for(j=0;j<i;j++)
8343  {
8344  strat->syz[ctr] = pCopy(F->m[j]);
8345  p_SetCompP(strat->syz[ctr],i+1,currRing);
8346  // add LM(F->m[i]) to the signature to get a Schreyer order
8347  // without changing the underlying polynomial ring at all
8348  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8349  // since p_Add_q() destroys all input
8350  // data we need to recreate help
8351  // each time
8352  poly help = pCopy(F->m[i]);
8353  p_SetCompP(help,j+1,currRing);
8354  pWrite(strat->syz[ctr]);
8355  pWrite(help);
8356  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8357  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8358  printf("%d. SYZ ",ctr);
8359  pWrite(strat->syz[ctr]);
8360  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8361  ctr++;
8362  }
8363  strat->syzl = ps;
8364  }
8365  */
8366  }
8367  }
8368  /*- test, if a unit is in F -*/
8369 
8370  if ((strat->Ll>=0)
8371 #ifdef HAVE_RINGS
8372  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8373 #endif
8374  && pIsConstant(strat->L[strat->Ll].p))
8375  {
8376  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8377  }
8378 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
unsigned long * sevSig
Definition: kutil.h:310
polyset sig
Definition: kutil.h:294
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
int syzmax
Definition: kutil.h:337
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:52
int Ll
Definition: kutil.h:339
int * S_2_R
Definition: kutil.h:330
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:268
void pWrite(poly p)
Definition: polys.h:290
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:31
intset fromQ
Definition: kutil.h:307
#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:272
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
unsigned sbaOrder
Definition: kutil.h:302
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:292
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:295
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
unsigned long * sevS
Definition: kutil.h:308
unsigned long * sevSyz
Definition: kutil.h:309
#define setmaxTinc
Definition: kutil.h:32
polyset syz
Definition: kutil.h:293
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:337
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8380 of file kutil.cc.

8381 {
8382  if( strat->S[0] )
8383  {
8384  if( strat->S[1] && !rField_is_Ring(currRing))
8385  {
8386  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8387  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8388  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8389  }
8390  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8391  /************************************************************
8392  * computing the length of the syzygy array needed
8393  ***********************************************************/
8394  for(i=1; i<=strat->sl; i++)
8395  {
8396  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8397  {
8398  ps += i;
8399  }
8400  }
8401  ps += strat->sl+1;
8402  //comp = pGetComp (strat->P.sig);
8403  comp = strat->currIdx;
8404  strat->syzIdx = initec(comp);
8405  strat->sevSyz = initsevS(ps);
8406  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8407  strat->syzmax = ps;
8408  strat->syzl = 0;
8409  strat->syzidxmax = comp;
8410 #if defined(DEBUGF5) || defined(DEBUGF51)
8411  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8412 #endif
8413  i = 1;
8414  j = 0;
8415  /************************************************************
8416  * generating the leading terms of the principal syzygies
8417  ***********************************************************/
8418  while (i <= strat->sl)
8419  {
8420  /**********************************************************
8421  * principal syzygies start with component index 2
8422  * the array syzIdx starts with index 0
8423  * => the rules for a signature with component comp start
8424  * at strat->syz[strat->syzIdx[comp-2]] !
8425  *********************************************************/
8426  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8427  {
8428  comp = pGetComp(strat->sig[i]);
8429  comp_old = pGetComp(strat->sig[i-1]);
8430  diff = comp - comp_old - 1;
8431  // diff should be zero, but sometimes also the initial generating
8432  // elements of the input ideal reduce to zero. then there is an
8433  // index-gap between the signatures. for these inbetween signatures we
8434  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8435  // in the following.
8436  // doing this, we keep the relation "j = comp - 2" alive, which makes
8437  // jumps way easier when checking criteria
8438  while (diff>0)
8439  {
8440  strat->syzIdx[j] = 0;
8441  diff--;
8442  j++;
8443  }
8444  strat->syzIdx[j] = ctr;
8445  j++;
8446  LObject Q;
8447  int pos;
8448  for (k = 0; k<i; k++)
8449  {
8450  Q.sig = pOne();
8452  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8453  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8454  p_SetCompP (Q.sig, comp, currRing);
8455  poly q = p_One(currRing);
8457  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8458  p_ExpVectorCopy(q,strat->S[i],currRing);
8459  q = p_Neg (q, currRing);
8460  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8461  Q.sig = p_Add_q (Q.sig, q, currRing);
8462  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8463  pos = posInSyz(strat, Q.sig);
8464  enterSyz(Q, strat, pos);
8465  ctr++;
8466  }
8467  }
8468  i++;
8469  }
8470  /**************************************************************
8471  * add syzygies for upcoming first element of new iteration step
8472  **************************************************************/
8473  comp = strat->currIdx;
8474  comp_old = pGetComp(strat->sig[i-1]);
8475  diff = comp - comp_old - 1;
8476  // diff should be zero, but sometimes also the initial generating
8477  // elements of the input ideal reduce to zero. then there is an
8478  // index-gap between the signatures. for these inbetween signatures we
8479  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8480  // in the following.
8481  // doing this, we keep the relation "j = comp - 2" alive, which makes
8482  // jumps way easier when checking criteria
8483  while (diff>0)
8484  {
8485  strat->syzIdx[j] = 0;
8486  diff--;
8487  j++;
8488  }
8489  strat->syzIdx[j] = ctr;
8490  LObject Q;
8491  int pos;
8492  for (k = 0; k<strat->sl+1; k++)
8493  {
8494  Q.sig = pOne();
8496  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8497  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8498  p_SetCompP (Q.sig, comp, currRing);
8499  poly q = p_One(currRing);
8501  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8502  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8503  q = p_Neg (q, currRing);
8504  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8505  Q.sig = p_Add_q (Q.sig, q, currRing);
8506  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8507  pos = posInSyz(strat, Q.sig);
8508  enterSyz(Q, strat, pos);
8509  ctr++;
8510  }
8511 //#if 1
8512 #ifdef DEBUGF5
8513  PrintS("Principal syzygies:\n");
8514  Print("syzl %d\n",strat->syzl);
8515  Print("syzmax %d\n",strat->syzmax);
8516  Print("ps %d\n",ps);
8517  PrintS("--------------------------------\n");
8518  for(i=0;i<=strat->syzl-1;i++)
8519  {
8520  Print("%d - ",i);
8521  pWrite(strat->syz[i]);
8522  }
8523  for(i=0;i<strat->currIdx;i++)
8524  {
8525  Print("%d - %d\n",i,strat->syzIdx[i]);
8526  }
8527  PrintS("--------------------------------\n");
8528 #endif
8529  }
8530 }
polyset sig
Definition: kutil.h:294
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:337
class sLObject LObject
Definition: kutil.h:52
int Ll
Definition: kutil.h:339
#define p_GetComp(p, r)
Definition: monomials.h:72
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
int currIdx
Definition: kutil.h:303
#define pGetComp(p)
Component.
Definition: polys.h:37
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
poly p_One(const ring r)
Definition: p_polys.cc:1314
int j
Definition: myNF.cc:70
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1236
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:292
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6350
int syzidxmax
Definition: kutil.h:337
#define nCopy(n)
Definition: numbers.h:15
unsigned long * sevSyz
Definition: kutil.h:309
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyset syz
Definition: kutil.h:293
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:336
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
int syzl
Definition: kutil.h:337
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9666
intset syzIdx
Definition: kutil.h:299

◆ initT()

KINLINE TSet initT ( )

Definition at line 81 of file kInline.h.

82 {
83  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
84  for (int i=setmaxT-1; i>=0; i--)
85  {
86  T[i].tailRing = currRing;
87  T[i].i_r = -1;
88  }
89  return T;
90 }
TObject * TSet
Definition: kutil.h:53
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define setmaxT
Definition: kutil.h:31
int i
Definition: cfEzgcd.cc:123
static jList * T
Definition: janet.cc:37
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:51

◆ k_GetLeadTerms()

KINLINE BOOLEAN k_GetLeadTerms ( const poly  p1,
const poly  p2,
const ring  p_r,
poly m1,
poly m2,
const ring  m_r 
)

Definition at line 935 of file kInline.h.

937 {
938  p_LmCheckPolyRing(p1, p_r);
939  p_LmCheckPolyRing(p2, p_r);
940 
941  int i;
942  long x;
943  m1 = p_Init(m_r);
944  m2 = p_Init(m_r);
945 
946  for (i = p_r->N; i; i--)
947  {
948  x = p_GetExpDiff(p1, p2, i, p_r);
949  if (x > 0)
950  {
951  if (x > (long) m_r->bitmask) goto false_return;
952  p_SetExp(m2,i,x, m_r);
953  p_SetExp(m1,i,0, m_r);
954  }
955  else
956  {
957  if (-x > (long) m_r->bitmask) goto false_return;
958  p_SetExp(m1,i,-x, m_r);
959  p_SetExp(m2,i,0, m_r);
960  }
961  }
962 
963  p_Setm(m1, m_r);
964  p_Setm(m2, m_r);
965  return TRUE;
966 
967  false_return:
968  p_LmFree(m1, m_r);
969  p_LmFree(m2, m_r);
970  m1 = m2 = NULL;
971  return FALSE;
972 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:630
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ k_GetStrongLeadTerms()

KINLINE void k_GetStrongLeadTerms ( const poly  p1,
const poly  p2,
const ring  leadRing,
poly m1,
poly m2,
poly lcm,
const ring  taiRing 
)

Definition at line 978 of file kInline.h.

980 {
981  p_LmCheckPolyRing(p1, leadRing);
982  p_LmCheckPolyRing(p2, leadRing);
983 
984  int i;
985  int x;
986  int e1;
987  int e2;
988  int s;
989  m1 = p_Init(tailRing);
990  m2 = p_Init(tailRing);
991  lcm = p_Init(leadRing);
992 
993  for (i = leadRing->N; i>=0; i--)
994  {
995  e1 = p_GetExp(p1,i,leadRing);
996  e2 = p_GetExp(p2,i,leadRing);
997  x = e1 - e2;
998  if (x > 0)
999  {
1000  p_SetExp(m2,i,x, tailRing);
1001  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1002  s = e1;
1003  }
1004  else if (x<0)
1005  {
1006  p_SetExp(m1,i,-x, tailRing);
1007  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1008  s = e2;
1009  }
1010  else
1011  s = e1; // e1==e2
1012  p_SetExp(lcm,i,s, leadRing);
1013  }
1014 
1015  p_Setm(m1, tailRing);
1016  p_Setm(m2, tailRing);
1017  p_Setm(lcm, leadRing);
1018 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 876 of file kInline.h.

877 {
878 
879  poly np = p_LmInit(p, currRing, tailRing, tailBin);
880  pNext(np) = pNext(p);
881  pSetCoeff0(np, pGetCoeff(p));
882  return np;
883 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10

◆ k_LmInit_currRing_2_tailRing() [2/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 908 of file kInline.h.

909 {
910  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
911 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 885 of file kInline.h.

886 {
887  poly np = p_LmInit(p, tailRing, currRing, lmBin);
888  pNext(np) = pNext(p);
889  pSetCoeff0(np, pGetCoeff(p));
890  return np;
891 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10

◆ k_LmInit_tailRing_2_currRing() [2/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 913 of file kInline.h.

914 {
915  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
916 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:885
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 894 of file kInline.h.

895 {
897  p_LmFree(p, currRing);
898  return np;
899 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
polyrec * poly
Definition: hilb.h:10

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 918 of file kInline.h.

919 {
921 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:894

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 901 of file kInline.h.

902 {
904  p_LmFree(p, tailRing);
905  return np;
906 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:885
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
polyrec * poly
Definition: hilb.h:10

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 923 of file kInline.h.

924 {
926 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:901

◆ kCheckSpolyCreation()

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

Definition at line 10802 of file kutil.cc.

10803 {
10804  if (strat->overflow) return FALSE;
10805  assume(L->p1 != NULL && L->p2 != NULL);
10806  // shift changes: from 0 to -1
10807  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10808  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10809  assume(strat->tailRing != currRing);
10810 
10811  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10812  return FALSE;
10813  // shift changes: extra case inserted
10814  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10815  {
10816  return TRUE;
10817  }
10818  poly p1_max = (strat->R[L->i_r1])->max_exp;
10819  poly p2_max = (strat->R[L->i_r2])->max_exp;
10820 
10821  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10822  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10823  {
10824  p_LmFree(m1, strat->tailRing);
10825  p_LmFree(m2, strat->tailRing);
10826  m1 = NULL;
10827  m2 = NULL;
10828  return FALSE;
10829  }
10830  return TRUE;
10831 }
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:935
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:328
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
polyrec * poly
Definition: hilb.h:10

◆ kCheckStrongCreation()

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

Definition at line 10840 of file kutil.cc.

10841 {
10842  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10843  //assume(strat->tailRing != currRing);
10844 
10845  poly p1_max = (strat->R[atR])->max_exp;
10846  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10847 
10848  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10849  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10850  {
10851  return FALSE;
10852  }
10853  return TRUE;
10854 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:330
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:328
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
polyrec * poly
Definition: hilb.h:10

◆ kCreateZeroPoly()

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

Definition at line 4406 of file kutil.cc.

4407 {
4408 
4409  poly zeroPoly = NULL;
4410 
4411  number tmp1;
4412  poly tmp2, tmp3;
4413 
4414  if (cabsind == -1)
4415  {
4416  cabsind = 0;
4417  for (int i = 1; i <= leadRing->N; i++)
4418  {
4419  cabsind += ind_fact_2(exp[i]);
4420  }
4421 // Print("cabsind: %d\n", cabsind);
4422  }
4423  if (cabsind < leadRing->ch)
4424  {
4425  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4426  }
4427  else
4428  {
4429  zeroPoly = p_ISet(1, tailRing);
4430  }
4431  for (int i = 1; i <= leadRing->N; i++)
4432  {
4433  for (long j = 1; j <= exp[i]; j++)
4434  {
4435  tmp1 = nInit(j);
4436  tmp2 = p_ISet(1, tailRing);
4437  p_SetExp(tmp2, i, 1, tailRing);
4438  p_Setm(tmp2, tailRing);
4439  if (nIsZero(tmp1))
4440  { // should nowbe obsolet, test ! TODO OLIVER
4441  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4442  }
4443  else
4444  {
4445  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4446  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4447  }
4448  }
4449  }
4450  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4451  for (int i = 1; i <= leadRing->N; i++)
4452  {
4453  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4454  }
4455  p_Setm(tmp2, leadRing);
4456  *t_p = zeroPoly;
4457  zeroPoly = pNext(zeroPoly);
4458  pNext(*t_p) = NULL;
4459  pNext(tmp2) = zeroPoly;
4460  return tmp2;
4461 }
#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:1444
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
long twoPow(long arg)
Definition: kutil.cc:4217
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:4202
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
p exp[i]
Definition: DebugPrint.cc:39
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#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:1298
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 11800 of file kutil.cc.

11801 {
11802  PrintS("red: ");
11803  if (strat->red==redFirst) PrintS("redFirst\n");
11804  else if (strat->red==redHoney) PrintS("redHoney\n");
11805  else if (strat->red==redEcart) PrintS("redEcart\n");
11806  else if (strat->red==redHomog) PrintS("redHomog\n");
11807  else Print("%p\n",(void*)strat->red);
11808  PrintS("posInT: ");
11809  if (strat->posInT==posInT0) PrintS("posInT0\n");
11810  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11811  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11812  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11813  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11814  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11815  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11816  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11817  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11818  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11819  #ifdef HAVE_RINGS
11820  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11821  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11822  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11823  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11824  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11825  #endif
11826 #ifdef HAVE_MORE_POS_IN_T
11827  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11828  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11829  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11830 #endif
11831  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11832  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11833  else Print("%p\n",(void*)strat->posInT);
11834  PrintS("posInL: ");
11835  if (strat->posInL==posInL0) PrintS("posInL0\n");
11836  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11837  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11838  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11839  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11840  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11841  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11842  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11843  #ifdef HAVE_RINGS
11844  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11845  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11846  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11847  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11848  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11849  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11850  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11851  #endif
11852  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11853  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11854  else Print("%p\n",(void*)strat->posInL);
11855  PrintS("enterS: ");
11856  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11857  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11858  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11859  else Print("%p\n",(void*)strat->enterS);
11860  PrintS("initEcart: ");
11861  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11862  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11863  else Print("%p\n",(void*)strat->initEcart);
11864  PrintS("initEcartPair: ");
11865  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11866  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11867  else Print("%p\n",(void*)strat->initEcartPair);
11868  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11869  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11870  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11871  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11872  PrintS("chainCrit: ");
11873  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11874  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11875  else Print("%p\n",(void*)strat->chainCrit);
11876  Print("posInLDependsOnLength=%d\n",
11877  strat->posInLDependsOnLength);
11878  PrintS(showOption());PrintLn();
11879  PrintS("LDeg: ");
11880  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11881  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11882  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11883  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11884  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11885  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11886  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11887  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11888  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11889  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11890  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11891  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11892  else Print("? (%lx)", (long)currRing->pLDeg);
11893  PrintS(" / ");
11894  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11895  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11896  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11897  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11898  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11899  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11900  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11901  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11902  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11903  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11904  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11905  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11906  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11907  PrintLn();
11908  PrintS("currRing->pFDeg: ");
11909  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11910  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11911  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11912  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11913  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11914  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11915  else Print("? (%lx)", (long)currRing->pFDeg);
11916  PrintLn();
11917  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11918  if(TEST_OPT_DEGBOUND)
11919  Print(" degBound: %d\n", Kstd1_deg);
11920 
11921  if( ecartWeights != NULL )
11922  {
11923  PrintS("ecartWeights: ");
11924  for (int i = rVar(currRing); i > 0; i--)
11925  Print("%hd ", ecartWeights[i]);
11926  PrintLn();
11928  }
11929 
11930 #ifndef SING_NDEBUG
11932 #endif
11933 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6390
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11766
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5470
BOOLEAN honey
Definition: kutil.h:366
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6887
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1362
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5363
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:842
#define TEST_OPT_DEGBOUND
Definition: options.h:108
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6432
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6502
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1006
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6846
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:878
BOOLEAN noTailReduction
Definition: kutil.h:367
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5335
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3247
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6604
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6931
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6811
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6776
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6729
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5757
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:771
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int ak
Definition: kutil.h:341
char * showOption()
Definition: misc_ip.cc:717
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:911
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7045
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5703
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6688
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5324
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:942
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5393
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5905
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
BOOLEAN homog
Definition: kutil.h:361
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5429
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
BOOLEAN Gebauer
Definition: kutil.h:367
#define assume(x)
Definition: mod2.h:394
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:597
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5859
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:740
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6132
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6981
void rDebugPrint(const ring r)
Definition: ring.cc:4012
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5798
BOOLEAN sugarCrit
Definition: kutil.h:366
int Kstd1_deg
Definition: kutil.cc:236
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1416
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11675
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:277
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:812
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:976
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
ring tailRing
Definition: kutil.h:331
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5546
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5588
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3460
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1039
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6089
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1069
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:614
BOOLEAN use_buckets
Definition: kutil.h:372
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6032
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:341
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11729
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5664
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
int LazyDegree
Definition: kutil.h:341
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5966
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5635
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ kFindDivisibleByInS() [1/2]

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 at line 197 of file kstd2.cc.

198 {
199  unsigned long not_sev = ~L->sev;
200  poly p = L->GetLmCurrRing();
201  int j = 0;
202 
203  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
204 #if 1
205  int ende;
206  if ((strat->ak>0) || currRing->pLexOrder || rField_is_Ring(currRing)) ende=strat->sl;
207  else ende=posInS(strat,*max_ind,p,0)+1;
208  if (ende>(*max_ind)) ende=(*max_ind);
209 #else
210  int ende=strat->sl;
211 #endif
212  (*max_ind)=ende;
214  {
215  loop
216  {
217  if (j > ende) return -1;
218 #if defined(PDEBUG) || defined(PDIV_DEBUG)
219  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
220  p, not_sev, currRing))
221  {
222  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
223  return j;
224  }
225 #else
226  if ( !(strat->sevS[j] & not_sev) &&
227  p_LmDivisibleBy(strat->S[j], p, currRing))
228  {
229  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
230  return j;
231  }
232 #endif
233  j++;
234  }
235  }
236  else
237  {
238  loop
239  {
240  if (j > ende) return -1;
241 #if defined(PDEBUG) || defined(PDIV_DEBUG)
242  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
243  p, not_sev, currRing))
244  {
245  return j;
246  }
247 #else
248  if ( !(strat->sevS[j] & not_sev) &&
249  p_LmDivisibleBy(strat->S[j], p, currRing))
250  {
251  return j;
252  }
253 #endif
254  j++;
255  }
256  }
257 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int & max_ind
Definition: myNF.cc:67
int ak
Definition: kutil.h:341
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
polyset S
Definition: kutil.h:292
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10

◆ kFindDivisibleByInS() [2/2]

TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart = LONG_MAX 
)

Definition at line 7358 of file kutil.cc.

7360 {
7361  int j = 0;
7362  const unsigned long not_sev = ~L->sev;
7363  const unsigned long* sev = strat->sevS;
7364  poly p;
7365  ring r;
7366  L->GetLm(p, r);
7367 
7368  assume(~not_sev == p_GetShortExpVector(p, r));
7369 
7370  if (r == currRing)
7371  {
7372  if(!rField_is_Ring(r))
7373  {
7374  loop
7375  {
7376  if (j > pos) return NULL;
7377  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7378  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7379  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7380  {
7381  break;
7382  }
7383  #else
7384  if (!(sev[j] & not_sev) &&
7385  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7386  p_LmDivisibleBy(strat->S[j], p, r))
7387  {
7388  break;
7389  }
7390  #endif
7391  j++;
7392  }
7393  }
7394  #ifdef HAVE_RINGS
7395  else
7396  {
7397  loop
7398  {
7399  if (j > pos) return NULL;
7400  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7401  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7402  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7403  {
7404  break;
7405  }
7406  #else
7407  if (!(sev[j] & not_sev) &&
7408  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7409  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7410  {
7411  break;
7412  }
7413  #endif
7414  j++;
7415  }
7416  }
7417  #endif
7418  // if called from NF, T objects do not exist:
7419  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7420  {
7421  T->Set(strat->S[j], r, strat->tailRing);
7422  return T;
7423  }
7424  else
7425  {
7426 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7427 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7428 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7429  return strat->S_2_T(j);
7430  }
7431  }
7432  else
7433  {
7434  TObject* t;
7435  if(!rField_is_Ring(r))
7436  {
7437  loop
7438  {
7439  if (j > pos) return NULL;
7440  assume(strat->S_2_R[j] != -1);
7441  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7442  t = strat->S_2_T(j);
7443  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7444  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7445  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7446  {
7447  return t;
7448  }
7449  #else
7450  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7451  {
7452  t = strat->S_2_T(j);
7453  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7454  if (p_LmDivisibleBy(t->t_p, p, r))
7455  {
7456  return t;
7457  }
7458  }
7459  #endif
7460  j++;
7461  }
7462  }
7463  #ifdef HAVE_RINGS
7464  else
7465  {
7466  loop
7467  {
7468  if (j > pos) return NULL;
7469  assume(strat->S_2_R[j] != -1);
7470  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7471  t = strat->S_2_T(j);
7472  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7473  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7474  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7475  {
7476  return t;
7477  }
7478  #else
7479  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7480  {
7481  t = strat->S_2_T(j);
7482  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7483  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7484  {
7485  return t;
7486  }
7487  }
7488  #endif
7489  j++;
7490  }
7491  }
7492  #endif
7493  }
7494 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:338
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:35
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
polyset S
Definition: kutil.h:292
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
intset ecartS
Definition: kutil.h:295
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
unsigned long * sevS
Definition: kutil.h:308
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
class sTObject TObject
Definition: kutil.h:51

◆ kFindDivisibleByInT()

int kFindDivisibleByInT ( const kStrategy  strat,
const LObject L,
const int  start = 0 
)

return -1 if no divisor is found number of first divisor in T, otherwise

Definition at line 88 of file kstd2.cc.

89 {
90  unsigned long not_sev = ~L->sev;
91  int j = start;
92 
93  const TSet T=strat->T;
94  const unsigned long* sevT=strat->sevT;
95  if (L->p!=NULL)
96  {
97  const ring r=currRing;
98  const poly p=L->p;
99 
100  pAssume(~not_sev == p_GetShortExpVector(p, r));
101 
102  if(rField_is_Ring(r))
103  {
104  loop
105  {
106  if (j > strat->tl) return -1;
107 #if defined(PDEBUG) || defined(PDIV_DEBUG)
108  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
109  {
110  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
111  return j;
112  }
113 #else
114  if (!(sevT[j] & not_sev) &&
115  p_LmDivisibleBy(T[j].p, p, r))
116  {
117  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
118  return j;
119  }
120 #endif
121  j++;
122  }
123  }
124  else
125  {
126  loop
127  {
128  if (j > strat->tl) return -1;
129 #if defined(PDEBUG) || defined(PDIV_DEBUG)
130  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
131  {
132  return j;
133  }
134 #else
135  if (!(sevT[j] & not_sev) &&
136  p_LmDivisibleBy(T[j].p, p, r))
137  {
138  return j;
139  }
140 #endif
141  j++;
142  }
143  }
144  }
145  else
146  {
147  const poly p=L->t_p;
148  const ring r=strat->tailRing;
149  if(rField_is_Ring(r))
150  {
151  loop
152  {
153  if (j > strat->tl) return -1;
154 #if defined(PDEBUG) || defined(PDIV_DEBUG)
155  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
156  p, not_sev, r))
157  {
158  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
159  return j;
160  }
161 #else
162  if (!(sevT[j] & not_sev) &&
163  p_LmDivisibleBy(T[j].t_p, p, r))
164  {
165  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
166  return j;
167  }
168 #endif
169  j++;
170  }
171  }
172  else
173  {
174  loop
175  {
176  if (j > strat->tl) return -1;
177 #if defined(PDEBUG) || defined(PDIV_DEBUG)
178  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
179  p, not_sev, r))
180  {
181  return j;
182  }
183 #else
184  if (!(sevT[j] & not_sev) &&
185  p_LmDivisibleBy(T[j].t_p, p, r))
186  {
187  return j;
188  }
189 #endif
190  j++;
191  }
192  }
193  }
194 }
TObject * TSet
Definition: kutil.h:53
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int tl
Definition: kutil.h:338
unsigned long * sevT
Definition: kutil.h:311
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
TSet T
Definition: kutil.h:312
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10

◆ kFindInT()

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

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

Definition at line 717 of file kutil.cc.

718 {
719  int i;
720 
721  for (i=0; i<=tlength; i++)
722  {
723  if (T[i].p == p) return i;
724  }
725  return -1;
726 }
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static jList * T
Definition: janet.cc:37

◆ kFindNextDivisibleByInS()

int kFindNextDivisibleByInS ( const kStrategy  strat,
int  start,
int  max_ind,
LObject L 
)

Definition at line 259 of file kstd2.cc.

260 {
261  unsigned long not_sev = ~L->sev;
262  poly p = L->GetLmCurrRing();
263  int j = start;
264 
265  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
266 #if 1
267  int ende=max_ind;
268 #else
269  int ende=strat->sl;
270 #endif
272  {
273  loop
274  {
275  if (j > ende) return -1;
276 #if defined(PDEBUG) || defined(PDIV_DEBUG)
277  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
278  p, not_sev, currRing))
279  {
280  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
281  return j;
282  }
283 #else
284  if ( !(strat->sevS[j] & not_sev) &&
285  p_LmDivisibleBy(strat->S[j], p, currRing))
286  {
287  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
288  return j;
289  }
290 #endif
291  j++;
292  }
293  }
294  else
295  {
296  loop
297  {
298  if (j > ende) return -1;
299 #if defined(PDEBUG) || defined(PDIV_DEBUG)
300  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
301  p, not_sev, currRing))
302  {
303  return j;
304  }
305 #else
306  if ( !(strat->sevS[j] & not_sev) &&
307  p_LmDivisibleBy(strat->S[j], p, currRing))
308  {
309  return j;
310  }
311 #endif
312  j++;
313  }
314  }
315 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int & max_ind
Definition: myNF.cc:67
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
polyset S
Definition: kutil.h:292
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10

◆ kFindZeroPoly()

poly kFindZeroPoly ( poly  input_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 318 of file kstd2.cc.

319 {
320  // m = currRing->ch
321 
322  if (input_p == NULL) return NULL;
323 
324  poly p = input_p;
325  poly zeroPoly = NULL;
326  unsigned long a = (unsigned long) pGetCoeff(p);
327 
328  int k_ind2 = 0;
329  int a_ind2 = ind2(a);
330 
331  // unsigned long k = 1;
332  // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
333  for (int i = 1; i <= leadRing->N; i++)
334  {
335  k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
336  }
337 
338  a = (unsigned long) pGetCoeff(p);
339 
340  number tmp1;
341  poly tmp2, tmp3;
342  poly lead_mult = p_ISet(1, tailRing);
343  if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
344  {
345  int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
346  int s_exp;
347  zeroPoly = p_ISet(a, tailRing);
348  for (int i = 1; i <= leadRing->N; i++)
349  {
350  s_exp = p_GetExp(p, i,leadRing);
351  if (s_exp % 2 != 0)
352  {
353  s_exp = s_exp - 1;
354  }
355  while ( (0 < ind2(s_exp)) && (ind2(s_exp) <= too_much) )
356  {
357  too_much = too_much - ind2(s_exp);
358  s_exp = s_exp - 2;
359  }
360  p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
361  for (int j = 1; j <= s_exp; j++)
362  {
363  tmp1 = nInit(j);
364  tmp2 = p_ISet(1, tailRing);
365  p_SetExp(tmp2, i, 1, tailRing);
366  p_Setm(tmp2, tailRing);
367  if (nIsZero(tmp1))
368  { // should nowbe obsolet, test ! TODO OLIVER
369  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
370  }
371  else
372  {
373  tmp3 = p_NSet(nCopy(tmp1), tailRing);
374  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
375  }
376  }
377  }
378  p_Setm(lead_mult, tailRing);
379  zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
380  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
381  for (int i = 1; i <= leadRing->N; i++)
382  {
383  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
384  }
385  p_Setm(tmp2, leadRing);
386  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
387  pNext(tmp2) = zeroPoly;
388  return tmp2;
389  }
390 /* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
391  if (1 == 0 && alpha_k <= a)
392  { // Temporarly disabled, reducing coefficients not compatible with std TODO Oliver
393  zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
394  for (int i = 1; i <= leadRing->N; i++)
395  {
396  for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
397  {
398  tmp1 = nInit(j);
399  tmp2 = p_ISet(1, tailRing);
400  p_SetExp(tmp2, i, 1, tailRing);
401  p_Setm(tmp2, tailRing);
402  if (nIsZero(tmp1))
403  {
404  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
405  }
406  else
407  {
408  tmp3 = p_ISet((unsigned long) tmp1, tailRing);
409  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
410  }
411  }
412  }
413  tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
414  for (int i = 1; i <= leadRing->N; i++)
415  {
416  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
417  }
418  p_Setm(tmp2, leadRing);
419  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
420  pNext(tmp2) = zeroPoly;
421  return tmp2;
422  } */
423  return NULL;
424 }
const poly a
Definition: syzextra.cc:212
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:720
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1444
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:448
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:4202
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
long ind2(long arg)
Definition: kutil.cc:4190
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#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:1298
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

◆ kFreeStrat()

void kFreeStrat ( kStrategy  strat)

◆ kNF2() [1/2]

poly kNF2 ( ideal  F,
ideal  Q,
poly  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3399 of file kstd2.cc.

3400 {
3401  assume(q!=NULL);
3402  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3403 
3404 // lazy_reduce flags: can be combined by |
3405 //#define KSTD_NF_LAZY 1
3406  // do only a reduction of the leading term
3407 //#define KSTD_NF_NONORM 4
3408  // only global: avoid normalization, return a multiply of NF
3409  poly p;
3410 
3411  //if ((idIs0(F))&&(Q==NULL))
3412  // return pCopy(q); /*F=0*/
3413  //strat->ak = idRankFreeModule(F);
3414  /*- creating temp data structures------------------- -*/
3415  BITSET save1;
3416  SI_SAVE_OPT1(save1);
3418  initBuchMoraCrit(strat);
3419  strat->initEcart = initEcartBBA;
3420  strat->enterS = enterSBba;
3421 #ifndef NO_BUCKETS
3423 #endif
3424  /*- set S -*/
3425  strat->sl = -1;
3426  /*- init local data struct.---------------------------------------- -*/
3427  /*Shdl=*/initS(F,Q,strat);
3428  /*- compute------------------------------------------------------- -*/
3429  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3430  //{
3431  // for (i=strat->sl;i>=0;i--)
3432  // pNorm(strat->S[i]);
3433  //}
3434  kTest(strat);
3435  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3436  if (BVERBOSE(23)) kDebugPrint(strat);
3437  int max_ind;
3438  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3439  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3440  {
3441  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3442  if (rField_is_Ring(currRing))
3443  {
3444  p = redtailBba_Z(p,max_ind,strat);
3445  }
3446  else
3447  {
3449  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3450  }
3451  }
3452  /*- release temp data------------------------------- -*/
3453  assume(strat->L==NULL); /* strat->L unused */
3454  assume(strat->B==NULL); /* strat->B unused */
3455  omFree(strat->sevS);
3456  omFree(strat->ecartS);
3457  assume(strat->T==NULL);//omfree(strat->T);
3458  assume(strat->sevT==NULL);//omfree(strat->sevT);
3459  assume(strat->R==NULL);//omfree(strat->R);
3460  omfree(strat->S_2_R);
3461  omfree(strat->fromQ);
3462  idDelete(&strat->Shdl);
3463  SI_RESTORE_OPT1(save1);
3464  if (TEST_OPT_PROT) PrintLn();
3465  return p;
3466 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1104
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:640
unsigned long * sevT
Definition: kutil.h:311
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1660
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:57
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:307
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:328
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:295
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11800
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNF2() [2/2]

ideal kNF2 ( ideal  F,
ideal  Q,
ideal  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3538 of file kstd2.cc.

3539 {
3540  assume(!idIs0(q));
3541  assume(!(idIs0(F)&&(Q==NULL)));
3542 // lazy_reduce flags: can be combined by |
3543 //#define KSTD_NF_LAZY 1
3544  // do only a reduction of the leading term
3545 //#define KSTD_NF_NONORM 4
3546  // only global: avoid normalization, return a multiply of NF
3547  poly p;
3548  int i;
3549  ideal res;
3550  int max_ind;
3551 
3552  //if (idIs0(q))
3553  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3554  //if ((idIs0(F))&&(Q==NULL))
3555  // return idCopy(q); /*F=0*/
3556  //strat->ak = idRankFreeModule(F);
3557  /*- creating temp data structures------------------- -*/
3558  BITSET save1;
3559  SI_SAVE_OPT1(save1);
3561  initBuchMoraCrit(strat);
3562  strat->initEcart = initEcartBBA;
3563  strat->enterS = enterSBba;
3564  /*- set S -*/
3565  strat->sl = -1;
3566 #ifndef NO_BUCKETS
3568 #endif
3569  /*- init local data struct.---------------------------------------- -*/
3570  /*Shdl=*/initS(F,Q,strat);
3571  /*- compute------------------------------------------------------- -*/
3572  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3574  for (i=IDELEMS(q)-1; i>=0; i--)
3575  {
3576  if (q->m[i]!=NULL)
3577  {
3578  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3579  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3580  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3581  {
3582  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3583  if (rField_is_Ring(currRing))
3584  {
3585  p = redtailBba_Z(p,max_ind,strat);
3586  }
3587  else
3588  {
3589  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3590  }
3591  }
3592  res->m[i]=p;
3593  }
3594  //else
3595  // res->m[i]=NULL;
3596  }
3597  /*- release temp data------------------------------- -*/
3598  assume(strat->L==NULL); /* strat->L unused */
3599  assume(strat->B==NULL); /* strat->B unused */
3600  omFree(strat->sevS);
3601  omFree(strat->ecartS);
3602  assume(strat->T==NULL);//omfree(strat->T);
3603  assume(strat->sevT==NULL);//omfree(strat->sevT);
3604  assume(strat->R==NULL);//omfree(strat->R);
3605  omfree(strat->S_2_R);
3606  omfree(strat->fromQ);
3607  idDelete(&strat->Shdl);
3608  SI_RESTORE_OPT1(save1);
3609  if (TEST_OPT_PROT) PrintLn();
3610  return res;
3611 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1104
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
unsigned long * sevT
Definition: kutil.h:311
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1660
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:57
poly res
Definition: myNF.cc:322
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:307
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
#define OPT_INTSTRATEGY
Definition: options.h:87
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:295
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNF2Bound() [1/2]

poly kNF2Bound ( ideal  F,
ideal  Q,
poly  q,
int  bound,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3468 of file kstd2.cc.

3469 {
3470  assume(q!=NULL);
3471  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3472 
3473 // lazy_reduce flags: can be combined by |
3474 //#define KSTD_NF_LAZY 1
3475  // do only a reduction of the leading term
3476 //#define KSTD_NF_NONORM 4
3477  // only global: avoid normalization, return a multiply of NF
3478  poly p;
3479 
3480  //if ((idIs0(F))&&(Q==NULL))
3481  // return pCopy(q); /*F=0*/
3482  //strat->ak = idRankFreeModule(F);
3483  /*- creating temp data structures------------------- -*/
3484  BITSET save1;
3485  SI_SAVE_OPT1(save1);
3487  initBuchMoraCrit(strat);
3488  strat->initEcart = initEcartBBA;
3489  strat->enterS = enterSBba;
3490 #ifndef NO_BUCKETS
3492 #endif
3493  /*- set S -*/
3494  strat->sl = -1;
3495  /*- init local data struct.---------------------------------------- -*/
3496  /*Shdl=*/initS(F,Q,strat);
3497  /*- compute------------------------------------------------------- -*/
3498  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3499  //{
3500  // for (i=strat->sl;i>=0;i--)
3501  // pNorm(strat->S[i]);
3502  //}
3503  kTest(strat);
3504  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3505  if (BVERBOSE(23)) kDebugPrint(strat);
3506  int max_ind;
3507  p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3508  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3509  {
3510  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3511  if (rField_is_Ring(currRing))
3512  {
3513  p = redtailBba_Z(p,max_ind,strat);
3514  }
3515  else
3516  {
3518  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3519  //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3520  }
3521  }
3522  /*- release temp data------------------------------- -*/
3523  assume(strat->L==NULL); /* strat->L unused */
3524  assume(strat->B==NULL); /* strat->B unused */
3525  omFree(strat->sevS);
3526  omFree(strat->ecartS);
3527  assume(strat->T==NULL);//omfree(strat->T);
3528  assume(strat->sevT==NULL);//omfree(strat->sevT);
3529  assume(strat->R==NULL);//omfree(strat->R);
3530  omfree(strat->S_2_R);
3531  omfree(strat->fromQ);
3532  idDelete(&strat->Shdl);
3533  SI_RESTORE_OPT1(save1);
3534  if (TEST_OPT_PROT) PrintLn();
3535  return p;
3536 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1104
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition: kstd2.cc:1816
#define kTest(A)
Definition: kutil.h:640
unsigned long * sevT
Definition: kutil.h:311
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:57
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1097
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:307
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:328
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:295
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11800
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNF2Bound() [2/2]

ideal kNF2Bound ( ideal  F,
ideal  Q,
ideal  q,
int  bound,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3613 of file kstd2.cc.

3614 {
3615  assume(!idIs0(q));
3616  assume(!(idIs0(F)&&(Q==NULL)));
3617 // lazy_reduce flags: can be combined by |
3618 //#define KSTD_NF_LAZY 1
3619  // do only a reduction of the leading term
3620 //#define KSTD_NF_NONORM 4
3621  // only global: avoid normalization, return a multiply of NF
3622  poly p;
3623  int i;
3624  ideal res;
3625  int max_ind;
3626 
3627  //if (idIs0(q))
3628  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3629  //if ((idIs0(F))&&(Q==NULL))
3630  // return idCopy(q); /*F=0*/
3631  //strat->ak = idRankFreeModule(F);
3632  /*- creating temp data structures------------------- -*/
3633  BITSET save1;
3634  SI_SAVE_OPT1(save1);
3636  initBuchMoraCrit(strat);
3637  strat->initEcart = initEcartBBA;
3638  strat->enterS = enterSBba;
3639  /*- set S -*/
3640  strat->sl = -1;
3641 #ifndef NO_BUCKETS
3643 #endif
3644  /*- init local data struct.---------------------------------------- -*/
3645  /*Shdl=*/initS(F,Q,strat);
3646  /*- compute------------------------------------------------------- -*/
3647  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3649  for (i=IDELEMS(q)-1; i>=0; i--)
3650  {
3651  if (q->m[i]!=NULL)
3652  {
3653  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3654  p = redNFBound(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3655  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3656  {
3657  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3658  if (rField_is_Ring(currRing))
3659  {
3660  p = redtailBba_Z(p,max_ind,strat);
3661  }
3662  else
3663  {
3664  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3665  }
3666  }
3667  res->m[i]=p;
3668  }
3669  //else
3670  // res->m[i]=NULL;
3671  }
3672  /*- release temp data------------------------------- -*/
3673  assume(strat->L==NULL); /* strat->L unused */
3674  assume(strat->B==NULL); /* strat->B unused */
3675  omFree(strat->sevS);
3676  omFree(strat->ecartS);
3677  assume(strat->T==NULL);//omfree(strat->T);
3678  assume(strat->sevT==NULL);//omfree(strat->sevT);
3679  assume(strat->R==NULL);//omfree(strat->R);
3680  omfree(strat->S_2_R);
3681  omfree(strat->fromQ);
3682  idDelete(&strat->Shdl);
3683  SI_RESTORE_OPT1(save1);
3684  if (TEST_OPT_PROT) PrintLn();
3685  return res;
3686 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1104
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition: kstd2.cc:1816
unsigned long * sevT
Definition: kutil.h:311
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:57
poly res
Definition: myNF.cc:322
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1097
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:307
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
#define OPT_INTSTRATEGY
Definition: options.h:87
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:295
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:314
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ ksCreateShortSpoly()

poly ksCreateShortSpoly ( poly  p1,
poly  p2,
ring  tailRing 
)

Definition at line 1017 of file kspoly.cc.

1018 {
1019  poly a1 = pNext(p1), a2 = pNext(p2);
1020  long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
1021  long c;
1022  poly m1,m2;
1023  number t1 = NULL,t2 = NULL;
1024  int cm,i;
1025  BOOLEAN equal;
1026 
1027 #ifdef HAVE_RINGS
1028  BOOLEAN is_Ring=rField_is_Ring(currRing);
1029  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
1030  if (is_Ring)
1031  {
1032  ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
1033  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1034  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1035  while (a1 != NULL && nIsZero(t2))
1036  {
1037  pIter(a1);
1038  nDelete(&t2);
1039  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1040  }
1041  while (a2 != NULL && nIsZero(t1))
1042  {
1043  pIter(a2);
1044  nDelete(&t1);
1045  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1046  }
1047  }
1048 #endif
1049 
1050  if (a1==NULL)
1051  {
1052  if(a2!=NULL)
1053  {
1054  m2=p_Init(currRing);
1055 x2:
1056  for (i = (currRing->N); i; i--)
1057  {
1058  c = p_GetExpDiff(p1, p2,i, currRing);
1059  if (c>0)
1060  {
1061  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
1062  }
1063  else
1064  {
1065  p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
1066  }
1067  }
1068  if ((c1==c2)||(c2!=0))
1069  {
1071  }
1072  else
1073  {
1074  p_SetComp(m2,c1,currRing);
1075  }
1076  p_Setm(m2, currRing);
1077 #ifdef HAVE_RINGS
1078  if (is_Ring)
1079  {
1080  nDelete(&lc1);
1081  nDelete(&lc2);
1082  nDelete(&t2);
1083  pSetCoeff0(m2, t1);
1084  }
1085  else
1086 #endif
1087  nNew(&(pGetCoeff(m2)));
1088  return m2;
1089  }
1090  else
1091  {
1092 #ifdef HAVE_RINGS
1093  if (is_Ring)
1094  {
1095  nDelete(&lc1);
1096  nDelete(&lc2);
1097  nDelete(&t1);
1098  nDelete(&t2);
1099  }
1100 #endif
1101  return NULL;
1102  }
1103  }
1104  if (a2==NULL)
1105  {
1106  m1=p_Init(currRing);
1107 x1:
1108  for (i = (currRing->N); i; i--)
1109  {
1110  c = p_GetExpDiff(p2, p1,i,currRing);
1111  if (c>0)
1112  {
1113  p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
1114  }
1115  else
1116  {
1117  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1118  }
1119  }
1120  if ((c1==c2)||(c1!=0))
1121  {
1123  }
1124  else
1125  {
1126  p_SetComp(m1,c2,currRing);
1127  }
1128  p_Setm(m1, currRing);
1129 #ifdef HAVE_RINGS
1130  if (is_Ring)
1131  {
1132  pSetCoeff0(m1, t2);
1133  nDelete(&lc1);
1134  nDelete(&lc2);
1135  nDelete(&t1);
1136  }
1137  else
1138 #endif
1139  nNew(&(pGetCoeff(m1)));
1140  return m1;
1141  }
1142  m1 = p_Init(currRing);
1143  m2 = p_Init(currRing);
1144  loop
1145  {
1146  for (i = (currRing->N); i; i--)
1147  {
1148  c = p_GetExpDiff(p1, p2,i,currRing);
1149  if (c > 0)
1150  {
1151  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
1152  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1153  }
1154  else
1155  {
1156  p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
1157  p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
1158  }
1159  }
1160  if(c1==c2)
1161  {
1164  }
1165  else
1166  {
1167  if(c1!=0)
1168  {
1170  p_SetComp(m2,c1, currRing);
1171  }
1172  else
1173  {
1175  p_SetComp(m1,c2, currRing);
1176  }
1177  }
1178  p_Setm(m1,currRing);
1179  p_Setm(m2,currRing);
1180  cm = p_LmCmp(m1, m2,currRing);
1181  if (cm!=0)
1182  {
1183  if(cm==1)
1184  {
1185  p_LmFree(m2,currRing);
1186 #ifdef HAVE_RINGS
1187  if (is_Ring)
1188  {
1189  pSetCoeff0(m1, t2);
1190  nDelete(&lc1);
1191  nDelete(&lc2);
1192  nDelete(&t1);
1193  }
1194  else
1195 #endif
1196  nNew(&(pGetCoeff(m1)));
1197  return m1;
1198  }
1199  else
1200  {
1201  p_LmFree(m1,currRing);
1202 #ifdef HAVE_RINGS
1203  if (is_Ring)
1204  {
1205  pSetCoeff0(m2, t1);
1206  nDelete(&lc1);
1207  nDelete(&lc2);
1208  nDelete(&t2);
1209  }
1210  else
1211 #endif
1212  nNew(&(pGetCoeff(m2)));
1213  return m2;
1214  }
1215  }
1216 #ifdef HAVE_RINGS
1217  if (is_Ring)
1218  {
1219  equal = nEqual(t1,t2);
1220  }
1221  else
1222 #endif
1223  {
1224  t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
1225  t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
1226  equal = nEqual(t1,t2);
1227  nDelete(&t2);
1228  nDelete(&t1);
1229  }
1230  if (!equal)
1231  {
1232  p_LmFree(m2,currRing);
1233 #ifdef HAVE_RINGS
1234  if (is_Ring)
1235  {
1236  pSetCoeff0(m1, nSub(t1, t2));
1237  nDelete(&lc1);
1238  nDelete(&lc2);
1239  nDelete(&t1);
1240  nDelete(&t2);
1241  }
1242  else
1243 #endif
1244  nNew(&(pGetCoeff(m1)));
1245  return m1;
1246  }
1247  pIter(a1);
1248  pIter(a2);
1249 #ifdef HAVE_RINGS
1250  if (is_Ring)
1251  {
1252  if (a2 != NULL)
1253  {
1254  nDelete(&t1);
1255  t1 = nMult(pGetCoeff(a2),lc1);
1256  }
1257  if (a1 != NULL)
1258  {
1259  nDelete(&t2);
1260  t2 = nMult(pGetCoeff(a1),lc2);
1261  }
1262  while ((a1 != NULL) && nIsZero(t2))
1263  {
1264  pIter(a1);
1265  if (a1 != NULL)
1266  {
1267  nDelete(&t2);
1268  t2 = nMult(pGetCoeff(a1),lc2);
1269  }
1270  }
1271  while ((a2 != NULL) && nIsZero(t1))
1272  {
1273  pIter(a2);
1274  if (a2 != NULL)
1275  {
1276  nDelete(&t1);
1277  t1 = nMult(pGetCoeff(a2),lc1);
1278  }
1279  }
1280  }
1281 #endif
1282  if (a2==NULL)
1283  {
1284  p_LmFree(m2,currRing);
1285  if (a1==NULL)
1286  {
1287 #ifdef HAVE_RINGS
1288  if (is_Ring)
1289  {
1290  nDelete(&lc1);
1291  nDelete(&lc2);
1292  nDelete(&t1);
1293  nDelete(&t2);
1294  }
1295 #endif
1296  p_LmFree(m1,currRing);
1297  return NULL;
1298  }
1299  goto x1;
1300  }
1301  if (a1==NULL)
1302  {
1303  p_LmFree(m1,currRing);
1304  goto x2;
1305  }
1306  }
1307 }
loop
Definition: myNF.cc:98
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
int ksCheckCoeff(number *a, number *b)
#define nEqual(n1, n2)
Definition: numbers.h:20
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
#define pIter(p)
Definition: monomials.h:44
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:630
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
bool equal
Definition: cfModGcd.cc:4067
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
#define nMult(n1, n2)
Definition: numbers.h:17
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
#define nSub(n1, n2)
Definition: numbers.h:22
int i
Definition: cfEzgcd.cc:123
#define nDelete(n)
Definition: numbers.h:16
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void nNew(number *a)
Definition: numbers.cc:49
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ ksCreateSpoly()

void ksCreateSpoly ( LObject Pair,
poly  spNoether = NULL,
int  use_buckets = 0,
ring  tailRing = currRing,
poly  m1 = NULL,
poly  m2 = NULL,
TObject **  R = NULL 
)

Definition at line 774 of file kspoly.cc.

777 {
778 #ifdef KDEBUG
779  create_count++;
780 #endif
781  kTest_L(Pair);
782  poly p1 = Pair->p1;
783  poly p2 = Pair->p2;
784  Pair->tailRing = tailRing;
785 
786  assume(p1 != NULL);
787  assume(p2 != NULL);
788  assume(tailRing != NULL);
789 
790  poly a1 = pNext(p1), a2 = pNext(p2);
791  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
792  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
793  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
794 
795  int l1=0, l2=0;
796 
797  if (p_GetComp(p1, currRing)!=p_GetComp(p2, currRing))
798  {
799  if (p_GetComp(p1, currRing)==0)
800  {
801  co=1;
803  }
804  else
805  {
806  co=2;
808  }
809  }
810 
811  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
812  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
813  if (m1 == NULL)
814  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
815 
816  pSetCoeff0(m1, lc2);
817  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
818 
819  if (R != NULL)
820  {
821  if (Pair->i_r1 == -1)
822  {
823  l1 = pLength(p1) - 1;
824  }
825  else
826  {
827  l1 = (R[Pair->i_r1])->GetpLength() - 1;
828  }
829  if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
830  {
831  l2 = pLength(p2) - 1;
832  }
833  else
834  {
835  l2 = (R[Pair->i_r2])->GetpLength() - 1;
836  }
837  }
838 
839  // get m2 * a2
840  if (spNoether != NULL)
841  {
842  l2 = -1;
843  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
844  assume(l2 == pLength(a2));
845  }
846  else
847  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
848 #ifdef HAVE_RINGS
849  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
850 #endif
851 
852  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
853 
854  // get m2*a2 - m1*a1
855  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
856 
857  // Clean-up time
858  Pair->LmDeleteAndIter();
859  p_LmDelete(m1, tailRing);
860 
861  if (co != 0)
862  {
863  if (co==1)
864  {
865  p_SetCompP(p1,0, currRing, tailRing);
866  }
867  else
868  {
869  p_SetCompP(p2,0, currRing, tailRing);
870  }
871  }
872 
873  // the following is commented out: shrinking
874 #ifdef HAVE_SHIFTBBA_NONEXISTENT
875  if (currRing->isLPring)
876  {
877  // assume? h->p in currRing
878  Pair->GetP();
879  poly qq = p_Shrink(Pair->p, currRing->isLPring, currRing);
880  Pair->Clear(); // does the right things
881  Pair->p = qq;
882  Pair->t_p = NULL;
883  Pair->SetShortExpVector();
884  }
885 #endif
886 
887 }
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:935
#define p_GetComp(p, r)
Definition: monomials.h:72
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
int ksCheckCoeff(number *a, number *b)
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
#define assume(x)
Definition: mod2.h:394
const ring R
Definition: DebugPrint.cc:36
#define kTest_L(T)
Definition: kutil.h:644
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define NULL
Definition: omList.c:10
int create_count
Definition: kspoly.cc:29
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
polyrec * poly
Definition: hilb.h:10

◆ ksOldCreateSpoly()

KINLINE poly ksOldCreateSpoly ( poly  p1,
poly  p2,
poly  spNoether = NULL,
ring  r = currRing 
)

Definition at line 1073 of file kInline.h.

1074 {
1075  LObject L(r);
1076  L.p1 = p1;
1077  L.p2 = p2;
1078 
1079  ksCreateSpoly(&L, spNoether);
1080  return L.GetLmCurrRing();
1081 }
class sLObject LObject
Definition: kutil.h:52
const ring r
Definition: syzextra.cc:208
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ ksOldSpolyRed()

KINLINE poly ksOldSpolyRed ( poly  p1,
poly  p2,
poly  spNoether = NULL 
)

Definition at line 1053 of file kInline.h.

1054 {
1055  LObject L(p2);
1056  TObject T(p1);
1057 
1058  ksReducePoly(&L, &T, spNoether);
1059 
1060  return L.GetLmCurrRing();
1061 }
class sLObject LObject
Definition: kutil.h:52
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:51

◆ ksOldSpolyRedNew()

KINLINE poly ksOldSpolyRedNew ( poly  p1,
poly  p2,
poly  spNoether = NULL 
)

Definition at line 1063 of file kInline.h.

1064 {
1065  LObject L(p_Copy(p2, currRing));
1066  TObject T(p1);
1067 
1068  ksReducePoly(&L, &T, spNoether);
1069 
1070  return L.GetLmCurrRing();
1071 }
class sLObject LObject
Definition: kutil.h:52
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:51

◆ ksOldSpolyTail()

KINLINE void ksOldSpolyTail ( poly  p1,
poly  q,
poly  q2,
poly  spNoether,
ring  r = currRing 
)

Definition at line 1083 of file kInline.h.

1084 {
1085  LObject L(q, currRing, r);
1086  TObject T(p1, currRing, r);
1087 
1088  ksReducePolyTail(&L, &T, q2, spNoether);
1089 }
class sLObject LObject
Definition: kutil.h:52
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:51

◆ ksReducePoly()

int ksReducePoly ( LObject PR,
TObject PW,
poly  spNoether = NULL,
number *  coef = NULL,
kStrategy  strat = NULL 
)

Definition at line 45 of file kspoly.cc.

50 {
51 #ifdef KDEBUG
52  red_count++;
53 #ifdef TEST_OPT_DEBUG_RED
54 // if (TEST_OPT_DEBUG)
55 // {
56 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
57 // PW->wrp();
58 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
59 // //pWrite(PR->p);
60 // }
61 #endif
62 #endif
63  int ret = 0;
64  ring tailRing = PR->tailRing;
65  kTest_L(PR);
66  kTest_T(PW);
67 
68  poly p1 = PR->GetLmTailRing(); // p2 | p1
69  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
70  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
71  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
72  p_CheckPolyRing(p1, tailRing);
73  p_CheckPolyRing(p2, tailRing);
74 
75  pAssume1(p2 != NULL && p1 != NULL &&
76  p_DivisibleBy(p2, p1, tailRing));
77 
78  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
79  (p_GetComp(p2, tailRing) == 0 &&
80  p_MaxComp(pNext(p2),tailRing) == 0));
81 
82 #ifdef HAVE_PLURAL
84  {
85  // for the time being: we know currRing==strat->tailRing
86  // no exp-bound checking needed
87  // (only needed if exp-bound(tailring)<exp-b(currRing))
88  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
89  else
90  {
91  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
92  assume(_p != NULL);
93  nc_PolyPolyRed(_p, p2,coef, currRing);
94  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
95  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
96  }
97  return 0;
98  }
99 #endif
100 
101  if (t2==NULL) // Divisor is just one term, therefore it will
102  { // just cancel the leading term
103  PR->LmDeleteAndIter();
104  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
105  return 0;
106  }
107 
108  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
109 
110  //if (tailRing != currRing)
111  {
112  // check that reduction does not violate exp bound
113  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
114  {
115  // undo changes of lm
116  p_ExpVectorAdd(lm, p2, tailRing);
117  if (strat == NULL) return 2;
118  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
119  tailRing = strat->tailRing;
120  p1 = PR->GetLmTailRing();
121  p2 = PW->GetLmTailRing();
122  t2 = pNext(p2);
123  lm = p1;
124  p_ExpVectorSub(lm, p2, tailRing);
125  ret = 1;
126  }
127  }
128 
129  // take care of coef buisness
130  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
131  {
132  number bn = pGetCoeff(lm);
133  number an = pGetCoeff(p2);
134  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
135  p_SetCoeff(lm, bn, tailRing);
136  if ((ct == 0) || (ct == 2))
137  PR->Tail_Mult_nn(an);
138  if (coef != NULL) *coef = an;
139  else n_Delete(&an, tailRing->cf);
140  }
141  else
142  {
143  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
144  }
145 
146 
147  // and finally,
148  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
149  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
150  PR->LmDeleteAndIter();
151 
152  // the following is commented out: shrinking
153 #ifdef HAVE_SHIFTBBA_NONEXISTENT
154  if ( (currRing->isLPring) && (!strat->homog) )
155  {
156  // assume? h->p in currRing
157  PR->GetP();
158  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
159  PR->Clear(); // does the right things
160  PR->p = qq;
161  PR->t_p = NULL;
162  PR->SetShortExpVector();
163  }
164 #endif
165 
166 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
167  if (TEST_OPT_DEBUG)
168  {
169  Print(" to: "); PR->wrp(); Print("\n");
170  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
171  }
172 #endif
173  return ret;
174 }
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
#define Print
Definition: emacs.cc:83
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2241
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
int ksCheckCoeff(number *a, number *b)
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define kTest_L(T)
Definition: kutil.h:644
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
int red_count
Definition: kspoly.cc:28
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1363
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:642
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287

◆ ksReducePolyBound()

int ksReducePolyBound ( LObject PR,
TObject PW,
int  bound,
poly  spNoether = NULL,
number *  coef = NULL,
kStrategy  strat = NULL 
)

Definition at line 176 of file kspoly.cc.

182 {
183 #ifdef KDEBUG
184  red_count++;
185 #ifdef TEST_OPT_DEBUG_RED
186  if (TEST_OPT_DEBUG)
187  {
188  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
189  PW->wrp();
190  //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
191  //pWrite(PR->p);
192  }
193 #endif
194 #endif
195  int ret = 0;
196  ring tailRing = PR->tailRing;
197  kTest_L(PR);
198  kTest_T(PW);
199 
200  poly p1 = PR->GetLmTailRing(); // p2 | p1
201  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
202  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
203  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
204  p_CheckPolyRing(p1, tailRing);
205  p_CheckPolyRing(p2, tailRing);
206 
207  pAssume1(p2 != NULL && p1 != NULL &&
208  p_DivisibleBy(p2, p1, tailRing));
209 
210  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
211  (p_GetComp(p2, tailRing) == 0 &&
212  p_MaxComp(pNext(p2),tailRing) == 0));
213 
214 #ifdef HAVE_PLURAL
215  if (rIsPluralRing(currRing))
216  {
217  // for the time being: we know currRing==strat->tailRing
218  // no exp-bound checking needed
219  // (only needed if exp-bound(tailring)<exp-b(currRing))
220  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
221  else
222  {
223  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
224  assume(_p != NULL);
225  nc_PolyPolyRed(_p, p2,coef, currRing);
226  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
227  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
228  }
229  return 0;
230  }
231 #endif
232 
233  if (t2==NULL) // Divisor is just one term, therefore it will
234  { // just cancel the leading term
235  PR->LmDeleteAndIter();
236  if (coef != NULL) *coef = n_Init(1, tailRing);
237  return 0;
238  }
239 
240  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
241 
242  if (tailRing != currRing)
243  {
244  // check that reduction does not violate exp bound
245  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
246  {
247  // undo changes of lm
248  p_ExpVectorAdd(lm, p2, tailRing);
249  if (strat == NULL) return 2;
250  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
251  tailRing = strat->tailRing;
252  p1 = PR->GetLmTailRing();
253  p2 = PW->GetLmTailRing();
254  t2 = pNext(p2);
255  lm = p1;
256  p_ExpVectorSub(lm, p2, tailRing);
257  ret = 1;
258  }
259  }
260 
261  // take care of coef buisness
262  if (! n_IsOne(pGetCoeff(p2), tailRing))
263  {
264  number bn = pGetCoeff(lm);
265  number an = pGetCoeff(p2);
266  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
267  p_SetCoeff(lm, bn, tailRing);
268  if ((ct == 0) || (ct == 2))
269  PR->Tail_Mult_nn(an);
270  if (coef != NULL) *coef = an;
271  else n_Delete(&an, tailRing);
272  }
273  else
274  {
275  if (coef != NULL) *coef = n_Init(1, tailRing);
276  }
277 
278 
279  // and finally,
280  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
281  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
282  PR->LmDeleteAndIter();
283 
284  // the following is commented out: shrinking
285 #ifdef HAVE_SHIFTBBA_NONEXISTENT
286  if ( (currRing->isLPring) && (!strat->homog) )
287  {
288  // assume? h->p in currRing
289  PR->GetP();
290  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
291  PR->Clear(); // does the right things
292  PR->p = qq;
293  PR->t_p = NULL;
294  PR->SetShortExpVector();
295  }
296 #endif
297 
298 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
299  if (TEST_OPT_DEBUG)
300  {
301  Print(" to: "); PR->wrp(); Print("\n");
302  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
303  }
304 #endif
305  return ret;
306 }
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
#define Print
Definition: emacs.cc:83
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2241
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
int ksCheckCoeff(number *a, number *b)
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define kTest_L(T)
Definition: kutil.h:644
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
int red_count
Definition: kspoly.cc:28
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1363
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:642
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287

◆ ksReducePolySig()

int ksReducePolySig ( LObject PR,
TObject PW,
long  idx,
poly  spNoether = NULL,
number *  coef = NULL,
kStrategy  strat = NULL 
)

Definition at line 315 of file kspoly.cc.

321 {
322 #ifdef KDEBUG
323  red_count++;
324 #ifdef TEST_OPT_DEBUG_RED
325  if (TEST_OPT_DEBUG)
326  {
327  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
328  PW->wrp();
329  }
330 #endif
331 #endif
332  int ret = 0;
333  ring tailRing = PR->tailRing;
334  kTest_L(PR);
335  kTest_T(PW);
336 
337  // signature-based stuff:
338  // checking for sig-safeness first
339  // NOTE: This has to be done in the current ring
340  //
341  /**********************************************
342  *
343  * TODO:
344  * --------------------------------------------
345  * if strat->sbaOrder == 1
346  * Since we are subdividing lower index and
347  * current index reductions it is enough to
348  * look at the polynomial part of the signature
349  * for a check. This should speed-up checking
350  * a lot!
351  * if !strat->sbaOrder == 0
352  * We are not subdividing lower and current index
353  * due to the fact that we are using the induced
354  * Schreyer order
355  *
356  * nevertheless, this different behaviour is
357  * taken care of by is_sigsafe
358  * => one reduction procedure can be used for
359  * both, the incremental and the non-incremental
360  * attempt!
361  * --------------------------------------------
362  *
363  *********************************************/
364  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
365  if (!PW->is_sigsafe)
366  {
367  poly sigMult = pCopy(PW->sig); // copy signature of reducer
368 //#if 1
369 #ifdef DEBUGF5
370  printf("IN KSREDUCEPOLYSIG: \n");
371  pWrite(pHead(f1));
372  pWrite(pHead(f2));
373  pWrite(sigMult);
374  printf("--------------\n");
375 #endif
376  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
377 //#if 1
378 #ifdef DEBUGF5
379  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
380  pWrite(pHead(f1));
381  pWrite(pHead(f2));
382  pWrite(sigMult);
383  pWrite(PR->sig);
384  printf("--------------\n");
385 #endif
386  int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
387  // now we can delete the copied polynomial data used for checking for
388  // sig-safeness of the reduction step
389 //#if 1
390 #ifdef DEBUGF5
391  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
392 
393 #endif
394  //pDelete(&f1);
395  pDelete(&sigMult);
396  // go on with the computations only if the signature of p2 is greater than the
397  // signature of fm*p1
398  if(sigSafe != 1)
399  {
400  PR->is_redundant = TRUE;
401  return 3;
402  }
403  //PW->is_sigsafe = TRUE;
404  }
405  PR->is_redundant = FALSE;
406  poly p1 = PR->GetLmTailRing(); // p2 | p1
407  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
408  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
409  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
410  p_CheckPolyRing(p1, tailRing);
411  p_CheckPolyRing(p2, tailRing);
412 
413  pAssume1(p2 != NULL && p1 != NULL &&
414  p_DivisibleBy(p2, p1, tailRing));
415 
416  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
417  (p_GetComp(p2, tailRing) == 0 &&
418  p_MaxComp(pNext(p2),tailRing) == 0));
419 
420 #ifdef HAVE_PLURAL
421  if (rIsPluralRing(currRing))
422  {
423  // for the time being: we know currRing==strat->tailRing
424  // no exp-bound checking needed
425  // (only needed if exp-bound(tailring)<exp-b(currRing))
426  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
427  else
428  {
429  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
430  assume(_p != NULL);
431  nc_PolyPolyRed(_p, p2, coef, currRing);
432  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
433  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
434  }
435  return 0;
436  }
437 #endif
438 
439  if (t2==NULL) // Divisor is just one term, therefore it will
440  { // just cancel the leading term
441  PR->LmDeleteAndIter();
442  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
443  return 0;
444  }
445 
446  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
447 
448  if (tailRing != currRing)
449  {
450  // check that reduction does not violate exp bound
451  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
452  {
453  // undo changes of lm
454  p_ExpVectorAdd(lm, p2, tailRing);
455  if (strat == NULL) return 2;
456  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
457  tailRing = strat->tailRing;
458  p1 = PR->GetLmTailRing();
459  p2 = PW->GetLmTailRing();
460  t2 = pNext(p2);
461  lm = p1;
462  p_ExpVectorSub(lm, p2, tailRing);
463  ret = 1;
464  }
465  }
466 
467  // take care of coef buisness
468  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
469  {
470  number bn = pGetCoeff(lm);
471  number an = pGetCoeff(p2);
472  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
473  p_SetCoeff(lm, bn, tailRing);
474  if ((ct == 0) || (ct == 2))
475  PR->Tail_Mult_nn(an);
476  if (coef != NULL) *coef = an;
477  else n_Delete(&an, tailRing->cf);
478  }
479  else
480  {
481  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
482  }
483 
484 
485  // and finally,
486  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
487  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
488  PR->LmDeleteAndIter();
489 
490  // the following is commented out: shrinking
491 #ifdef HAVE_SHIFTBBA_NONEXISTENT
492  if ( (currRing->isLPring) && (!strat->homog) )
493  {
494  // assume? h->p in currRing
495  PR->GetP();
496  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
497  PR->Clear(); // does the right things
498  PR->p = qq;
499  PR->t_p = NULL;
500  PR->SetShortExpVector();
501  }
502 #endif
503 
504 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
505  if (TEST_OPT_DEBUG)
506  {
507  Print(" to: "); PR->wrp(); Print("\n");
508  }
509 #endif
510  return ret;
511 }
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
#define Print
Definition: emacs.cc:83
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2241
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
int ksCheckCoeff(number *a, number *b)
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define kTest_L(T)
Definition: kutil.h:644
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
int red_count
Definition: kspoly.cc:28
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1363
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:642
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1379
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ ksReducePolySigRing()

int ksReducePolySigRing ( LObject PR,
TObject PW,
long  idx,
poly  spNoether = NULL,
number *  coef = NULL,
kStrategy  strat = NULL 
)

Definition at line 513 of file kspoly.cc.

519 {
520 #ifdef ADIDEBUG
521 printf("\nksReducePolySig\n");
522 pWrite(PR->p);pWrite(PR->sig);
523 pWrite(PW->p);pWrite(PW->sig);
524 #endif
525 #ifdef KDEBUG
526  red_count++;
527 #ifdef TEST_OPT_DEBUG_RED
528  if (TEST_OPT_DEBUG)
529  {
530  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
531  PW->wrp();
532  }
533 #endif
534 #endif
535  int ret = 0;
536  ring tailRing = PR->tailRing;
537  kTest_L(PR);
538  kTest_T(PW);
539 
540  // signature-based stuff:
541  // checking for sig-safeness first
542  // NOTE: This has to be done in the current ring
543  //
544  /**********************************************
545  *
546  * TODO:
547  * --------------------------------------------
548  * if strat->sbaOrder == 1
549  * Since we are subdividing lower index and
550  * current index reductions it is enough to
551  * look at the polynomial part of the signature
552  * for a check. This should speed-up checking
553  * a lot!
554  * if !strat->sbaOrder == 0
555  * We are not subdividing lower and current index
556  * due to the fact that we are using the induced
557  * Schreyer order
558  *
559  * nevertheless, this different behaviour is
560  * taken care of by is_sigsafe
561  * => one reduction procedure can be used for
562  * both, the incremental and the non-incremental
563  * attempt!
564  * --------------------------------------------
565  *
566  *********************************************/
567  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
568  if (!PW->is_sigsafe)
569  {
570  poly sigMult = pCopy(PW->sig); // copy signature of reducer
571 //#if 1
572 #ifdef DEBUGF5
573  printf("IN KSREDUCEPOLYSIG: \n");
574  pWrite(pHead(f1));
575  pWrite(pHead(f2));
576  pWrite(sigMult);
577  printf("--------------\n");
578 #endif
579  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
580  //I have also to set the leading coeficient for sigMult (in the case of rings)
582  {
583  pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
584  if(nIsZero(pGetCoeff(sigMult)))
585  {
586  sigMult = NULL;
587  }
588  }
589 //#if 1
590 #ifdef DEBUGF5
591  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
592  pWrite(pHead(f1));
593  pWrite(pHead(f2));
594  pWrite(sigMult);
595  pWrite(PR->sig);
596  printf("--------------\n");
597 #endif
598  int sigSafe;
600  sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
601  // now we can delete the copied polynomial data used for checking for
602  // sig-safeness of the reduction step
603 //#if 1
604 #ifdef DEBUGF5
605  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
606 
607 #endif
609  {
610  // Set the sig
611  poly origsig = pCopy(PR->sig);
612  if(sigMult != NULL)
613  PR->sig = pHead(pSub(PR->sig, sigMult));
614  //The sigs have the same lm, have to substract
615  //It may happen that now the signature is 0 (drop)
616  if(PR->sig == NULL)
617  {
618  #ifdef ADIDEBUG
619  printf("\nPossible sigdrop in ksreducepolysig (lost signature)\n");
620  #endif
621  strat->sigdrop=TRUE;
622  }
623  else
624  {
625  if(pLtCmp(PR->sig,origsig) == 1)
626  {
627  // do not allow this reduction - it will increase it's signature
628  // and the partially standard basis is just till the old sig, not the new one
629  PR->is_redundant = TRUE;
630  pDelete(&PR->sig);
631  PR->sig = origsig;
632  strat->blockred++;
633  return 3;
634  }
635  if(pLtCmp(PR->sig,origsig) == -1)
636  {
637  #ifdef ADIDEBUG
638  printf("\nSigdrop in ksreducepolysig from * to *\n");pWrite(origsig);pWrite(PR->sig);
639  #endif
640  strat->sigdrop=TRUE;
641  }
642  }
643  pDelete(&origsig);
644  }
645  //pDelete(&f1);
646  // go on with the computations only if the signature of p2 is greater than the
647  // signature of fm*p1
648  if(sigSafe != 1 && !rField_is_Ring(currRing))
649  {
650  PR->is_redundant = TRUE;
651  return 3;
652  }
653  //PW->is_sigsafe = TRUE;
654  }
655  PR->is_redundant = FALSE;
656  poly p1 = PR->GetLmTailRing(); // p2 | p1
657  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
658  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
659  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
660  p_CheckPolyRing(p1, tailRing);
661  p_CheckPolyRing(p2, tailRing);
662 
663  pAssume1(p2 != NULL && p1 != NULL &&
664  p_DivisibleBy(p2, p1, tailRing));
665 
666  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
667  (p_GetComp(p2, tailRing) == 0 &&
668  p_MaxComp(pNext(p2),tailRing) == 0));
669 
670 #ifdef HAVE_PLURAL
671  if (rIsPluralRing(currRing))
672  {
673  // for the time being: we know currRing==strat->tailRing
674  // no exp-bound checking needed
675  // (only needed if exp-bound(tailring)<exp-b(currRing))
676  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
677  else
678  {
679  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
680  assume(_p != NULL);
681  nc_PolyPolyRed(_p, p2, coef, currRing);
682  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
683  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
684  }
685  return 0;
686  }
687 #endif
688 
689  if (t2==NULL) // Divisor is just one term, therefore it will
690  { // just cancel the leading term
691  PR->LmDeleteAndIter();
692  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
693  return 0;
694  }
695 
696  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
697 
698  if (tailRing != currRing)
699  {
700  // check that reduction does not violate exp bound
701  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
702  {
703  // undo changes of lm
704  p_ExpVectorAdd(lm, p2, tailRing);
705  if (strat == NULL) return 2;
706  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
707  tailRing = strat->tailRing;
708  p1 = PR->GetLmTailRing();
709  p2 = PW->GetLmTailRing();
710  t2 = pNext(p2);
711  lm = p1;
712  p_ExpVectorSub(lm, p2, tailRing);
713  ret = 1;
714  }
715  }
716  // take care of coef buisness
718  {
719  p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
720  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
721  }
722  else
723  {
724  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
725  {
726  number bn = pGetCoeff(lm);
727  number an = pGetCoeff(p2);
728  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
729  p_SetCoeff(lm, bn, tailRing);
730  if (((ct == 0) || (ct == 2)))
731  PR->Tail_Mult_nn(an);
732  if (coef != NULL) *coef = an;
733  else n_Delete(&an, tailRing->cf);
734  }
735  else
736  {
737  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
738  }
739  }
740 
741  // and finally,
742  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
743  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
744  PR->LmDeleteAndIter();
745 
746  // the following is commented out: shrinking
747 #ifdef HAVE_SHIFTBBA_NONEXISTENT
748  if ( (currRing->isLPring) && (!strat->homog) )
749  {
750  // assume? h->p in currRing
751  PR->GetP();
752  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
753  PR->Clear(); // does the right things
754  PR->p = qq;
755  PR->t_p = NULL;
756  PR->SetShortExpVector();
757  }
758 #endif
759 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
760  if (TEST_OPT_DEBUG)
761  {
762  Print(" to: "); PR->wrp(); Print("\n");
763  }
764 #endif
765  return ret;
766 }
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
#define Print
Definition: emacs.cc:83
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2241
bool sigdrop
Definition: kutil.h:348
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
int ksCheckCoeff(number *a, number *b)
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define pSub(a, b)
Definition: polys.h:269
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define nMult(n1, n2)
Definition: numbers.h:17
#define kTest_L(T)
Definition: kutil.h:644
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
int red_count
Definition: kspoly.cc:28
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1363
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDiv(a, b)
Definition: numbers.h:32
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
int blockred
Definition: kutil.h:353
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:642
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1379
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ ksReducePolyTail() [1/2]

int ksReducePolyTail ( LObject PR,
TObject PW,
poly  Current,
poly  spNoether = NULL 
)

Definition at line 889 of file kspoly.cc.

890 {
891  BOOLEAN ret;
892  number coef;
893  poly Lp = PR->GetLmCurrRing();
894  poly Save = PW->GetLmCurrRing();
895 
896  kTest_L(PR);
897  kTest_T(PW);
898  pAssume(pIsMonomOf(Lp, Current));
899 
900  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
901  assume(PR->bucket == NULL);
902 
903  LObject Red(pNext(Current), PR->tailRing);
904  TObject With(PW, Lp == Save);
905 
906  pAssume(!pHaveCommonMonoms(Red.p, With.p));
907  ret = ksReducePoly(&Red, &With, spNoether, &coef);
908 
909  if (!ret)
910  {
911  if (! n_IsOne(coef, currRing->cf))
912  {
913  pNext(Current) = NULL;
914  if (Current == PR->p && PR->t_p != NULL)
915  pNext(PR->t_p) = NULL;
916  PR->Mult_nn(coef);
917  }
918 
919  n_Delete(&coef, currRing->cf);
920  pNext(Current) = Red.GetLmTailRing();
921  if (Current == PR->p && PR->t_p != NULL)
922  pNext(PR->t_p) = pNext(Current);
923  }
924 
925  if (Lp == Save)
926  With.Delete();
927 
928  // the following is commented out: shrinking
929 #ifdef HAVE_SHIFTBBA_NONEXISTENT
930  if (currRing->isLPring)
931  {
932  // assume? h->p in currRing
933  PR->GetP();
934  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
935  PR->Clear(); // does the right things
936  PR->p = qq;
937  PR->t_p = NULL;
938  PR->SetShortExpVector();
939  }
940 #endif
941 
942  return ret;
943 }
class sLObject LObject
Definition: kutil.h:52
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define pAssume(cond)
Definition: monomials.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
BOOLEAN pHaveCommonMonoms(poly p, poly q)
Definition: pDebug.cc:174
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:164
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#define kTest_L(T)
Definition: kutil.h:644
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:642
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
class sTObject TObject
Definition: kutil.h:51

◆ ksReducePolyTail() [2/2]

KINLINE int ksReducePolyTail ( LObject PR,
TObject PW,
LObject Red 
)

Definition at line 1026 of file kInline.h.

1027 {
1028  BOOLEAN ret;
1029  number coef;
1030 
1031  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1032  Red->HeadNormalize();
1033  ret = ksReducePoly(Red, PW, NULL, &coef);
1034 
1035  if (!ret)
1036  {
1037  if (! n_IsOne(coef, currRing->cf))
1038  {
1039  PR->Mult_nn(coef);
1040  // HANNES: mark for Normalize
1041  }
1042  n_Delete(&coef, currRing->cf);
1043  }
1044  return ret;
1045 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
int BOOLEAN
Definition: auxiliary.h:85

◆ kStratChangeTailRing()

BOOLEAN kStratChangeTailRing ( kStrategy  strat,
LObject L = NULL,
TObject T = NULL,
unsigned long  new_expbound = 0 
)

Definition at line 11254 of file kutil.cc.

11255 {
11256  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11257  /* initial setup or extending */
11258 
11259  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11260  if (expbound >= currRing->bitmask) return FALSE;
11261  strat->overflow=FALSE;
11262  ring new_tailRing = rModifyRing(currRing,
11263  // Hmmm .. the condition pFDeg == p_Deg
11264  // might be too strong
11265  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11266  (strat->ak==0), // omit_comp if the input is an ideal
11267  expbound); // exp_limit
11268 
11269  if (new_tailRing == currRing) return TRUE;
11270 
11271  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11272  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11273 
11274  if (currRing->pFDeg != currRing->pFDegOrig)
11275  {
11276  new_tailRing->pFDeg = currRing->pFDeg;
11277  new_tailRing->pLDeg = currRing->pLDeg;
11278  }
11279 
11280  if (TEST_OPT_PROT)
11281  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11282  kTest_TS(strat);
11283  assume(new_tailRing != strat->tailRing);
11284  pShallowCopyDeleteProc p_shallow_copy_delete
11285  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11286 
11287  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11288 
11289  int i;
11290  for (i=0; i<=strat->tl; i++)
11291  {
11292  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11293  p_shallow_copy_delete);
11294  }
11295  for (i=0; i<=strat->Ll; i++)
11296  {
11297  assume(strat->L[i].p != NULL);
11298  if (pNext(strat->L[i].p) != strat->tail)
11299  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11300  }
11301  if ((strat->P.t_p != NULL) ||
11302  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11303  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11304 
11305  if ((L != NULL) && (L->tailRing != new_tailRing))
11306  {
11307  if (L->i_r < 0)
11308  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11309  else
11310  {
11311  assume(L->i_r <= strat->tl);
11312  TObject* t_l = strat->R[L->i_r];
11313  assume(t_l != NULL);
11314  L->tailRing = new_tailRing;
11315  L->p = t_l->p;
11316  L->t_p = t_l->t_p;
11317  L->max_exp = t_l->max_exp;
11318  }
11319  }
11320 
11321  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11322  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11323 
11324  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11325  if (strat->tailRing != currRing)
11326  rKillModifiedRing(strat->tailRing);
11327 
11328  strat->tailRing = new_tailRing;
11329  strat->tailBin = new_tailBin;
11330  strat->p_shallow_copy_delete
11331  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11332 
11333  if (strat->kHEdge != NULL)
11334  {
11335  if (strat->t_kHEdge != NULL)
11336  p_LmFree(strat->t_kHEdge, strat->tailRing);
11337  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11338  }
11339 
11340  if (strat->kNoether != NULL)
11341  {
11342  if (strat->t_kNoether != NULL)
11343  p_LmFree(strat->t_kNoether, strat->tailRing);
11345  new_tailRing);
11346  }
11347  kTest_TS(strat);
11348  if (TEST_OPT_PROT)
11349  PrintS("]");
11350  return TRUE;
11351 }
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
Definition: omBin.c:396
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:315
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:285
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:316
int tl
Definition: kutil.h:338
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2606
#define TRUE
Definition: auxiliary.h:98
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:326
int ak
Definition: kutil.h:341
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
BOOLEAN homog
Definition: kutil.h:361
#define kTest_TS(A)
Definition: kutil.h:641
#define assume(x)
Definition: mod2.h:394
LObject P
Definition: kutil.h:288
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:317
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
poly t_kNoether
Definition: kutil.h:319
omBin tailBin
Definition: kutil.h:333
char overflow
Definition: kutil.h:393
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2972
TSet T
Definition: kutil.h:312
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:284
class sTObject TObject
Definition: kutil.h:51

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11353 of file kutil.cc.

11354 {
11355  unsigned long l = 0;
11356  int i;
11357  long e;
11358 
11359  assume(strat->tailRing == currRing);
11360 
11361  for (i=0; i<= strat->Ll; i++)
11362  {
11363  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11364  }
11365  for (i=0; i<=strat->tl; i++)
11366  {
11367  // Hmm ... this we could do in one Step
11368  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11369  }
11370  if (rField_is_Ring(currRing))
11371  {
11372  l *= 2;
11373  }
11374  e = p_GetMaxExp(l, currRing);
11375  if (e <= 1) e = 2;
11376 
11377  kStratChangeTailRing(strat, NULL, NULL, e);
11378 }
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:1176
int Ll
Definition: kutil.h:339
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:338
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
TSet T
Definition: kutil.h:312
int l
Definition: cfEzgcd.cc:94

◆ message()

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

Definition at line 7915 of file kutil.cc.

7916 {
7917  if (i != *olddeg)
7918  {
7919  Print("%d",i);
7920  *olddeg = i;
7921  }
7922  if (TEST_OPT_OLDSTD)
7923  {
7924  if (strat->Ll != *reduc)
7925  {
7926  if (strat->Ll != *reduc-1)
7927  Print("(%d)",strat->Ll+1);
7928  else
7929  PrintS("-");
7930  *reduc = strat->Ll;
7931  }
7932  else
7933  PrintS(".");
7934  mflush();
7935  }
7936  else
7937  {
7938  if (red_result == 0)
7939  PrintS("-");
7940  else if (red_result < 0)
7941  PrintS(".");
7942  if ((red_result > 0) || ((strat->Ll % 100)==99))
7943  {
7944  if (strat->Ll != *reduc && strat->Ll > 0)
7945  {
7946  Print("(%d)",strat->Ll+1);
7947  *reduc = strat->Ll;
7948  }
7949  }
7950  }
7951 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:339
#define mflush()
Definition: reporter.h:57
#define TEST_OPT_OLDSTD
Definition: options.h:117
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284

◆ messageStat()

void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7956 of file kutil.cc.

7957 {
7958  //PrintS("\nUsage/Allocation of temporary storage:\n");
7959  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7960  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7961  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7962  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7963  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7964  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7965  /*mflush();*/
7966 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:335
int cv
Definition: kutil.h:358
int cp
Definition: kutil.h:335

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7968 of file kutil.cc.

7969 {
7970  //PrintS("\nUsage/Allocation of temporary storage:\n");
7971  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7972  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7973  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
7974  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7975  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7976  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7977  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7978  /*mflush();*/
7979 }
#define Print
Definition: emacs.cc:83
int cv
Definition: kutil.h:358
int nrsyzcrit
Definition: kutil.h:349
int nrrewcrit
Definition: kutil.h:350

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10736 of file kutil.cc.

10737 {
10738  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10739  return FALSE;
10740  int i,j;
10741  poly newNoether;
10742 
10743 #if 0
10744  if (currRing->weight_all_1)
10745  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10746  else
10747  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10748 #else
10749  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10750 #endif
10751  if (strat->kHEdge==NULL) return FALSE;
10752  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10753  if (strat->tailRing != currRing)
10754  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10755  /* compare old and new noether*/
10756  newNoether = pLmInit(strat->kHEdge);
10757  j = p_FDeg(newNoether,currRing);
10758  for (i=1; i<=(currRing->N); i++)
10759  {
10760  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10761  }
10762  pSetm(newNoether);
10763  if (j < strat->HCord) /*- statistics -*/
10764  {
10765  if (TEST_OPT_PROT)
10766  {
10767  Print("H(%d)",j);
10768  mflush();
10769  }
10770  strat->HCord=j;
10771  #ifdef KDEBUG
10772  if (TEST_OPT_DEBUG)
10773  {
10774  Print("H(%d):",j);
10775  wrp(strat->kHEdge);
10776  PrintLn();
10777  }
10778  #endif
10779  }
10780  if (pCmp(strat->kNoether,newNoether)!=1)
10781  {
10782  pDelete(&strat->kNoether);
10783  strat->kNoether=newNoether;
10784  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10785  if (strat->tailRing != currRing)
10786  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10787 
10788  return TRUE;
10789  }
10790  if (rField_is_Ring(currRing))
10791  pLmDelete(newNoether);
10792  else
10793  pLmFree(newNoether);
10794  return FALSE;
10795 }
#define pSetm(p)
Definition: polys.h:253
int HCord
Definition: kutil.cc:235
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:315
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:316
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:341
#define TEST_OPT_DEBUG
Definition: options.h:103
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
int HCord
Definition: kutil.h:343
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#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:876
int j
Definition: myNF.cc:70
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
poly t_kHEdge
Definition: kutil.h:317
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
poly t_kNoether
Definition: kutil.h:319
#define pDelete(p_ptr)
Definition: polys.h:169
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:289

◆ pairs()

void pairs ( )

◆ pCopyL2p()

poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 11967 of file kutil.cc.

11968 {
11969  /* restores a poly in currRing from LObject */
11970  LObject h = H;
11971  h.Copy();
11972  poly p;
11973  if (h.p == NULL)
11974  {
11975  if (h.t_p != NULL)
11976  {
11977  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11978  return(p);
11979  }
11980  else
11981  {
11982  /* h.tp == NULL -> the object is NULL */
11983  return(NULL);
11984  }
11985  }
11986  /* we're here if h.p != NULL */
11987  if (h.t_p == NULL)
11988  {
11989  /* then h.p is the whole poly in currRing */
11990  p = h.p;
11991  return(p);
11992  }
11993  /* we're here if h.p != NULL and h.t_p != NULL */
11994  // clean h.p, get poly from t_p
11995  pNext(h.p)=NULL;
11996  pLmDelete(&h.p);
11997  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
11998  /* dest. ring: */ currRing);
11999  // no need to clean h: we re-used the polys
12000  return(p);
12001 }
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 11936 of file kutil.cc.

11937 {
11938  /* assume: p is completely in currRing */
11939  /* produces an object with LM in curring
11940  and TAIL in tailring */
11941  if (pNext(p)!=NULL)
11942  {
11943  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11944  }
11945  return(p);
11946 }
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 11950 of file kutil.cc.

11951 {
11952  /* assume: p has LM in curring and TAIL in tailring */
11953  /* convert it to complete currRing */
11954 
11955  /* check that LM is in currRing */
11957 
11958  if (pNext(p)!=NULL)
11959  {
11960  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11961  }
11962  return(p);
11963 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43

◆ posInIdealMonFirst()

int posInIdealMonFirst ( const ideal  F,
const poly  p,
int  start = 0,
int  end = -1 
)

Definition at line 5280 of file kutil.cc.

5281 {
5282  if(end < 0 || end >= IDELEMS(F))
5283  end = IDELEMS(F);
5284  if (end<0) return 0;
5285  if(pNext(p) == NULL) return start;
5286  polyset set=F->m;
5287  int o = p_Deg(p,currRing);
5288  int op;
5289  int i;
5290  int an = start;
5291  for(i=start;i<end;i++)
5292  if(set[i] != NULL && pNext(set[i]) == NULL)
5293  an++;
5294  if(an == end-1)
5295  return end;
5296  int en= end;
5297  loop
5298  {
5299  if(an>=en)
5300  return en;
5301  if (an == en-1)
5302  {
5303  op = p_Deg(set[an],currRing);
5304  if ((op < o)
5305  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5306  return en;
5307  return an;
5308  }
5309  i=(an+en) / 2;
5310  op = p_Deg(set[i],currRing);
5311  if ((op < o)
5312  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5313  an=i;
5314  else
5315  en=i;
5316  }
5317 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
#define pNext(p)
Definition: monomials.h:43

◆ posInL0()

int posInL0 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6132 of file kutil.cc.

6134 {
6135  if (length<0) return 0;
6136 
6137  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6138  return length+1;
6139 
6140  int i;
6141  int an = 0;
6142  int en= length;
6143  loop
6144  {
6145  if (an >= en-1)
6146  {
6147  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6148  return an;
6149  }
6150  i=(an+en) / 2;
6151  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6152  else en=i;
6153  /*aend. fuer lazy == in !=- machen */
6154  }
6155 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL10()

int posInL10 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 1098 of file kstd1.cc.

1099 {
1100  int j,dp,dL;
1101 
1102  if (length<0) return 0;
1103  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1104  {
1105  int op= p->GetpFDeg() +p->ecart;
1106  for (j=length; j>=0; j--)
1107  {
1108  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1109  return j+1;
1110  if (dp < dL)
1111  return j+1;
1112  if ((dp == dL)
1113  && (set[j].GetpFDeg()+set[j].ecart >= op))
1114  return j+1;
1115  }
1116  }
1117  j=length;
1118  loop
1119  {
1120  if (j<0) break;
1121  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1122  j--;
1123  }
1124  return strat->posInLOld(set,j,p,strat);
1125 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int lastAxis
Definition: kutil.h:344
int j
Definition: myNF.cc:70
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:274
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:1048

◆ posInL10Ring()

int posInL10Ring ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

◆ posInL11()

int posInL11 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6390 of file kutil.cc.

6392 {
6393  if (length<0) return 0;
6394 
6395  int o = p->GetpFDeg();
6396  int op = set[length].GetpFDeg();
6397 
6398  if ((op > o)
6399  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6400  return length+1;
6401  int i;
6402  int an = 0;
6403  int en= length;
6404  loop
6405  {
6406  if (an >= en-1)
6407  {
6408  op = set[an].GetpFDeg();
6409  if ((op > o)
6410  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6411  return en;
6412  return an;
6413  }
6414  i=(an+en) / 2;
6415  op = set[i].GetpFDeg();
6416  if ((op > o)
6417  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6418  an=i;
6419  else
6420  en=i;
6421  }
6422 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL110()

int posInL110 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6688 of file kutil.cc.

6690 {
6691  if (length<0) return 0;
6692 
6693  int o = p->GetpFDeg();
6694  int op = set[length].GetpFDeg();
6695 
6696  if ((op > o)
6697  || ((op == o) && (set[length].length >p->length))
6698  || ((op == o) && (set[length].length <= p->length)
6699  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6700  return length+1;
6701  int i;
6702  int an = 0;
6703  int en= length;
6704  loop
6705  {
6706  if (an >= en-1)
6707  {
6708  op = set[an].GetpFDeg();
6709  if ((op > o)
6710  || ((op == o) && (set[an].length >p->length))
6711  || ((op == o) && (set[an].length <=p->length)
6712  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6713  return en;
6714  return an;
6715  }
6716  i=(an+en) / 2;
6717  op = set[i].GetpFDeg();
6718  if ((op > o)
6719  || ((op == o) && (set[i].length > p->length))
6720  || ((op == o) && (set[i].length <= p->length)
6721  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6722  an=i;
6723  else
6724  en=i;
6725  }
6726 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL11Ring()

int posInL11Ring ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6432 of file kutil.cc.

6434 {
6435  if (length<0) return 0;
6436 
6437  int o = p->GetpFDeg();
6438  int op = set[length].GetpFDeg();
6439 
6440  if ((op > o)
6441  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6442  return length+1;
6443  int i;
6444  int an = 0;
6445  int en= length;
6446  loop
6447  {
6448  if (an >= en-1)
6449  {
6450  op = set[an].GetpFDeg();
6451  if ((op > o)
6452  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6453  return en;
6454  return an;
6455  }
6456  i=(an+en) / 2;
6457  op = set[i].GetpFDeg();
6458  if ((op > o)
6459  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6460  an=i;
6461  else
6462  en=i;
6463  }
6464 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL11Ringls()

int posInL11Ringls ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6502 of file kutil.cc.

6504 {
6505  if (length < 0) return 0;
6506  int an,en,i;
6507  an = 0;
6508  en = length+1;
6509  loop
6510  {
6511  if (an >= en-1)
6512  {
6513  if(an == en)
6514  return en;
6515  if (set[an].FDeg > p->FDeg)
6516  return en;
6517  if (set[an].FDeg < p->FDeg)
6518  return an;
6519  if (set[an].FDeg == p->FDeg)
6520  {
6521  number lcset,lcp;
6522  lcset = pGetCoeff(set[an].p);
6523  lcp = pGetCoeff(p->p);
6524  if(!nGreaterZero(lcset))
6525  {
6526  set[an].p=p_Neg(set[an].p,currRing);
6527  if (set[an].t_p!=NULL)
6528  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6529  lcset=pGetCoeff(set[an].p);
6530  }
6531  if(!nGreaterZero(lcp))
6532  {
6533  p->p=p_Neg(p->p,currRing);
6534  if (p->t_p!=NULL)
6535  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6536  lcp=pGetCoeff(p->p);
6537  }
6538  if(nGreater(lcset, lcp))
6539  {
6540  return en;
6541  }
6542  else
6543  {
6544  return an;
6545  }
6546  }
6547  }
6548  i=(an+en) / 2;
6549  if (set[i].FDeg > p->FDeg)
6550  an=i;
6551  if (set[i].FDeg < p->FDeg)
6552  en=i;
6553  if (set[i].FDeg == p->FDeg)
6554  {
6555  number lcset,lcp;
6556  lcset = pGetCoeff(set[i].p);
6557  lcp = pGetCoeff(p->p);
6558  if(!nGreaterZero(lcset))
6559  {
6560  set[i].p=p_Neg(set[i].p,currRing);
6561  if (set[i].t_p!=NULL)
6562  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6563  lcset=pGetCoeff(set[i].p);
6564  }
6565  if(!nGreaterZero(lcp))
6566  {
6567  p->p=p_Neg(p->p,currRing);
6568  if (p->t_p!=NULL)
6569  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6570  lcp=pGetCoeff(p->p);
6571  }
6572  if(nGreater(lcset, lcp))
6573  {
6574  an = i;
6575  }
6576  else
6577  {
6578  en = i;
6579  }
6580  }
6581  }
6582 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInL13()

int posInL13 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6776 of file kutil.cc.

6778 {
6779  if (length<0) return 0;
6780 
6781  int o = p->GetpFDeg();
6782 
6783  if (set[length].GetpFDeg() > o)
6784  return length+1;
6785 
6786  int i;
6787  int an = 0;
6788  int en= length;
6789  loop
6790  {
6791  if (an >= en-1)
6792  {
6793  if (set[an].GetpFDeg() >= o)
6794  return en;
6795  return an;
6796  }
6797  i=(an+en) / 2;
6798  if (set[i].GetpFDeg() >= o)
6799  an=i;
6800  else
6801  en=i;
6802  }
6803 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL15()

int posInL15 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6811 of file kutil.cc.

6813 {
6814  if (length<0) return 0;
6815 
6816  int o = p->GetpFDeg() + p->ecart;
6817  int op = set[length].GetpFDeg() + set[length].ecart;
6818 
6819  if ((op > o)
6820  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6821  return length+1;
6822  int i;
6823  int an = 0;
6824  int en= length;
6825  loop
6826  {
6827  if (an >= en-1)
6828  {
6829  op = set[an].GetpFDeg() + set[an].ecart;
6830  if ((op > o)
6831  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6832  return en;
6833  return an;
6834  }
6835  i=(an+en) / 2;
6836  op = set[i].GetpFDeg() + set[i].ecart;
6837  if ((op > o)
6838  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6839  an=i;
6840  else
6841  en=i;
6842  }
6843 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL15Ring()

int posInL15Ring ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6846 of file kutil.cc.

6848 {
6849  if (length<0) return 0;
6850 
6851  int o = p->GetpFDeg() + p->ecart;
6852  int op = set[length].GetpFDeg() + set[length].ecart;
6853 
6854  if ((op > o)
6855  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6856  return length+1;
6857  int i;
6858  int an = 0;
6859  int en= length;
6860  loop
6861  {
6862  if (an >= en-1)
6863  {
6864  op = set[an].GetpFDeg() + set[an].ecart;
6865  if ((op > o)
6866  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6867  return en;
6868  return an;
6869  }
6870  i=(an+en) / 2;
6871  op = set[i].GetpFDeg() + set[i].ecart;
6872  if ((op > o)
6873  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6874  an=i;
6875  else
6876  en=i;
6877  }
6878 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL17()

int posInL17 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6887 of file kutil.cc.

6889 {
6890  if (length<0) return 0;
6891 
6892  int o = p->GetpFDeg() + p->ecart;
6893 
6894  if ((set[length].GetpFDeg() + set[length].ecart > o)
6895  || ((set[length].GetpFDeg() + set[length].ecart == o)
6896  && (set[length].ecart > p->ecart))
6897  || ((set[length].GetpFDeg() + set[length].ecart == o)
6898  && (set[length].ecart == p->ecart)
6899  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6900  return length+1;
6901  int i;
6902  int an = 0;
6903  int en= length;
6904  loop
6905  {
6906  if (an >= en-1)
6907  {
6908  if ((set[an].GetpFDeg() + set[an].ecart > o)
6909  || ((set[an].GetpFDeg() + set[an].ecart == o)
6910  && (set[an].ecart > p->ecart))
6911  || ((set[an].GetpFDeg() + set[an].ecart == o)
6912  && (set[an].ecart == p->ecart)
6913  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6914  return en;
6915  return an;
6916  }
6917  i=(an+en) / 2;
6918  if ((set[i].GetpFDeg() + set[i].ecart > o)
6919  || ((set[i].GetpFDeg() + set[i].ecart == o)
6920  && (set[i].ecart > p->ecart))
6921  || ((set[i].GetpFDeg() +set[i].ecart == o)
6922  && (set[i].ecart == p->ecart)
6923  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6924  an=i;
6925  else
6926  en=i;
6927  }
6928 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInLF5C()

int posInLF5C ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6378 of file kutil.cc.

6380 {
6381  return strat->Ll+1;
6382 }
int Ll
Definition: kutil.h:339

◆ posInLF5CRing()

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

Definition at line 6466 of file kutil.cc.

6468 {
6469  if (length<0) return 0;
6470  if(start == (length +1)) return (length+1);
6471  int o = p->GetpFDeg();
6472  int op = set[length].GetpFDeg();
6473 
6474  if ((op > o)
6475  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6476  return length+1;
6477  int i;
6478  int an = start;
6479  int en= length;
6480  loop
6481  {
6482  if (an >= en-1)
6483  {
6484  op = set[an].GetpFDeg();
6485  if ((op > o)
6486  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6487  return en;
6488  return an;
6489  }
6490  i=(an+en) / 2;
6491  op = set[i].GetpFDeg();
6492  if ((op > o)
6493  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6494  an=i;
6495  else
6496  en=i;
6497  }
6498 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInLRing()

int posInLRing ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6277 of file kutil.cc.

6279 {
6280  if (length < 0) return 0;
6281  if (set[length].FDeg > p->FDeg)
6282  return length+1;
6283  if (set[length].FDeg == p->FDeg)
6284  if(set[length].GetpLength() > p->GetpLength())
6285  return length+1;
6286  int i;
6287  int an = 0;
6288  int en= length+1;
6289  loop
6290  {
6291  if (an >= en-1)
6292  {
6293  if(an == en)
6294  return en;
6295  if (set[an].FDeg > p->FDeg)
6296  return en;
6297  if(set[an].FDeg == p->FDeg)
6298  {
6299  if(set[an].GetpLength() > p->GetpLength())
6300  return en;
6301  else
6302  {
6303  if(set[an].GetpLength() == p->GetpLength())
6304  {
6305  if(nGreater(set[an].p->coef, p->p->coef))
6306  return en;
6307  else
6308  return an;
6309  }
6310  else
6311  {
6312  return an;
6313  }
6314  }
6315  }
6316  else
6317  return an;
6318  }
6319  i=(an+en) / 2;
6320  if (set[i].FDeg > p->FDeg)
6321  an=i;
6322  else
6323  {
6324  if(set[i].FDeg == p->FDeg)
6325  {
6326  if(set[i].GetpLength() > p->GetpLength())
6327  an=i;
6328  else
6329  {
6330  if(set[i].GetpLength() == p->GetpLength())
6331  {
6332  if(nGreater(set[i].p->coef, p->p->coef))
6333  an = i;
6334  else
6335  en = i;
6336  }
6337  else
6338  {
6339  en=i;
6340  }
6341  }
6342  }
6343  else
6344  en=i;
6345  }
6346  }
6347 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInLSig()

int posInLSig ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6190 of file kutil.cc.

6192 {
6193  if (length<0) return 0;
6194  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6195  return length+1;
6196 
6197  int i;
6198  int an = 0;
6199  int en= length;
6200  loop
6201  {
6202  if (an >= en-1)
6203  {
6204  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6205  return an;
6206  }
6207  i=(an+en) / 2;
6208  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6209  else en=i;
6210  /*aend. fuer lazy == in !=- machen */
6211  }
6212 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInLSigRing()

int posInLSigRing ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6214 of file kutil.cc.

6216 {
6217  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6218  if (length<0) return 0;
6219  if (pLtCmp(set[length].sig,p->sig)== 1)
6220  return length+1;
6221 
6222  int an,en,i;
6223  an = 0;
6224  en = length+1;
6225  int cmp;
6226  loop
6227  {
6228  if (an >= en-1)
6229  {
6230  if(an == en)
6231  return en;
6232  cmp = pLtCmp(set[an].sig,p->sig);
6233  if (cmp == 1)
6234  return en;
6235  if (cmp == -1)
6236  return an;
6237  if (cmp == 0)
6238  {
6239  if (set[an].FDeg > p->FDeg)
6240  return en;
6241  if (set[an].FDeg < p->FDeg)
6242  return an;
6243  if (set[an].FDeg == p->FDeg)
6244  {
6245  cmp = pLtCmp(set[an].p,p->p);
6246  if(cmp == 1)
6247  return en;
6248  else
6249  return an;
6250  }
6251  }
6252  }
6253  i=(an+en) / 2;
6254  cmp = pLtCmp(set[i].sig,p->sig);
6255  if (cmp == 1)
6256  an = i;
6257  if (cmp == -1)
6258  en = i;
6259  if (cmp == 0)
6260  {
6261  if (set[i].FDeg > p->FDeg)
6262  an = i;
6263  if (set[i].FDeg < p->FDeg)
6264  en = i;
6265  if (set[i].FDeg == p->FDeg)
6266  {
6267  cmp = pLtCmp(set[i].p,p->p);
6268  if(cmp == 1)
6269  an = i;
6270  else
6271  en = i;
6272  }
6273  }
6274  }
6275 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477

◆ posInS()

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

Definition at line 5102 of file kutil.cc.

5104 {
5105  if(length==-1) return 0;
5106  polyset set=strat->S;
5107  int i;
5108  int an = 0;
5109  int en = length;
5110  int cmp_int = currRing->OrdSgn;
5112 #ifdef HAVE_PLURAL
5113  && (currRing->real_var_start==0)
5114 #endif
5115 #if 0
5116  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5117 #endif
5118  )
5119  {
5120  int o=p_Deg(p,currRing);
5121  int oo=p_Deg(set[length],currRing);
5122 
5123  if ((oo<o)
5124  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5125  return length+1;
5126 
5127  loop
5128  {
5129  if (an >= en-1)
5130  {
5131  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5132  {
5133  return an;
5134  }
5135  return en;
5136  }
5137  i=(an+en) / 2;
5138  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5139  else an=i;
5140  }
5141  }
5142  else
5143  {
5144  if (rField_is_Ring(currRing))
5145  {
5146  if (pLmCmp(set[length],p)== -cmp_int)
5147  return length+1;
5148  int cmp;
5149  loop
5150  {
5151  if (an >= en-1)
5152  {
5153  cmp = pLmCmp(set[an],p);
5154  if (cmp == cmp_int) return an;
5155  if (cmp == -cmp_int) return en;
5156  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5157  return an;
5158  }
5159  i = (an+en) / 2;
5160  cmp = pLmCmp(set[i],p);
5161  if (cmp == cmp_int) en = i;
5162  else if (cmp == -cmp_int) an = i;
5163  else
5164  {
5165  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5166  else en = i;
5167  }
5168  }
5169  }
5170  else
5171  if (pLmCmp(set[length],p)== -cmp_int)
5172  return length+1;
5173 
5174  loop
5175  {
5176  if (an >= en-1)
5177  {
5178  if (pLmCmp(set[an],p) == cmp_int) return an;
5179  if (pLmCmp(set[an],p) == -cmp_int) return en;
5180  if ((cmp_int!=1)
5181  && ((strat->ecartS[an])>ecart_p))
5182  return an;
5183  return en;
5184  }
5185  i=(an+en) / 2;
5186  if (pLmCmp(set[i],p) == cmp_int) en=i;
5187  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5188  else
5189  {
5190  if ((cmp_int!=1)
5191  &&((strat->ecartS[i])<ecart_p))
5192  en=i;
5193  else
5194  an=i;
5195  }
5196  }
5197  }
5198 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int ak
Definition: kutil.h:341
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
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:787
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
intset ecartS
Definition: kutil.h:295
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
poly * polyset
Definition: hutil.h:15

◆ posInSMonFirst()

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

Definition at line 5203 of file kutil.cc.

5204 {
5205  if (length<0) return 0;
5206  polyset set=strat->S;
5207  if(pNext(p) == NULL)
5208  {
5209  int mon = 0;
5210  for(int i = 0;i<=length;i++)
5211  {
5212  if(set[i] != NULL && pNext(set[i]) == NULL)
5213  mon++;
5214  }
5215  int o = p_Deg(p,currRing);
5216  int op = p_Deg(set[mon],currRing);
5217 
5218  if ((op < o)
5219  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5220  return length+1;
5221  int i;
5222  int an = 0;
5223  int en= mon;
5224  loop
5225  {
5226  if (an >= en-1)
5227  {
5228  op = p_Deg(set[an],currRing);
5229  if ((op < o)
5230  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5231  return en;
5232  return an;
5233  }
5234  i=(an+en) / 2;
5235  op = p_Deg(set[i],currRing);
5236  if ((op < o)
5237  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5238  an=i;
5239  else
5240  en=i;
5241  }
5242  }
5243  else /*if(pNext(p) != NULL)*/
5244  {
5245  int o = p_Deg(p,currRing);
5246  int op = p_Deg(set[length],currRing);
5247 
5248  if ((op < o)
5249  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5250  return length+1;
5251  int i;
5252  int an = 0;
5253  for(i=0;i<=length;i++)
5254  if(set[i] != NULL && pNext(set[i]) == NULL)
5255  an++;
5256  int en= length;
5257  loop
5258  {
5259  if (an >= en-1)
5260  {
5261  op = p_Deg(set[an],currRing);
5262  if ((op < o)
5263  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5264  return en;
5265  return an;
5266  }
5267  i=(an+en) / 2;
5268  op = p_Deg(set[i],currRing);
5269  if ((op < o)
5270  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5271  an=i;
5272  else
5273  en=i;
5274  }
5275  }
5276 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
#define pNext(p)
Definition: monomials.h:43

◆ posInSyz()

int posInSyz ( const kStrategy  strat,
const poly  sig 
)

Definition at line 6350 of file kutil.cc.

6351 {
6352  if (strat->syzl==0) return 0;
6353  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6354  return strat->syzl;
6355  int i;
6356  int an = 0;
6357  int en= strat->syzl-1;
6358  loop
6359  {
6360  if (an >= en-1)
6361  {
6362  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6363  return an;
6364  }
6365  i=(an+en) / 2;
6366  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6367  else en=i;
6368  /*aend. fuer lazy == in !=- machen */
6369  }
6370 }
loop
Definition: myNF.cc:98
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
polyset syz
Definition: kutil.h:293
int syzl
Definition: kutil.h:337

◆ posInT0()

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

Definition at line 5324 of file kutil.cc.

5325 {
5326  return (length+1);
5327 }

◆ posInT1()

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

Definition at line 5335 of file kutil.cc.

5336 {
5337  if (length==-1) return 0;
5338 
5339  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5340 
5341  int i;
5342  int an = 0;
5343  int en= length;
5344 
5345  loop
5346  {
5347  if (an >= en-1)
5348  {
5349  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5350  return en;
5351  }
5352  i=(an+en) / 2;
5353  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5354  else an=i;
5355  }
5356 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT11()

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

Definition at line 5393 of file kutil.cc.

5394 {
5395  if (length==-1) return 0;
5396 
5397  int o = p.GetpFDeg();
5398  int op = set[length].GetpFDeg();
5399 
5400  if ((op < o)
5401  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5402  return length+1;
5403 
5404  int i;
5405  int an = 0;
5406  int en= length;
5407 
5408  loop
5409  {
5410  if (an >= en-1)
5411  {
5412  op= set[an].GetpFDeg();
5413  if ((op > o)
5414  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5415  return an;
5416  return en;
5417  }
5418  i=(an+en) / 2;
5419  op = set[i].GetpFDeg();
5420  if (( op > o)
5421  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5422  en=i;
5423  else
5424  an=i;
5425  }
5426 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT110()

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

Definition at line 5546 of file kutil.cc.

5547 {
5548  p.GetpLength();
5549  if (length==-1) return 0;
5550 
5551  int o = p.GetpFDeg();
5552  int op = set[length].GetpFDeg();
5553 
5554  if (( op < o)
5555  || (( op == o) && (set[length].length<p.length))
5556  || (( op == o) && (set[length].length == p.length)
5557  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5558  return length+1;
5559 
5560  int i;
5561  int an = 0;
5562  int en= length;
5563  loop
5564  {
5565  if (an >= en-1)
5566  {
5567  op = set[an].GetpFDeg();
5568  if (( op > o)
5569  || (( op == o) && (set[an].length > p.length))
5570  || (( op == o) && (set[an].length == p.length)
5571  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5572  return an;
5573  return en;
5574  }
5575  i=(an+en) / 2;
5576  op = set[i].GetpFDeg();
5577  if (( op > o)
5578  || (( op == o) && (set[i].length > p.length))
5579  || (( op == o) && (set[i].length == p.length)
5580  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5581  en=i;
5582  else
5583  an=i;
5584  }
5585 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT13()

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

Definition at line 5635 of file kutil.cc.

5636 {
5637  if (length==-1) return 0;
5638 
5639  int o = p.GetpFDeg();
5640 
5641  if (set[length].GetpFDeg() <= o)
5642  return length+1;
5643 
5644  int i;
5645  int an = 0;
5646  int en= length;
5647  loop
5648  {
5649  if (an >= en-1)
5650  {
5651  if (set[an].GetpFDeg() > o)
5652  return an;
5653  return en;
5654  }
5655  i=(an+en) / 2;
5656  if (set[i].GetpFDeg() > o)
5657  en=i;
5658  else
5659  an=i;
5660  }
5661 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInT15()

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

Definition at line 5703 of file kutil.cc.

5722 {
5723  if (length==-1) return 0;
5724 
5725  int o = p.GetpFDeg() + p.ecart;
5726  int op = set[length].GetpFDeg()+set[length].ecart;
5727 
5728  if ((op < o)
5729  || ((op == o)
5730  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5731  return length+1;
5732 
5733  int i;
5734  int an = 0;
5735  int en= length;
5736  loop
5737  {
5738  if (an >= en-1)
5739  {
5740  op = set[an].GetpFDeg()+set[an].ecart;
5741  if (( op > o)
5742  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5743  return an;
5744  return en;
5745  }
5746  i=(an+en) / 2;
5747  op = set[i].GetpFDeg()+set[i].ecart;
5748  if (( op > o)
5749  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5750  en=i;
5751  else
5752  an=i;
5753  }
5754 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT17()

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

Definition at line 5798 of file kutil.cc.

5819 {
5820  if (length==-1) return 0;
5821 
5822  int o = p.GetpFDeg() + p.ecart;
5823  int op = set[length].GetpFDeg()+set[length].ecart;
5824 
5825  if ((op < o)
5826  || (( op == o) && (set[length].ecart > p.ecart))
5827  || (( op == o) && (set[length].ecart==p.ecart)
5828  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5829  return length+1;
5830 
5831  int i;
5832  int an = 0;
5833  int en= length;
5834  loop
5835  {
5836  if (an >= en-1)
5837  {
5838  op = set[an].GetpFDeg()+set[an].ecart;
5839  if (( op > o)
5840  || (( op == o) && (set[an].ecart < p.ecart))
5841  || (( op == o) && (set[an].ecart==p.ecart)
5842  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5843  return an;
5844  return en;
5845  }
5846  i=(an+en) / 2;
5847  op = set[i].GetpFDeg()+set[i].ecart;
5848  if ((op > o)
5849  || (( op == o) && (set[i].ecart < p.ecart))
5850  || (( op == o) && (set[i].ecart == p.ecart)
5851  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5852  en=i;
5853  else
5854  an=i;
5855  }
5856 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT17_c()

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

Definition at line 5905 of file kutil.cc.

5906 {
5907  if (length==-1) return 0;
5908 
5909  int cc = (-1+2*currRing->order[0]==ringorder_c);
5910  /* cc==1 for (c,..), cc==-1 for (C,..) */
5911  int o = p.GetpFDeg() + p.ecart;
5912  int c = pGetComp(p.p)*cc;
5913 
5914  if (pGetComp(set[length].p)*cc < c)
5915  return length+1;
5916  if (pGetComp(set[length].p)*cc == c)
5917  {
5918  int op = set[length].GetpFDeg()+set[length].ecart;
5919  if ((op < o)
5920  || ((op == o) && (set[length].ecart > p.ecart))
5921  || ((op == o) && (set[length].ecart==p.ecart)
5922  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5923  return length+1;
5924  }
5925 
5926  int i;
5927  int an = 0;
5928  int en= length;
5929  loop
5930  {
5931  if (an >= en-1)
5932  {
5933  if (pGetComp(set[an].p)*cc < c)
5934  return en;
5935  if (pGetComp(set[an].p)*cc == c)
5936  {
5937  int op = set[an].GetpFDeg()+set[an].ecart;
5938  if ((op > o)
5939  || ((op == o) && (set[an].ecart < p.ecart))
5940  || ((op == o) && (set[an].ecart==p.ecart)
5941  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5942  return an;
5943  }
5944  return en;
5945  }
5946  i=(an+en) / 2;
5947  if (pGetComp(set[i].p)*cc > c)
5948  en=i;
5949  else if (pGetComp(set[i].p)*cc == c)
5950  {
5951  int op = set[i].GetpFDeg()+set[i].ecart;
5952  if ((op > o)
5953  || ((op == o) && (set[i].ecart < p.ecart))
5954  || ((op == o) && (set[i].ecart == p.ecart)
5955  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5956  en=i;
5957  else
5958  an=i;
5959  }
5960  else
5961  an=i;
5962  }
5963 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT19()

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

Definition at line 6032 of file kutil.cc.

6033 {
6034  p.GetpLength();
6035  if (length==-1) return 0;
6036 
6037  int o = p.ecart;
6038  int op=p.GetpFDeg();
6039 
6040  if (set[length].ecart < o)
6041  return length+1;
6042  if (set[length].ecart == o)
6043  {
6044  int oo=set[length].GetpFDeg();
6045  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
6046  return length+1;
6047  }
6048 
6049  int i;
6050  int an = 0;
6051  int en= length;
6052  loop
6053  {
6054  if (an >= en-1)
6055  {
6056  if (set[an].ecart > o)
6057  return an;
6058  if (set[an].ecart == o)
6059  {
6060  int oo=set[an].GetpFDeg();
6061  if((oo > op)
6062  || ((oo==op) && (set[an].length > p.length)))
6063  return an;
6064  }
6065  return en;
6066  }
6067  i=(an+en) / 2;
6068  if (set[i].ecart > o)
6069  en=i;
6070  else if (set[i].ecart == o)
6071  {
6072  int oo=set[i].GetpFDeg();
6073  if ((oo > op)
6074  || ((oo == op) && (set[i].length > p.length)))
6075  en=i;
6076  else
6077  an=i;
6078  }
6079  else
6080  an=i;
6081  }
6082 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInT2()

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

Definition at line 5363 of file kutil.cc.

5364 {
5365  p.GetpLength();
5366  if (length==-1)
5367  return 0;
5368  if (set[length].length<p.length)
5369  return length+1;
5370 
5371  int i;
5372  int an = 0;
5373  int en= length;
5374 
5375  loop
5376  {
5377  if (an >= en-1)
5378  {
5379  if (set[an].length>p.length) return an;
5380  return en;
5381  }
5382  i=(an+en) / 2;
5383  if (set[i].length>p.length) en=i;
5384  else an=i;
5385  }
5386 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInT_EcartFDegpLength()

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

Definition at line 11675 of file kutil.cc.

11676 {
11677 
11678  if (length==-1) return 0;
11679 
11680  int o = p.ecart;
11681  int op=p.GetpFDeg();
11682  int ol = p.GetpLength();
11683 
11684  if (set[length].ecart < o)
11685  return length+1;
11686  if (set[length].ecart == o)
11687  {
11688  int oo=set[length].GetpFDeg();
11689  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11690  return length+1;
11691  }
11692 
11693  int i;
11694  int an = 0;
11695  int en= length;
11696  loop
11697  {
11698  if (an >= en-1)
11699  {
11700  if (set[an].ecart > o)
11701  return an;
11702  if (set[an].ecart == o)
11703  {
11704  int oo=set[an].GetpFDeg();
11705  if((oo > op)
11706  || ((oo==op) && (set[an].pLength > ol)))
11707  return an;
11708  }
11709  return en;
11710  }
11711  i=(an+en) / 2;
11712  if (set[i].ecart > o)
11713  en=i;
11714  else if (set[i].ecart == o)
11715  {
11716  int oo=set[i].GetpFDeg();
11717  if ((oo > op)
11718  || ((oo == op) && (set[i].pLength > ol)))
11719  en=i;
11720  else
11721  an=i;
11722  }
11723  else
11724  an=i;
11725  }
11726 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInT_EcartpLength()

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

Definition at line 5664 of file kutil.cc.

5665 {
5666  int ol = p.GetpLength();
5667  if (length==-1) return 0;
5668 
5669  int op=p.ecart;
5670 
5671  int oo=set[length].ecart;
5672  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5673  return length+1;
5674 
5675  int i;
5676  int an = 0;
5677  int en= length;
5678  loop
5679  {
5680  if (an >= en-1)
5681  {
5682  int oo=set[an].ecart;
5683  if((oo > op)
5684  || ((oo==op) && (set[an].pLength > ol)))
5685  return an;
5686  return en;
5687  }
5688  i=(an+en) / 2;
5689  int oo=set[i].ecart;
5690  if ((oo > op)
5691  || ((oo == op) && (set[i].pLength > ol)))
5692  en=i;
5693  else
5694  an=i;
5695  }
5696 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInT_FDegpLength()

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

Definition at line 11729 of file kutil.cc.

11730 {
11731 
11732  if (length==-1) return 0;
11733 
11734  int op=p.GetpFDeg();
11735  int ol = p.GetpLength();
11736 
11737  int oo=set[length].GetpFDeg();
11738  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11739  return length+1;
11740 
11741  int i;
11742  int an = 0;
11743  int en= length;
11744  loop
11745  {
11746  if (an >= en-1)
11747  {
11748  int oo=set[an].GetpFDeg();
11749  if((oo > op)
11750  || ((oo==op) && (set[an].pLength > ol)))
11751  return an;
11752  return en;
11753  }
11754  i=(an+en) / 2;
11755  int oo=set[i].GetpFDeg();
11756  if ((oo > op)
11757  || ((oo == op) && (set[i].pLength > ol)))
11758  en=i;
11759  else
11760  an=i;
11761  }
11762 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInT_pLength()

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

Definition at line 11766 of file kutil.cc.

11767 {
11768  int ol = p.GetpLength();
11769  if (length==-1)
11770  return 0;
11771  if (set[length].length<p.length)
11772  return length+1;
11773 
11774  int i;
11775  int an = 0;
11776  int en= length;
11777 
11778  loop
11779  {
11780  if (an >= en-1)
11781  {
11782  if (set[an].pLength>ol) return an;
11783  return en;
11784  }
11785  i=(an+en) / 2;
11786  if (set[i].pLength>ol) en=i;
11787  else an=i;
11788  }
11789 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInTSig()

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

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

11032 {
11033  if(!nCoeff_is_Ring_Z(currRing->cf))
11034  return;
11035  poly pH = h->GetP();
11036  poly p,pp;
11037  p = pH;
11038  bool deleted = FALSE, ok = FALSE;
11039  for(int i = 0; i<=strat->sl; i++)
11040  {
11041  p = pH;
11042  if(pNext(strat->S[i]) == NULL)
11043  {
11044  //pWrite(p);
11045  //pWrite(strat->S[i]);
11046  while(ok == FALSE && p != NULL)
11047  {
11048  if(pLmDivisibleBy(strat->S[i], p))
11049  {
11050  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11051  p_SetCoeff(p,dummy,currRing);
11052  }
11053  if(nIsZero(p->coef))
11054  {
11055  pLmDelete(&p);
11056  h->p = p;
11057  deleted = TRUE;
11058  }
11059  else
11060  {
11061  ok = TRUE;
11062  }
11063  }
11064  if (p!=NULL)
11065  {
11066  pp = pNext(p);
11067  while(pp != NULL)
11068  {
11069  if(pLmDivisibleBy(strat->S[i], pp))
11070  {
11071  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11072  p_SetCoeff(pp,dummy,currRing);
11073  if(nIsZero(pp->coef))
11074  {
11075  pLmDelete(&pNext(p));
11076  pp = pNext(p);
11077  deleted = TRUE;
11078  }
11079  else
11080  {
11081  p = pp;
11082  pp = pNext(p);
11083  }
11084  }
11085  else
11086  {
11087  p = pp;
11088  pp = pNext(p);
11089  }
11090  }
11091  }
11092  }
11093  }
11094  h->SetLmCurrRing();
11095  if((deleted)&&(h->p!=NULL))
11096  strat->initEcart(h);
11097 }
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:632
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#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:407
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11099 of file kutil.cc.

11100 {
11101  if(!nCoeff_is_Ring_Z(currRing->cf))
11102  return;
11103  poly hSig = h->sig;
11104  poly pH = h->GetP();
11105  poly p,pp;
11106  p = pH;
11107  bool deleted = FALSE, ok = FALSE;
11108  for(int i = 0; i<=strat->sl; i++)
11109  {
11110  p = pH;
11111  if(pNext(strat->S[i]) == NULL)
11112  {
11113  while(ok == FALSE && p!=NULL)
11114  {
11115  if(pLmDivisibleBy(strat->S[i], p))
11116  {
11117  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11118  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11119  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11120  {
11121  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11122  p_SetCoeff(p,dummy,currRing);
11123  }
11124  pDelete(&sigMult);
11125  }
11126  if(nIsZero(p->coef))
11127  {
11128  pLmDelete(&p);
11129  h->p = p;
11130  deleted = TRUE;
11131  }
11132  else
11133  {
11134  ok = TRUE;
11135  }
11136  }
11137  if(p == NULL)
11138  return;
11139  pp = pNext(p);
11140  while(pp != NULL)
11141  {
11142  if(pLmDivisibleBy(strat->S[i], pp))
11143  {
11144  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11145  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11146  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11147  {
11148  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11149  p_SetCoeff(pp,dummy,currRing);
11150  if(nIsZero(pp->coef))
11151  {
11152  pLmDelete(&pNext(p));
11153  pp = pNext(p);
11154  deleted = TRUE;
11155  }
11156  else
11157  {
11158  p = pp;
11159  pp = pNext(p);
11160  }
11161  }
11162  else
11163  {
11164  p = pp;
11165  pp = pNext(p);
11166  }
11167  pDelete(&sigMult);
11168  }
11169  else
11170  {
11171  p = pp;
11172  pp = pNext(p);
11173  }
11174  }
11175  }
11176  }
11177  h->SetLmCurrRing();
11178  if(deleted)
11179  strat->initEcart(h);
11180 
11181 }
polyset sig
Definition: kutil.h:294
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:632
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define ppMult_mm(p, m)
Definition: polys.h:184
#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:407
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pDivideM(a, b)
Definition: polys.h:276
int i
Definition: cfEzgcd.cc:123
#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:292
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ preIntegerCheck()

poly preIntegerCheck ( ideal  F,
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 10863 of file kutil.cc.

10864 {
10866  if(!nCoeff_is_Ring_Z(currRing->cf))
10867  return NULL;
10868  ideal F = idCopy(Forig);
10869  idSkipZeroes(F);
10870  poly pmon;
10871  ring origR = currRing;
10872  ideal monred = idInit(1,1);
10873  for(int i=0; i<idElem(F); i++)
10874  {
10875  if(pNext(F->m[i]) == NULL)
10876  idInsertPoly(monred, pCopy(F->m[i]));
10877  }
10878  int posconst = idPosConstant(F);
10879  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10880  {
10881  idDelete(&F);
10882  idDelete(&monred);
10883  return NULL;
10884  }
10885  int idelemQ = 0;
10886  if(Q!=NULL)
10887  {
10888  idelemQ = IDELEMS(Q);
10889  for(int i=0; i<idelemQ; i++)
10890  {
10891  if(pNext(Q->m[i]) == NULL)
10892  idInsertPoly(monred, pCopy(Q->m[i]));
10893  }
10894  idSkipZeroes(monred);
10895  posconst = idPosConstant(monred);
10896  //the constant, if found, will be from Q
10897  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10898  {
10899  pmon = pCopy(monred->m[posconst]);
10900  idDelete(&F);
10901  idDelete(&monred);
10902  return pmon;
10903  }
10904  }
10905  ring QQ_ring = rCopy0(currRing,FALSE);
10906  nKillChar(QQ_ring->cf);
10907  QQ_ring->cf = nInitChar(n_Q, NULL);
10908  rComplete(QQ_ring,1);
10909  QQ_ring = rAssure_c_dp(QQ_ring);
10910  rChangeCurrRing(QQ_ring);
10911  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10912  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10913  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10914  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10915  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10916  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10917  ideal one = kStd(II, NULL, isNotHomog, NULL);
10918  idSkipZeroes(one);
10919  if(idIsConstant(one))
10920  {
10921  //one should be <1>
10922  for(int i = IDELEMS(II)-1; i>=0; i--)
10923  if(II->m[i] != NULL)
10924  II->m[i+1] = II->m[i];
10925  II->m[0] = pOne();
10926  ideal syz = idSyzygies(II, isNotHomog, NULL);
10927  poly integer = NULL;
10928  for(int i = IDELEMS(syz)-1;i>=0; i--)
10929  {
10930  if(pGetComp(syz->m[i]) == 1)
10931  {
10932  pSetComp(syz->m[i],0);
10933  if(pIsConstant(pHead(syz->m[i])))
10934  {
10935  integer = pHead(syz->m[i]);
10936  break;
10937  }
10938  }
10939  }
10940  rChangeCurrRing(origR);
10941  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10942  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10943  idDelete(&monred);
10944  idDelete(&F);
10945  id_Delete(&II,QQ_ring);
10946  id_Delete(&one,QQ_ring);
10947  id_Delete(&syz,QQ_ring);
10948  p_Delete(&integer,QQ_ring);
10949  rDelete(QQ_ring);
10950  return pmon;
10951  }
10952  else
10953  {
10954  if(idIs0(monred))
10955  {
10956  poly mindegmon = NULL;
10957  for(int i = 0; i<IDELEMS(one); i++)
10958  {
10959  if(pNext(one->m[i]) == NULL)
10960  {
10961  if(mindegmon == NULL)
10962  mindegmon = pCopy(one->m[i]);
10963  else
10964  {
10965  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10966  mindegmon = pCopy(one->m[i]);
10967  }
10968  }
10969  }
10970  if(mindegmon != NULL)
10971  {
10972  for(int i = IDELEMS(II)-1; i>=0; i--)
10973  if(II->m[i] != NULL)
10974  II->m[i+1] = II->m[i];
10975  II->m[0] = pCopy(mindegmon);
10976  ideal syz = idSyzygies(II, isNotHomog, NULL);
10977  bool found = FALSE;
10978  for(int i = IDELEMS(syz)-1;i>=0; i--)
10979  {
10980  if(pGetComp(syz->m[i]) == 1)
10981  {
10982  pSetComp(syz->m[i],0);
10983  if(pIsConstant(pHead(syz->m[i])))
10984  {
10985  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10986  found = TRUE;
10987  break;
10988  }
10989  }
10990  }
10991  id_Delete(&syz,QQ_ring);
10992  if (found == FALSE)
10993  {
10994  rChangeCurrRing(origR);
10995  idDelete(&monred);
10996  idDelete(&F);
10997  id_Delete(&II,QQ_ring);
10998  id_Delete(&one,QQ_ring);
10999  rDelete(QQ_ring);
11000  return NULL;
11001  }
11002  rChangeCurrRing(origR);
11003  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11004  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11005  idDelete(&monred);
11006  idDelete(&F);
11007  id_Delete(&II,QQ_ring);
11008  id_Delete(&one,QQ_ring);
11009  id_Delete(&syz,QQ_ring);
11010  rDelete(QQ_ring);
11011  return pmon;
11012  }
11013  }
11014  }
11015  rChangeCurrRing(origR);
11016  idDelete(&monred);
11017  idDelete(&F);
11018  id_Delete(&II,QQ_ring);
11019  id_Delete(&one,QQ_ring);
11020  rDelete(QQ_ring);
11021  return NULL;
11022 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
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:2231
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4893
#define pGetComp(p)
Component.
Definition: polys.h:37
bool found
Definition: facFactorize.cc:56
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:47
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
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:3365
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1325
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 might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:725
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:12
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:562
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10
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:504
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:341
#define idIsConstant(I)
Definition: ideals.h:40

◆ redFirstShift()

int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 4405 of file kstd2.cc.

4406 {
4407  if (h->IsNull()) return 0;
4408 
4409  int at, reddeg,d;
4410  int pass = 0;
4411  int j = 0;
4412 
4413  if (! strat->homog)
4414  {
4415  d = h->GetpFDeg() + h->ecart;
4416  reddeg = strat->LazyDegree+d;
4417  }
4418  h->SetShortExpVector();
4419  loop
4420  {
4421  j = kFindDivisibleByInT(strat, h);
4422  if (j < 0)
4423  {
4424  h->SetDegStuffReturnLDeg(strat->LDegLast);
4425  return 1;
4426  }
4427 
4428  if (!TEST_OPT_INTSTRATEGY)
4429  strat->T[j].pNorm();
4430 #ifdef KDEBUG
4431  if (TEST_OPT_DEBUG)
4432  {
4433  PrintS("reduce ");
4434  h->wrp();
4435  PrintS(" with ");
4436  strat->T[j].wrp();
4437  }
4438 #endif
4439  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
4440  if (!h->IsNull())
4441  {
4442  poly qq=p_Shrink(h->GetTP(),strat->lV,strat->tailRing);
4443  h->p=NULL;
4444  h->t_p=qq;
4445  if (qq!=NULL) h->GetP(strat->lmBin);
4446  }
4447 
4448 #ifdef KDEBUG
4449  if (TEST_OPT_DEBUG)
4450  {
4451  PrintS("\nto ");
4452  wrp(h->p);
4453  PrintLn();
4454  }
4455 #endif
4456  if (h->IsNull())
4457  {
4458  if (h->lcm!=NULL) pLmFree(h->lcm);
4459  h->Clear();
4460  return 0;
4461  }
4462  h->SetShortExpVector();
4463 
4464 #if 0
4465  if ((strat->syzComp!=0) && !strat->honey)
4466  {
4467  if ((strat->syzComp>0) &&
4468  (h->Comp() > strat->syzComp))
4469  {
4470  assume(h->MinComp() > strat->syzComp);
4471 #ifdef KDEBUG
4472  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
4473 #endif
4474  if (strat->homog)
4475  h->SetDegStuffReturnLDeg(strat->LDegLast);
4476  return -2;
4477  }
4478  }
4479 #endif
4480  if (!strat->homog)
4481  {
4482  if (!TEST_OPT_OLDSTD && strat->honey)
4483  {
4484  h->SetpFDeg();
4485  if (strat->T[j].ecart <= h->ecart)
4486  h->ecart = d - h->GetpFDeg();
4487  else
4488  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
4489 
4490  d = h->GetpFDeg() + h->ecart;
4491  }
4492  else
4493  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
4494  /*- try to reduce the s-polynomial -*/
4495  pass++;
4496  /*
4497  *test whether the polynomial should go to the lazyset L
4498  *-if the degree jumps
4499  *-if the number of pre-defined reductions jumps
4500  */
4501  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
4502  && ((d >= reddeg) || (pass > strat->LazyPass)))
4503  {
4504  h->SetLmCurrRing();
4505  if (strat->posInLDependsOnLength)
4506  h->SetLength(strat->length_pLength);
4507  at = strat->posInL(strat->L,strat->Ll,h,strat);
4508  if (at <= strat->Ll)
4509  {
4510  //int dummy=strat->sl;
4511  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
4512  //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
4513  if (kFindDivisibleByInT(strat, h) < 0)
4514  return 1;
4515  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
4516 #ifdef KDEBUG
4517  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
4518 #endif
4519  h->Clear();
4520  return -1;
4521  }
4522  }
4523  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
4524  {
4525  reddeg = d+1;
4526  Print(".%d",d);mflush();
4527  }
4528  }
4529  }
4530 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
BOOLEAN length_pLength
Definition: kutil.h:376
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define mflush()
Definition: reporter.h:57
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
int lV
Definition: kutil.h:357
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:394
void PrintS(const char *s)
Definition: reporter.cc:284
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:313
BOOLEAN LDegLast
Definition: kutil.h:374
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
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:312
omBin lmBin
Definition: kutil.h:332
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:88
void wrp(poly p)
Definition: polys.h:292
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int LazyDegree
Definition: kutil.h:341

◆ redHomog()

int redHomog ( LObject h,
kStrategy  strat 
)

Definition at line 542 of file kstd2.cc.

543 {
544  if (strat->tl<0) return 1;
545  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
546  assume(h->FDeg == h->pFDeg());
547 
548  poly h_p;
549  int i,j,at,pass, ii;
550  unsigned long not_sev;
551  // long reddeg,d;
552 
553  pass = j = 0;
554  // d = reddeg = h->GetpFDeg();
555  h->SetShortExpVector();
556  int li;
557  h_p = h->GetLmTailRing();
558  not_sev = ~ h->sev;
559  loop
560  {
561  j = kFindDivisibleByInT(strat, h);
562  if (j < 0) return 1;
563 
564  li = strat->T[j].pLength;
565  ii = j;
566  /*
567  * the polynomial to reduce with (up to the moment) is;
568  * pi with length li
569  */
570  i = j;
571 #if 1
572  if (TEST_OPT_LENGTH)
573  loop
574  {
575  /*- search the shortest possible with respect to length -*/
576  i++;
577  if (i > strat->tl)
578  break;
579  if (li<=1)
580  break;
581  if ((strat->T[i].pLength < li)
582  &&
583  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
584  h_p, not_sev, strat->tailRing))
585  {
586  /*
587  * the polynomial to reduce with is now;
588  */
589  li = strat->T[i].pLength;
590  ii = i;
591  }
592  }
593 #endif
594 
595  /*
596  * end of search: have to reduce with pi
597  */
598 #ifdef KDEBUG
599  if (TEST_OPT_DEBUG)
600  {
601  PrintS("red:");
602  h->wrp();
603  PrintS(" with ");
604  strat->T[ii].wrp();
605  }
606 #endif
607  assume(strat->fromT == FALSE);
608 
609  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
610 #if SBA_PRINT_REDUCTION_STEPS
611  sba_interreduction_steps++;
612 #endif
613 #if SBA_PRINT_OPERATIONS
614  sba_interreduction_operations += pLength(strat->T[ii].p);
615 #endif
616 
617 #ifdef KDEBUG
618  if (TEST_OPT_DEBUG)
619  {
620  PrintS("\nto ");
621  h->wrp();
622  PrintLn();
623  }
624 #endif
625 
626  h_p = h->GetLmTailRing();
627  if (h_p == NULL)
628  {
629  if (h->lcm!=NULL) pLmFree(h->lcm);
630 #ifdef KDEBUG
631  h->lcm=NULL;
632 #endif
633  return 0;
634  }
635  h->SetShortExpVector();
636  not_sev = ~ h->sev;
637  /*
638  * try to reduce the s-polynomial h
639  *test first whether h should go to the lazyset L
640  *-if the degree jumps
641  *-if the number of pre-defined reductions jumps
642  */
643  pass++;
644  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
645  {
646  h->SetLmCurrRing();
647  at = strat->posInL(strat->L,strat->Ll,h,strat);
648  if (at <= strat->Ll)
649  {
650  int dummy=strat->sl;
651  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
652  return 1;
653  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
654 #ifdef KDEBUG
655  if (TEST_OPT_DEBUG)
656  Print(" lazy: -> L%d\n",at);
657 #endif
658  h->Clear();
659  return -1;
660  }
661  }
662  }
663 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
int tl
Definition: kutil.h:338
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
unsigned long * sevT
Definition: kutil.h:311
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
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:336
TSet T
Definition: kutil.h:312
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:88
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978

◆ redHoney()

int redHoney ( LObject h,
kStrategy  strat 
)

Definition at line 1456 of file kstd2.cc.

1457 {
1458  if (strat->tl<0) return 1;
1459  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1460  assume(h->FDeg == h->pFDeg());
1461  poly h_p;
1462  int i,j,at,pass,ei, ii, h_d;
1463  unsigned long not_sev;
1464  long reddeg,d;
1465 
1466  pass = j = 0;
1467  d = reddeg = h->GetpFDeg() + h->ecart;
1468  h->SetShortExpVector();
1469  int li;
1470  h_p = h->GetLmTailRing();
1471  not_sev = ~ h->sev;
1472 
1473  h->PrepareRed(strat->use_buckets);
1474  loop
1475  {
1476  j=kFindDivisibleByInT(strat, h);
1477  if (j < 0) return 1;
1478 
1479  ei = strat->T[j].ecart;
1480  li = strat->T[j].pLength;
1481  ii = j;
1482  /*
1483  * the polynomial to reduce with (up to the moment) is;
1484  * pi with ecart ei (T[ii])
1485  */
1486  i = j;
1487  if (TEST_OPT_LENGTH)
1488  loop
1489  {
1490  /*- takes the first possible with respect to ecart -*/
1491  i++;
1492  if (i > strat->tl)
1493  break;
1494  //if (ei < h->ecart)
1495  // break;
1496  if (li<=1)
1497  break;
1498  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1499  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1500  &&
1501  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1502  h_p, not_sev, strat->tailRing))
1503  {
1504  /*
1505  * the polynomial to reduce with is now;
1506  */
1507  ei = strat->T[i].ecart;
1508  li = strat->T[i].pLength;
1509  ii = i;
1510  }
1511  }
1512 
1513  /*
1514  * end of search: have to reduce with pi
1515  */
1516  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1517  {
1518  h->GetTP(); // clears bucket
1519  h->SetLmCurrRing();
1520  /*
1521  * It is not possible to reduce h with smaller ecart;
1522  * if possible h goes to the lazy-set L,i.e
1523  * if its position in L would be not the last one
1524  */
1525  if (strat->Ll >= 0) /* L is not empty */
1526  {
1527  at = strat->posInL(strat->L,strat->Ll,h,strat);
1528  if(at <= strat->Ll)
1529  /*- h will not become the next element to reduce -*/
1530  {
1531  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1532 #ifdef KDEBUG
1533  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1534 #endif
1535  h->Clear();
1536  return -1;
1537  }
1538  }
1539  }
1540 #ifdef KDEBUG
1541  if (TEST_OPT_DEBUG)
1542  {
1543  PrintS("red:");
1544  h->wrp();
1545  Print("\nwith T[%d]:",ii);
1546  strat->T[ii].wrp();
1547  }
1548 #endif
1549  assume(strat->fromT == FALSE);
1550 
1551  number coef;
1552  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),&coef,strat);
1553 #if SBA_PRINT_REDUCTION_STEPS
1554  sba_interreduction_steps++;
1555 #endif
1556 #if SBA_PRINT_OPERATIONS
1557  sba_interreduction_operations += pLength(strat->T[ii].p);
1558 #endif
1559 #ifdef KDEBUG
1560  if (TEST_OPT_DEBUG)
1561  {
1562  PrintS("\nto:");
1563  h->wrp();
1564  PrintLn();
1565  }
1566 #endif
1567  if(h->IsNull())
1568  {
1569  h->Clear();
1570  if (h->lcm!=NULL) pLmFree(h->lcm);
1571  #ifdef KDEBUG
1572  h->lcm=NULL;
1573  #endif
1574  return 0;
1575  }
1576  if (TEST_OPT_IDLIFT)
1577  {
1578  if (h->p!=NULL)
1579  {
1580  if(p_GetComp(h->p,currRing)>strat->syzComp)
1581  {
1582  h->Delete();
1583  return 0;
1584  }
1585  }
1586  else if (h->t_p!=NULL)
1587  {
1588  if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1589  {
1590  h->Delete();
1591  return 0;
1592  }
1593  }
1594  }
1595  h->SetShortExpVector();
1596  not_sev = ~ h->sev;
1597  h_d = h->SetpFDeg();
1598  /* compute the ecart */
1599  if (ei <= h->ecart)
1600  h->ecart = d-h_d;
1601  else
1602  h->ecart = d-h_d+ei-h->ecart;
1603 
1604  /*
1605  * try to reduce the s-polynomial h
1606  *test first whether h should go to the lazyset L
1607  *-if the degree jumps
1608  *-if the number of pre-defined reductions jumps
1609  */
1610  pass++;
1611  d = h_d + h->ecart;
1612  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1613  {
1614  h->GetTP(); // clear bucket
1615  h->SetLmCurrRing();
1616  at = strat->posInL(strat->L,strat->Ll,h,strat);
1617  if (at <= strat->Ll)
1618  {
1619  int dummy=strat->sl;
1620  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1621  return 1;
1622  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1623 #ifdef KDEBUG
1624  if (TEST_OPT_DEBUG)
1625  Print(" degree jumped: -> L%d\n",at);
1626 #endif
1627  h->Clear();
1628  return -1;
1629  }
1630  }
1631  else if (d > reddeg)
1632  {
1633  if (d>=(long)strat->tailRing->bitmask)
1634  {
1635  if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
1636  {
1637  strat->overflow=TRUE;
1638  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1639  h->GetP();
1640  at = strat->posInL(strat->L,strat->Ll,h,strat);
1641  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1642  h->Clear();
1643  return -1;
1644  }
1645  }
1646  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1647  {
1648  //h->wrp(); Print("<%d>\n",h->GetpLength());
1649  reddeg = d;
1650  Print(".%ld",d); mflush();
1651  }
1652  }
1653  }
1654 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
unsigned long * sevT
Definition: kutil.h:311
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
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:336
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
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:88
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ redLazy()

int redLazy ( LObject h,
kStrategy  strat 
)

TEST_OPT_REDTHROUGH &&

Definition at line 1296 of file kstd2.cc.

1297 {
1298  if (strat->tl<0) return 1;
1299  int at,i,ii,li;
1300  int j = 0;
1301  int pass = 0;
1302  assume(h->pFDeg() == h->FDeg);
1303  long reddeg = h->GetpFDeg();
1304  long d;
1305  unsigned long not_sev;
1306 
1307  h->SetShortExpVector();
1308  poly h_p = h->GetLmTailRing();
1309  not_sev = ~ h->sev;
1310  loop
1311  {
1312  j = kFindDivisibleByInT(strat, h);
1313  if (j < 0) return 1;
1314 
1315  li = strat->T[j].pLength;
1316  #if 0
1317  if (li==0)
1318  {
1319  li=strat->T[j].pLength=pLength(strat->T[j].p);
1320  }
1321  #endif
1322  ii = j;
1323  /*
1324  * the polynomial to reduce with (up to the moment) is;
1325  * pi with length li
1326  */
1327 
1328  i = j;
1329 #if 1
1330  if (TEST_OPT_LENGTH)
1331  loop
1332  {
1333  /*- search the shortest possible with respect to length -*/
1334  i++;
1335  if (i > strat->tl)
1336  break;
1337  if (li<=1)
1338  break;
1339  #if 0
1340  if (strat->T[i].pLength==0)
1341  {
1342  PrintS("!");
1343  strat->T[i].pLength=pLength(strat->T[i].p);
1344  }
1345  #endif
1346  if ((strat->T[i].pLength < li)
1347  &&
1348  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1349  h_p, not_sev, strat->tailRing))
1350  {
1351  /*
1352  * the polynomial to reduce with is now;
1353  */
1354  PrintS("+");
1355  li = strat->T[i].pLength;
1356  ii = i;
1357  }
1358  }
1359 #endif
1360 
1361  /*
1362  * end of search: have to reduce with pi
1363  */
1364 
1365 
1366 #ifdef KDEBUG
1367  if (TEST_OPT_DEBUG)
1368  {
1369  PrintS("red:");
1370  h->wrp();
1371  PrintS(" with ");
1372  strat->T[ii].wrp();
1373  }
1374 #endif
1375 
1376  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
1377 #if SBA_PRINT_REDUCTION_STEPS
1378  sba_interreduction_steps++;
1379 #endif
1380 #if SBA_PRINT_OPERATIONS
1381  sba_interreduction_operations += pLength(strat->T[ii].p);
1382 #endif
1383 
1384 #ifdef KDEBUG
1385  if (TEST_OPT_DEBUG)
1386  {
1387  PrintS("\nto ");
1388  h->wrp();
1389  PrintLn();
1390  }
1391 #endif
1392 
1393  h_p=h->GetLmTailRing();
1394 
1395  if (h_p == NULL)
1396  {
1397  if (h->lcm!=NULL) pLmFree(h->lcm);
1398 #ifdef KDEBUG
1399  h->lcm=NULL;
1400 #endif
1401  return 0;
1402  }
1403  h->SetShortExpVector();
1404  not_sev = ~ h->sev;
1405  d = h->SetpFDeg();
1406  /*- try to reduce the s-polynomial -*/
1407  pass++;
1408  if (//!TEST_OPT_REDTHROUGH &&
1409  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1410  {
1411  h->SetLmCurrRing();
1412  at = strat->posInL(strat->L,strat->Ll,h,strat);
1413  if (at <= strat->Ll)
1414  {
1415 #if 1
1416  int dummy=strat->sl;
1417  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1418  return 1;
1419 #endif
1420 #ifdef KDEBUG
1421  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
1422 #endif
1423  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1424  h->Clear();
1425  return -1;
1426  }
1427  }
1428  else if (d != reddeg)
1429  {
1430  if (d>=(long)strat->tailRing->bitmask)
1431  {
1432  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
1433  {
1434  strat->overflow=TRUE;
1435  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1436  h->GetP();
1437  at = strat->posInL(strat->L,strat->Ll,h,strat);
1438  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1439  h->Clear();
1440  return -1;
1441  }
1442  }
1443  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
1444  {
1445  Print(".%ld",d);mflush();
1446  reddeg = d;
1447  }
1448  }
1449  }
1450 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
unsigned long * sevT
Definition: kutil.h:311
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define mflush()
Definition: reporter.h:57
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
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:336
TSet T
Definition: kutil.h:312
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:88
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ redNF()

poly redNF ( poly  h,
int &  max_ind,
int  nonorm,
kStrategy  strat 
)

Definition at line 1660 of file kstd2.cc.

1661 {
1662 #define REDNF_CANONICALIZE 60
1663  if (h==NULL) return NULL;
1664  int j;
1665  int cnt=REDNF_CANONICALIZE;
1666  max_ind=strat->sl;
1667 
1668  if (0 > strat->sl)
1669  {
1670  return h;
1671  }
1672  LObject P(h);
1673  P.SetShortExpVector();
1674  P.bucket = kBucketCreate(currRing);
1675  kBucketInit(P.bucket,P.p,pLength(P.p));
1676  kbTest(P.bucket);
1677 #ifdef HAVE_RINGS
1679 #endif
1680 #ifdef KDEBUG
1681 // if (TEST_OPT_DEBUG)
1682 // {
1683 // PrintS("redNF: starting S:\n");
1684 // for( j = 0; j <= max_ind; j++ )
1685 // {
1686 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1687 // pWrite(strat->S[j]);
1688 // }
1689 // };
1690 #endif
1691 
1692  loop
1693  {
1694  j=kFindDivisibleByInS(strat,&max_ind,&P);
1695  if (j>=0)
1696  {
1697 #ifdef HAVE_RINGS
1698  if (!is_ring)
1699  {
1700 #endif
1701  int sl=pSize(strat->S[j]);
1702  int jj=j;
1703  loop
1704  {
1705  int sll;
1706  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1707  if (jj<0) break;
1708  sll=pSize(strat->S[jj]);
1709  if (sll<sl)
1710  {
1711  #ifdef KDEBUG
1712  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1713  #endif
1714  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1715  j=jj;
1716  sl=sll;
1717  }
1718  }
1719  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1720  {
1721  pNorm(strat->S[j]);
1722  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1723  }
1724 #ifdef HAVE_RINGS
1725  }
1726 #endif
1727  nNormalize(pGetCoeff(P.p));
1728 #ifdef KDEBUG
1729  if (TEST_OPT_DEBUG)
1730  {
1731  PrintS("red:");
1732  wrp(h);
1733  PrintS(" with ");
1734  wrp(strat->S[j]);
1735  }
1736 #endif
1737 #ifdef HAVE_PLURAL
1738  if (rIsPluralRing(currRing))
1739  {
1740  number coef;
1741  nc_kBucketPolyRed(P.bucket,strat->S[j],&coef);
1742  nDelete(&coef);
1743  }
1744  else
1745 #endif
1746  {
1747  number coef;
1748  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1749  nDelete(&coef);
1750  }
1751  cnt--;
1752  if (cnt==0)
1753  {
1754  kBucketCanonicalize(P.bucket);
1755  cnt=REDNF_CANONICALIZE;
1756  }
1757  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1758  if (h==NULL)
1759  {
1760  kBucketDestroy(&P.bucket);
1761 
1762 #ifdef KDEBUG
1763 // if (TEST_OPT_DEBUG)
1764 // {
1765 // PrintS("redNF: starting S:\n");
1766 // for( j = 0; j <= max_ind; j++ )
1767 // {
1768 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1769 // pWrite(strat->S[j]);
1770 // }
1771 // };
1772 #endif
1773 
1774  return NULL;
1775  }
1776  kbTest(P.bucket);
1777  P.p=h;
1778  P.t_p=NULL;
1779  P.SetShortExpVector();
1780 #ifdef KDEBUG
1781  if (TEST_OPT_DEBUG)
1782  {
1783  PrintS("\nto:");
1784  wrp(h);
1785  PrintLn();
1786  }
1787 #endif
1788  }
1789  else
1790  {
1791  P.p=kBucketClear(P.bucket);
1792  kBucketDestroy(&P.bucket);
1793  pNormalize(P.p);
1794 
1795 #ifdef KDEBUG
1796 // if (TEST_OPT_DEBUG)
1797 // {
1798 // PrintS("redNF: starting S:\n");
1799 // for( j = 0; j <= max_ind; j++ )
1800 // {
1801 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1802 // pWrite(strat->S[j]);
1803 // }
1804 // };
1805 #endif
1806 
1807  return P.p;
1808  }
1809  }
1810 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:495
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:259
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:181
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:467
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:52
#define nNormalize(n)
Definition: numbers.h:30
loop
Definition: myNF.cc:98
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1053
#define REDNF_CANONICALIZE
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:480
int & max_ind
Definition: myNF.cc:67
poly kNoether
Definition: kutil.h:316
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
BOOLEAN is_ring
Definition: myNF.cc:83
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
int j
Definition: myNF.cc:70
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
pNormalize(P.p)
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:197
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
polyset S
Definition: kutil.h:292
#define nDelete(n)
Definition: numbers.h:16
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
int sl
Definition: kutil.h:336
void wrp(poly p)
Definition: polys.h:292
kBucketDestroy & P
Definition: myNF.cc:191
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:193
static Poly * h
Definition: janet.cc:978
int int nonorm
Definition: myNF.cc:67
int BOOLEAN
Definition: auxiliary.h:85
int kBucketCanonicalize(kBucket_pt bucket)
#define pSize(p)
Definition: polys.h:300

◆ redNF0()

int redNF0 ( LObject P,
kStrategy  strat 
)

◆ redNFTail()

poly redNFTail ( poly  h,
const int  sl,
kStrategy  strat 
)

◆ redRiloc()

int redRiloc ( LObject h,
kStrategy  strat 
)

Definition at line 348 of file kstd1.cc.

349 {
350  int i,at,ei,li,ii;
351  int j = 0;
352  int pass = 0;
353  long d,reddeg;
354 
355 
356 #ifdef ADIDEBUG_NF
357  int iii;
358  PrintS("\n---------------------------- NEW REDRILOC COMPUTATION ----------------------------\n");
359  PrintS(" The pair h :\n");
360  PrintS("\n p1 = "); p_Write(h->p1,strat->tailRing);
361  PrintS("\n p2 = "); p_Write(h->p2,strat->tailRing);
362  PrintS("\n p = "); p_Write(h->p,strat->tailRing);
363  PrintS("\n The actual reducer T is: ");
364  if(strat->tl<0)
365  {PrintS(" Empty.\n");}
366  else
367  {
368  for (iii=0;iii<=strat->tl;iii++)
369  {
370  Print("\n T[%i] = ",iii);p_Write(strat->T[iii].p,strat->tailRing);
371  }
372  }
373 #endif /* ADIDEBUG_NF */
374 
375  d = h->GetpFDeg()+ h->ecart;
376  reddeg = strat->LazyDegree+d;
377  h->SetShortExpVector();
378 #ifdef ADIDEBUG_NF
379  Print("\n Searching for a poly in T that divides h (of ecart %i) ...\n",h->ecart);
380 #endif
381  loop
382  {
383  j = kFindDivisibleByInT(strat, h);
384 #ifdef ADIDEBUG_NF
385  if(j != -1)
386  {
387  ei = strat->T[j].ecart;
388  Print("\n Found one: T[%i] of ecart %i: ",j,ei);
389  p_Write(strat->T[j].p,strat->tailRing);
390  PrintS("\n Try to find another with smaller ecart:\n");
391  }
392  else
393  {
394  PrintS("\n No poly in T divides h.\n");
395  }
396  //getchar();
397 #endif
398  if (j < 0)
399  {
400  // over ZZ: cleanup coefficients by complete reduction with monomials
401  postReduceByMon(h, strat);
402  if(h->p == NULL)
403  {
404  if (h->lcm!=NULL) pLmDelete(h->lcm);
405  h->Clear();
406  return 0;
407  }
408  if (strat->honey) h->SetLength(strat->length_pLength);
409  if(strat->tl >= 0)
410  h->i_r1 = strat->tl;
411  else
412  h->i_r1 = -1;
413  if (h->GetLmTailRing() == NULL)
414  {
415  if (h->lcm!=NULL) pLmDelete(h->lcm);
416  h->Clear();
417  return 0;
418  }
419  return 1;
420  }
421 
422  ei = strat->T[j].ecart;
423  ii = j;
424 #ifdef ADIDEBUG_NF
425  iii=ii;
426 #endif
427  if (ei > h->ecart && ii < strat->tl)
428  {
429  li = strat->T[j].length;
430  // the polynomial to reduce with (up to the moment) is;
431  // pi with ecart ei and length li
432  // look for one with smaller ecart
433  i = j;
434  loop
435  {
436  /*- takes the first possible with respect to ecart -*/
437  i++;
438 #if 1
439  if (i > strat->tl) break;
440  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
441  strat->T[i].length < li))
442  &&
443  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
444  &&
445  n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
446 #else
447  j = kFindDivisibleByInT(strat, h, i);
448  if (j < 0) break;
449  i = j;
450  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
451  strat->T[i].length < li))
452 #endif
453  {
454  // the polynomial to reduce with is now
455  #ifdef ADIDEBUG_NF
456  printf("\n Intermidiate one, h.ecart = %i < ecart = %i < ei = %i: ",h->ecart,strat->T[i].ecart, ei);
457  pWrite(strat->T[i].p);
458  #endif
459  ii = i;
460  ei = strat->T[i].ecart;
461  if (ei <= h->ecart) break;
462  li = strat->T[i].length;
463  }
464  }
465 
466 #ifdef ADIDEBUG_NF
467  if(iii == ii)
468  {
469  PrintS("\n None was found.\n");
470  }
471  else
472  {
473  Print("\n A better one (ecart = %i): T[%i] = ",ei,ii);
474  p_Write(strat->T[ii].p,strat->tailRing);
475  PrintLn();
476  }
477 #endif
478  }
479 
480  // end of search: have to reduce with pi
481  if (ei > h->ecart)
482  {
483  #ifdef ADIDEBUG_NF
484  printf("\nHAD TO REDUCE WITH BIGGER ECART!!!\n");
485  #endif
486  // It is not possible to reduce h with smaller ecart;
487  // if possible h goes to the lazy-set L,i.e
488  // if its position in L would be not the last one
489  strat->fromT = TRUE;
490  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
491  {
492  h->SetLmCurrRing();
493  if (strat->honey && strat->posInLDependsOnLength)
494  h->SetLength(strat->length_pLength);
495  assume(h->FDeg == h->pFDeg());
496  at = strat->posInL(strat->L,strat->Ll,h,strat);
497  if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
498  {
499  /*- h will not become the next element to reduce -*/
500  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
501  #ifdef KDEBUG
502  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
503  #endif
504  h->Clear();
505  strat->fromT = FALSE;
506  return -1;
507  }
508  }
509  doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
510  }
511  else
512  {
513  // now we finally can reduce
514  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
515  }
516  strat->fromT=FALSE;
517  // are we done ???
518  if (h->IsNull())
519  {
520  #ifdef ADIDEBUG_NF
521  printf("\nReduced to 0. Exit\n");
522  #endif
523  if (h->lcm!=NULL) pLmDelete(h->lcm);
524  h->Clear();
525  return 0;
526  }
527 
528  // NO!
529  h->SetShortExpVector();
530  h->SetpFDeg();
531  if (strat->honey)
532  {
533  if (ei <= h->ecart)
534  h->ecart = d-h->GetpFDeg();
535  else
536  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
537  }
538  else
539  // this has the side effect of setting h->length
540  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
541  #ifdef ADIDEBUG_NF
542  printf("\n Partial Reduced (ecart %i) h = ",h->ecart);p_Write(h->p,strat->tailRing);
543  PrintLn();
544  #endif
545  /*- try to reduce the s-polynomial -*/
546  pass++;
547  d = h->GetpFDeg()+h->ecart;
548  /*
549  *test whether the polynomial should go to the lazyset L
550  *-if the degree jumps
551  *-if the number of pre-defined reductions jumps
552  */
553  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
554  && ((d >= reddeg) || (pass > strat->LazyPass)))
555  {
556  h->SetLmCurrRing();
557  if (strat->honey && strat->posInLDependsOnLength)
558  h->SetLength(strat->length_pLength);
559  assume(h->FDeg == h->pFDeg());
560  at = strat->posInL(strat->L,strat->Ll,h,strat);
561  if (at <= strat->Ll)
562  {
563  int dummy=strat->sl;
564  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
565  {
566  if (strat->honey && !strat->posInLDependsOnLength)
567  h->SetLength(strat->length_pLength);
568  return 1;
569  }
570  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
571 #ifdef KDEBUG
572  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
573 #endif
574  h->Clear();
575  return -1;
576  }
577  }
578  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
579  {
580  Print(".%ld",d);mflush();
581  reddeg = d+1;
582  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
583  {
584  strat->overflow=TRUE;
585  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
586  h->GetP();
587  at = strat->posInL(strat->L,strat->Ll,h,strat);
588  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
589  h->Clear();
590  return -1;
591  }
592  }
593  }
594 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:376
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#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
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define nEqual(n1, n2)
Definition: numbers.h:20
#define mflush()
Definition: reporter.h:57
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:313
BOOLEAN LDegLast
Definition: kutil.h:374
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11031
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
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:88
int LazyPass
Definition: kutil.h:341
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:341

◆ redRing()

int redRing ( LObject h,
kStrategy  strat 
)

Definition at line 432 of file kstd2.cc.

433 {
434  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
435  if (strat->tl<0) return 1;
436 
437  int at/*,i*/;
438  long d;
439  int j = 0;
440  int pass = 0;
441  // poly zeroPoly = NULL;
442 
443 // TODO warum SetpFDeg notwendig?
444  h->SetpFDeg();
445  assume(h->pFDeg() == h->FDeg);
446  long reddeg = h->GetpFDeg();
447 
448  h->SetShortExpVector();
449  loop
450  {
451  j = kFindDivisibleByInT(strat, h);
452  if (j < 0)
453  {
454  // over ZZ: cleanup coefficients by complete reduction with monomials
455  postReduceByMon(h, strat);
456  if(h->p == NULL)
457  {
458  if (h->lcm!=NULL) pLmDelete(h->lcm);
459  h->Clear();
460  return 0;
461  }
462  if(nIsZero(pGetCoeff(h->p))) return 2;
463  j = kFindDivisibleByInT(strat, h);
464  if(j < 0)
465  {
466  if(strat->tl >= 0)
467  h->i_r1 = strat->tl;
468  else
469  h->i_r1 = -1;
470  if (h->GetLmTailRing() == NULL)
471  {
472  if (h->lcm!=NULL) pLmDelete(h->lcm);
473  h->Clear();
474  return 0;
475  }
476  return 1;
477  }
478  }
479  //printf("\nFound one: ");pWrite(strat->T[j].p);
480  //enterT(*h, strat);
481  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
482  //printf("\nAfter small red: ");pWrite(h->p);
483  if (h->GetLmTailRing() == NULL)
484  {
485  if (h->lcm!=NULL) pLmDelete(h->lcm);
486 #ifdef KDEBUG
487  h->lcm=NULL;
488 #endif
489  h->Clear();
490  return 0;
491  }
492  h->SetShortExpVector();
493  d = h->SetpFDeg();
494  /*- try to reduce the s-polynomial -*/
495  pass++;
496  if (!TEST_OPT_REDTHROUGH &&
497  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
498  {
499  h->SetLmCurrRing();
500  if (strat->posInLDependsOnLength)
501  h->SetLength(strat->length_pLength);
502  at = strat->posInL(strat->L,strat->Ll,h,strat);
503  if (at <= strat->Ll)
504  {
505 #ifdef KDEBUG
506  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
507 #endif
508  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
509  h->Clear();
510  return -1;
511  }
512  }
513  if (d != reddeg)
514  {
515  if (d >= (long)strat->tailRing->bitmask)
516  {
517  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
518  {
519  strat->overflow=TRUE;
520  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
521  h->GetP();
522  at = strat->posInL(strat->L,strat->Ll,h,strat);
523  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
524  h->Clear();
525  return -1;
526  }
527  }
528  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
529  {
530  Print(".%ld",d);mflush();
531  reddeg = d;
532  }
533  }
534  }
535 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:376
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define mflush()
Definition: reporter.h:57
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
LSet L
Definition: kutil.h:313
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11031
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
TSet T
Definition: kutil.h:312
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:88
int LazyPass
Definition: kutil.h:341
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978

◆ redSig()

int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 703 of file kstd2.cc.

704 {
705  if (strat->tl<0) return 1;
706  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
707  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
708  assume(h->FDeg == h->pFDeg());
709 //#if 1
710 #ifdef DEBUGF5
711  PrintS("------- IN REDSIG -------\n");
712  Print("p: ");
713  pWrite(pHead(h->p));
714  PrintS("p1: ");
715  pWrite(pHead(h->p1));
716  PrintS("p2: ");
717  pWrite(pHead(h->p2));
718  PrintS("---------------------------\n");
719 #endif
720  poly h_p;
721  int i,j,at,pass, ii;
722  int start=0;
723  int sigSafe;
724  unsigned long not_sev;
725  // long reddeg,d;
726 
727  pass = j = 0;
728  // d = reddeg = h->GetpFDeg();
729  h->SetShortExpVector();
730  int li;
731  h_p = h->GetLmTailRing();
732  not_sev = ~ h->sev;
733  loop
734  {
735  j = kFindDivisibleByInT(strat, h, start);
736  if (j < 0)
737  {
738  return 1;
739  }
740 
741  li = strat->T[j].pLength;
742  ii = j;
743  /*
744  * the polynomial to reduce with (up to the moment) is;
745  * pi with length li
746  */
747  i = j;
748 #if 1
749  if (TEST_OPT_LENGTH)
750  loop
751  {
752  /*- search the shortest possible with respect to length -*/
753  i++;
754  if (i > strat->tl)
755  break;
756  if (li<=1)
757  break;
758  if ((strat->T[i].pLength < li)
759  &&
760  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
761  h_p, not_sev, strat->tailRing))
762  {
763  /*
764  * the polynomial to reduce with is now;
765  */
766  li = strat->T[i].pLength;
767  ii = i;
768  }
769  }
770  start = ii+1;
771 #endif
772 
773  /*
774  * end of search: have to reduce with pi
775  */
776 #ifdef KDEBUG
777  if (TEST_OPT_DEBUG)
778  {
779  PrintS("red:");
780  h->wrp();
781  PrintS(" with ");
782  strat->T[ii].wrp();
783  }
784 #endif
785  assume(strat->fromT == FALSE);
786 //#if 1
787 #ifdef DEBUGF5
788  Print("BEFORE REDUCTION WITH %d:\n",ii);
789  PrintS("--------------------------------\n");
790  pWrite(h->sig);
791  pWrite(strat->T[ii].sig);
792  pWrite(h->GetLmCurrRing());
793  pWrite(pHead(h->p1));
794  pWrite(pHead(h->p2));
795  pWrite(pHead(strat->T[ii].p));
796  PrintS("--------------------------------\n");
797  printf("INDEX OF REDUCER T: %d\n",ii);
798 #endif
799  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
800 #if SBA_PRINT_REDUCTION_STEPS
801  if (sigSafe != 3)
802  sba_reduction_steps++;
803 #endif
804 #if SBA_PRINT_OPERATIONS
805  if (sigSafe != 3)
806  sba_operations += pLength(strat->T[ii].p);
807 #endif
808  // if reduction has taken place, i.e. the reduction was sig-safe
809  // otherwise start is already at the next position and the loop
810  // searching reducers in T goes on from index start
811 //#if 1
812 #ifdef DEBUGF5
813  Print("SigSAFE: %d\n",sigSafe);
814 #endif
815  if (sigSafe != 3)
816  {
817  // start the next search for reducers in T from the beginning
818  start = 0;
819 #ifdef KDEBUG
820  if (TEST_OPT_DEBUG)
821  {
822  PrintS("\nto ");
823  h->wrp();
824  PrintLn();
825  }
826 #endif
827 
828  h_p = h->GetLmTailRing();
829  if (h_p == NULL)
830  {
831  if (h->lcm!=NULL) pLmFree(h->lcm);
832 #ifdef KDEBUG
833  h->lcm=NULL;
834 #endif
835  return 0;
836  }
837  h->SetShortExpVector();
838  not_sev = ~ h->sev;
839  /*
840  * try to reduce the s-polynomial h
841  *test first whether h should go to the lazyset L
842  *-if the degree jumps
843  *-if the number of pre-defined reductions jumps
844  */
845  pass++;
846  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
847  {
848  h->SetLmCurrRing();
849  at = strat->posInL(strat->L,strat->Ll,h,strat);
850  if (at <= strat->Ll)
851  {
852  int dummy=strat->sl;
853  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
854  {
855  return 1;
856  }
857  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
858 #ifdef KDEBUG
859  if (TEST_OPT_DEBUG)
860  Print(" lazy: -> L%d\n",at);
861 #endif
862  h->Clear();
863  return -1;
864  }
865  }
866  }
867  }
868 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:330
int tl
Definition: kutil.h:338
unsigned long * sevT
Definition: kutil.h:311
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:315
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
LSet L
Definition: kutil.h:313
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
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:336
TSet T
Definition: kutil.h:312
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:88
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978

◆ redSigRing()

int redSigRing ( LObject h,
kStrategy  strat 
)

Definition at line 871 of file kstd2.cc.

872 {
873  //Since reduce is really bad for SBA we use the following idea:
874  // We first check if we can build a gcd pair between h and S
875  //where the sig remains the same and replace h by this gcd poly
877  #if GCD_SBA
878  #ifdef ADIDEBUG
879  printf("\nBefore sbaCheckGcdPair ");pWrite(h->p);
880  #endif
881  while(sbaCheckGcdPair(h,strat))
882  {
883  #ifdef ADIDEBUG
884  printf("\nIntermidiate sbaCheckGcdPair ");pWrite(h->p);
885  #endif
886  h->sev = pGetShortExpVector(h->p);
887  }
888  #ifdef ADIDEBUG
889  printf("\nAfter sbaCheckGcdPair ");pWrite(h->p);
890  #endif
891  #endif
892  poly beforeredsig;
893  beforeredsig = pCopy(h->sig);
894 
895  if (strat->tl<0) return 1;
896  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
897  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
898  assume(h->FDeg == h->pFDeg());
899  #ifdef ADIDEBUG
900  printf("\n--------------------------redSig-------------------------------------\n");
901  printf("\nBefore redSig:\n");
902  p_Write(h->p,strat->tailRing);pWrite(h->sig);
903  #endif
904 //#if 1
905 #ifdef DEBUGF5
906  Print("------- IN REDSIG -------\n");
907  Print("p: ");
908  pWrite(pHead(h->p));
909  Print("p1: ");
910  pWrite(pHead(h->p1));
911  Print("p2: ");
912  pWrite(pHead(h->p2));
913  Print("---------------------------\n");
914 #endif
915  poly h_p;
916  int i,j,at,pass, ii;
917  int start=0;
918  int sigSafe;
919  unsigned long not_sev;
920  // long reddeg,d;
921 
922  pass = j = 0;
923  // d = reddeg = h->GetpFDeg();
924  h->SetShortExpVector();
925  int li;
926  h_p = h->GetLmTailRing();
927  not_sev = ~ h->sev;
928  loop
929  {
930  j = kFindDivisibleByInT(strat, h, start);
931  if (j < 0)
932  {
933  #if GCD_SBA
934  #ifdef ADIDEBUG
935  printf("\nBefore sbaCheckGcdPair ");pWrite(h->p);
936  #endif
937  while(sbaCheckGcdPair(h,strat))
938  {
939  #ifdef ADIDEBUG
940  printf("\nIntermidiate sbaCheckGcdPair ");pWrite(h->p);
941  #endif
942  h->sev = pGetShortExpVector(h->p);
943  h->is_redundant = FALSE;
944  start = 0;
945  }
946  #ifdef ADIDEBUG
947  printf("\nAfter sbaCheckGcdPair ");pWrite(h->p);
948  #endif
949  #endif
950  // over ZZ: cleanup coefficients by complete reduction with monomials
951  postReduceByMonSig(h, strat);
952  if(h->p == NULL || nIsZero(pGetCoeff(h->p))) return 2;
953  j = kFindDivisibleByInT(strat, h,start);
954  if(j < 0)
955  {
956  if(strat->tl >= 0)
957  h->i_r1 = strat->tl;
958  else
959  h->i_r1 = -1;
960  if (h->GetLmTailRing() == NULL)
961  {
962  if (h->lcm!=NULL) pLmDelete(h->lcm);
963  h->Clear();
964  return 0;
965  }
966  //Check for sigdrop after reduction
967  if(pLtCmp(beforeredsig,h->sig) == 1)
968  {
969  #ifdef ADIDEBUG
970  printf("\nSigDrop after reduce\n");pWrite(beforeredsig);pWrite(h->sig);
971  #endif
972  strat->sigdrop = TRUE;
973  //Reduce it as much as you can
974  int red_result = redRing(h,strat);
975  if(red_result == 0)
976  {
977  //It reduced to 0, cancel the sigdrop
978  #ifdef ADIDEBUG
979  printf("\nReduced to 0 via redRing. Cancel sigdrop\n");
980  #endif
981  strat->sigdrop = FALSE;
982  p_Delete(&h->sig,currRing);h->sig = NULL;
983  return 0;
984  }
985  else
986  {
987  #ifdef ADIDEBUG
988  printf("\nReduced to this via redRing.SIGDROP\n");pWrite(h->p);
989  #endif
990  //strat->enterS(*h, strat->sl+1, strat, strat->tl);
991  return 0;
992  }
993  }
994  p_Delete(&beforeredsig,currRing);
995  return 1;
996  }
997  }
998 
999  li = strat->T[j].pLength;
1000  ii = j;
1001  /*
1002  * the polynomial to reduce with (up to the moment) is;
1003  * pi with length li
1004  */
1005  i = j;
1006  if (TEST_OPT_LENGTH)
1007  loop
1008  {
1009  /*- search the shortest possible with respect to length -*/
1010  i++;
1011  if (i > strat->tl)
1012  break;
1013  if (li<=1)
1014  break;
1015  if ((strat->T[i].pLength < li)
1016  && n_DivBy(pGetCoeff(h_p),pGetCoeff(strat->T[i].p),currRing->cf)
1017  && p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1018  h_p, not_sev, strat->tailRing))
1019  {
1020  /*
1021  * the polynomial to reduce with is now;
1022  */
1023  li = strat->T[i].pLength;
1024  ii = i;
1025  }
1026  }
1027 
1028  start = ii+1;
1029 
1030  /*
1031  * end of search: have to reduce with pi
1032  */
1033 #ifdef KDEBUG
1034  if (TEST_OPT_DEBUG)
1035  {
1036  PrintS("red:");
1037  h->wrp();
1038  PrintS(" with ");
1039  strat->T[ii].wrp();
1040  }
1041 #endif
1042  assume(strat->fromT == FALSE);
1043 //#if 1
1044 #ifdef DEBUGF5
1045  Print("BEFORE REDUCTION WITH %d:\n",ii);
1046  Print("--------------------------------\n");
1047  pWrite(h->sig);
1048  pWrite(strat->T[ii].sig);
1049  pWrite(h->GetLmCurrRing());
1050  pWrite(pHead(h->p1));
1051  pWrite(pHead(h->p2));
1052  pWrite(pHead(strat->T[ii].p));
1053  Print("--------------------------------\n");
1054  printf("INDEX OF REDUCER T: %d\n",ii);
1055 #endif
1056  #ifdef ADIDEBUG
1057  printf("\nWe reduce it with:\n");p_Write(strat->T[ii].p,strat->tailRing);pWrite(strat->T[ii].sig);
1058  #endif
1059  sigSafe = ksReducePolySigRing(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
1060  #ifdef ADIDEBUG
1061  printf("\nAfter small reduction:\n");pWrite(h->p);pWrite(h->sig);
1062  #endif
1063  if(h->p == NULL && h->sig == NULL)
1064  {
1065  //Trivial case catch
1066  strat->sigdrop = FALSE;
1067  }
1068  #if 0
1069  //If the reducer has the same lt (+ or -) as the other one, reduce it via redRing
1070  //In some cases this proves to be very bad
1071  if(rField_is_Ring(currRing) && h->p != NULL && pLmCmp(h->p,strat->T[ii].p)==0)
1072  {
1073  #ifdef ADIDEBUG
1074  printf("\nReducer and Original have same LT. Force it with redRing!\n");
1075  #endif
1076  int red_result = redRing(h,strat);
1077  if(red_result == 0)
1078  {
1079  #ifdef ADIDEBUG
1080  printf("\nRedRing reduced it to 0. Perfect\n");
1081  #endif
1082  pDelete(&h->sig);h->sig = NULL;
1083  return 0;
1084  }
1085  else
1086  {
1087  #ifdef ADIDEBUG
1088  printf("\nRedRing reduced it to *.\nHave to sigdrop now\n");pWrite(h->p);
1089  #endif
1090  strat->sigdrop = TRUE;
1091  return 1;
1092  }
1093  }
1094  #endif
1095  if(strat->sigdrop)
1096  return 1;
1097 #if SBA_PRINT_REDUCTION_STEPS
1098  if (sigSafe != 3)
1099  sba_reduction_steps++;
1100 #endif
1101 #if SBA_PRINT_OPERATIONS
1102  if (sigSafe != 3)
1103  sba_operations += pLength(strat->T[ii].p);
1104 #endif
1105  // if reduction has taken place, i.e. the reduction was sig-safe
1106  // otherwise start is already at the next position and the loop
1107  // searching reducers in T goes on from index start
1108 //#if 1
1109 #ifdef DEBUGF5
1110  Print("SigSAFE: %d\n",sigSafe);
1111 #endif
1112  if (sigSafe != 3)
1113  {
1114  // start the next search for reducers in T from the beginning
1115  start = 0;
1116 #ifdef KDEBUG
1117  if (TEST_OPT_DEBUG)
1118  {
1119  PrintS("\nto ");
1120  h->wrp();
1121  PrintLn();
1122  }
1123 #endif
1124 
1125  h_p = h->GetLmTailRing();
1126  if (h_p == NULL)
1127  {
1128  if (h->lcm!=NULL) pLmFree(h->lcm);
1129 #ifdef KDEBUG
1130  h->lcm=NULL;
1131 #endif
1132  return 0;
1133  }
1134  h->SetShortExpVector();
1135  not_sev = ~ h->sev;
1136  /*
1137  * try to reduce the s-polynomial h
1138  *test first whether h should go to the lazyset L
1139  *-if the degree jumps
1140  *-if the number of pre-defined reductions jumps
1141  */
1142  pass++;
1143  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1144  {
1145  h->SetLmCurrRing();
1146  at = strat->posInL(strat->L,strat->Ll,h,strat);
1147  if (at <= strat->Ll)
1148  {
1149  int dummy=strat->sl;
1150  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1151  {
1152  return 1;
1153  }
1154  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1155 #ifdef KDEBUG
1156  if (TEST_OPT_DEBUG)
1157  Print(" lazy: -> L%d\n",at);
1158 #endif
1159  h->Clear();
1160  return -1;
1161  }
1162  }
1163  }
1164  }
1165 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
bool sigdrop
Definition: kutil.h:348
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition: kutil.cc:11099
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:330
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
Definition: kutil.cc:1663
int tl
Definition: kutil.h:338
#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
unsigned long * sevT
Definition: kutil.h:311
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
LSet L
Definition: kutil.h:313
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
#define pDelete(p_ptr)
Definition: polys.h:169
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:336
TSet T
Definition: kutil.h:312
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
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:88
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:513

◆ redtail() [1/2]

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

Definition at line 7566 of file kutil.cc.

7567 {
7568  LObject L(p, currRing);
7569  return redtail(&L, pos, strat);
7570 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

◆ redtail() [2/2]

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

Definition at line 7496 of file kutil.cc.

7497 {
7498  poly h, hn;
7499  strat->redTailChange=FALSE;
7500 
7501  L->GetP();
7502  poly p = L->p;
7503  if (strat->noTailReduction || pNext(p) == NULL)
7504  return p;
7505 
7506  LObject Ln(strat->tailRing);
7507  TObject* With;
7508  // placeholder in case strat->tl < 0
7509  TObject With_s(strat->tailRing);
7510  h = p;
7511  hn = pNext(h);
7512  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7513  long e;
7514  int l;
7515  BOOLEAN save_HE=strat->kHEdgeFound;
7516  strat->kHEdgeFound |=
7517  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7518 
7519  while(hn != NULL)
7520  {
7521  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7522  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7523  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7524  loop
7525  {
7526  Ln.Set(hn, strat->tailRing);
7527  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7528  if (strat->kHEdgeFound)
7529  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7530  else
7531  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
7532  if (With == NULL) break;
7533  With->length=0;
7534  With->pLength=0;
7535  strat->redTailChange=TRUE;
7536  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7537  {
7538  // reducing the tail would violate the exp bound
7539  if (kStratChangeTailRing(strat, L))
7540  {
7541  strat->kHEdgeFound = save_HE;
7542  return redtail(L, pos, strat);
7543  }
7544  else
7545  return NULL;
7546  }
7547  hn = pNext(h);
7548  if (hn == NULL) goto all_done;
7549  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7550  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7551  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7552  }
7553  h = hn;
7554  hn = pNext(h);
7555  }
7556 
7557  all_done:
7558  if (strat->redTailChange)
7559  {
7560  L->pLength = 0;
7561  }
7562  strat->kHEdgeFound = save_HE;
7563  return p;
7564 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define TRUE
Definition: auxiliary.h:98
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7358
int Kstd1_deg
Definition: kutil.cc:236
BOOLEAN kHEdgeFound
Definition: kutil.h:365
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:388
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:51

◆ redtailBba() [1/3]

KINLINE poly redtailBba ( poly  p,
int  pos,
kStrategy  strat,
BOOLEAN  normalize = FALSE 
)

Definition at line 1091 of file kInline.h.

1092 {
1093  LObject L(p);
1094  return redtailBba(&L, pos, strat,FALSE, normalize);
1095 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:52
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091

◆ redtailBba() [2/3]

poly redtailBba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 7572 of file kutil.cc.

7573 {
7574 #define REDTAIL_CANONICALIZE 100
7575  strat->redTailChange=FALSE;
7576  if (strat->noTailReduction) return L->GetLmCurrRing();
7577  poly h, p;
7578  p = h = L->GetLmTailRing();
7579  if ((h==NULL) || (pNext(h)==NULL))
7580  return L->GetLmCurrRing();
7581 
7582  TObject* With;
7583  // placeholder in case strat->tl < 0
7584  TObject With_s(strat->tailRing);
7585 
7586  LObject Ln(pNext(h), strat->tailRing);
7587  Ln.pLength = L->GetpLength() - 1;
7588 
7589  pNext(h) = NULL;
7590  if (L->p != NULL) pNext(L->p) = NULL;
7591  L->pLength = 1;
7592 
7593  Ln.PrepareRed(strat->use_buckets);
7594 
7595  int cnt=REDTAIL_CANONICALIZE;
7596  while(!Ln.IsNull())
7597  {
7598  loop
7599  {
7600  if (TEST_OPT_IDLIFT)
7601  {
7602  if (Ln.p!=NULL)
7603  {
7604  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7605  }
7606  else
7607  {
7608  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7609  }
7610  }
7611  Ln.SetShortExpVector();
7612  if (withT)
7613  {
7614  int j;
7615  j = kFindDivisibleByInT(strat, &Ln);
7616  if (j < 0) break;
7617  With = &(strat->T[j]);
7618  }
7619  else
7620  {
7621  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7622  if (With == NULL) break;
7623  }
7624  cnt--;
7625  if (cnt==0)
7626  {
7628  /*poly tmp=*/Ln.CanonicalizeP();
7629  if (normalize)
7630  {
7631  Ln.Normalize();
7632  //pNormalize(tmp);
7633  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7634  }
7635  }
7636  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7637  {
7638  With->pNorm();
7639  }
7640  strat->redTailChange=TRUE;
7641  if (ksReducePolyTail(L, With, &Ln))
7642  {
7643  // reducing the tail would violate the exp bound
7644  // set a flag and hope for a retry (in bba)
7645  strat->completeReduce_retry=TRUE;
7646  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7647  do
7648  {
7649  pNext(h) = Ln.LmExtractAndIter();
7650  pIter(h);
7651  L->pLength++;
7652  } while (!Ln.IsNull());
7653  goto all_done;
7654  }
7655  if (Ln.IsNull()) goto all_done;
7656  if (! withT) With_s.Init(currRing);
7657  }
7658  pNext(h) = Ln.LmExtractAndIter();
7659  pIter(h);
7660  pNormalize(h);
7661  L->pLength++;
7662  }
7663 
7664  all_done:
7665  Ln.Delete();
7666  if (L->p != NULL) pNext(L->p) = pNext(p);
7667 
7668  if (strat->redTailChange)
7669  {
7670  L->length = 0;
7671  L->pLength = 0;
7672  }
7673 
7674  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7675  //L->Normalize(); // HANNES: should have a test
7676  kTest_L(L);
7677  return L->GetLmCurrRing();
7678 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
int syzComp
Definition: kutil.h:342
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define p_GetComp(p, r)
Definition: monomials.h:72
#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:51
char completeReduce_retry
Definition: kutil.h:392
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:644
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7358
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:331
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
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:88
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:388
class sTObject TObject
Definition: kutil.h:51

◆ redtailBba() [3/3]

poly redtailBba ( TObject T,
int  pos,
kStrategy  strat 
)

Definition at line 1111 of file kInline.h.

1112 {
1113  LObject L;
1114  L = *T;
1115  poly p = redtailBba(&L, pos, strat, FALSE);
1116  *T = L;
1117  //kTest_T(T);
1118  assume( p == T->p);
1119  return p;
1120 }
class sLObject LObject
Definition: kutil.h:52
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
#define assume(x)
Definition: mod2.h:394
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10

◆ redtailBba_Z() [1/2]

KINLINE poly redtailBba_Z ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 1104 of file kInline.h.

1105 {
1106  LObject L(p, currRing, strat->tailRing);
1107  return redtailBba_Z(&L, pos, strat);
1108 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1104
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ring tailRing
Definition: kutil.h:331

◆ redtailBba_Z() [2/2]

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

Definition at line 7797 of file kutil.cc.

7799 {
7800  strat->redTailChange=FALSE;
7801  if (strat->noTailReduction) return L->GetLmCurrRing();
7802  poly h, p;
7803  p = h = L->GetLmTailRing();
7804  if ((h==NULL) || (pNext(h)==NULL))
7805  return L->GetLmCurrRing();
7806 
7807  TObject* With;
7808  // placeholder in case strat->tl < 0
7809  TObject With_s(strat->tailRing);
7810 
7811  LObject Ln(pNext(h), strat->tailRing);
7812  Ln.pLength = L->GetpLength() - 1;
7813 
7814  pNext(h) = NULL;
7815  if (L->p != NULL) pNext(L->p) = NULL;
7816  L->pLength = 1;
7817 
7818  Ln.PrepareRed(strat->use_buckets);
7819 
7820  int cnt=REDTAIL_CANONICALIZE;
7821  while(!Ln.IsNull())
7822  {
7823  loop
7824  {
7825  Ln.SetShortExpVector();
7826  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7827  if (With == NULL) break;
7828  cnt--;
7829  if (cnt==0)
7830  {
7832  /*poly tmp=*/Ln.CanonicalizeP();
7833  }
7834  // we are in Z, do not call pNorm
7835  strat->redTailChange=TRUE;
7836  // test divisibility of coefs:
7837  poly p_Ln=Ln.GetLmCurrRing();
7838  poly p_With=With->GetLmCurrRing();
7839  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7840  if (!nIsZero(z))
7841  {
7842  // subtract z*Ln, add z.Ln to L
7843  poly m=pHead(p_Ln);
7844  pSetCoeff(m,z);
7845  poly mm=pHead(m);
7846  pNext(h) = m;
7847  pIter(h);
7848  L->pLength++;
7849  mm=pNeg(mm);
7850  if (Ln.bucket!=NULL)
7851  {
7852  int dummy=1;
7853  kBucket_Add_q(Ln.bucket,mm,&dummy);
7854  }
7855  else
7856  {
7857  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7858  Ln.GetP();
7859  if (Ln.p!=NULL)
7860  {
7861  Ln.p=pAdd(Ln.p,mm);
7862  if (Ln.t_p!=NULL)
7863  {
7864  pNext(Ln.t_p)=NULL;
7865  p_LmDelete(Ln.t_p,strat->tailRing);
7866  }
7867  }
7868  }
7869  }
7870  else
7871  nDelete(&z);
7872 
7873  if (ksReducePolyTail(L, With, &Ln))
7874  {
7875  // reducing the tail would violate the exp bound
7876  // set a flag and hope for a retry (in bba)
7877  strat->completeReduce_retry=TRUE;
7878  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7879  do
7880  {
7881  pNext(h) = Ln.LmExtractAndIter();
7882  pIter(h);
7883  L->pLength++;
7884  } while (!Ln.IsNull());
7885  goto all_done;
7886  }
7887  if (Ln.IsNull()) goto all_done;
7888  With_s.Init(currRing);
7889  }
7890  pNext(h) = Ln.LmExtractAndIter();
7891  pIter(h);
7892  pNormalize(h);
7893  L->pLength++;
7894  }
7895 
7896  all_done:
7897  Ln.Delete();
7898  if (L->p != NULL) pNext(L->p) = pNext(p);
7899 
7900  if (strat->redTailChange)
7901  {
7902  L->length = 0;
7903  }
7904 
7905  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7906  //L->Normalize(); // HANNES: should have a test
7907  kTest_L(L);
7908  return L->GetLmCurrRing();
7909 }
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:632
#define pAdd(p, q)
Definition: polys.h:186
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define pNeg(p)
Definition: polys.h:181
#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:51
char completeReduce_retry
Definition: kutil.h:392
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:644
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7358
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:388
class sTObject TObject
Definition: kutil.h:51
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:628

◆ redtailBbaBound() [1/2]

KINLINE poly redtailBbaBound ( poly  p,
int  pos,
kStrategy  strat,
int  bound,
BOOLEAN  normalize = FALSE 
)

Definition at line 1097 of file kInline.h.

1098 {
1099  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1100  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1101 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
class sLObject LObject
Definition: kutil.h:52
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1097
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ring tailRing
Definition: kutil.h:331

◆ redtailBbaBound() [2/2]

poly redtailBbaBound ( LObject L,
int  pos,
kStrategy  strat,
int  bound,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 7680 of file kutil.cc.

7681 {
7682 #define REDTAIL_CANONICALIZE 100
7683  strat->redTailChange=FALSE;
7684  if (strat->noTailReduction) return L->GetLmCurrRing();
7685  poly h, p;
7686  p = h = L->GetLmTailRing();
7687  if ((h==NULL) || (pNext(h)==NULL))
7688  return L->GetLmCurrRing();
7689 
7690  TObject* With;
7691  // placeholder in case strat->tl < 0
7692  TObject With_s(strat->tailRing);
7693 
7694  LObject Ln(pNext(h), strat->tailRing);
7695  Ln.pLength = L->GetpLength() - 1;
7696 
7697  pNext(h) = NULL;
7698  if (L->p != NULL) pNext(L->p) = NULL;
7699  L->pLength = 1;
7700 
7701  Ln.PrepareRed(strat->use_buckets);
7702 
7703  int cnt=REDTAIL_CANONICALIZE;
7704  while(!Ln.IsNull())
7705  {
7706  loop
7707  {
7708  if (TEST_OPT_IDLIFT)
7709  {
7710  if (Ln.p!=NULL)
7711  {
7712  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7713  }
7714  else
7715  {
7716  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7717  }
7718  }
7719  Ln.SetShortExpVector();
7720  if (withT)
7721  {
7722  int j;
7723  j = kFindDivisibleByInT(strat, &Ln);
7724  if (j < 0) break;
7725  With = &(strat->T[j]);
7726  }
7727  else
7728  {
7729  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7730  if (With == NULL) break;
7731  }
7732  cnt--;
7733  if (cnt==0)
7734  {
7736  /*poly tmp=*/Ln.CanonicalizeP();
7737  if (normalize)
7738  {
7739  Ln.Normalize();
7740  //pNormalize(tmp);
7741  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7742  }
7743  }
7744  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7745  {
7746  With->pNorm();
7747  }
7748  strat->redTailChange=TRUE;
7749  if (ksReducePolyTail(L, With, &Ln))
7750  {
7751  // reducing the tail would violate the exp bound
7752  // set a flag and hope for a retry (in bba)
7753  strat->completeReduce_retry=TRUE;
7754  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7755  do
7756  {
7757  pNext(h) = Ln.LmExtractAndIter();
7758  pIter(h);
7759  L->pLength++;
7760  } while (!Ln.IsNull());
7761  goto all_done;
7762  }
7763  if(!Ln.IsNull())
7764  {
7765  Ln.GetP();
7766  Ln.p = pJet(Ln.p,bound);
7767  }
7768  if (Ln.IsNull())
7769  {
7770  goto all_done;
7771  }
7772  if (! withT) With_s.Init(currRing);
7773  }
7774  pNext(h) = Ln.LmExtractAndIter();
7775  pIter(h);
7776  pNormalize(h);
7777  L->pLength++;
7778  }
7779 
7780  all_done:
7781  Ln.Delete();
7782  if (L->p != NULL) pNext(L->p) = pNext(p);
7783 
7784  if (strat->redTailChange)
7785  {
7786  L->length = 0;
7787  L->pLength = 0;
7788  }
7789 
7790  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7791  //L->Normalize(); // HANNES: should have a test
7792  kTest_L(L);
7793  return L->GetLmCurrRing();
7794 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:342
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define p_GetComp(p, r)
Definition: monomials.h:72
#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:51
char completeReduce_retry
Definition: kutil.h:392
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:644
#define pJet(p, m)
Definition: polys.h:350
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7358
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:331
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
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:88
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:388
class sTObject TObject
Definition: kutil.h:51

◆ redtailBbaShift()

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

Definition at line 12740 of file kutil.cc.

12741 {
12742  /* for the shift case need to run it with withT = TRUE */
12743  strat->redTailChange=FALSE;
12744  if (strat->noTailReduction) return L->GetLmCurrRing();
12745  poly h, p;
12746  p = h = L->GetLmTailRing();
12747  if ((h==NULL) || (pNext(h)==NULL))
12748  return L->GetLmCurrRing();
12749 
12750  TObject* With;
12751  // placeholder in case strat->tl < 0
12752  TObject With_s(strat->tailRing);
12753 
12754  LObject Ln(pNext(h), strat->tailRing);
12755  Ln.pLength = L->GetpLength() - 1;
12756 
12757  pNext(h) = NULL;
12758  if (L->p != NULL) pNext(L->p) = NULL;
12759  L->pLength = 1;
12760 
12761  Ln.PrepareRed(strat->use_buckets);
12762 
12763  while(!Ln.IsNull())
12764  {
12765  loop
12766  {
12767  Ln.SetShortExpVector();
12768  if (withT)
12769  {
12770  int j;
12771  j = kFindDivisibleByInT(strat, &Ln);
12772  if (j < 0) break;
12773  With = &(strat->T[j]);
12774  }
12775  else
12776  {
12777  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12778  if (With == NULL) break;
12779  }
12780  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12781  {
12782  With->pNorm();
12783  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12784  }
12785  strat->redTailChange=TRUE;
12786  if (ksReducePolyTail(L, With, &Ln))
12787  {
12788  // reducing the tail would violate the exp bound
12789  // set a flag and hope for a retry (in bba)
12790  strat->completeReduce_retry=TRUE;
12791  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12792  do
12793  {
12794  pNext(h) = Ln.LmExtractAndIter();
12795  pIter(h);
12796  L->pLength++;
12797  } while (!Ln.IsNull());
12798  goto all_done;
12799  }
12800  if (Ln.IsNull()) goto all_done;
12801  if (! withT) With_s.Init(currRing);
12802  }
12803  pNext(h) = Ln.LmExtractAndIter();
12804  pIter(h);
12805  L->pLength++;
12806  }
12807 
12808  all_done:
12809  Ln.Delete();
12810  if (L->p != NULL) pNext(L->p) = pNext(p);
12811 
12812  if (strat->redTailChange)
12813  {
12814  L->length = 0;
12815  }
12816  L->Normalize(); // HANNES: should have a test
12817  kTest_L(L);
12818  return L->GetLmCurrRing();
12819 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#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:51
char completeReduce_retry
Definition: kutil.h:392
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define kTest_L(T)
Definition: kutil.h:644
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7358
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
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:88
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:388
class sTObject TObject
Definition: kutil.h:51

◆ redtailSba()

poly redtailSba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 1168 of file kstd2.cc.

1169 {
1170 #define REDTAIL_CANONICALIZE 100
1171  strat->redTailChange=FALSE;
1172  if (strat->noTailReduction) return L->GetLmCurrRing();
1173  poly h, p;
1174  p = h = L->GetLmTailRing();
1175  if ((h==NULL) || (pNext(h)==NULL))
1176  return L->GetLmCurrRing();
1177 
1178  TObject* With;
1179  // placeholder in case strat->tl < 0
1180  TObject With_s(strat->tailRing);
1181 
1182  LObject Ln(pNext(h), strat->tailRing);
1183  Ln.sig = L->sig;
1184  Ln.sevSig = L->sevSig;
1185  Ln.pLength = L->GetpLength() - 1;
1186 
1187  pNext(h) = NULL;
1188  if (L->p != NULL) pNext(L->p) = NULL;
1189  L->pLength = 1;
1190 
1191  Ln.PrepareRed(strat->use_buckets);
1192 
1193  int cnt=REDTAIL_CANONICALIZE;
1194  while(!Ln.IsNull())
1195  {
1196  loop
1197  {
1198  if(rField_is_Ring(currRing) && strat->sigdrop)
1199  break;
1200  Ln.SetShortExpVector();
1201  if (withT)
1202  {
1203  int j;
1204  j = kFindDivisibleByInT(strat, &Ln);
1205  if (j < 0) break;
1206  With = &(strat->T[j]);
1207  }
1208  else
1209  {
1210  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
1211  if (With == NULL) break;
1212  }
1213  cnt--;
1214  if (cnt==0)
1215  {
1217  /*poly tmp=*/Ln.CanonicalizeP();
1219  {
1220  Ln.Normalize();
1221  //pNormalize(tmp);
1222  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1223  }
1224  }
1225  if (normalize && (!TEST_OPT_INTSTRATEGY) && !rField_is_Ring(currRing) && (!nIsOne(pGetCoeff(With->p))))
1226  {
1227  With->pNorm();
1228  }
1229  strat->redTailChange=TRUE;
1230  #ifdef ADIDEBUG
1231  printf("\nWill TAILreduce * with *:\n");p_Write(Ln.p,strat->tailRing);pWrite(Ln.sig);
1232  p_Write(With->p,strat->tailRing);pWrite(With->sig);pWrite(L->sig);
1233  #endif
1234  int ret = ksReducePolyTailSig(L, With, &Ln, strat);
1236  L->sig = Ln.sig;
1237  //Because Ln.sig is set to L->sig, but in ksReducePolyTailSig -> ksReducePolySig
1238  // I delete it an then set Ln.sig. Hence L->sig is lost
1239  #ifdef ADIDEBUG
1240  printf("\nAfter small TAILreduce:\n");pWrite(Ln.p);pWrite(Ln.sig);pWrite(L->sig);
1241  #endif
1242 #if SBA_PRINT_REDUCTION_STEPS
1243  if (ret != 3)
1244  sba_reduction_steps++;
1245 #endif
1246 #if SBA_PRINT_OPERATIONS
1247  if (ret != 3)
1248  sba_operations += pLength(With->p);
1249 #endif
1250  if (ret)
1251  {
1252  // reducing the tail would violate the exp bound
1253  // set a flag and hope for a retry (in bba)
1254  strat->completeReduce_retry=TRUE;
1255  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
1256  do
1257  {
1258  pNext(h) = Ln.LmExtractAndIter();
1259  pIter(h);
1260  L->pLength++;
1261  } while (!Ln.IsNull());
1262  goto all_done;
1263  }
1264  if (Ln.IsNull()) goto all_done;
1265  if (! withT) With_s.Init(currRing);
1266  if(rField_is_Ring(currRing) && strat->sigdrop)
1267  {
1268  //Cannot break the loop here so easily
1269  break;
1270  }
1271  }
1272  pNext(h) = Ln.LmExtractAndIter();
1273  pIter(h);
1274  if(!rField_is_Ring(currRing))
1275  pNormalize(h);
1276  L->pLength++;
1277  }
1278  all_done:
1279  Ln.Delete();
1280  if (L->p != NULL) pNext(L->p) = pNext(p);
1281 
1282  if (strat->redTailChange)
1283  {
1284  L->length = 0;
1285  }
1286  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
1287  //L->Normalize(); // HANNES: should have a test
1288  kTest_L(L);
1289  return L->GetLmCurrRing();
1290 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:52
bool sigdrop
Definition: kutil.h:348
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:392
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
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:197
#define kTest_L(T)
Definition: kutil.h:644
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define REDTAIL_CANONICALIZE
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
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:88
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
Definition: kstd2.cc:665
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:388
class sTObject TObject
Definition: kutil.h:51

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 5049 of file kutil.cc.

5050 {
5051  int i,j,at,ecart, s2r;
5052  int fq=0;
5053  unsigned long sev;
5054  poly p;
5055  int new_suc=strat->sl+1;
5056  i= *suc;
5057  if (i<0) i=0;
5058 
5059  for (; i<=strat->sl; i++)
5060  {
5061  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5062  if (at != i)
5063  {
5064  if (new_suc > at) new_suc = at;
5065  p = strat->S[i];
5066  ecart = strat->ecartS[i];
5067  sev = strat->sevS[i];
5068  s2r = strat->S_2_R[i];
5069  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5070  for (j=i; j>=at+1; j--)
5071  {
5072  strat->S[j] = strat->S[j-1];
5073  strat->ecartS[j] = strat->ecartS[j-1];
5074  strat->sevS[j] = strat->sevS[j-1];
5075  strat->S_2_R[j] = strat->S_2_R[j-1];
5076  }
5077  strat->S[at] = p;
5078  strat->ecartS[at] = ecart;
5079  strat->sevS[at] = sev;
5080  strat->S_2_R[at] = s2r;
5081  if (strat->fromQ!=NULL)
5082  {
5083  for (j=i; j>=at+1; j--)
5084  {
5085  strat->fromQ[j] = strat->fromQ[j-1];
5086  }
5087  strat->fromQ[at]=fq;
5088  }
5089  }
5090  }
5091  if (new_suc <= strat->sl) *suc=new_suc;
5092  else *suc=-1;
5093 }
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:307
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
intset ecartS
Definition: kutil.h:295
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
polyrec * poly
Definition: hilb.h:10

◆ sba()

ideal sba ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 2355 of file kstd2.cc.

2356 {
2357  // ring order stuff:
2358  // in sba we have (until now) two possibilities:
2359  // 1. an incremental computation w.r.t. (C,monomial order)
2360  // 2. a (possibly non-incremental) computation w.r.t. the
2361  // induced Schreyer order.
2362  // The corresponding orders are computed in sbaRing(), depending
2363  // on the flag strat->sbaOrder
2364 #if SBA_PRINT_ZERO_REDUCTIONS
2365  long zeroreductions = 0;
2366 #endif
2367 #if SBA_PRINT_PRODUCT_CRITERION
2368  long product_criterion = 0;
2369 #endif
2370 #if SBA_PRINT_SIZE_G
2371  int size_g = 0;
2372  int size_g_non_red = 0;
2373 #endif
2374 #if SBA_PRINT_SIZE_SYZ
2375  long size_syz = 0;
2376 #endif
2377  // global variable
2378 #if SBA_PRINT_REDUCTION_STEPS
2379  sba_reduction_steps = 0;
2380  sba_interreduction_steps = 0;
2381 #endif
2382 #if SBA_PRINT_OPERATIONS
2383  sba_operations = 0;
2384  sba_interreduction_operations = 0;
2385 #endif
2386 
2387  ideal F1 = F0;
2388  ring sRing, currRingOld;
2389  currRingOld = currRing;
2390  if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
2391  {
2392  sRing = sbaRing(strat);
2393  if (sRing!=currRingOld)
2394  {
2395  rChangeCurrRing (sRing);
2396  F1 = idrMoveR (F0, currRingOld, currRing);
2397  }
2398  }
2399  ideal F;
2400  // sort ideal F
2401  //Put the SigDrop element on the correct position (think of sbaEnterS)
2402  //We also sort them
2403  if(rField_is_Ring(currRing) && strat->sigdrop)
2404  {
2405  #if 1
2406  F = idInit(IDELEMS(F1),F1->rank);
2407  for (int i=0; i<IDELEMS(F1);++i)
2408  F->m[i] = F1->m[i];
2409  if(strat->sbaEnterS >= 0)
2410  {
2411  poly dummy;
2412  dummy = pCopy(F->m[0]); //the sigdrop element
2413  for(int i = 0;i<strat->sbaEnterS;i++)
2414  F->m[i] = F->m[i+1];
2415  F->m[strat->sbaEnterS] = dummy;
2416  }
2417  #else
2418  F = idInit(1,F1->rank);
2419  //printf("\nBefore the initial block sorting:\n");idPrint(F1);
2420  F->m[0] = F1->m[0];
2421  int pos;
2422  if(strat->sbaEnterS >= 0)
2423  {
2424  for(int i=1;i<=strat->sbaEnterS;i++)
2425  {
2426  pos = posInIdealMonFirst(F,F1->m[i],1,strat->sbaEnterS);
2427  idInsertPolyOnPos(F,F1->m[i],pos);
2428  }
2429  for(int i=strat->sbaEnterS+1;i<IDELEMS(F1);i++)
2430  {
2431  pos = posInIdealMonFirst(F,F1->m[i],strat->sbaEnterS+1,IDELEMS(F));
2432  idInsertPolyOnPos(F,F1->m[i],pos);
2433  }
2434  poly dummy;
2435  dummy = pCopy(F->m[0]); //the sigdrop element
2436  for(int i = 0;i<strat->sbaEnterS;i++)
2437  F->m[i] = F->m[i+1];
2438  F->m[strat->sbaEnterS] = dummy;
2439  }
2440  else
2441  {
2442  for(int i=1;i<IDELEMS(F1);i++)
2443  {
2444  pos = posInIdealMonFirst(F,F1->m[i],1,IDELEMS(F));
2445  idInsertPolyOnPos(F,F1->m[i],pos);
2446  }
2447  }
2448  #endif
2449  //printf("\nAfter the initial block sorting:\n");idPrint(F);getchar();
2450  }
2451  else
2452  {
2453  F = idInit(IDELEMS(F1),F1->rank);
2454  intvec *sort = idSort(F1);
2455  for (int i=0; i<sort->length();++i)
2456  F->m[i] = F1->m[(*sort)[i]-1];
2458  {
2459  // put the monomials after the sbaEnterS polynomials
2460  //printf("\nThis is the ideal before sorting (sbaEnterS = %i)\n",strat->sbaEnterS);idPrint(F);
2461  int nrmon = 0;
2462  for(int i = IDELEMS(F)-1,j;i>strat->sbaEnterS+nrmon+1 ;i--)
2463  {
2464  //pWrite(F->m[i]);
2465  if(F->m[i] != NULL && pNext(F->m[i]) == NULL)
2466  {
2467  poly mon = F->m[i];
2468  for(j = i;j>strat->sbaEnterS+nrmon+1;j--)
2469  {
2470  F->m[j] = F->m[j-1];
2471  }
2472  F->m[j] = mon;
2473  nrmon++;
2474  }
2475  //idPrint(F);
2476  }
2477  }
2478  }
2479  //printf("\nThis is the ideal after sorting\n");idPrint(F);getchar();
2481  strat->sigdrop = FALSE;
2482  strat->nrsyzcrit = 0;
2483  strat->nrrewcrit = 0;
2485  F = kInterRed(F,NULL);
2486 #endif
2487 #if F5DEBUG
2488  printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2489  rWrite (currRing);
2490  printf("ordSgn = %d\n",currRing->OrdSgn);
2491  printf("\n");
2492 #endif
2493  int srmax,lrmax, red_result = 1;
2494  int olddeg,reduc;
2495  int hilbeledeg=1,hilbcount=0,minimcnt=0;
2496  LObject L;
2497  BOOLEAN withT = TRUE;
2498  strat->max_lower_index = 0;
2499  //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
2500  initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
2501  initSbaPos(strat);
2502  initHilbCrit(F,Q,&hilb,strat);
2503  initSba(F,strat);
2504  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2505  /*Shdl=*/initSbaBuchMora(F, Q,strat);
2506  idTest(strat->Shdl);
2507  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2508  srmax = strat->sl;
2509  reduc = olddeg = lrmax = 0;
2510 #ifndef NO_BUCKETS
2511  if (!TEST_OPT_NOT_BUCKETS)
2512  strat->use_buckets = 1;
2513 #endif
2514 
2515  // redtailBBa against T for inhomogenous input
2516  // if (!TEST_OPT_OLDSTD)
2517  // withT = ! strat->homog;
2518 
2519  // strat->posInT = posInT_pLength;
2520  kTest_TS(strat);
2521 
2522 #ifdef HAVE_TAIL_RING
2523  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2524  kStratInitChangeTailRing(strat);
2525 #endif
2526  if (BVERBOSE(23))
2527  {
2528  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
2529  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
2530  kDebugPrint(strat);
2531  }
2532  // We add the elements directly in S from the previous loop
2533  if(rField_is_Ring(currRing) && strat->sbaEnterS >= 0)
2534  {
2535  for(int i = 0;i<strat->sbaEnterS;i++)
2536  {
2537  //Update: now the element is at the corect place
2538  //i+1 because on the 0 position is the sigdrop element
2539  enterT(strat->L[strat->Ll-(i)],strat);
2540  strat->enterS(strat->L[strat->Ll-(i)], strat->sl+1, strat, strat->tl);
2541  }
2542  strat->Ll = strat->Ll - strat->sbaEnterS;
2543  strat->sbaEnterS = -1;
2544  }
2545  kTest_TS(strat);
2546 #ifdef KDEBUG
2547  //kDebugPrint(strat);
2548 #endif
2549  /* compute------------------------------------------------------- */
2550  while (strat->Ll >= 0)
2551  {
2552  #ifdef ADIDEBUG
2553  printf("\n ------------------------NEW LOOP\n");
2554  printf("\nShdl = \n");
2555  #if 0
2556  idPrint(strat->Shdl);
2557  #else
2558  for(int ii = 0; ii<=strat->sl;ii++)
2559  {
2560  printf("\nS[%i]: ",ii);p_Write(strat->S[ii],strat->tailRing);
2561  printf("sig: ");pWrite(strat->sig[ii]);
2562  }
2563  #endif
2564  #if 0
2565  for(int iii = 0; iii< strat->syzl; iii++)
2566  {
2567  printf("\nsyz[%i]:\n",iii);
2568  p_Write(strat->syz[iii], currRing);
2569  }
2570  #endif
2571  #if 0
2572  for(int iii = 0; iii<= strat->tl; iii++)
2573  {
2574  printf("\nT[%i]:\n",iii);
2575  p_Write(strat->T[iii].p, currRing);
2576  }
2577  #endif
2578  printf("\n list L\n");
2579  int iii;
2580  #if 0
2581  for(iii = 0; iii<= strat->Ll; iii++)
2582  {
2583  printf("\nL[%i]:\n",iii);
2584  p_Write(strat->L[iii].p, currRing);
2585  p_Write(strat->L[iii].p1, currRing);
2586  p_Write(strat->L[iii].p2, currRing);
2587  p_Write(strat->L[iii].sig, currRing);
2588  }
2589  #else
2590  {
2591  printf("L[%i]:",strat->Ll);
2592  p_Write(strat->L[strat->Ll].p, strat->tailRing);
2593  p_Write(strat->L[strat->Ll].p1, strat->tailRing);
2594  p_Write(strat->L[strat->Ll].p2, strat->tailRing);
2595  p_Write(strat->L[strat->Ll].sig, currRing);
2596  }
2597  #endif
2598  //getchar();
2599  #endif
2600  if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
2601  #ifdef KDEBUG
2602  if (TEST_OPT_DEBUG) messageSets(strat);
2603  #endif
2604  if (strat->Ll== 0) strat->interpt=TRUE;
2605  /*
2606  if (TEST_OPT_DEGBOUND
2607  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2608  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2609  {
2610 
2611  //stops computation if
2612  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2613  //a predefined number Kstd1_deg
2614  while ((strat->Ll >= 0)
2615  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2616  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2617  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2618  )
2619  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2620  if (strat->Ll<0) break;
2621  else strat->noClearS=TRUE;
2622  }
2623  */
2624  if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
2625  {
2626  strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
2627 #if F5C
2628  // 1. interreduction of the current standard basis
2629  // 2. generation of new principal syzygy rules for syzCriterion
2630  f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2631  lrmax, reduc, Q, w, hilb );
2632 #endif
2633  // initialize new syzygy rules for the next iteration step
2634  initSyzRules(strat);
2635  }
2636  /*********************************************************************
2637  * interrreduction step is done, we can go on with the next iteration
2638  * step of the signature-based algorithm
2639  ********************************************************************/
2640  /* picks the last element from the lazyset L */
2641  strat->P = strat->L[strat->Ll];
2642  strat->Ll--;
2643 
2645  strat->sbaEnterS = pGetComp(strat->P.sig) - 1;
2646 
2647  #ifdef ADIDEBUG
2648  printf("\n-------------------------\nThis is the current element P\n");
2649  p_Write(strat->P.p,strat->tailRing);
2650  p_Write(strat->P.p1,strat->tailRing);
2651  p_Write(strat->P.p2,strat->tailRing);
2652  p_Write(strat->P.sig,currRing);
2653  #endif
2654  /* reduction of the element chosen from L */
2655  if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) {
2656  //#if 1
2657 #ifdef DEBUGF5
2658  PrintS("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2659  PrintS("-------------------------------------------------\n");
2660  pWrite(strat->P.sig);
2661  pWrite(pHead(strat->P.p));
2662  pWrite(pHead(strat->P.p1));
2663  pWrite(pHead(strat->P.p2));
2664  PrintS("-------------------------------------------------\n");
2665 #endif
2666  if (pNext(strat->P.p) == strat->tail)
2667  {
2668  // deletes the short spoly
2669  /*
2670  if (rField_is_Ring(currRing))
2671  pLmDelete(strat->P.p);
2672  else
2673  pLmFree(strat->P.p);
2674 */
2675  // TODO: needs some masking
2676  // TODO: masking needs to vanish once the signature
2677  // sutff is completely implemented
2678  strat->P.p = NULL;
2679  poly m1 = NULL, m2 = NULL;
2680 
2681  // check that spoly creation is ok
2682  while (strat->tailRing != currRing &&
2683  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2684  {
2685  assume(m1 == NULL && m2 == NULL);
2686  // if not, change to a ring where exponents are at least
2687  // large enough
2688  if (!kStratChangeTailRing(strat))
2689  {
2690  WerrorS("OVERFLOW...");
2691  break;
2692  }
2693  }
2694  // create the real one
2695  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2696  strat->tailRing, m1, m2, strat->R);
2697 
2698  }
2699  else if (strat->P.p1 == NULL)
2700  {
2701  if (strat->minim > 0)
2702  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2703  // for input polys, prepare reduction
2704  if(!rField_is_Ring(currRing))
2705  strat->P.PrepareRed(strat->use_buckets);
2706  }
2707  if (strat->P.p == NULL && strat->P.t_p == NULL)
2708  {
2709  red_result = 0;
2710  }
2711  else
2712  {
2713  //#if 1
2714 #ifdef DEBUGF5
2715  PrintS("Poly before red: ");
2716  pWrite(pHead(strat->P.p));
2717  pWrite(strat->P.sig);
2718 #endif
2719 #if SBA_PRODUCT_CRITERION
2720  if (strat->P.prod_crit) {
2721 #if SBA_PRINT_PRODUCT_CRITERION
2722  product_criterion++;
2723 #endif
2724  int pos = posInSyz(strat, strat->P.sig);
2725  enterSyz(strat->P, strat, pos);
2726  if (strat->P.lcm!=NULL)
2727  pLmFree(strat->P.lcm);
2728  red_result = 2;
2729  } else {
2730  red_result = strat->red(&strat->P,strat);
2731  }
2732 #else
2733  red_result = strat->red(&strat->P,strat);
2734 #endif
2735  }
2736  } else {
2737  /*
2738  if (strat->P.lcm != NULL)
2739  pLmFree(strat->P.lcm);
2740  */
2741  red_result = 2;
2742  }
2744  {
2745  if(strat->P.sig!= NULL && !nGreaterZero(pGetCoeff(strat->P.sig)))
2746  {
2747  strat->P.p = pNeg(strat->P.p);
2748  strat->P.sig = pNeg(strat->P.sig);
2749  }
2750  strat->P.pLength = pLength(strat->P.p);
2751  if(strat->P.sig != NULL)
2752  strat->P.sevSig = pGetShortExpVector(strat->P.sig);
2753  if(strat->P.p != NULL)
2754  strat->P.sev = pGetShortExpVector(strat->P.p);
2755  }
2756  #ifdef ADIDEBUG
2757  printf("\nAfter reduce (redresult=%i): \n",red_result);pWrite(strat->P.p);pWrite(strat->P.sig);
2758  #endif
2759  //sigdrop case
2760  if(rField_is_Ring(currRing) && strat->sigdrop)
2761  {
2762  //First reduce it as much as one can
2763  #ifdef ADIDEBUG
2764  printf("\nSigdrop in the reduce. Trying redring\n");
2765  #endif
2766  red_result = redRing(&strat->P,strat);
2767  if(red_result == 0)
2768  {
2769  #ifdef ADIDEBUG
2770  printf("\nSigdrop cancelled since redRing reduced to 0\n");
2771  #endif
2772  strat->sigdrop = FALSE;
2773  pDelete(&strat->P.sig);
2774  strat->P.sig = NULL;
2775  }
2776  else
2777  {
2778  #ifdef ADIDEBUG
2779  printf("\nStill Sigdrop - redRing reduced to:\n");pWrite(strat->P.p);
2780  #endif
2781  strat->enterS(strat->P, 0, strat, strat->tl);
2782  if (TEST_OPT_PROT)
2783  PrintS("-");
2784  break;
2785  }
2786  }
2787  if(rField_is_Ring(currRing) && strat->blockred > strat->blockredmax)
2788  {
2789  #ifdef ADIDEBUG
2790  printf("\nToo many blocked reductions\n");
2791  #endif
2792  strat->sigdrop = TRUE;
2793  break;
2794  }
2795 
2796  if (errorreported) break;
2797 
2798 //#if 1
2799 #ifdef DEBUGF5
2800  if (red_result != 0) {
2801  PrintS("Poly after red: ");
2802  pWrite(pHead(strat->P.p));
2803  pWrite(strat->P.GetLmCurrRing());
2804  pWrite(strat->P.sig);
2805  printf("%d\n",red_result);
2806  }
2807 #endif
2808  if (TEST_OPT_PROT)
2809  {
2810  if(strat->P.p != NULL)
2811  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2812  &olddeg,&reduc,strat, red_result);
2813  else
2814  message((strat->honey ? strat->P.ecart : 0),
2815  &olddeg,&reduc,strat, red_result);
2816  }
2817 
2818  if (strat->overflow)
2819  {
2820  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2821  }
2822  // reduction to non-zero new poly
2823  if (red_result == 1)
2824  {
2825  // get the polynomial (canonicalize bucket, make sure P.p is set)
2826  strat->P.GetP(strat->lmBin);
2827 
2828  // sig-safe computations may lead to wrong FDeg computation, thus we need
2829  // to recompute it to make sure everything is alright
2830  (strat->P).FDeg = (strat->P).pFDeg();
2831  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2832  // but now, for entering S, T, we reset it
2833  // in the inhomogeneous case: FDeg == pFDeg
2834  if (strat->homog) strat->initEcart(&(strat->P));
2835 
2836  /* statistic */
2837  if (TEST_OPT_PROT) PrintS("s");
2838 
2839  //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2840  // in F5E we know that the last reduced element is already the
2841  // the one with highest signature
2842  int pos = strat->sl+1;
2843 
2844  // reduce the tail and normalize poly
2845  // in the ring case we cannot expect LC(f) = 1,
2846  // therefore we call pContent instead of pNorm
2847  #ifdef HAVE_RINGS
2848  poly beforetailred;
2850  beforetailred = pCopy(strat->P.sig);
2851  #endif
2852 #if SBA_TAIL_RED
2854  {
2856  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2857  }
2858  else
2859  {
2860  if (strat->sbaOrder != 2) {
2862  {
2863  strat->P.pCleardenom();
2865  {
2866  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2867  strat->P.pCleardenom();
2868  }
2869  }
2870  else
2871  {
2872  strat->P.pNorm();
2874  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2875  }
2876  }
2877  }
2878  // It may happen that we have lost the sig in redtailsba
2879  // It cannot reduce to 0 since here we are doing just tail reduction.
2880  // Best case scenerio: remains the leading term
2881  if(rField_is_Ring(currRing) && strat->sigdrop)
2882  {
2883  #ifdef ADIDEBUG
2884  printf("\n Still sigdrop after redtailSba - it reduced to \n");pWrite(strat->P.p);
2885  #endif
2886  strat->enterS(strat->P, 0, strat, strat->tl);
2887  break;
2888  }
2889 #endif
2891  {
2892  if(strat->P.sig == NULL || pLtCmp(beforetailred,strat->P.sig) == 1)
2893  {
2894  #ifdef ADIDEBUG
2895  printf("\nSigDrop after TAILred\n");pWrite(beforetailred);pWrite(strat->P.sig);
2896  #endif
2897  strat->sigdrop = TRUE;
2898  //Reduce it as much as you can
2899  red_result = redRing(&strat->P,strat);
2900  if(red_result == 0)
2901  {
2902  //It reduced to 0, cancel the sigdrop
2903  #ifdef ADIDEBUG
2904  printf("\nReduced to 0 via redRing. Cancel sigdrop\n");
2905  #endif
2906  strat->sigdrop = FALSE;
2907  p_Delete(&strat->P.sig,currRing);strat->P.sig = NULL;
2908  }
2909  else
2910  {
2911  #ifdef ADIDEBUG
2912  printf("\nReduced to this via redRing.SIGDROP\n");pWrite(strat->P.p);
2913  #endif
2914  strat->enterS(strat->P, 0, strat, strat->tl);
2915  break;
2916  }
2917  }
2918  p_Delete(&beforetailred,currRing);
2919  // strat->P.p = NULL may appear if we had a sigdrop above and reduced to 0 via redRing
2920  if(strat->P.p == NULL)
2921  goto case_when_red_result_changed;
2922  }
2923  #ifdef ADIDEBUG
2924  printf("\nNach redTailSba: \n");
2925  p_Write(strat->P.p,strat->tailRing);p_Write(strat->P.sig,currRing);
2926  #endif
2927  // remove sigsafe label since it is no longer valid for the next element to
2928  // be reduced
2929  if (strat->sbaOrder == 1)
2930  {
2931  for (int jj = 0; jj<strat->tl+1; jj++)
2932  {
2933  if (pGetComp(strat->T[jj].sig) == strat->currIdx)
2934  {
2935  strat->T[jj].is_sigsafe = FALSE;
2936  }
2937  }
2938  }
2939  else
2940  {
2941  for (int jj = 0; jj<strat->tl+1; jj++)
2942  {
2943  strat->T[jj].is_sigsafe = FALSE;
2944  }
2945  }
2946 #ifdef KDEBUG
2947  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2948 #endif /* KDEBUG */
2949 
2950  // min_std stuff
2951  if ((strat->P.p1==NULL) && (strat->minim>0))
2952  {
2953  if (strat->minim==1)
2954  {
2955  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2956  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2957  }
2958  else
2959  {
2960  strat->M->m[minimcnt]=strat->P.p2;
2961  strat->P.p2=NULL;
2962  }
2963  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2964  pNext(strat->M->m[minimcnt])
2965  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2966  strat->tailRing, currRing,
2967  currRing->PolyBin);
2968  minimcnt++;
2969  }
2970 
2971  // enter into S, L, and T
2972  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2973  enterT(strat->P, strat);
2974  strat->T[strat->tl].is_sigsafe = FALSE;
2975  /*
2976  printf("hier\n");
2977  pWrite(strat->P.GetLmCurrRing());
2978  pWrite(strat->P.sig);
2979  */
2980  if (rField_is_Ring(currRing))
2981  superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2982  else
2983  enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2984  #ifdef ADIDEBUG
2985  printf("\nThis element is added to S\n");
2986  p_Write(strat->P.p, strat->tailRing);p_Write(strat->P.p1, strat->tailRing);p_Write(strat->P.p2, strat->tailRing);pWrite(strat->P.sig);
2987  //getchar();
2988  #endif
2989  if(rField_is_Ring(currRing) && strat->sigdrop)
2990  break;
2992  strat->P.sevSig = p_GetShortExpVector(strat->P.sig,currRing);
2993  strat->enterS(strat->P, pos, strat, strat->tl);
2994  if(strat->sbaOrder != 1)
2995  {
2996  BOOLEAN overwrite = FALSE;
2997  for (int tk=0; tk<strat->sl+1; tk++)
2998  {
2999  if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
3000  {
3001  //printf("TK %d / %d\n",tk,strat->sl);
3002  overwrite = FALSE;
3003  break;
3004  }
3005  }
3006  //printf("OVERWRITE %d\n",overwrite);
3007  if (overwrite)
3008  {
3009  int cmp = pGetComp(strat->P.sig);
3010  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
3011  pGetExpV (strat->P.p,vv);
3012  pSetExpV (strat->P.sig, vv);
3013  pSetComp (strat->P.sig,cmp);
3014 
3015  strat->P.sevSig = pGetShortExpVector (strat->P.sig);
3016  int i;
3017  LObject Q;
3018  for(int ps=0;ps<strat->sl+1;ps++)
3019  {
3020 
3021  strat->newt = TRUE;
3022  if (strat->syzl == strat->syzmax)
3023  {
3024  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
3025  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
3026  (strat->syzmax)*sizeof(unsigned long),
3027  ((strat->syzmax)+setmaxTinc)
3028  *sizeof(unsigned long));
3029  strat->syzmax += setmaxTinc;
3030  }
3031  Q.sig = pCopy(strat->P.sig);
3032  // add LM(F->m[i]) to the signature to get a Schreyer order
3033  // without changing the underlying polynomial ring at all
3034  if (strat->sbaOrder == 0)
3035  p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
3036  // since p_Add_q() destroys all input
3037  // data we need to recreate help
3038  // each time
3039  // ----------------------------------------------------------
3040  // in the Schreyer order we always know that the multiplied
3041  // module monomial strat->P.sig gives the leading monomial of
3042  // the corresponding principal syzygy
3043  // => we do not need to compute the "real" syzygy completely
3044  poly help = p_Copy(strat->sig[ps],currRing);
3045  p_ExpVectorAdd (help,strat->P.p,currRing);
3046  Q.sig = p_Add_q(Q.sig,help,currRing);
3047  //printf("%d. SYZ ",i+1);
3048  //pWrite(strat->syz[i]);
3049  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
3050  i = posInSyz(strat, Q.sig);
3051  enterSyz(Q, strat, i);
3052  }
3053  }
3054  }
3055  // deg - idx - lp/rp
3056  // => we need to add syzygies with indices > pGetComp(strat->P.sig)
3057  if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
3058  {
3059  int cmp = pGetComp(strat->P.sig);
3060  int max_cmp = IDELEMS(F);
3061  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
3062  pGetExpV (strat->P.p,vv);
3063  LObject Q;
3064  int pos;
3065  int idx = p_GetComp(strat->P.sig,currRing);
3066  //printf("++ -- adding syzygies -- ++\n");
3067  // if new element is the first one in this index
3068  if (strat->currIdx < idx) {
3069  for (int i=0; i<strat->sl; ++i) {
3070  Q.sig = p_Copy(strat->P.sig,currRing);
3071  p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
3072  poly help = p_Copy(strat->sig[i],currRing);
3073  p_ExpVectorAdd(help,strat->P.p,currRing);
3074  Q.sig = p_Add_q(Q.sig,help,currRing);
3075  //pWrite(Q.sig);
3076  pos = posInSyz(strat, Q.sig);
3077  enterSyz(Q, strat, pos);
3078  }
3079  strat->currIdx = idx;
3080  } else {
3081  // if the element is not the first one in the given index we build all
3082  // possible syzygies with elements of higher index
3083  for (int i=cmp+1; i<=max_cmp; ++i) {
3084  pos = -1;
3085  for (int j=0; j<strat->sl; ++j) {
3086  if (p_GetComp(strat->sig[j],currRing) == i) {
3087  pos = j;
3088  break;
3089  }
3090  }
3091  if (pos != -1) {
3092  Q.sig = p_One(currRing);
3093  p_SetExpV(Q.sig, vv, currRing);
3094  // F->m[i-1] corresponds to index i
3095  p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
3096  p_SetComp(Q.sig, i, currRing);
3097  poly help = p_Copy(strat->P.sig,currRing);
3098  p_ExpVectorAdd(help,strat->S[pos],currRing);
3099  Q.sig = p_Add_q(Q.sig,help,currRing);
3100  if (strat->sbaOrder == 0) {
3101  if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn) {
3102  pos = posInSyz(strat, Q.sig);
3103  enterSyz(Q, strat, pos);
3104  }
3105  } else {
3106  pos = posInSyz(strat, Q.sig);
3107  enterSyz(Q, strat, pos);
3108  }
3109  }
3110  }
3111  //printf("++ -- done adding syzygies -- ++\n");
3112  }
3113  }
3114 //#if 1
3115 #if DEBUGF50
3116  printf("---------------------------\n");
3117  Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
3118  PrintS("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
3119  PrintS("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
3120 #endif
3121  /*
3122  if (newrules)
3123  {
3124  newrules = FALSE;
3125  }
3126  */
3127 #if 0
3128  int pl=pLength(strat->P.p);
3129  if (pl==1)
3130  {
3131  //if (TEST_OPT_PROT)
3132  //PrintS("<1>");
3133  }
3134  else if (pl==2)
3135  {
3136  //if (TEST_OPT_PROT)
3137  //PrintS("<2>");
3138  }
3139 #endif
3140  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3141 // Print("[%d]",hilbeledeg);
3142  if (strat->P.lcm!=NULL)
3143 #ifdef HAVE_RINGS
3144  pLmDelete(strat->P.lcm);
3145 #else
3146  pLmFree(strat->P.lcm);
3147 #endif
3148  if (strat->sl>srmax) srmax = strat->sl;
3149  }
3150  else
3151  {
3152  case_when_red_result_changed:
3153  // adds signature of the zero reduction to
3154  // strat->syz. This is the leading term of
3155  // syzygy and can be used in syzCriterion()
3156  // the signature is added if and only if the
3157  // pair was not detected by the rewritten criterion in strat->red = redSig
3158  if (red_result!=2) {
3159 #if SBA_PRINT_ZERO_REDUCTIONS
3160  zeroreductions++;
3161 #endif
3162  if(rField_is_Ring(currRing) && strat->P.p == NULL && strat->P.sig == NULL)
3163  {
3164  //Catch the case when p = 0, sig = 0
3165  }
3166  else
3167  {
3168  int pos = posInSyz(strat, strat->P.sig);
3169  enterSyz(strat->P, strat, pos);
3170  //#if 1
3171  #ifdef DEBUGF5
3172  Print("ADDING STUFF TO SYZ : ");
3173  //pWrite(strat->P.p);
3174  pWrite(strat->P.sig);
3175  #endif
3176  }
3177  }
3178  if (strat->P.p1 == NULL && strat->minim > 0)
3179  {
3180  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3181  }
3182  }
3183 
3184 #ifdef KDEBUG
3185  memset(&(strat->P), 0, sizeof(strat->P));
3186 #endif /* KDEBUG */
3187  kTest_TS(strat);
3188  }
3189  #if 0
3190  if(strat->sigdrop)
3191  printf("\nSigDrop!\n");
3192  else
3193  printf("\nEnded with no SigDrop\n");
3194  #endif
3195 // Clean strat->P for the next sba call
3196  if(rField_is_Ring(currRing) && strat->sigdrop)
3197  {
3198  //This is used to know how many elements can we directly add to S in the next run
3199  if(strat->P.sig != NULL)
3200  strat->sbaEnterS = pGetComp(strat->P.sig)-1;
3201  //else we already set it at the beggining of the loop
3202  #ifdef KDEBUG
3203  memset(&(strat->P), 0, sizeof(strat->P));
3204  #endif /* KDEBUG */
3205  }
3206 #ifdef KDEBUG
3207  if (TEST_OPT_DEBUG) messageSets(strat);
3208 #endif /* KDEBUG */
3209 
3210  if (TEST_OPT_SB_1)
3211  {
3212  if(!rField_is_Ring(currRing))
3213  {
3214  int k=1;
3215  int j;
3216  while(k<=strat->sl)
3217  {
3218  j=0;
3219  loop
3220  {
3221  if (j>=k) break;
3222  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3223  j++;
3224  }
3225  k++;
3226  }
3227  }
3228  }
3229  /* complete reduction of the standard basis--------- */
3230  if (TEST_OPT_REDSB)
3231  {
3232  completeReduce(strat);
3233  if (strat->completeReduce_retry)
3234  {
3235  // completeReduce needed larger exponents, retry
3236  // to reduce with S (instead of T)
3237  // and in currRing (instead of strat->tailRing)
3238 #ifdef HAVE_TAIL_RING
3239  if(currRing->bitmask>strat->tailRing->bitmask)
3240  {
3241  strat->completeReduce_retry=FALSE;
3242  cleanT(strat);strat->tailRing=currRing;
3243  int i;
3244  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3245  completeReduce(strat);
3246  }
3247  if (strat->completeReduce_retry)
3248 #endif
3249  Werror("exponent bound is %ld",currRing->bitmask);
3250  }
3251  }
3252  else if (TEST_OPT_PROT) PrintLn();
3253 
3254 #if SBA_PRINT_SIZE_SYZ
3255  // that is correct, syzl is counting one too far
3256  size_syz = strat->syzl;
3257 #endif
3258 // if (TEST_OPT_WEIGHTM)
3259 // {
3260 // pRestoreDegProcs(pFDegOld, pLDegOld);
3261 // if (ecartWeights)
3262 // {
3263 // omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
3264 // ecartWeights=NULL;
3265 // }
3266 // }
3267  if (TEST_OPT_PROT) messageStatSBA(hilbcount,strat);
3268  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3269 #if SBA_PRINT_SIZE_G
3270  size_g_non_red = IDELEMS(strat->Shdl);
3271 #endif
3272  if(!rField_is_Ring(currRing))
3273  exitSba(strat);
3274  // I have to add the initial input polynomials which where not used (p1 and p2 = NULL)
3275  #ifdef HAVE_RINGS
3276  int k;
3278  {
3279  //for(k = strat->sl;k>=0;k--)
3280  // {printf("\nS[%i] = %p\n",k,strat->Shdl->m[k]);pWrite(strat->Shdl->m[k]);}
3281  k = strat->Ll;
3282  #if 1
3283  // 1 - adds just the unused ones, 0 - adds everthing
3284  for(;k>=0 && (strat->L[k].p1 != NULL || strat->L[k].p2 != NULL);k--)
3285  {
3286  //printf("\nDeleted k = %i, %p\n",k,strat->L[k].p);pWrite(strat->L[k].p);pWrite(strat->L[k].p1);pWrite(strat->L[k].p2);
3287  deleteInL(strat->L,&strat->Ll,k,strat);
3288  }
3289  #endif
3290  //for(int kk = strat->sl;kk>=0;kk--)
3291  // {printf("\nS[%i] = %p\n",kk,strat->Shdl->m[kk]);pWrite(strat->Shdl->m[kk]);}
3292  //idPrint(strat->Shdl);
3293  //printf("\nk = %i\n",k);
3294  for(;k>=0 && strat->L[k].p1 == NULL && strat->L[k].p2 == NULL;k--)
3295  {
3296  //printf("\nAdded k = %i\n",k);
3297  strat->enterS(strat->L[k], strat->sl+1, strat, strat->tl);
3298  //printf("\nThis elements was added from L on pos %i\n",strat->sl);pWrite(strat->S[strat->sl]);pWrite(strat->sig[strat->sl]);
3299  }
3300  }
3301  // Find the "sigdrop element" and put the same signature as the previous one - do we really need this?? - now i put it on the 0 position - no more comparing needed
3302  #if 0
3303  if(strat->sigdrop && rField_is_Ring(currRing))
3304  {
3305  for(k=strat->sl;k>=0;k--)
3306  {
3307  printf("\nsig[%i] = ",i);pWrite(strat->sig[k]);
3308  if(strat->sig[k] == NULL)
3309  strat->sig[k] = pCopy(strat->sig[k-1]);
3310  }
3311  }
3312  #endif
3313  #endif
3314  //Never do this - you will damage S
3315  //idSkipZeroes(strat->Shdl);
3316  //idPrint(strat->Shdl);
3317 
3318  if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
3319  {
3320  rChangeCurrRing (currRingOld);
3321  F0 = idrMoveR (F1, sRing, currRing);
3322  strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
3323  rChangeCurrRing (sRing);
3325  exitSba(strat);
3326  rChangeCurrRing (currRingOld);
3327  if(strat->tailRing == sRing)
3328  strat->tailRing = currRing;
3329  rDelete (sRing);
3330  }
3331  if(rField_is_Ring(currRing) && !strat->sigdrop)
3332  id_DelDiv(strat->Shdl, currRing);
3333  if(!rField_is_Ring(currRing))
3334  id_DelDiv(strat->Shdl, currRing);
3335  idSkipZeroes(strat->Shdl);
3336  idTest(strat->Shdl);
3337 
3338 #if SBA_PRINT_SIZE_G
3339  size_g = IDELEMS(strat->Shdl);
3340 #endif
3341 #ifdef DEBUGF5
3342  printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
3343  int oo = 0;
3344  while (oo<IDELEMS(strat->Shdl))
3345  {
3346  printf(" %d. ",oo+1);
3347  pWrite(pHead(strat->Shdl->m[oo]));
3348  oo++;
3349  }
3350 #endif
3351 #if SBA_PRINT_ZERO_REDUCTIONS
3352  printf("----------------------------------------------------------\n");
3353  printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3354  zeroreductions = 0;
3355 #endif
3356 #if SBA_PRINT_REDUCTION_STEPS
3357  printf("----------------------------------------------------------\n");
3358  printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3359 #endif
3360 #if SBA_PRINT_OPERATIONS
3361  printf("OPERATIONS: %ld\n",sba_operations);
3362 #endif
3363 #if SBA_PRINT_REDUCTION_STEPS
3364  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3365  printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3366 #endif
3367 #if SBA_PRINT_OPERATIONS
3368  printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3369 #endif
3370 #if SBA_PRINT_REDUCTION_STEPS
3371  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3372  printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3373  sba_interreduction_steps = 0;
3374  sba_reduction_steps = 0;
3375 #endif
3376 #if SBA_PRINT_OPERATIONS
3377  printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3378  sba_interreduction_operations = 0;
3379  sba_operations = 0;
3380 #endif
3381 #if SBA_PRINT_SIZE_G
3382  printf("----------------------------------------------------------\n");
3383  printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3384  size_g = 0;
3385  size_g_non_red = 0;
3386 #endif
3387 #if SBA_PRINT_SIZE_SYZ
3388  printf("SIZE OF SYZ: %ld\n",size_syz);
3389  printf("----------------------------------------------------------\n");
3390  size_syz = 0;
3391 #endif
3392 #if SBA_PRINT_PRODUCT_CRITERION
3393  printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3394  product_criterion = 0;
3395 #endif
3396  return (strat->Shdl);
3397 }
polyset sig
Definition: kutil.h:294
#define TEST_OPT_REDTAIL
Definition: options.h:111
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void initSbaPos(kStrategy strat)
Definition: kutil.cc:10186
BOOLEAN honey
Definition: kutil.h:366
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7915
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
class sLObject LObject
Definition: kutil.h:52
bool sigdrop
Definition: kutil.h:348
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Definition: kutil.cc:5280
#define FALSE
Definition: auxiliary.h:94
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
int sbaEnterS
Definition: kutil.h:351
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:280
void initSba(ideal F, kStrategy strat)
Definition: kstd1.cc:1479
#define pNeg(p)
Definition: polys.h:181
void initSyzRules(kStrategy strat)
Definition: kutil.cc:8380
int tl
Definition: kutil.h:338
#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 TEST_OPT_REDSB
Definition: options.h:99
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:11380
void pWrite(poly p)
Definition: polys.h:290
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10288
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:185
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int currIdx
Definition: kutil.h:303
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4952
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:346
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1451
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11353
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
BOOLEAN interpt
Definition: kutil.h:360
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int blockredmax
Definition: kutil.h:354
#define idPrint(id)
Definition: ideals.h:46
int nrsyzcrit
Definition: kutil.h:349
int nrrewcrit
Definition: kutil.h:350
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:14
#define kTest_TS(A)
Definition: kutil.h:641
poly p_One(const ring r)
Definition: p_polys.cc:1314
int max_lower_index
Definition: kutil.h:304
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9750
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:528
#define pSetExpV(p, e)
Definition: polys.h:97
void messageStatSBA(int hilbcount, kStrategy strat)
Definition: kutil.cc:7968
#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:272
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3542
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
#define pSetComp(p, v)
Definition: polys.h:38
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
LObject P
Definition: kutil.h:288
ideal M
Definition: kutil.h:291
unsigned sbaOrder
Definition: kutil.h:302
void exitSba(kStrategy strat)
Definition: kutil.cc:10361
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:322
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4899
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
void f5c(kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
Definition: kstd2.cc:3696
TObject ** R
Definition: kutil.h:328
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
static unsigned pLength(poly a)
Definition: p_polys.h:189
#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:292
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
short errorreported
Definition: feFopen.cc:23
#define help
Definition: libparse.cc:1228
void rChangeCurrRing(ring r)
Definition: polys.cc:12
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
#define BVERBOSE(a)
Definition: options.h:33
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4635
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:552
#define SBA_INTERRED_START
Definition: kstd2.cc:38
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
int length() const
Definition: intvec.h:86
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6350
ring tailRing
Definition: kutil.h:331
#define TEST_OPT_SB_1
Definition: options.h:113
int blockred
Definition: kutil.h:353
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:9832
#define pDelete(p_ptr)
Definition: polys.h:169
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10613
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:32
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10401
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
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:82
polyset syz
Definition: kutil.h:293
int sl
Definition: kutil.h:336
void sort(CFArray &A, int l=0)
quick sort A
TSet T
Definition: kutil.h:312
BOOLEAN use_buckets
Definition: kutil.h:372
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:83
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
ideal Shdl
Definition: kutil.h:289
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kstd2.cc:1168
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int syzl
Definition: kutil.h:337
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11800
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9666
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define idTest(id)
Definition: ideals.h:47

◆ sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair ( LObject h,
kStrategy  strat 
)

Definition at line 1663 of file kutil.cc.

1664 {
1665  if(strat->sl < 0) return FALSE;
1666  int i;
1667  for(i=0;i<strat->sl;i++)
1668  {
1669  //Construct the gcd pair between h and S[i]
1670  number d, s, t;
1671  poly m1, m2, gcd;
1672  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1673  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1674  {
1675  nDelete(&d);
1676  nDelete(&s);
1677  nDelete(&t);
1678  }
1679  else
1680  {
1681  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1682  pSetCoeff0(m1, s);
1683  pSetCoeff0(m2, t);
1684  pSetCoeff0(gcd, d);
1685  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);
1686  poly pSigMult = p_Copy(h->sig,currRing);
1687  poly sSigMult = p_Copy(strat->sig[i],currRing);
1688  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1689  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1690  p_LmDelete(m1, strat->tailRing);
1691  p_LmDelete(m2, strat->tailRing);
1692  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1693  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1694  {
1695  #ifdef ADIDEBUG
1696  printf("\nCan replace * (sig = *) with * (sig = *) since of * with sig *\n");
1697  pWrite(h->p);pWrite(h->sig);pWrite(gcd);pWrite(pairsig);pWrite(strat->S[i]);pWrite(strat->sig[i]);
1698  //getchar();
1699  #endif
1700  pDelete(&h->p);
1701  h->p = gcd;
1702  pDelete(&h->sig);
1703  h->sig = pairsig;
1704  pNext(h->sig) = NULL;
1705  strat->initEcart(h);
1706  h->sev = pGetShortExpVector(h->p);
1707  h->sevSig = pGetShortExpVector(h->sig);
1708  h->i_r1 = -1;h->i_r2 = -1;
1709  if(h->lcm != NULL)
1710  {
1711  pLmDelete(h->lcm);
1712  h->lcm = NULL;
1713  }
1714  if (currRing!=strat->tailRing)
1715  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1716  return TRUE;
1717  }
1718  //Delete what you didn't use
1719  pDelete(&gcd);
1720  pDelete(&pairsig);
1721  }
1722  }
1723  return FALSE;
1724 }
polyset sig
Definition: kutil.h:294
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:968
#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:957
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
#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:123
polyset S
Definition: kutil.h:292
#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:697
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:978
int sl
Definition: kutil.h:336
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

◆ sbaRing()

ring sbaRing ( kStrategy  strat,
const ring  r = currRing,
BOOLEAN  complete = TRUE,
int  sgn = 1 
)

Definition at line 11380 of file kutil.cc.

11381 {
11382  int n = rBlocks(r); // Including trailing zero!
11383  // if sbaOrder == 1 => use (C,monomial order from r)
11384  if (strat->sbaOrder == 1)
11385  {
11386  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11387  {
11388  return r;
11389  }
11390  ring res = rCopy0(r, TRUE, FALSE);
11391  res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
11392  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11393  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11394  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11395  res->wvhdl = wvhdl;
11396  for (int i=1; i<n; i++)
11397  {
11398  res->order[i] = r->order[i-1];
11399  res->block0[i] = r->block0[i-1];
11400  res->block1[i] = r->block1[i-1];
11401  res->wvhdl[i] = r->wvhdl[i-1];
11402  }
11403 
11404  // new 1st block
11405  res->order[0] = ringorder_C; // Prefix
11406  // removes useless secondary component order if defined in old ring
11407  for (int i=rBlocks(res); i>0; --i)
11408  {
11409  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11410  {
11411  res->order[i] = (rRingOrder_t)0;
11412  }
11413  }
11414  rComplete(res, 1);
11415 #ifdef HAVE_PLURAL
11416  if (rIsPluralRing(r))
11417  {
11418  if ( nc_rComplete(r, res, false) ) // no qideal!
11419  {
11420 #ifndef SING_NDEBUG
11421  WarnS("error in nc_rComplete");
11422 #endif
11423  // cleanup?
11424 
11425  // rDelete(res);
11426  // return r;
11427 
11428  // just go on..
11429  }
11430  }
11431 #endif
11432  strat->tailRing = res;
11433  return (res);
11434  }
11435  // if sbaOrder == 3 => degree - position - ring order
11436  if (strat->sbaOrder == 3)
11437  {
11438  ring res = rCopy0(r, TRUE, FALSE);
11439  res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
11440  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11441  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11442  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11443  res->wvhdl = wvhdl;
11444  for (int i=2; i<n+2; i++)
11445  {
11446  res->order[i] = r->order[i-2];
11447  res->block0[i] = r->block0[i-2];
11448  res->block1[i] = r->block1[i-2];
11449  res->wvhdl[i] = r->wvhdl[i-2];
11450  }
11451 
11452  // new 1st block
11453  res->order[0] = ringorder_a; // Prefix
11454  res->block0[0] = 1;
11455  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11456  for (int i=0; i<res->N; ++i)
11457  res->wvhdl[0][i] = 1;
11458  res->block1[0] = si_min(res->N, rVar(res));
11459  // new 2nd block
11460  res->order[1] = ringorder_C; // Prefix
11461  res->wvhdl[1] = NULL;
11462  // removes useless secondary component order if defined in old ring
11463  for (int i=rBlocks(res); i>1; --i)
11464  {
11465  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11466  {
11467  res->order[i] = (rRingOrder_t)0;
11468  }
11469  }
11470  rComplete(res, 1);
11471 #ifdef HAVE_PLURAL
11472  if (rIsPluralRing(r))
11473  {
11474  if ( nc_rComplete(r, res, false) ) // no qideal!
11475  {
11476 #ifndef SING_NDEBUG
11477  WarnS("error in nc_rComplete");
11478 #endif
11479  // cleanup?
11480 
11481  // rDelete(res);
11482  // return r;
11483 
11484  // just go on..
11485  }
11486  }
11487 #endif
11488  strat->tailRing = res;
11489  return (res);
11490  }
11491 
11492  // not sbaOrder == 1 => use Schreyer order
11493  // this is done by a trick when initializing the signatures
11494  // in initSLSba():
11495  // Instead of using the signature 1e_i for F->m[i], we start
11496  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11497  // Schreyer order w.r.t. the underlying monomial order.
11498  // => we do not need to change the underlying polynomial ring at all!
11499 
11500  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11501 
11502  /*
11503  else
11504  {
11505  ring res = rCopy0(r, FALSE, FALSE);
11506  // Create 2 more blocks for prefix/suffix:
11507  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11508  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11509  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11510  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11511 
11512  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11513  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11514 
11515  // new 1st block
11516  int j = 0;
11517  res->order[j] = ringorder_IS; // Prefix
11518  res->block0[j] = res->block1[j] = 0;
11519  // wvhdl[j] = NULL;
11520  j++;
11521 
11522  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11523  {
11524  res->order [j] = r->order [i];
11525  res->block0[j] = r->block0[i];
11526  res->block1[j] = r->block1[i];
11527 
11528  if (r->wvhdl[i] != NULL)
11529  {
11530  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11531  } // else wvhdl[j] = NULL;
11532  }
11533 
11534  // new last block
11535  res->order [j] = ringorder_IS; // Suffix
11536  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11537  // wvhdl[j] = NULL;
11538  j++;
11539 
11540  // res->order [j] = 0; // The End!
11541  res->wvhdl = wvhdl;
11542 
11543  // j == the last zero block now!
11544  assume(j == (n+1));
11545  assume(res->order[0]==ringorder_IS);
11546  assume(res->order[j-1]==ringorder_IS);
11547  assume(res->order[j]==0);
11548 
11549  if (complete)
11550  {
11551  rComplete(res, 1);
11552 
11553 #ifdef HAVE_PLURAL
11554  if (rIsPluralRing(r))
11555  {
11556  if ( nc_rComplete(r, res, false) ) // no qideal!
11557  {
11558  }
11559  }
11560  assume(rIsPluralRing(r) == rIsPluralRing(res));
11561 #endif
11562 
11563 
11564 #ifdef HAVE_PLURAL
11565  ring old_ring = r;
11566 
11567 #endif
11568 
11569  if (r->qideal!=NULL)
11570  {
11571  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11572 
11573  assume(idRankFreeModule(res->qideal, res) == 0);
11574 
11575 #ifdef HAVE_PLURAL
11576  if( rIsPluralRing(res) )
11577  if( nc_SetupQuotient(res, r, true) )
11578  {
11579  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11580  }
11581 
11582 #endif
11583  assume(idRankFreeModule(res->qideal, res) == 0);
11584  }
11585 
11586 #ifdef HAVE_PLURAL
11587  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11588  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11589  assume(rIsSCA(res) == rIsSCA(old_ring));
11590  assume(ncRingType(res) == ncRingType(old_ring));
11591 #endif
11592  }
11593  strat->tailRing = res;
11594  return res;
11595  }
11596  */
11597 
11598  assume(FALSE);
11599  return(NULL);
11600 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
#define FALSE
Definition: auxiliary.h:94
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5533
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:559
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3365
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1325
rRingOrder_t
order stuff
Definition: ring.h:75
unsigned sbaOrder
Definition: kutil.h:302
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ superenterpairs()

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

Definition at line 4889 of file kutil.cc.

4890 {
4892  // enter also zero divisor * poly, if this is non zero and of smaller degree
4893  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4894  initenterpairs(h, k, ecart, 0, strat, atR);
4895  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4896  clearSbatch(h, k, pos, strat);
4897 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4863
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3824
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4601
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4650
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static Poly * h
Definition: janet.cc:978

◆ superenterpairsSig()

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

Definition at line 4899 of file kutil.cc.

4900 {
4902  // enter also zero divisor * poly, if this is non zero and of smaller degree
4903  #ifdef ADIDEBUG
4904  printf("\n Trying to add extended spolys\n");
4905  #endif
4906  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4907  if(strat->sigdrop) return;
4908  #ifdef ADIDEBUG
4909  printf("\n Trying to add spolys\n");
4910  #endif
4911  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4912  if(strat->sigdrop) return;
4913  #ifdef ADIDEBUG
4914  printf("\n Trying to add gcd-polys\n");
4915  #endif
4916  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4917  if(strat->sigdrop) return;
4918  clearSbatch(h, k, pos, strat);
4919 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4863
bool sigdrop
Definition: kutil.h:348
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3954
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition: kutil.cc:4733
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4623
static Poly * h
Definition: janet.cc:978

◆ syzCriterion()

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

Definition at line 7112 of file kutil.cc.

7113 {
7114 //#if 1
7115 #ifdef DEBUGF5
7116  PrintS("syzygy criterion checks: ");
7117  pWrite(sig);
7118 #endif
7119  for (int k=0; k<strat->syzl; k++)
7120  {
7121  //printf("-%d",k);
7122 //#if 1
7123 #ifdef DEBUGF5
7124  Print("checking with: %d / %d -- \n",k,strat->syzl);
7125  pWrite(pHead(strat->syz[k]));
7126 #endif
7127  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7128  && (!rField_is_Ring(currRing) ||
7129  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7130  {
7131 //#if 1
7132 #ifdef DEBUGF5
7133  PrintS("DELETE!\n");
7134 #endif
7135  #ifdef ADIDEBUG
7136  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7137  #endif
7138  strat->nrsyzcrit++;
7139  //printf("- T -\n\n");
7140  return TRUE;
7141  }
7142  }
7143  //printf("- F -\n\n");
7144  return FALSE;
7145 }
#define Print
Definition: emacs.cc:83
#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:290
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrsyzcrit
Definition: kutil.h:349
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:477
unsigned long * sevSyz
Definition: kutil.h:309
polyset syz
Definition: kutil.h:293
int syzl
Definition: kutil.h:337

◆ syzCriterionInc()

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

Definition at line 7150 of file kutil.cc.

7151 {
7152 //#if 1
7153  if(sig == NULL)
7154  return FALSE;
7155 #ifdef DEBUGF5
7156  PrintS("--- syzygy criterion checks: ");
7157  pWrite(sig);
7158 #endif
7159  int comp = p_GetComp(sig, currRing);
7160  int min, max;
7161  if (comp<=1)
7162  return FALSE;
7163  else
7164  {
7165  min = strat->syzIdx[comp-2];
7166  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7167  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7168  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7169  if (comp == strat->currIdx)
7170  {
7171  max = strat->syzl;
7172  }
7173  else
7174  {
7175  max = strat->syzIdx[comp-1];
7176  }
7177  for (int k=min; k<max; k++)
7178  {
7179 #ifdef F5DEBUG
7180  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7181  Print("checking with: %d -- ",k);
7182  pWrite(pHead(strat->syz[k]));
7183 #endif
7184  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7185  && (!rField_is_Ring(currRing) ||
7186  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7187  {
7188  #ifdef ADIDEBUG
7189  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7190  #endif
7191  strat->nrsyzcrit++;
7192  return TRUE;
7193  }
7194  }
7195  return FALSE;
7196  }
7197 }
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int currIdx
Definition: kutil.h:303
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrsyzcrit
Definition: kutil.h:349
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:477
#define NULL
Definition: omList.c:10
unsigned long * sevSyz
Definition: kutil.h:309
polyset syz
Definition: kutil.h:293
int syzl
Definition: kutil.h:337
intset syzIdx
Definition: kutil.h:299

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4217 of file kutil.cc.

4218 {
4219  return 1L << arg;
4220 }

◆ updateResult()

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

Definition at line 10401 of file kutil.cc.

10402 {
10403  int l;
10404  if (strat->ak>0)
10405  {
10406  for (l=IDELEMS(r)-1;l>=0;l--)
10407  {
10408  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10409  {
10410  pDelete(&r->m[l]); // and set it to NULL
10411  }
10412  }
10413  int q;
10414  poly p;
10415  if(!rField_is_Ring(currRing))
10416  {
10417  for (l=IDELEMS(r)-1;l>=0;l--)
10418  {
10419  if ((r->m[l]!=NULL)
10420  //&& (strat->syzComp>0)
10421  //&& (pGetComp(r->m[l])<=strat->syzComp)
10422  )
10423  {
10424  for(q=IDELEMS(Q)-1; q>=0;q--)
10425  {
10426  if ((Q->m[q]!=NULL)
10427  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10428  {
10429  if (TEST_OPT_REDSB)
10430  {
10431  p=r->m[l];
10432  r->m[l]=kNF(Q,NULL,p);
10433  pDelete(&p);
10434  }
10435  else
10436  {
10437  pDelete(&r->m[l]); // and set it to NULL
10438  }
10439  break;
10440  }
10441  }
10442  }
10443  }
10444  }
10445  #ifdef HAVE_RINGS
10446  else
10447  {
10448  for (l=IDELEMS(r)-1;l>=0;l--)
10449  {
10450  if ((r->m[l]!=NULL)
10451  //&& (strat->syzComp>0)
10452  //&& (pGetComp(r->m[l])<=strat->syzComp)
10453  )
10454  {
10455  for(q=IDELEMS(Q)-1; q>=0;q--)
10456  {
10457  if ((Q->m[q]!=NULL)
10458  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10459  {
10460  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10461  {
10462  if (TEST_OPT_REDSB)
10463  {
10464  p=r->m[l];
10465  r->m[l]=kNF(Q,NULL,p);
10466  pDelete(&p);
10467  }
10468  else
10469  {
10470  pDelete(&r->m[l]); // and set it to NULL
10471  }
10472  break;
10473  }
10474  }
10475  }
10476  }
10477  }
10478  }
10479  #endif
10480  }
10481  else
10482  {
10483  int q;
10484  poly p;
10485  BOOLEAN reduction_found=FALSE;
10486  if (!rField_is_Ring(currRing))
10487  {
10488  for (l=IDELEMS(r)-1;l>=0;l--)
10489  {
10490  if (r->m[l]!=NULL)
10491  {
10492  for(q=IDELEMS(Q)-1; q>=0;q--)
10493  {
10494  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10495  {
10496  if (TEST_OPT_REDSB)
10497  {
10498  p=r->m[l];
10499  r->m[l]=kNF(Q,NULL,p);
10500  pDelete(&p);
10501  reduction_found=TRUE;
10502  }
10503  else
10504  {
10505  pDelete(&r->m[l]); // and set it to NULL
10506  }
10507  break;
10508  }
10509  }
10510  }
10511  }
10512  }
10513  #ifdef HAVE_RINGS
10514  //Also need divisibility of the leading coefficients
10515  else
10516  {
10517  for (l=IDELEMS(r)-1;l>=0;l--)
10518  {
10519  if (r->m[l]!=NULL)
10520  {
10521  for(q=IDELEMS(Q)-1; q>=0;q--)
10522  {
10523  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10524  {
10525  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10526  {
10527  if (TEST_OPT_REDSB)
10528  {
10529  p=r->m[l];
10530  r->m[l]=kNF(Q,NULL,p);
10531  pDelete(&p);
10532  reduction_found=TRUE;
10533  }
10534  else
10535  {
10536  pDelete(&r->m[l]); // and set it to NULL
10537  }
10538  break;
10539  }
10540  }
10541  }
10542  }
10543  }
10544  }
10545  #endif
10546  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10547  {
10548  #ifdef HAVE_RINGS
10550  {
10551  for (l=IDELEMS(r)-1;l>=0;l--)
10552  {
10553  if (r->m[l]!=NULL)
10554  {
10555  for(q=IDELEMS(r)-1;q>=0;q--)
10556  {
10557  if ((l!=q)
10558  && (r->m[q]!=NULL)
10559  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10560  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10561  )
10562  {
10563  //If they are equal then take the one with the smallest length
10564  if(pLmDivisibleBy(r->m[q],r->m[l])
10565  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10566  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10567  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10568  {
10569  pDelete(&r->m[l]);
10570  break;
10571  }
10572  else
10573  pDelete(&r->m[q]);
10574  }
10575  }
10576  }
10577  }
10578  }
10579  else
10580  #endif
10581  {
10582  for (l=IDELEMS(r)-1;l>=0;l--)
10583  {
10584  if (r->m[l]!=NULL)
10585  {
10586  for(q=IDELEMS(r)-1;q>=0;q--)
10587  {
10588  if ((l!=q)
10589  && (r->m[q]!=NULL)
10590  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10591  )
10592  {
10593  //If they are equal then take the one with the smallest length
10594  if(pLmDivisibleBy(r->m[q],r->m[l])
10595  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10596  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10597  {
10598  pDelete(&r->m[l]);
10599  break;
10600  }
10601  else
10602  pDelete(&r->m[q]);
10603  }
10604  }
10605  }
10606  }
10607  }
10608  }
10609  }
10610  idSkipZeroes(r);
10611 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:341
#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
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define nGreaterZero(n)
Definition: numbers.h:27
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pDelete(p_ptr)
Definition: polys.h:169
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9000 of file kutil.cc.

9001 {
9002  LObject h;
9003  int i, suc=0;
9004  poly redSi=NULL;
9005  BOOLEAN change,any_change;
9006 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9007 // for (i=0; i<=(strat->sl); i++)
9008 // {
9009 // Print("s%d:",i);
9010 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9011 // pWrite(strat->S[i]);
9012 // }
9013 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9014  any_change=FALSE;
9016  {
9017  while (suc != -1)
9018  {
9019  i=suc+1;
9020  while (i<=strat->sl)
9021  {
9022  change=FALSE;
9024  any_change = FALSE;
9025  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9026  {
9027  redSi = pHead(strat->S[i]);
9028  strat->S[i] = redBba(strat->S[i],i-1,strat);
9029  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9030  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9031  if (pCmp(redSi,strat->S[i])!=0)
9032  {
9033  change=TRUE;
9034  any_change=TRUE;
9035  #ifdef KDEBUG
9036  if (TEST_OPT_DEBUG)
9037  {
9038  PrintS("reduce:");
9039  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9040  }
9041  #endif
9042  if (TEST_OPT_PROT)
9043  {
9044  if (strat->S[i]==NULL)
9045  PrintS("V");
9046  else
9047  PrintS("v");
9048  mflush();
9049  }
9050  }
9051  pLmDelete(&redSi);
9052  if (strat->S[i]==NULL)
9053  {
9054  deleteInS(i,strat);
9055  i--;
9056  }
9057  else if (change)
9058  {
9060  {
9061  if (TEST_OPT_CONTENTSB)
9062  {
9063  number n;
9064  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9065  if (!nIsOne(n))
9066  {
9068  denom->n=nInvers(n);
9069  denom->next=DENOMINATOR_LIST;
9070  DENOMINATOR_LIST=denom;
9071  }
9072  nDelete(&n);
9073  }
9074  else
9075  {
9076  //pContent(strat->S[i]);
9077  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9078  }
9079  }
9080  else
9081  {
9082  pNorm(strat->S[i]);
9083  }
9084  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9085  }
9086  }
9087  i++;
9088  }
9089  if (any_change) reorderS(&suc,strat);
9090  else break;
9091  }
9092  if (toT)
9093  {
9094  for (i=0; i<=strat->sl; i++)
9095  {
9096  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9097  {
9098  h.p = redtailBba(strat->S[i],i-1,strat);
9100  {
9101  h.pCleardenom();// also does a pContent
9102  }
9103  }
9104  else
9105  {
9106  h.p = strat->S[i];
9107  }
9108  strat->initEcart(&h);
9109  if (strat->honey)
9110  {
9111  strat->ecartS[i] = h.ecart;
9112  }
9113  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9114  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9115  h.sev = strat->sevS[i];
9116  /*puts the elements of S also to T*/
9117  strat->initEcart(&h);
9118  enterT(h,strat);
9119  strat->S_2_R[i] = strat->tl;
9120  }
9121  }
9122  }
9123  else
9124  {
9125  while (suc != -1)
9126  {
9127  i=suc;
9128  while (i<=strat->sl)
9129  {
9130  change=FALSE;
9131  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9132  {
9133  redSi=pHead((strat->S)[i]);
9134  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9135  if ((strat->S)[i]==NULL)
9136  {
9137  deleteInS(i,strat);
9138  i--;
9139  }
9140  else if (pCmp((strat->S)[i],redSi)!=0)
9141  {
9142  any_change=TRUE;
9143  h.p = strat->S[i];
9144  strat->initEcart(&h);
9145  strat->ecartS[i] = h.ecart;
9147  {
9148  if (TEST_OPT_CONTENTSB)
9149  {
9150  number n;
9151  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9152  if (!nIsOne(n))
9153  {
9155  denom->n=nInvers(n);
9156  denom->next=DENOMINATOR_LIST;
9157  DENOMINATOR_LIST=denom;
9158  }
9159  nDelete(&n);
9160  }
9161  else
9162  {
9163  //pContent(strat->S[i]);
9164  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9165  }
9166  }
9167  else
9168  {
9169  pNorm(strat->S[i]); // == h.p
9170  }
9171  h.sev = pGetShortExpVector(h.p);
9172  strat->sevS[i] = h.sev;
9173  }
9174  pLmDelete(&redSi);
9175  kTest(strat);
9176  }
9177  i++;
9178  }
9179 #ifdef KDEBUG
9180  kTest(strat);
9181 #endif
9182  if (any_change) reorderS(&suc,strat);
9183  else { suc=-1; break; }
9184  if (h.p!=NULL)
9185  {
9186  if (!strat->kHEdgeFound)
9187  {
9188  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9189  }
9190  if (strat->kHEdgeFound)
9191  newHEdge(strat);
9192  }
9193  }
9194  for (i=0; i<=strat->sl; i++)
9195  {
9196  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9197  {
9198  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9199  strat->initEcart(&h);
9200  strat->ecartS[i] = h.ecart;
9201  h.sev = pGetShortExpVector(h.p);
9202  strat->sevS[i] = h.sev;
9203  }
9204  else
9205  {
9206  h.p = strat->S[i];
9207  h.ecart=strat->ecartS[i];
9208  h.sev = strat->sevS[i];
9209  h.length = h.pLength = pLength(h.p);
9210  }
9211  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9212  cancelunit1(&h,&suc,strat->sl,strat);
9213  h.SetpFDeg();
9214  /*puts the elements of S also to T*/
9215  enterT(h,strat);
9216  strat->S_2_R[i] = strat->tl;
9217  }
9218  if (suc!= -1) updateS(toT,strat);
9219  }
9220 #ifdef KDEBUG
9221  kTest(strat);
9222 #endif
9223 }
denominator_list_s * denominator_list
Definition: kutil.h:57
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:52
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:330
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8843
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5049
#define TEST_OPT_CONTENTSB
Definition: options.h:121
int tl
Definition: kutil.h:338
#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:89
#define kTest(A)
Definition: kutil.h:640
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7572
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8931
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2883
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
#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:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
#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:292
#define nDelete(n)
Definition: numbers.h:16
int int kStrategy strat
Definition: myNF.cc:68
#define nInvers(a)
Definition: numbers.h:33
BOOLEAN kHEdgeFound
Definition: kutil.h:365
intset ecartS
Definition: kutil.h:295
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
ring tailRing
Definition: kutil.h:331
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
denominator_list next
Definition: kutil.h:59
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9000
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8955
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10736
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2755

◆ updateSShift()

void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 12060 of file kutil.cc.

12061 {
12062  /* to use after updateS(toT=FALSE,strat) */
12063  /* fills T with shifted elt's of S */
12064  int i;
12065  LObject h;
12066  int atT = -1; // or figure out smth better
12067  strat->tl = -1; // init
12068  for (i=0; i<=strat->sl; i++)
12069  {
12070  memset(&h,0,sizeof(h));
12071  h.p = strat->S[i]; // lm in currRing, tail in TR
12072  strat->initEcart(&h);
12073  h.sev = strat->sevS[i];
12074  h.t_p = NULL;
12075  h.GetTP(); // creates correct t_p
12076  /*puts the elements of S with their shifts to T*/
12077  // int atT, int uptodeg, int lV)
12078  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12079  // need a small check for above; we insert >=1 elements
12080  // insert this check into kTest_TS ?
12081  enterTShift(h,strat,atT,uptodeg,lV);
12082  }
12083  /* what about setting strat->tl? */
12084 }
class sLObject LObject
Definition: kutil.h:52
int * S_2_R
Definition: kutil.h:330
int tl
Definition: kutil.h:338
void(* initEcart)(TObject *L)
Definition: kutil.h:266
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12697
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:292
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:308
int sl
Definition: kutil.h:336
static Poly * h
Definition: janet.cc:978

Variable Documentation

◆ DENOMINATOR_LIST

denominator_list DENOMINATOR_LIST

Definition at line 89 of file kutil.cc.

◆ HCord

int HCord

Definition at line 235 of file kutil.cc.

◆ strat_nr

int strat_nr

Definition at line 27 of file kstdfac.cc.

◆ test_PosInL

int(* test_PosInL) (const LSet set, const int length, LObject *L, const kStrategy strat)

Definition at line 83 of file kstd2.cc.

◆ test_PosInT

int(* test_PosInT) (const TSet T, const int tl, LObject &h)

Definition at line 82 of file kstd2.cc.