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   16
 
#define setmaxL   ((4096-12)/sizeof(LObject))
 
#define setmaxLinc   ((4096)/sizeof(LObject))
 
#define setmaxT   64
 
#define setmaxTinc   32
 
#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 67 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 392 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 51 of file kutil.h.

◆ kTest

#define kTest (   A)    (TRUE)

Definition at line 648 of file kutil.h.

◆ kTest_L

#define kTest_L (   T)    (TRUE)

Definition at line 652 of file kutil.h.

◆ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 651 of file kutil.h.

◆ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 650 of file kutil.h.

◆ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 649 of file kutil.h.

◆ messageSets

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

Definition at line 536 of file kutil.h.

◆ NO_KINLINE

#define NO_KINLINE   1

Definition at line 52 of file kutil.h.

◆ setmax

#define setmax   16

Definition at line 28 of file kutil.h.

◆ setmaxL

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

Definition at line 29 of file kutil.h.

◆ setmaxLinc

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

Definition at line 30 of file kutil.h.

◆ setmaxT

#define setmaxT   64

Definition at line 32 of file kutil.h.

◆ setmaxTinc

#define setmaxTinc   32

Definition at line 33 of file kutil.h.

Typedef Documentation

◆ denominator_list

Definition at line 65 of file kutil.h.

◆ intset

typedef int* intset

Definition at line 55 of file kutil.h.

◆ LObject

typedef class sLObject LObject

Definition at line 60 of file kutil.h.

◆ LSet

typedef LObject* LSet

Definition at line 62 of file kutil.h.

◆ TObject

typedef class sTObject TObject

Definition at line 59 of file kutil.h.

◆ TSet

typedef TObject* TSet

Definition at line 61 of file kutil.h.

◆ wlen_set

typedef wlen_type* wlen_set

Definition at line 57 of file kutil.h.

◆ wlen_type

typedef int64 wlen_type

Definition at line 56 of file kutil.h.

Function Documentation

◆ arriRewCriterion()

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

Definition at line 7290 of file kutil.cc.

7291 {
7292  #ifdef ADIDEBUG
7293  printf("\narriRewCrit\n");
7294  #endif
7296  return FALSE;
7297  poly p1 = pOne();
7298  poly p2 = pOne();
7299  for (int ii=strat->sl; ii>start; ii--)
7300  {
7301  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7302  {
7303  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7304  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7305  if (!(pLmCmp(p1,p2) == 1))
7306  {
7307  #ifdef ADIDEBUG
7308  printf("\narriRewCrit deleted: sig, P.sig\n");
7309  #endif
7310  pDelete(&p1);
7311  pDelete(&p2);
7312  return TRUE;
7313  }
7314  }
7315  }
7316  pDelete(&p1);
7317  pDelete(&p2);
7318  return FALSE;
7319 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#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:296
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:300
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:344
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 7321 of file kutil.cc.

7322 {
7323  #ifdef ADIDEBUG
7324  printf("\narriRewCritPre\n");
7325  #endif
7326  //Over Rings, there are still some changes to do: considering coeffs
7328  return FALSE;
7329  int found = -1;
7330  for (int i=strat->Bl; i>-1; i--) {
7331  if (pLmEqual(strat->B[i].sig,sig))
7332  {
7333  found = i;
7334  break;
7335  }
7336  }
7337  if (found != -1)
7338  {
7339  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7340  {
7341  deleteInL(strat->B,&strat->Bl,found,strat);
7342  #ifdef ADIDEBUG
7343  printf("\nDelete!\n");
7344  #endif
7345  }
7346  else
7347  {
7348  #ifdef ADIDEBUG
7349  printf("\nDelete this one!\n");
7350  #endif
7351  return TRUE;
7352  }
7353  }
7354  poly p1 = pOne();
7355  poly p2 = pOne();
7356  for (int ii=strat->sl; ii>-1; ii--)
7357  {
7358  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7359  {
7360  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7361  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7362  if (!(pLmCmp(p1,p2) == 1))
7363  {
7364  pDelete(&p1);
7365  pDelete(&p2);
7366  #ifdef ADIDEBUG
7367  printf("\nDelete this one!\n");
7368  #endif
7369  return TRUE;
7370  }
7371  }
7372  }
7373  pDelete(&p1);
7374  pDelete(&p2);
7375  return FALSE;
7376 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#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:348
#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:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
LSet B
Definition: kutil.h:322
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:344
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:278
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9945
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7941
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7982
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10118
#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:4952
int Bl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
char noClearS
Definition: kutil.h:399
#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:10031
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:275
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:354
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:11379
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
BOOLEAN interpt
Definition: kutil.h:368
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:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:649
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9776
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:536
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:11280
LObject P
Definition: kutil.h:296
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9794
ideal M
Definition: kutil.h:299
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
static unsigned pLength(poly a)
Definition: p_polys.h:189
polyset S
Definition: kutil.h:300
#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:10828
#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:321
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:322
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4915
ring tailRing
Definition: kutil.h:339
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:5128
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10639
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10427
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:344
BOOLEAN use_buckets
Definition: kutil.h:380
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:11214
ideal Shdl
Definition: kutil.h:297
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:10194
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11826
#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:374
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9945
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7941
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7982
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#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:399
#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:12700
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10031
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
int minim
Definition: kutil.h:354
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:11379
#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:12086
BOOLEAN interpt
Definition: kutil.h:368
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
void(* initEcart)(TObject *L)
Definition: kutil.h:274
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:12731
int lV
Definition: kutil.h:365
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:649
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9776
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:536
#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:11280
LObject P
Definition: kutil.h:296
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9794
ideal M
Definition: kutil.h:299
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:12114
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10828
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:321
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:339
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10639
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10427
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:340
BOOLEAN use_buckets
Definition: kutil.h:380
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:10194
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:750
#define TEST_OPT_CANCELUNIT
Definition: options.h:122
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1207

◆ chainCritNormal()

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

Definition at line 3270 of file kutil.cc.

3271 {
3272  int i,j,l;
3273 
3274  /*
3275  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3276  *In this case all elements in B such
3277  *that their lcm is divisible by the leading term of S[i] can be canceled
3278  */
3279  if (strat->pairtest!=NULL)
3280  {
3281  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3282  for (j=0; j<=strat->sl; j++)
3283  {
3284  if (strat->pairtest[j])
3285  {
3286  for (i=strat->Bl; i>=0; i--)
3287  {
3288  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3289  {
3290  deleteInL(strat->B,&strat->Bl,i,strat);
3291  strat->c3++;
3292  }
3293  }
3294  }
3295  }
3296  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3297  strat->pairtest=NULL;
3298  }
3299  if (strat->Gebauer || strat->fromT)
3300  {
3301  if (strat->sugarCrit)
3302  {
3303  /*
3304  *suppose L[j] == (s,r) and p/lcm(s,r)
3305  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3306  *and in case the sugar is o.k. then L[j] can be canceled
3307  */
3308  for (j=strat->Ll; j>=0; j--)
3309  {
3310  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3311  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3312  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3313  {
3314  if (strat->L[j].p == strat->tail)
3315  {
3316  deleteInL(strat->L,&strat->Ll,j,strat);
3317  strat->c3++;
3318  }
3319  }
3320  }
3321  /*
3322  *this is GEBAUER-MOELLER:
3323  *in B all elements with the same lcm except the "best"
3324  *(i.e. the last one in B with this property) will be canceled
3325  */
3326  j = strat->Bl;
3327  loop /*cannot be changed into a for !!! */
3328  {
3329  if (j <= 0) break;
3330  i = j-1;
3331  loop
3332  {
3333  if (i < 0) break;
3334  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3335  {
3336  strat->c3++;
3337  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3338  {
3339  deleteInL(strat->B,&strat->Bl,i,strat);
3340  j--;
3341  }
3342  else
3343  {
3344  deleteInL(strat->B,&strat->Bl,j,strat);
3345  break;
3346  }
3347  }
3348  i--;
3349  }
3350  j--;
3351  }
3352  }
3353  else /*sugarCrit*/
3354  {
3355  /*
3356  *suppose L[j] == (s,r) and p/lcm(s,r)
3357  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3358  *and in case the sugar is o.k. then L[j] can be canceled
3359  */
3360  for (j=strat->Ll; j>=0; j--)
3361  {
3362  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3363  {
3364  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3365  {
3366  deleteInL(strat->L,&strat->Ll,j,strat);
3367  strat->c3++;
3368  }
3369  }
3370  }
3371  /*
3372  *this is GEBAUER-MOELLER:
3373  *in B all elements with the same lcm except the "best"
3374  *(i.e. the last one in B with this property) will be canceled
3375  */
3376  j = strat->Bl;
3377  loop /*cannot be changed into a for !!! */
3378  {
3379  if (j <= 0) break;
3380  for(i=j-1; i>=0; i--)
3381  {
3382  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3383  {
3384  strat->c3++;
3385  deleteInL(strat->B,&strat->Bl,i,strat);
3386  j--;
3387  }
3388  }
3389  j--;
3390  }
3391  }
3392  /*
3393  *the elements of B enter L
3394  */
3395  kMergeBintoL(strat);
3396  }
3397  else
3398  {
3399  for (j=strat->Ll; j>=0; j--)
3400  {
3401  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3402  {
3403  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3404  {
3405  deleteInL(strat->L,&strat->Ll,j,strat);
3406  strat->c3++;
3407  }
3408  }
3409  }
3410  /*
3411  *this is our MODIFICATION of GEBAUER-MOELLER:
3412  *First the elements of B enter L,
3413  *then we fix a lcm and the "best" element in L
3414  *(i.e the last in L with this lcm and of type (s,p))
3415  *and cancel all the other elements of type (r,p) with this lcm
3416  *except the case the element (s,r) has also the same lcm
3417  *and is on the worst position with respect to (s,p) and (r,p)
3418  */
3419  /*
3420  *B enters to L/their order with respect to B is permutated for elements
3421  *B[i].p with the same leading term
3422  */
3423  kMergeBintoL(strat);
3424  j = strat->Ll;
3425  loop /*cannot be changed into a for !!! */
3426  {
3427  if (j <= 0)
3428  {
3429  /*now L[0] cannot be canceled any more and the tail can be removed*/
3430  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3431  break;
3432  }
3433  if (strat->L[j].p2 == p)
3434  {
3435  i = j-1;
3436  loop
3437  {
3438  if (i < 0) break;
3439  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3440  {
3441  /*L[i] could be canceled but we search for a better one to cancel*/
3442  strat->c3++;
3443  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3444  && (pNext(strat->L[l].p) == strat->tail)
3445  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3446  && pDivisibleBy(p,strat->L[l].lcm))
3447  {
3448  /*
3449  *"NOT equal(...)" because in case of "equal" the element L[l]
3450  *is "older" and has to be from theoretical point of view behind
3451  *L[i], but we do not want to reorder L
3452  */
3453  strat->L[i].p2 = strat->tail;
3454  /*
3455  *L[l] will be canceled, we cannot cancel L[i] later on,
3456  *so we mark it with "tail"
3457  */
3458  deleteInL(strat->L,&strat->Ll,l,strat);
3459  i--;
3460  }
3461  else
3462  {
3463  deleteInL(strat->L,&strat->Ll,i,strat);
3464  }
3465  j--;
3466  }
3467  i--;
3468  }
3469  }
3470  else if (strat->L[j].p2 == strat->tail)
3471  {
3472  /*now L[j] cannot be canceled any more and the tail can be removed*/
3473  strat->L[j].p2 = p;
3474  }
3475  j--;
3476  }
3477  }
3478 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
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:376
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:375
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:330
polyset S
Definition: kutil.h:300
BOOLEAN sugarCrit
Definition: kutil.h:374
LSet L
Definition: kutil.h:321
#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:322
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
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 3483 of file kutil.cc.

3484 {
3485  if (strat->pairtest!=NULL)
3486  {
3487  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3488  strat->pairtest=NULL;
3489  }
3490  /*
3491  *the elements of B enter L
3492  */
3493  kMergeBintoL(strat);
3494 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:329
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
int BOOLEAN
Definition: auxiliary.h:85

◆ chainCritSig()

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

Definition at line 3499 of file kutil.cc.

3500 {
3501  int i,j,l;
3502  kMergeBintoLSba(strat);
3503  j = strat->Ll;
3504  loop /*cannot be changed into a for !!! */
3505  {
3506  if (j <= 0)
3507  {
3508  /*now L[0] cannot be canceled any more and the tail can be removed*/
3509  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3510  break;
3511  }
3512  if (strat->L[j].p2 == p)
3513  {
3514  i = j-1;
3515  loop
3516  {
3517  if (i < 0) break;
3518  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3519  {
3520  /*L[i] could be canceled but we search for a better one to cancel*/
3521  strat->c3++;
3522  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3523  && (pNext(strat->L[l].p) == strat->tail)
3524  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3525  && pDivisibleBy(p,strat->L[l].lcm))
3526  {
3527  /*
3528  *"NOT equal(...)" because in case of "equal" the element L[l]
3529  *is "older" and has to be from theoretical point of view behind
3530  *L[i], but we do not want to reorder L
3531  */
3532  strat->L[i].p2 = strat->tail;
3533  /*
3534  *L[l] will be canceled, we cannot cancel L[i] later on,
3535  *so we mark it with "tail"
3536  */
3537  deleteInL(strat->L,&strat->Ll,l,strat);
3538  i--;
3539  }
3540  else
3541  {
3542  deleteInL(strat->L,&strat->Ll,i,strat);
3543  }
3544  j--;
3545  }
3546  i--;
3547  }
3548  }
3549  else if (strat->L[j].p2 == strat->tail)
3550  {
3551  /*now L[j] cannot be canceled any more and the tail can be removed*/
3552  strat->L[j].p2 = p;
3553  }
3554  j--;
3555  }
3556 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
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:330
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3247
LSet L
Definition: kutil.h:321
#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:346
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:300
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:339
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
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:399
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:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevS
Definition: kutil.h:316

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 10639 of file kutil.cc.

10640 {
10641  int i;
10642  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10643  LObject L;
10644 
10645 #ifdef KDEBUG
10646  // need to set this: during tailreductions of T[i], T[i].max is out of
10647  // sync
10648  sloppy_max = TRUE;
10649 #endif
10650 
10651  strat->noTailReduction = FALSE;
10652  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10653  if (TEST_OPT_PROT)
10654  {
10655  PrintLn();
10656 // if (timerv) writeTime("standard base computed:");
10657  }
10658  if (TEST_OPT_PROT)
10659  {
10660  Print("(S:%d)",strat->sl);mflush();
10661  }
10662  for (i=strat->sl; i>=low; i--)
10663  {
10664  int end_pos=strat->sl;
10665  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10666  if (strat->ak==0) end_pos=i-1;
10667  TObject* T_j = strat->s_2_t(i);
10668  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10669  {
10670  L = *T_j;
10671  #ifdef KDEBUG
10672  if (TEST_OPT_DEBUG)
10673  {
10674  Print("test S[%d]:",i);
10675  p_wrp(L.p,currRing,strat->tailRing);
10676  PrintLn();
10677  }
10678  #endif
10680  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10681  else
10682  strat->S[i] = redtail(&L, strat->sl, strat);
10683  #ifdef KDEBUG
10684  if (TEST_OPT_DEBUG)
10685  {
10686  Print("to (tailR) S[%d]:",i);
10687  p_wrp(strat->S[i],currRing,strat->tailRing);
10688  PrintLn();
10689  }
10690  #endif
10691 
10692  if (strat->redTailChange)
10693  {
10694  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10695  if (pNext(T_j->p) != NULL)
10696  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10697  else
10698  T_j->max_exp = NULL;
10699  }
10701  T_j->pCleardenom();
10702  }
10703  else
10704  {
10705  assume(currRing == strat->tailRing);
10706  #ifdef KDEBUG
10707  if (TEST_OPT_DEBUG)
10708  {
10709  Print("test S[%d]:",i);
10710  p_wrp(strat->S[i],currRing,strat->tailRing);
10711  PrintLn();
10712  }
10713  #endif
10715  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10716  else
10717  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10719  {
10720  if (TEST_OPT_CONTENTSB)
10721  {
10722  number n;
10723  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10724  if (!nIsOne(n))
10725  {
10727  denom->n=nInvers(n);
10728  denom->next=DENOMINATOR_LIST;
10729  DENOMINATOR_LIST=denom;
10730  }
10731  nDelete(&n);
10732  }
10733  else
10734  {
10735  //pContent(strat->S[i]);
10736  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10737  }
10738  }
10739  #ifdef KDEBUG
10740  if (TEST_OPT_DEBUG)
10741  {
10742  Print("to (-tailR) S[%d]:",i);
10743  p_wrp(strat->S[i],currRing,strat->tailRing);
10744  PrintLn();
10745  }
10746  #endif
10747  }
10748  if (TEST_OPT_PROT)
10749  PrintS("-");
10750  }
10751  if (TEST_OPT_PROT) PrintLn();
10752 #ifdef KDEBUG
10753  sloppy_max = FALSE;
10754 #endif
10755 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
#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:349
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7598
#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:2875
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:315
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
#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:750
ring tailRing
Definition: kutil.h:339
denominator_list next
Definition: kutil.h:67
#define pNext(p)
Definition: monomials.h:43
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:344
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:2747
char redTailChange
Definition: kutil.h:396
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137

◆ createG0()

ideal createG0 ( )

Definition at line 4561 of file kutil.cc.

4562 {
4563  // Initialize
4564  long exp[50]; // The exponent of \hat{X} (basepoint)
4565  long cexp[50]; // The current exponent for iterating over all
4566  long ind[50]; // The power of 2 in the i-th component of exp
4567  long cind[50]; // analog for cexp
4568  long mult[50]; // How to multiply the elements of G
4569  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4570  long habsind = 0; // The abs. index of the coefficient of h
4571  long step[50]; // The last increases
4572  for (int i = 1; i <= currRing->N; i++)
4573  {
4574  exp[i] = 0;
4575  cexp[i] = exp[i];
4576  ind[i] = 0;
4577  step[i] = 500000;
4578  cind[i] = ind[i];
4579  }
4580  long bound = currRing->ch;
4581  step[1] = 500000;
4582 #ifdef OLI_DEBUG
4583  PrintS("-------------\npoly :");
4584 // wrp(p);
4585  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4586  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4587  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4588  Print("bound : %d\n", bound);
4589  Print("cind : %d\n", cabsind);
4590 #endif
4591  if (cabsind == 0)
4592  {
4593  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4594  {
4595  return idInit(1, 1);
4596  }
4597  }
4598  ideal G0 = idInit(1, 1);
4599  // Now the whole simplex
4600  do
4601  {
4602  // Build s-polynomial
4603  // 2**ind-def * mult * g - exp-def * h
4604  poly t_p;
4605  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4606 #ifdef OLI_DEBUG
4607  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4608  PrintS("zPoly : ");
4609  wrp(zeroPoly);
4610  PrintLn();
4611 #endif
4612  // Add to ideal
4613  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4614  IDELEMS(G0) += 1;
4615  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4616  }
4617  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4618  idSkipZeroes(G0);
4619  return G0;
4620 }
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:4432
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4366
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:3594
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:60
return P p
Definition: myNF.cc:203
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
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:652
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:373
BOOLEAN LDegLast
Definition: kutil.h:382
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137

◆ 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:60
return P p
Definition: myNF.cc:203
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc: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:330
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#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:314
int * S_2_R
Definition: kutil.h:338
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
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:318
polyset sig
Definition: kutil.h:302
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4676 of file kutil.cc.

4677 {
4678  if (nIsOne(pGetCoeff(h))) return;
4679  number gcd;
4680  bool go = false;
4681  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4682  {
4683  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4684  go = true;
4685  }
4686  else
4687  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4688  if (go || !nIsOne(gcd))
4689  {
4690  poly p = h->next;
4691  if (!go)
4692  {
4693  number tmp = gcd;
4694  gcd = n_Ann(gcd,currRing->cf);
4695  nDelete(&tmp);
4696  }
4697  p_Test(p,strat->tailRing);
4698  p = pp_Mult_nn(p, gcd, strat->tailRing);
4699  nDelete(&gcd);
4700 
4701  if (p != NULL)
4702  {
4703  if (TEST_OPT_PROT)
4704  {
4705  PrintS("Z");
4706  }
4707 #ifdef KDEBUG
4708  if (TEST_OPT_DEBUG)
4709  {
4710  PrintS("--- create zero spoly: ");
4711  p_wrp(h,currRing,strat->tailRing);
4712  PrintS(" ---> ");
4713  }
4714 #endif
4715  poly tmp = pInit();
4716  pSetCoeff0(tmp, pGetCoeff(p));
4717  for (int i = 1; i <= rVar(currRing); i++)
4718  {
4719  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4720  }
4722  {
4723  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4724  }
4725  p_Setm(tmp, currRing);
4726  p = p_LmFreeAndNext(p, strat->tailRing);
4727  pNext(tmp) = p;
4728  LObject Lp;
4729  Lp.Init();
4730  Lp.p = tmp;
4731  Lp.tailRing = strat->tailRing;
4732  int posx;
4733  if (Lp.p!=NULL)
4734  {
4735  strat->initEcart(&Lp);
4736  if (strat->Ll==-1)
4737  posx =0;
4738  else
4739  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4740  Lp.sev = pGetShortExpVector(Lp.p);
4741  if (strat->tailRing != currRing)
4742  {
4743  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4744  }
4745 #ifdef KDEBUG
4746  if (TEST_OPT_DEBUG)
4747  {
4748  p_wrp(tmp,currRing,strat->tailRing);
4749  PrintLn();
4750  }
4751 #endif
4752  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4753  }
4754  }
4755  }
4756  nDelete(&gcd);
4757 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
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:60
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#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:274
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:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
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 4759 of file kutil.cc.

4760 {
4761  if (nIsOne(pGetCoeff(h))) return;
4762  number gcd;
4763  bool go = false;
4764  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4765  {
4766  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4767  go = true;
4768  }
4769  else
4770  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4771  if (go || !nIsOne(gcd))
4772  {
4773  poly p = h->next;
4774  if (!go)
4775  {
4776  number tmp = gcd;
4777  gcd = n_Ann(gcd,currRing->cf);
4778  nDelete(&tmp);
4779  }
4780  p_Test(p,strat->tailRing);
4781  p = pp_Mult_nn(p, gcd, strat->tailRing);
4782 
4783  if (p != NULL)
4784  {
4785  if (TEST_OPT_PROT)
4786  {
4787  PrintS("Z");
4788  }
4789 #ifdef KDEBUG
4790  if (TEST_OPT_DEBUG)
4791  {
4792  PrintS("--- create zero spoly: ");
4793  p_wrp(h,currRing,strat->tailRing);
4794  PrintS(" ---> ");
4795  }
4796 #endif
4797  poly tmp = pInit();
4798  pSetCoeff0(tmp, pGetCoeff(p));
4799  for (int i = 1; i <= rVar(currRing); i++)
4800  {
4801  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4802  }
4804  {
4805  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4806  }
4807  p_Setm(tmp, currRing);
4808  p = p_LmFreeAndNext(p, strat->tailRing);
4809  pNext(tmp) = p;
4810  LObject Lp;
4811  Lp.Init();
4812  Lp.p = tmp;
4813  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4814  #if EXT_POLY_NEW
4815  Lp.sig = pp_Mult_nn(hSig, gcd, currRing);
4816  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4817  {
4818  #ifdef ADIDEBUG
4819  printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig);
4820  #endif
4821  strat->sigdrop = TRUE;
4822  //Try to reduce it as far as we can via redRing
4823  int red_result = redRing(&Lp,strat);
4824  #ifdef ADIDEBUG
4825  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
4826  #endif
4827  if(red_result == 0)
4828  {
4829  // Cancel the sigdrop
4830  #ifdef ADIDEBUG
4831  printf("\nCancel the sigdrop. It reduced to 0\n");
4832  #endif
4833  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4834  strat->sigdrop = FALSE;
4835  return;
4836  }
4837  else
4838  {
4839  #ifdef ADIDEBUG
4840  printf("\nSigdrop. end\n");
4841  #endif
4842  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4843  #if 1
4844  strat->enterS(Lp,0,strat,strat->tl);
4845  #endif
4846  return;
4847  }
4848 
4849  }
4850  #else
4851  Lp.sig = pOne();
4852  if(strat->Ll >= 0)
4853  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4854  else
4855  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4856  #endif
4857  Lp.tailRing = strat->tailRing;
4858  int posx;
4859  if (Lp.p!=NULL)
4860  {
4861  strat->initEcart(&Lp);
4862  if (strat->Ll==-1)
4863  posx =0;
4864  else
4865  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4866  Lp.sev = pGetShortExpVector(Lp.p);
4867  if (strat->tailRing != currRing)
4868  {
4869  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4870  }
4871 #ifdef KDEBUG
4872  if (TEST_OPT_DEBUG)
4873  {
4874  p_wrp(tmp,currRing,strat->tailRing);
4875  PrintLn();
4876  }
4877 #endif
4878  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4879  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4880  }
4881  }
4882  nDelete(&gcd);
4883  }
4884  nDelete(&gcd);
4885 }
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:60
bool sigdrop
Definition: kutil.h:356
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#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:276
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int tl
Definition: kutil.h:346
#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:274
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:280
LObject P
Definition: kutil.h:296
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:321
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
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:344
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:60
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:30
#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 1954 of file kutil.cc.

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

12270 {
12271 
12272  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12273  /* for true self pairs qq ==p */
12274  /* we test both qq and p */
12276  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12279 
12280  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12281 
12282  // int j = 0;
12283  int j = 1;
12284 
12285  /* for such self pairs start with 1, not with 0 */
12286  if (qq == p) j=1;
12287 
12288  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12289  /* that is create the pairs (f, s \dot g) */
12290 
12291  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12292 
12293 #ifdef KDEBUG
12294  //if (TEST_OPT_DEBUG)
12295  //{
12296  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12297  //}
12298 #endif
12299 
12300  poly q;
12301 
12302  /* these vars hold for all shifts of s[i] */
12303  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12304  int qfromQ = 0; // strat->fromQ[i];
12305 
12306  for (; j<= toInsert; j++)
12307  {
12308  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12309  /* we increase shifts by one; must delete q there*/
12310  // q = qq; q = pMoveCurrTail2poly(q,strat);
12311  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12312  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12313  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12314  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12315  // pNext(q) = s; // in tailRing
12316  /* here we need to call enterOnePair with two polys ... */
12317 #ifdef KDEBUG
12318  //if (TEST_OPT_DEBUG)
12319  //{
12320  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12321  //}
12322 #endif
12323  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12324  }
12325 }
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:12332
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:339
#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 12332 of file kutil.cc.

12333 {
12334 
12335  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12336 
12337  /* check this Formats: */
12339  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12342 
12343 #ifdef KDEBUG
12344 // if (TEST_OPT_DEBUG)
12345 // {
12346 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12347 // wrp(q); // wrp(pHead(q));
12348 // PrintS(", p = ");
12349 // wrp(p); //wrp(pHead(p));
12350 // PrintLn();
12351 // }
12352 #endif
12353 
12354  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12355 
12356  int qfromQ = qisFromQ;
12357 
12358  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12359 
12360  int l,j,compare;
12361  LObject Lp;
12362  Lp.i_r = -1;
12363 
12364 #ifdef KDEBUG
12365  Lp.ecart=0; Lp.length=0;
12366 #endif
12367  /*- computes the lcm(s[i],p) -*/
12368  Lp.lcm = pInit();
12369 
12370  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
12371  pSetm(Lp.lcm);
12372 
12373  /* apply the V criterion */
12374  if (!isInV(Lp.lcm, lV))
12375  {
12376 #ifdef KDEBUG
12377  if (TEST_OPT_DEBUG)
12378  {
12379  PrintS("V crit applied to q = ");
12380  wrp(q); // wrp(pHead(q));
12381  PrintS(", p = ");
12382  wrp(p); //wrp(pHead(p));
12383  PrintLn();
12384  }
12385 #endif
12386  pLmFree(Lp.lcm);
12387  Lp.lcm=NULL;
12388  /* + counter for applying the V criterion */
12389  strat->cv++;
12390  return;
12391  }
12392 
12393  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12394  {
12395  if((!((ecartq>0)&&(ecart>0)))
12396  && pHasNotCF(p,q))
12397  {
12398  /*
12399  *the product criterion has applied for (s,p),
12400  *i.e. lcm(s,p)=product of the leading terms of s and p.
12401  *Suppose (s,r) is in L and the leading term
12402  *of p divides lcm(s,r)
12403  *(==> the leading term of p divides the leading term of r)
12404  *but the leading term of s does not divide the leading term of r
12405  *(notice that this condition is automatically satisfied if r is still
12406  *in S), then (s,r) can be cancelled.
12407  *This should be done here because the
12408  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12409  *
12410  *Moreover, skipping (s,r) holds also for the noncommutative case.
12411  */
12412  strat->cp++;
12413  pLmFree(Lp.lcm);
12414  Lp.lcm=NULL;
12415  return;
12416  }
12417  else
12418  Lp.ecart = si_max(ecart,ecartq);
12419  if (strat->fromT && (ecartq>ecart))
12420  {
12421  pLmFree(Lp.lcm);
12422  Lp.lcm=NULL;
12423  return;
12424  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12425  }
12426  /*
12427  *the set B collects the pairs of type (S[j],p)
12428  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12429  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12430  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12431  */
12432  {
12433  j = strat->Bl;
12434  loop
12435  {
12436  if (j < 0) break;
12437  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12438  if ((compare==1)
12439  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12440  {
12441  strat->c3++;
12442  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12443  {
12444  pLmFree(Lp.lcm);
12445  return;
12446  }
12447  break;
12448  }
12449  else
12450  if ((compare ==-1)
12451  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12452  {
12453  deleteInL(strat->B,&strat->Bl,j,strat);
12454  strat->c3++;
12455  }
12456  j--;
12457  }
12458  }
12459  }
12460  else /*sugarcrit*/
12461  {
12462  if (ALLOW_PROD_CRIT(strat))
12463  {
12464  // if currRing->nc_type!=quasi (or skew)
12465  // TODO: enable productCrit for super commutative algebras...
12466  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12467  pHasNotCF(p,q))
12468  {
12469  /*
12470  *the product criterion has applied for (s,p),
12471  *i.e. lcm(s,p)=product of the leading terms of s and p.
12472  *Suppose (s,r) is in L and the leading term
12473  *of p devides lcm(s,r)
12474  *(==> the leading term of p devides the leading term of r)
12475  *but the leading term of s does not devide the leading term of r
12476  *(notice that tis condition is automatically satisfied if r is still
12477  *in S), then (s,r) can be canceled.
12478  *This should be done here because the
12479  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12480  */
12481  strat->cp++;
12482  pLmFree(Lp.lcm);
12483  Lp.lcm=NULL;
12484  return;
12485  }
12486  if (strat->fromT && (ecartq>ecart))
12487  {
12488  pLmFree(Lp.lcm);
12489  Lp.lcm=NULL;
12490  return;
12491  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12492  }
12493  /*
12494  *the set B collects the pairs of type (S[j],p)
12495  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12496  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12497  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12498  */
12499  for(j = strat->Bl;j>=0;j--)
12500  {
12501  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12502  if (compare==1)
12503  {
12504  strat->c3++;
12505  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12506  {
12507  pLmFree(Lp.lcm);
12508  return;
12509  }
12510  break;
12511  }
12512  else
12513  if (compare ==-1)
12514  {
12515  deleteInL(strat->B,&strat->Bl,j,strat);
12516  strat->c3++;
12517  }
12518  }
12519  }
12520  }
12521  /*
12522  *the pair (S[i],p) enters B if the spoly != 0
12523  */
12524  /*- compute the short s-polynomial -*/
12525  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12526  pNorm(p);
12527  if ((q==NULL) || (p==NULL))
12528  return;
12529  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12530  Lp.p=NULL;
12531  else
12532  {
12533 // if ( rIsPluralRing(currRing) )
12534 // {
12535 // if(pHasNotCF(p, q))
12536 // {
12537 // if(ncRingType(currRing) == nc_lie)
12538 // {
12539 // // generalized prod-crit for lie-type
12540 // strat->cp++;
12541 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12542 // }
12543 // else
12544 // if( ALLOW_PROD_CRIT(strat) )
12545 // {
12546 // // product criterion for homogeneous case in SCA
12547 // strat->cp++;
12548 // Lp.p = NULL;
12549 // }
12550 // else
12551 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12552 // }
12553 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12554 // }
12555 // else
12556 // {
12557 
12558  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12559  /* p is already in this form, so convert q */
12560  // q = pMove2CurrTail(q, strat);
12561  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12562  // }
12563  }
12564  if (Lp.p == NULL)
12565  {
12566  /*- the case that the s-poly is 0 -*/
12567  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12568 // if (strat->pairtest==NULL) initPairtest(strat);
12569 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12570 // strat->pairtest[strat->sl+1] = TRUE;
12571  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12572  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12573  /*
12574  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12575  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12576  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12577  *term of p devides the lcm(s,r)
12578  *(this canceling should be done here because
12579  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12580  *the first case is handeled in chainCrit
12581  */
12582  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12583  }
12584  else
12585  {
12586  /*- the pair (S[i],p) enters B -*/
12587  /* both of them should have their LM in currRing and TAIL in tailring */
12588  Lp.p1 = q; // already in the needed form
12589  Lp.p2 = p; // already in the needed form
12590 
12591  if ( !rIsPluralRing(currRing) )
12592  pNext(Lp.p) = strat->tail;
12593 
12594  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12595  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12596  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12597  {
12598  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12599  Lp.i_r2 = atR;
12600  }
12601  else
12602  {
12603  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12604  Lp.i_r1 = -1;
12605  Lp.i_r2 = -1;
12606  }
12607  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12608 
12610  {
12611  if (!rIsPluralRing(currRing))
12612  nDelete(&(Lp.p->coef));
12613  }
12614 
12615  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12616  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12617  }
12618 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define pSetm(p)
Definition: polys.h:253
void PrintLn()
Definition: reporter.cc:310
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
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:366
int Bl
Definition: kutil.h:348
#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:281
#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:348
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:376
#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:315
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:330
BOOLEAN sugarCrit
Definition: kutil.h:374
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
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
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
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 4952 of file kutil.cc.

4953 {
4954  int j=pos;
4955 
4957  initenterpairs(h,k,ecart,0,strat, atR);
4958  if ( (!strat->fromT)
4959  && ((strat->syzComp==0)
4960  ||(pGetComp(h)<=strat->syzComp)))
4961  {
4962  unsigned long h_sev = pGetShortExpVector(h);
4963  loop
4964  {
4965  if (j > k) break;
4966  clearS(h,h_sev, &j,&k,strat);
4967  j++;
4968  }
4969  }
4970 }
int syzComp
Definition: kutil.h:350
loop
Definition: myNF.cc:98
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3847
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:376
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 12700 of file kutil.cc.

12701 {
12702  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12703  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12704  int j=pos;
12705 
12707  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12708  if ( (!strat->fromT)
12709  && ((strat->syzComp==0)
12710  ||(pGetComp(h)<=strat->syzComp)))
12711  {
12712  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12713  unsigned long h_sev = pGetShortExpVector(h);
12714  loop
12715  {
12716  if (j > k) break;
12717  clearS(h,h_sev, &j,&k,strat);
12718  j++;
12719  }
12720  //Print("end clearS sl=%d\n",strat->sl);
12721  }
12722  // PrintS("end enterpairs\n");
12723 }
int syzComp
Definition: kutil.h:350
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:12627
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:376
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 4978 of file kutil.cc.

4979 {
4980  int j=pos;
4982  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4983  if ( (!strat->fromT)
4984  && ((strat->syzComp==0)
4985  ||(pGetComp(h)<=strat->syzComp)))
4986  {
4987  unsigned long h_sev = pGetShortExpVector(h);
4988  loop
4989  {
4990  if (j > k) break;
4991  clearS(h,h_sev, &j,&k,strat);
4992  j++;
4993  }
4994  }
4995 }
int syzComp
Definition: kutil.h:350
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:3917
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:376
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 9255 of file kutil.cc.

9256 {
9257  strat->news = TRUE;
9258  /*- puts p to the standardbasis s at position at -*/
9259  if (strat->sl == IDELEMS(strat->Shdl)-1)
9260  {
9261  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9262  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9263  (IDELEMS(strat->Shdl)+setmaxTinc)
9264  *sizeof(unsigned long));
9265  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9266  IDELEMS(strat->Shdl)*sizeof(int),
9267  (IDELEMS(strat->Shdl)+setmaxTinc)
9268  *sizeof(int));
9269  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9270  IDELEMS(strat->Shdl)*sizeof(int),
9271  (IDELEMS(strat->Shdl)+setmaxTinc)
9272  *sizeof(int));
9273  if (strat->lenS!=NULL)
9274  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9275  IDELEMS(strat->Shdl)*sizeof(int),
9276  (IDELEMS(strat->Shdl)+setmaxTinc)
9277  *sizeof(int));
9278  if (strat->lenSw!=NULL)
9279  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9280  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9281  (IDELEMS(strat->Shdl)+setmaxTinc)
9282  *sizeof(wlen_type));
9283  if (strat->fromQ!=NULL)
9284  {
9285  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9286  IDELEMS(strat->Shdl)*sizeof(int),
9287  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9288  }
9289  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9290  IDELEMS(strat->Shdl)+=setmaxTinc;
9291  strat->Shdl->m=strat->S;
9292  }
9293  if (atS <= strat->sl)
9294  {
9295 #ifdef ENTER_USE_MEMMOVE
9296  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9297  (strat->sl - atS + 1)*sizeof(poly));
9298  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9299  (strat->sl - atS + 1)*sizeof(int));
9300  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9301  (strat->sl - atS + 1)*sizeof(unsigned long));
9302  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9303  (strat->sl - atS + 1)*sizeof(int));
9304  if (strat->lenS!=NULL)
9305  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9306  (strat->sl - atS + 1)*sizeof(int));
9307  if (strat->lenSw!=NULL)
9308  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9309  (strat->sl - atS + 1)*sizeof(wlen_type));
9310 #else
9311  for (i=strat->sl+1; i>=atS+1; i--)
9312  {
9313  strat->S[i] = strat->S[i-1];
9314  strat->ecartS[i] = strat->ecartS[i-1];
9315  strat->sevS[i] = strat->sevS[i-1];
9316  strat->S_2_R[i] = strat->S_2_R[i-1];
9317  }
9318  if (strat->lenS!=NULL)
9319  for (i=strat->sl+1; i>=atS+1; i--)
9320  strat->lenS[i] = strat->lenS[i-1];
9321  if (strat->lenSw!=NULL)
9322  for (i=strat->sl+1; i>=atS+1; i--)
9323  strat->lenSw[i] = strat->lenSw[i-1];
9324 #endif
9325  }
9326  if (strat->fromQ!=NULL)
9327  {
9328 #ifdef ENTER_USE_MEMMOVE
9329  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9330  (strat->sl - atS + 1)*sizeof(int));
9331 #else
9332  for (i=strat->sl+1; i>=atS+1; i--)
9333  {
9334  strat->fromQ[i] = strat->fromQ[i-1];
9335  }
9336 #endif
9337  strat->fromQ[atS]=0;
9338  }
9339 
9340  /*- save result -*/
9341  strat->S[atS] = p.p;
9342  if (strat->honey) strat->ecartS[atS] = p.ecart;
9343  if (p.sev == 0)
9344  p.sev = pGetShortExpVector(p.p);
9345  else
9346  assume(p.sev == pGetShortExpVector(p.p));
9347  strat->sevS[atS] = p.sev;
9348  strat->ecartS[atS] = p.ecart;
9349  strat->S_2_R[atS] = atR;
9350  strat->sl++;
9351 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:374
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:397
#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:315
#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:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297

◆ entersets()

void entersets ( LObject  h)

◆ enterSSba()

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

Definition at line 9357 of file kutil.cc.

9358 {
9359  strat->news = TRUE;
9360  /*- puts p to the standardbasis s at position at -*/
9361  if (strat->sl == IDELEMS(strat->Shdl)-1)
9362  {
9363  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9364  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9365  (IDELEMS(strat->Shdl)+setmaxTinc)
9366  *sizeof(unsigned long));
9367  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9368  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9369  (IDELEMS(strat->Shdl)+setmaxTinc)
9370  *sizeof(unsigned long));
9371  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9372  IDELEMS(strat->Shdl)*sizeof(int),
9373  (IDELEMS(strat->Shdl)+setmaxTinc)
9374  *sizeof(int));
9375  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9376  IDELEMS(strat->Shdl)*sizeof(int),
9377  (IDELEMS(strat->Shdl)+setmaxTinc)
9378  *sizeof(int));
9379  if (strat->lenS!=NULL)
9380  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9381  IDELEMS(strat->Shdl)*sizeof(int),
9382  (IDELEMS(strat->Shdl)+setmaxTinc)
9383  *sizeof(int));
9384  if (strat->lenSw!=NULL)
9385  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9386  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9387  (IDELEMS(strat->Shdl)+setmaxTinc)
9388  *sizeof(wlen_type));
9389  if (strat->fromQ!=NULL)
9390  {
9391  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9392  IDELEMS(strat->Shdl)*sizeof(int),
9393  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9394  }
9395  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9396  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
9397  IDELEMS(strat->Shdl)+=setmaxTinc;
9398  strat->Shdl->m=strat->S;
9399  }
9400  // in a signature-based algorithm the following situation will never
9401  // appear due to the fact that the critical pairs are already sorted
9402  // by increasing signature.
9403  // True. However, in the case of integers we need to put the element
9404  // that caused the signature drop on the first position
9405  if (atS <= strat->sl)
9406  {
9407 #ifdef ENTER_USE_MEMMOVE
9408  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9409  (strat->sl - atS + 1)*sizeof(poly));
9410  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9411  (strat->sl - atS + 1)*sizeof(poly));
9412  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9413  (strat->sl - atS + 1)*sizeof(unsigned long));
9414  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9415  (strat->sl - atS + 1)*sizeof(int));
9416  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9417  (strat->sl - atS + 1)*sizeof(unsigned long));
9418  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9419  (strat->sl - atS + 1)*sizeof(int));
9420  if (strat->lenS!=NULL)
9421  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9422  (strat->sl - atS + 1)*sizeof(int));
9423  if (strat->lenSw!=NULL)
9424  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9425  (strat->sl - atS + 1)*sizeof(wlen_type));
9426 #else
9427  for (i=strat->sl+1; i>=atS+1; i--)
9428  {
9429  strat->S[i] = strat->S[i-1];
9430  strat->ecartS[i] = strat->ecartS[i-1];
9431  strat->sevS[i] = strat->sevS[i-1];
9432  strat->S_2_R[i] = strat->S_2_R[i-1];
9433  strat->sig[i] = strat->sig[i-1];
9434  strat->sevSig[i] = strat->sevSig[i-1];
9435  }
9436  if (strat->lenS!=NULL)
9437  for (i=strat->sl+1; i>=atS+1; i--)
9438  strat->lenS[i] = strat->lenS[i-1];
9439  if (strat->lenSw!=NULL)
9440  for (i=strat->sl+1; i>=atS+1; i--)
9441  strat->lenSw[i] = strat->lenSw[i-1];
9442 #endif
9443  }
9444  if (strat->fromQ!=NULL)
9445  {
9446 #ifdef ENTER_USE_MEMMOVE
9447  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9448  (strat->sl - atS + 1)*sizeof(int));
9449 #else
9450  for (i=strat->sl+1; i>=atS+1; i--)
9451  {
9452  strat->fromQ[i] = strat->fromQ[i-1];
9453  }
9454 #endif
9455  strat->fromQ[atS]=0;
9456  }
9457 
9458  /*- save result -*/
9459  strat->S[atS] = p.p;
9460  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9461  if (strat->honey) strat->ecartS[atS] = p.ecart;
9462  if (p.sev == 0)
9463  p.sev = pGetShortExpVector(p.p);
9464  else
9465  assume(p.sev == pGetShortExpVector(p.p));
9466  strat->sevS[atS] = p.sev;
9467  // during the interreduction process of a signature-based algorithm we do not
9468  // compute the signature at this point, but when the whole interreduction
9469  // process finishes, i.e. f5c terminates!
9470  if (p.sig != NULL)
9471  {
9472  if (p.sevSig == 0)
9473  p.sevSig = pGetShortExpVector(p.sig);
9474  else
9475  assume(p.sevSig == pGetShortExpVector(p.sig));
9476  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9477  }
9478  strat->ecartS[atS] = p.ecart;
9479  strat->S_2_R[atS] = atR;
9480  strat->sl++;
9481 #ifdef DEBUGF5
9482  int k;
9483  Print("--- LIST S: %d ---\n",strat->sl);
9484  for(k=0;k<=strat->sl;k++)
9485  {
9486  pWrite(strat->sig[k]);
9487  }
9488  PrintS("--- LIST S END ---\n");
9489 #endif
9490 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:374
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:98
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:315
#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:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297

◆ enterSyz()

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

Definition at line 9692 of file kutil.cc.

9693 {
9694  #ifdef ADIDEBUG
9695  printf("\n Entersyz:\n");pWrite(p.sig);
9696  #endif
9697  int i;
9698  strat->newt = TRUE;
9699  if (strat->syzl == strat->syzmax-1)
9700  {
9701  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9702  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9703  (strat->syzmax)*sizeof(unsigned long),
9704  ((strat->syzmax)+setmaxTinc)
9705  *sizeof(unsigned long));
9706  strat->syzmax += setmaxTinc;
9707  }
9708  if (atT < strat->syzl)
9709  {
9710 #ifdef ENTER_USE_MEMMOVE
9711  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9712  (strat->syzl-atT+1)*sizeof(poly));
9713  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9714  (strat->syzl-atT+1)*sizeof(unsigned long));
9715 #endif
9716  for (i=strat->syzl; i>=atT+1; i--)
9717  {
9718 #ifndef ENTER_USE_MEMMOVE
9719  strat->syz[i] = strat->syz[i-1];
9720  strat->sevSyz[i] = strat->sevSyz[i-1];
9721 #endif
9722  }
9723  }
9724  //i = strat->syzl;
9725  i = atT;
9726  //Makes sure the syz saves just the signature
9727  #ifdef HAVE_RINGS
9729  pNext(p.sig) = NULL;
9730  #endif
9731  strat->syz[atT] = p.sig;
9732  strat->sevSyz[atT] = p.sevSig;
9733  strat->syzl++;
9734 #if F5DEBUG
9735  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9736  pWrite(strat->syz[atT]);
9737 #endif
9738  // recheck pairs in strat->L with new rule and delete correspondingly
9739  int cc = strat->Ll;
9740  while (cc>-1)
9741  {
9742  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9743  //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);
9744  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9745  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9746  #ifdef HAVE_RINGS
9747  &&((!rField_is_Ring(currRing))
9748  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9749  #endif
9750  )
9751  {
9752  //printf("\nYES!\n");
9753  #ifdef ADIDEBUG
9754  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9755  #endif
9756  deleteInL(strat->L,&strat->Ll,cc,strat);
9757  }
9758  cc--;
9759  }
9760 //#if 1
9761 #ifdef DEBUGF5
9762  PrintS("--- Syzygies ---\n");
9763  Print("syzl %d\n",strat->syzl);
9764  Print("syzmax %d\n",strat->syzmax);
9765  PrintS("--------------------------------\n");
9766  for(i=0;i<=strat->syzl-1;i++)
9767  {
9768  Print("%d - ",i);
9769  pWrite(strat->syz[i]);
9770  }
9771  PrintS("--------------------------------\n");
9772 #endif
9773 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:345
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:398
#define pLtCmp(p, q)
Definition: polys.h:123
#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
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:321
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:3594
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:317
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:301
polyrec * poly
Definition: hilb.h:10
int syzl
Definition: kutil.h:345

◆ enterT()

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

Definition at line 9495 of file kutil.cc.

9496 {
9497  int i;
9498 
9499  pp_Test(p.p, currRing, p.tailRing);
9500  assume(strat->tailRing == p.tailRing);
9501  // redMoraNF complains about this -- but, we don't really
9502  // neeed this so far
9503  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9504  assume(p.FDeg == p.pFDeg());
9505  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9506 
9507 #ifdef KDEBUG
9508  // do not put an LObject twice into T:
9509  for(i=strat->tl;i>=0;i--)
9510  {
9511  if (p.p==strat->T[i].p)
9512  {
9513  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9514  return;
9515  }
9516  }
9517 #endif
9518 
9519 #ifdef HAVE_TAIL_RING
9520  if (currRing!=strat->tailRing)
9521  {
9522  p.t_p=p.GetLmTailRing();
9523  }
9524 #endif
9525  strat->newt = TRUE;
9526  if (atT < 0)
9527  atT = strat->posInT(strat->T, strat->tl, p);
9528  if (strat->tl == strat->tmax-1)
9529  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9530  if (atT <= strat->tl)
9531  {
9532 #ifdef ENTER_USE_MEMMOVE
9533  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9534  (strat->tl-atT+1)*sizeof(TObject));
9535  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9536  (strat->tl-atT+1)*sizeof(unsigned long));
9537 #endif
9538  for (i=strat->tl+1; i>=atT+1; i--)
9539  {
9540 #ifndef ENTER_USE_MEMMOVE
9541  strat->T[i] = strat->T[i-1];
9542  strat->sevT[i] = strat->sevT[i-1];
9543 #endif
9544  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9545  }
9546  }
9547 
9548  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9549  {
9551  (strat->tailRing != NULL ?
9552  strat->tailRing : currRing),
9553  strat->tailBin);
9554  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9555  }
9556  strat->T[atT] = (TObject) p;
9557  #ifdef ADIDEBUG
9558  printf("\nenterT: add in position %i\n",atT);
9559  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9560  #endif
9561  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9562 
9563  if (pNext(p.p) != NULL)
9564  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9565  else
9566  strat->T[atT].max_exp = NULL;
9567 
9568  strat->tl++;
9569  strat->R[strat->tl] = &(strat->T[atT]);
9570  strat->T[atT].i_r = strat->tl;
9571  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9572  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9573  kTest_T(&(strat->T[atT]));
9574 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:398
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:319
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:275
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:336
static unsigned pLength(poly a)
Definition: p_polys.h:189
int tmax
Definition: kutil.h:346
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
omBin tailBin
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:320
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
#define kTest_T(T)
Definition: kutil.h:650
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137

◆ enterT_strong()

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

Definition at line 9580 of file kutil.cc.

9581 {
9583  int i;
9584 
9585  pp_Test(p.p, currRing, p.tailRing);
9586  assume(strat->tailRing == p.tailRing);
9587  // redMoraNF complains about this -- but, we don't really
9588  // neeed this so far
9589  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9590  assume(p.FDeg == p.pFDeg());
9591  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9592 
9593 #ifdef KDEBUG
9594  // do not put an LObject twice into T:
9595  for(i=strat->tl;i>=0;i--)
9596  {
9597  if (p.p==strat->T[i].p)
9598  {
9599  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9600  return;
9601  }
9602  }
9603 #endif
9604 
9605 #ifdef HAVE_TAIL_RING
9606  if (currRing!=strat->tailRing)
9607  {
9608  p.t_p=p.GetLmTailRing();
9609  }
9610 #endif
9611  strat->newt = TRUE;
9612  if (atT < 0)
9613  atT = strat->posInT(strat->T, strat->tl, p);
9614  if (strat->tl == strat->tmax-1)
9615  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9616  if (atT <= strat->tl)
9617  {
9618 #ifdef ENTER_USE_MEMMOVE
9619  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9620  (strat->tl-atT+1)*sizeof(TObject));
9621  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9622  (strat->tl-atT+1)*sizeof(unsigned long));
9623 #endif
9624  for (i=strat->tl+1; i>=atT+1; i--)
9625  {
9626 #ifndef ENTER_USE_MEMMOVE
9627  strat->T[i] = strat->T[i-1];
9628  strat->sevT[i] = strat->sevT[i-1];
9629 #endif
9630  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9631  }
9632  }
9633 
9634  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9635  {
9637  (strat->tailRing != NULL ?
9638  strat->tailRing : currRing),
9639  strat->tailBin);
9640  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9641  }
9642  strat->T[atT] = (TObject) p;
9643  #ifdef ADIDEBUG
9644  printf("\nenterT_strong: add in position %i\n",atT);
9645  pWrite(p.p);
9646  #endif
9647  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9648 
9649  if (pNext(p.p) != NULL)
9650  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9651  else
9652  strat->T[atT].max_exp = NULL;
9653 
9654  strat->tl++;
9655  strat->R[strat->tl] = &(strat->T[atT]);
9656  strat->T[atT].i_r = strat->tl;
9657  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9658  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9659  #if 1
9661  && !n_IsUnit(p.p->coef, currRing->cf))
9662  {
9663  #ifdef ADIDEBUG
9664  printf("\nDas ist p:\n");pWrite(p.p);
9665  #endif
9666  for(i=strat->tl;i>=0;i--)
9667  {
9668  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9669  {
9670  #ifdef ADIDEBUG
9671  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9672  #endif
9673  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9674  }
9675  }
9676  }
9677  /*
9678  printf("\nThis is T:\n");
9679  for(i=strat->tl;i>=0;i--)
9680  {
9681  pWrite(strat->T[i].p);
9682  }
9683  //getchar();*/
9684  #endif
9685  kTest_T(&(strat->T[atT]));
9686 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
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:398
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:319
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:275
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:336
static unsigned pLength(poly a)
Definition: p_polys.h:189
int tmax
Definition: kutil.h:346
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:1533
ring tailRing
Definition: kutil.h:339
omBin tailBin
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:320
#define kTest_T(T)
Definition: kutil.h:650
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137

◆ enterTShift()

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

Definition at line 12731 of file kutil.cc.

12732 {
12733  /* determine how many elements we have to insert */
12734  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12735  /* hence, a total number of elt's to add is: */
12736  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12737 
12738  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12739 
12740 #ifdef PDEBUG
12741  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12742 #endif
12743  int i;
12744 
12745  if (atT < 0)
12746  atT = strat->posInT(strat->T, strat->tl, p);
12747 
12748  /* can call enterT in a sequence, e.g. */
12749 
12750  /* shift0 = it's our model for further shifts */
12751  enterT(p,strat,atT);
12752  LObject qq;
12753  for (i=1; i<=toInsert; i++) // toIns - 1?
12754  {
12755  qq = p; //qq.Copy();
12756  qq.p = NULL;
12757  qq.max_exp = NULL;
12758  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12759  qq.GetP();
12760  // update q.sev
12761  qq.sev = pGetShortExpVector(qq.p);
12762  /* enter it into T, first el't is with the shift 0 */
12763  // compute the position for qq
12764  atT = strat->posInT(strat->T, strat->tl, qq);
12765  enterT(qq,strat,atT);
12766  }
12767 /* Q: what to do with this one in the orig enterT ? */
12768 /* strat->R[strat->tl] = &(strat->T[atT]); */
12769 /* Solution: it is done by enterT each time separately */
12770 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:346
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
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:9495
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:339
TSet T
Definition: kutil.h:320

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10194 of file kutil.cc.

10195 {
10196  /*- release temp data -*/
10197  cleanT(strat);
10198  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10199  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10200  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10201  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10202  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10203  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10204  /*- set L: should be empty -*/
10205  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10206  /*- set B: should be empty -*/
10207  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10208  pLmDelete(&strat->tail);
10209  strat->syzComp=0;
10210 }
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
#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:319
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:348
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:316
TSet T
Definition: kutil.h:320
ideal Shdl
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:59

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10387 of file kutil.cc.

10388 {
10389  /*- release temp data -*/
10391  cleanTSbaRing(strat);
10392  else
10393  cleanT(strat);
10394  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10395  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10396  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10397  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10398  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10399  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10400  if(strat->syzmax>0)
10401  {
10402  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10403  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10404  if (strat->sbaOrder == 1)
10405  {
10406  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10407  }
10408  }
10409  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10410  /*- set L: should be empty -*/
10411  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10412  /*- set B: should be empty -*/
10413  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10414  /*- set sig: no need for the signatures anymore -*/
10415  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10416  pLmDelete(&strat->tail);
10417  strat->syzComp=0;
10418 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
int syzComp
Definition: kutil.h:350
int syzmax
Definition: kutil.h:345
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
#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:319
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:348
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:310
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
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:322
int Lmax
Definition: kutil.h:347
int syzidxmax
Definition: kutil.h:345
unsigned long * sevS
Definition: kutil.h:316
unsigned long * sevSyz
Definition: kutil.h:317
polyset syz
Definition: kutil.h:301
TSet T
Definition: kutil.h:320
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:59
intset syzIdx
Definition: kutil.h:307

◆ 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:5229
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7941
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:6492
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int tl
Definition: kutil.h:346
#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:354
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:11379
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void(* initEcart)(TObject *L)
Definition: kutil.h:274
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:11280
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define pOne()
Definition: polys.h:297
TObject ** R
Definition: kutil.h:336
#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:10828
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:321
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:347
ring tailRing
Definition: kutil.h:339
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
#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:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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 7228 of file kutil.cc.

7229 {
7230  //printf("Faugere Rewritten Criterion\n");
7232  return FALSE;
7233 //#if 1
7234 #ifdef DEBUGF5
7235  PrintS("rewritten criterion checks: ");
7236  pWrite(sig);
7237 #endif
7238  for(int k = strat->sl; k>=start; k--)
7239  {
7240 //#if 1
7241 #ifdef DEBUGF5
7242  PrintS("checking with: ");
7243  pWrite(strat->sig[k]);
7244  pWrite(pHead(strat->S[k]));
7245 #endif
7246  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7247  {
7248 //#if 1
7249 #ifdef DEBUGF5
7250  PrintS("DELETE!\n");
7251 #endif
7252  #ifdef ADIDEBUG
7253  printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
7254  #endif
7255  strat->nrrewcrit++;
7256  return TRUE;
7257  }
7258  //k--;
7259  }
7260 #ifdef DEBUGF5
7261  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7262  for(int kk = 0; kk<strat->sl+1; kk++)
7263  {
7264  pWrite(pHead(strat->S[kk]));
7265  }
7266  PrintS("------------------------------\n");
7267 #endif
7268  return FALSE;
7269 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#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:358
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:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int sl
Definition: kutil.h:344

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

11215 {
11216  if(!nCoeff_is_Ring_Z(currRing->cf))
11217  return;
11218  poly p,pp;
11219  for(int j = 0; j<=strat->sl; j++)
11220  {
11221  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11222  {
11223  for(int i = 0; i<=strat->sl; i++)
11224  {
11225  if((i != j) && (strat->S[i] != NULL))
11226  {
11227  p = strat->S[i];
11228  if(pLmDivisibleBy(strat->S[j], p))
11229  {
11230  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11231  p_SetCoeff(p,dummy,currRing);
11232  }
11233  pp = pNext(p);
11234  if((pp == NULL) && (nIsZero(p->coef)))
11235  {
11236  deleteInS(i, strat);
11237  }
11238  else
11239  {
11240  while(pp != NULL)
11241  {
11242  if(pLmDivisibleBy(strat->S[j], pp))
11243  {
11244  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11245  p_SetCoeff(pp,dummy,currRing);
11246  if(nIsZero(pp->coef))
11247  {
11248  pLmDelete(&pNext(p));
11249  pp = pNext(p);
11250  }
11251  else
11252  {
11253  p = pp;
11254  pp = pNext(p);
11255  }
11256  }
11257  else
11258  {
11259  p = pp;
11260  pp = pNext(p);
11261  }
11262  }
11263  }
11264  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11265  {
11266  if(pNext(strat->S[i]) == NULL)
11267  strat->S[i]=NULL;
11268  else
11269  strat->S[i]=pNext(strat->S[i]);
11270  }
11271  }
11272  }
11273  //idPrint(strat->Shdl);
11274  }
11275  }
11276  //idSkipZeroes(strat->Shdl);
11277 }
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:300
#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:344
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:328
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:349
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:752
BOOLEAN kHEdgeFound
Definition: kutil.h:373
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 4213 of file kutil.cc.

4214 {
4215  long ind = 0;
4216  if (arg <= 0) return 0;
4217  while (arg%2 == 0)
4218  {
4219  arg = arg / 2;
4220  ind++;
4221  }
4222  return ind;
4223 }

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4225 of file kutil.cc.

4226 {
4227  long ind = 0;
4228  if (arg <= 0) return 0;
4229  if (arg%2 == 1) { arg--; }
4230  while (arg > 0)
4231  {
4232  ind += ind2(arg);
4233  arg = arg - 2;
4234  }
4235  return ind;
4236 }
long ind2(long arg)
Definition: kutil.cc:4213

◆ 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:374
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:281
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
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:274
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:369
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:280
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:349
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9255

◆ 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:374
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:4405
void(* initEcart)(TObject *L)
Definition: kutil.h:274
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:280
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9255

◆ initBuchMora()

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

Definition at line 10118 of file kutil.cc.

10119 {
10120  strat->interpt = BTEST1(OPT_INTERRUPT);
10121  strat->kHEdge=NULL;
10123  /*- creating temp data structures------------------- -*/
10124  strat->cp = 0;
10125  strat->c3 = 0;
10126  strat->tail = pInit();
10127  /*- set s -*/
10128  strat->sl = -1;
10129  /*- set L -*/
10130  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10131  strat->Ll = -1;
10132  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10133  /*- set B -*/
10134  strat->Bmax = setmaxL;
10135  strat->Bl = -1;
10136  strat->B = initL();
10137  /*- set T -*/
10138  strat->tl = -1;
10139  strat->tmax = setmaxT;
10140  strat->T = initT();
10141  strat->R = initR();
10142  strat->sevT = initsevT();
10143  /*- init local data struct.---------------------------------------- -*/
10144  strat->P.ecart=0;
10145  strat->P.length=0;
10146  strat->P.pLength=0;
10148  {
10149  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10150  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10151  }
10153  {
10154  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10155  }
10156  else
10157  {
10158  if(TEST_OPT_SB_1)
10159  {
10160  int i;
10161  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10162  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10163  {
10164  P->m[i-strat->newIdeal] = F->m[i];
10165  F->m[i] = NULL;
10166  }
10167  initSSpecial(F,Q,P,strat);
10168  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10169  {
10170  F->m[i] = P->m[i-strat->newIdeal];
10171  P->m[i-strat->newIdeal] = NULL;
10172  }
10173  idDelete(&P);
10174  }
10175  else
10176  {
10177  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10178  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10179  }
10180  }
10181  strat->fromT = FALSE;
10183  if ((!TEST_OPT_SB_1)
10184  || (rField_is_Ring(currRing))
10185  )
10186  {
10187  updateS(TRUE,strat);
10188  }
10189  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10190  strat->fromQ=NULL;
10191  assume(kTest_TS(strat));
10192 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8155
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
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:376
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8561
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:649
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#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:9026
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:418
int newIdeal
Definition: kutil.h:353
ideal Shdl
Definition: kutil.h:297
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9794 of file kutil.cc.

9795 {
9797  strat->chainCrit=chainCritNormal;
9798  if (TEST_OPT_SB_1)
9799  strat->chainCrit=chainCritOpt_1;
9800 #ifdef HAVE_RINGS
9801  if (rField_is_Ring(currRing))
9802  {
9804  strat->chainCrit=chainCritRing;
9805  }
9806 #endif
9807 #ifdef HAVE_RATGRING
9808  if (rIsRatGRing(currRing))
9809  {
9810  strat->chainCrit=chainCritPart;
9811  /* enterOnePairNormal get rational part in it */
9812  }
9813 #endif
9814  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9815  && (!rIsPluralRing(currRing)))
9817 
9818  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9819  strat->Gebauer = strat->homog || strat->sugarCrit;
9820  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9821  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9822  strat->pairtest = NULL;
9823  /* alway use tailreduction, except:
9824  * - in local rings, - in lex order case, -in ring over extensions */
9826  //if(rHasMixedOrdering(currRing)==2)
9827  //{
9828  // strat->noTailReduction =TRUE;
9829  //}
9830 
9831 #ifdef HAVE_PLURAL
9832  // and r is plural_ring
9833  // hence this holds for r a rational_plural_ring
9834  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9835  { //or it has non-quasi-comm type... later
9836  strat->sugarCrit = FALSE;
9837  strat->Gebauer = FALSE;
9838  strat->honey = FALSE;
9839  }
9840 #endif
9841 
9842  // Coefficient ring?
9843  if (rField_is_Ring(currRing))
9844  {
9845  strat->sugarCrit = FALSE;
9846  strat->Gebauer = FALSE ;
9847  strat->honey = FALSE;
9848  }
9849  #ifdef KDEBUG
9850  if (TEST_OPT_DEBUG)
9851  {
9852  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9853  else PrintS("ideal/module is not homogeneous\n");
9854  }
9855  #endif
9856 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3270
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2237
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:329
BOOLEAN z2homog
Definition: kutil.h:371
#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:1954
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:284
BOOLEAN homog
Definition: kutil.h:369
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4040
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:375
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:374
#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:285
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:3483
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3558

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9945 of file kutil.cc.

9946 {
9948  {
9949  if (strat->honey)
9950  {
9951  strat->posInL = posInL15;
9952  // ok -- here is the deal: from my experiments for Singular-2-0
9953  // I conclude that that posInT_EcartpLength is the best of
9954  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9955  // see the table at the end of this file
9956  if (TEST_OPT_OLDSTD)
9957  strat->posInT = posInT15;
9958  else
9959  strat->posInT = posInT_EcartpLength;
9960  }
9961  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9962  {
9963  strat->posInL = posInL11;
9964  strat->posInT = posInT11;
9965  }
9966  else if (TEST_OPT_INTSTRATEGY)
9967  {
9968  strat->posInL = posInL11;
9969  strat->posInT = posInT11;
9970  }
9971  else
9972  {
9973  strat->posInL = posInL0;
9974  strat->posInT = posInT0;
9975  }
9976  //if (strat->minim>0) strat->posInL =posInLSpecial;
9977  if (strat->homog)
9978  {
9979  strat->posInL = posInL110;
9980  strat->posInT = posInT110;
9981  }
9982  }
9983  else
9984  {
9985  if (strat->homog)
9986  {
9987  strat->posInL = posInL11;
9988  strat->posInT = posInT11;
9989  }
9990  else
9991  {
9992  if ((currRing->order[0]==ringorder_c)
9993  ||(currRing->order[0]==ringorder_C))
9994  {
9995  strat->posInL = posInL17_c;
9996  strat->posInT = posInT17_c;
9997  }
9998  else
9999  {
10000  strat->posInL = posInL17;
10001  strat->posInT = posInT17;
10002  }
10003  }
10004  }
10005  if (strat->minim>0) strat->posInL =posInLSpecial;
10006  // for further tests only
10007  if ((BTEST1(11)) || (BTEST1(12)))
10008  strat->posInL = posInL11;
10009  else if ((BTEST1(13)) || (BTEST1(14)))
10010  strat->posInL = posInL13;
10011  else if ((BTEST1(15)) || (BTEST1(16)))
10012  strat->posInL = posInL15;
10013  else if ((BTEST1(17)) || (BTEST1(18)))
10014  strat->posInL = posInL17;
10015  if (BTEST1(11))
10016  strat->posInT = posInT11;
10017  else if (BTEST1(13))
10018  strat->posInT = posInT13;
10019  else if (BTEST1(15))
10020  strat->posInT = posInT15;
10021  else if ((BTEST1(17)))
10022  strat->posInT = posInT17;
10023  else if ((BTEST1(19)))
10024  strat->posInT = posInT19;
10025  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10026  strat->posInT = posInT1;
10028 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6416
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6837
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
#define BTEST1(a)
Definition: options.h:32
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5729
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9929
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:5419
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5931
BOOLEAN homog
Definition: kutil.h:369
#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:6158
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7007
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5824
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5572
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10031 of file kutil.cc.

10032 {
10034  {
10035  if (strat->honey)
10036  {
10037  strat->posInL = posInL15Ring;
10038  // ok -- here is the deal: from my experiments for Singular-2-0
10039  // I conclude that that posInT_EcartpLength is the best of
10040  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10041  // see the table at the end of this file
10042  if (TEST_OPT_OLDSTD)
10043  strat->posInT = posInT15Ring;
10044  else
10045  strat->posInT = posInT_EcartpLength;
10046  }
10047  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10048  {
10049  strat->posInL = posInL11Ring;
10050  strat->posInT = posInT11;
10051  }
10052  else if (TEST_OPT_INTSTRATEGY)
10053  {
10054  strat->posInL = posInL11Ring;
10055  strat->posInT = posInT11;
10056  }
10057  else
10058  {
10059  strat->posInL = posInL0Ring;
10060  strat->posInT = posInT0;
10061  }
10062  //if (strat->minim>0) strat->posInL =posInLSpecial;
10063  if (strat->homog)
10064  {
10065  strat->posInL = posInL110Ring;
10066  strat->posInT = posInT110Ring;
10067  }
10068  }
10069  else
10070  {
10071  if (strat->homog)
10072  {
10073  //printf("\nHere 3\n");
10074  strat->posInL = posInL11Ring;
10075  strat->posInT = posInT11Ring;
10076  }
10077  else
10078  {
10079  if ((currRing->order[0]==ringorder_c)
10080  ||(currRing->order[0]==ringorder_C))
10081  {
10082  strat->posInL = posInL17_cRing;
10083  strat->posInT = posInT17_cRing;
10084  }
10085  else
10086  {
10087  strat->posInL = posInL11Ringls;
10088  strat->posInT = posInT17Ring;
10089  }
10090  }
10091  }
10092  if (strat->minim>0) strat->posInL =posInLSpecial;
10093  // for further tests only
10094  if ((BTEST1(11)) || (BTEST1(12)))
10095  strat->posInL = posInL11Ring;
10096  else if ((BTEST1(13)) || (BTEST1(14)))
10097  strat->posInL = posInL13;
10098  else if ((BTEST1(15)) || (BTEST1(16)))
10099  strat->posInL = posInL15Ring;
10100  else if ((BTEST1(17)) || (BTEST1(18)))
10101  strat->posInL = posInL17Ring;
10102  if (BTEST1(11))
10103  strat->posInT = posInT11Ring;
10104  else if (BTEST1(13))
10105  strat->posInT = posInT13;
10106  else if (BTEST1(15))
10107  strat->posInT = posInT15Ring;
10108  else if ((BTEST1(17)))
10109  strat->posInT = posInT17Ring;
10110  else if ((BTEST1(19)))
10111  strat->posInT = posInT19;
10112  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10113  strat->posInT = posInT1;
10115 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6458
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6528
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6872
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6957
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6755
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5783
#define BTEST1(a)
Definition: options.h:32
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7071
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9929
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:5419
BOOLEAN homog
Definition: kutil.h:369
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5455
#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:5885
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5614
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6184
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5992
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661

◆ initBuchMoraShift()

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

Definition at line 12114 of file kutil.cc.

12115 {
12116  strat->interpt = BTEST1(OPT_INTERRUPT);
12117  strat->kHEdge=NULL;
12119  /*- creating temp data structures------------------- -*/
12120  strat->cp = 0;
12121  strat->c3 = 0;
12122  strat->cv = 0;
12123  strat->tail = pInit();
12124  /*- set s -*/
12125  strat->sl = -1;
12126  /*- set L -*/
12127  strat->Lmax = setmaxL;
12128  strat->Ll = -1;
12129  strat->L = initL();
12130  /*- set B -*/
12131  strat->Bmax = setmaxL;
12132  strat->Bl = -1;
12133  strat->B = initL();
12134  /*- set T -*/
12135  strat->tl = -1;
12136  strat->tmax = setmaxT;
12137  strat->T = initT();
12138  strat->R = initR();
12139  strat->sevT = initsevT();
12140  /*- init local data struct.---------------------------------------- -*/
12141  strat->P.ecart=0;
12142  strat->P.length=0;
12144  {
12145  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12146  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12147  }
12149  {
12150  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12151  }
12152  {
12153  if(TEST_OPT_SB_1)
12154  {
12155  int i;
12156  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12157  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12158  {
12159  P->m[i-strat->newIdeal] = F->m[i];
12160  F->m[i] = NULL;
12161  }
12162  initSSpecial(F,Q,P,strat);
12163  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12164  {
12165  F->m[i] = P->m[i-strat->newIdeal];
12166  P->m[i-strat->newIdeal] = NULL;
12167  }
12168  idDelete(&P);
12169  }
12170  else
12171  {
12172  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12173  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12174  }
12175  }
12176  strat->fromT = FALSE;
12177  if (!TEST_OPT_SB_1)
12178  {
12179  /* the only change: we do not fill the set T*/
12180  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12181  }
12182  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12183  strat->fromQ=NULL;
12184  /* more changes: fill the set T with all the shifts of elts of S*/
12185  /* is done by other procedure */
12186 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:366
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8155
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
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:376
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8561
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:315
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#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:9026
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:418
int newIdeal
Definition: kutil.h:353
ideal Shdl
Definition: kutil.h:297
#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 9776 of file kutil.cc.

9777 {
9778 
9779  //if the ordering is local, then hilb criterion
9780  //can be used also if the ideal is not homogenous
9782  {
9784  *hilb=NULL;
9785  else
9786  return;
9787  }
9788  if (strat->homog!=isHomog)
9789  {
9790  *hilb=NULL;
9791  }
9792 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
#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:369
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
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 418 of file kutil.h.

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

◆ 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:32
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:59

◆ initS()

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

Definition at line 8059 of file kutil.cc.

8060 {
8061  int i,pos;
8062 
8063  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8064  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8065  strat->ecartS=initec(i);
8066  strat->sevS=initsevS(i);
8067  strat->S_2_R=initS_2_R(i);
8068  strat->fromQ=NULL;
8069  strat->Shdl=idInit(i,F->rank);
8070  strat->S=strat->Shdl->m;
8071  /*- put polys into S -*/
8072  if (Q!=NULL)
8073  {
8074  strat->fromQ=initec(i);
8075  memset(strat->fromQ,0,i*sizeof(int));
8076  for (i=0; i<IDELEMS(Q); i++)
8077  {
8078  if (Q->m[i]!=NULL)
8079  {
8080  LObject h;
8081  h.p = pCopy(Q->m[i]);
8083  {
8084  //pContent(h.p);
8085  h.pCleardenom(); // also does a pContent
8086  }
8087  else
8088  {
8089  h.pNorm();
8090  }
8092  {
8093  deleteHC(&h, strat);
8094  }
8095  if (h.p!=NULL)
8096  {
8097  strat->initEcart(&h);
8098  if (strat->sl==-1)
8099  pos =0;
8100  else
8101  {
8102  pos = posInS(strat,strat->sl,h.p,h.ecart);
8103  }
8104  h.sev = pGetShortExpVector(h.p);
8105  strat->enterS(h,pos,strat,-1);
8106  strat->fromQ[pos]=1;
8107  }
8108  }
8109  }
8110  }
8111  for (i=0; i<IDELEMS(F); i++)
8112  {
8113  if (F->m[i]!=NULL)
8114  {
8115  LObject h;
8116  h.p = pCopy(F->m[i]);
8118  {
8119  cancelunit(&h); /*- tries to cancel a unit -*/
8120  deleteHC(&h, strat);
8121  }
8122  if (h.p!=NULL)
8123  // do not rely on the input being a SB!
8124  {
8126  {
8127  //pContent(h.p);
8128  h.pCleardenom(); // also does a pContent
8129  }
8130  else
8131  {
8132  h.pNorm();
8133  }
8134  strat->initEcart(&h);
8135  if (strat->sl==-1)
8136  pos =0;
8137  else
8138  pos = posInS(strat,strat->sl,h.p,h.ecart);
8139  h.sev = pGetShortExpVector(h.p);
8140  strat->enterS(h,pos,strat,-1);
8141  }
8142  }
8143  }
8144  /*- test, if a unit is in F -*/
8145  if ((strat->sl>=0)
8146 #ifdef HAVE_RINGS
8147  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8148 #endif
8149  && pIsConstant(strat->S[0]))
8150  {
8151  while (strat->sl>0) deleteInS(strat->sl,strat);
8152  }
8153 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
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:60
int * S_2_R
Definition: kutil.h:338
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:274
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:315
#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:280
#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:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
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:5128
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
ideal Shdl
Definition: kutil.h:297
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:751
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:374
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9357
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:281
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:703
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int currIdx
Definition: kutil.h:311
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
pFDegProc pOrigFDeg
Definition: kutil.h:290
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:348
void(* initEcart)(TObject *L)
Definition: kutil.h:274
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:291
BOOLEAN homog
Definition: kutil.h:369
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:280
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:3547
#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:349
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:273

◆ initSbaBuchMora()

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

Definition at line 10314 of file kutil.cc.

10315 {
10316  strat->interpt = BTEST1(OPT_INTERRUPT);
10317  strat->kHEdge=NULL;
10319  /*- creating temp data structures------------------- -*/
10320  strat->cp = 0;
10321  strat->c3 = 0;
10322  strat->tail = pInit();
10323  /*- set s -*/
10324  strat->sl = -1;
10325  /*- set ps -*/
10326  strat->syzl = -1;
10327  /*- set L -*/
10328  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10329  strat->Ll = -1;
10330  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10331  /*- set B -*/
10332  strat->Bmax = setmaxL;
10333  strat->Bl = -1;
10334  strat->B = initL();
10335  /*- set T -*/
10336  strat->tl = -1;
10337  strat->tmax = setmaxT;
10338  strat->T = initT();
10339  strat->R = initR();
10340  strat->sevT = initsevT();
10341  /*- init local data struct.---------------------------------------- -*/
10342  strat->P.ecart=0;
10343  strat->P.length=0;
10345  {
10346  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10347  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10348  }
10350  {
10351  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10352  }
10353  else
10354  {
10355  if(TEST_OPT_SB_1)
10356  {
10357  int i;
10358  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10359  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10360  {
10361  P->m[i-strat->newIdeal] = F->m[i];
10362  F->m[i] = NULL;
10363  }
10364  initSSpecialSba(F,Q,P,strat);
10365  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10366  {
10367  F->m[i] = P->m[i-strat->newIdeal];
10368  P->m[i-strat->newIdeal] = NULL;
10369  }
10370  idDelete(&P);
10371  }
10372  else
10373  {
10374  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10375  }
10376  }
10377  strat->fromT = FALSE;
10378  if (!TEST_OPT_SB_1)
10379  {
10380  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10381  }
10382  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10383  //strat->fromQ=NULL;
10384  assume(kTest_TS(strat));
10385 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:343
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
#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:8706
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define setmaxLinc
Definition: kutil.h:30
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8254
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
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:376
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:649
#define assume(x)
Definition: mod2.h:394
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#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:9026
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:418
int newIdeal
Definition: kutil.h:353
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:345

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9858 of file kutil.cc.

9859 {
9860  //strat->enterOnePair=enterOnePairNormal;
9862  //strat->chainCrit=chainCritNormal;
9863  strat->chainCrit = chainCritSig;
9864  /******************************************
9865  * rewCrit1 and rewCrit2 are already set in
9866  * kSba() in kstd1.cc
9867  *****************************************/
9868  //strat->rewCrit1 = faugereRewCriterion;
9869  if (strat->sbaOrder == 1)
9870  {
9871  strat->syzCrit = syzCriterionInc;
9872  }
9873  else
9874  {
9875  strat->syzCrit = syzCriterion;
9876  }
9877 #ifdef HAVE_RINGS
9878  if (rField_is_Ring(currRing))
9879  {
9881  strat->chainCrit=chainCritRing;
9882  }
9883 #endif
9884 #ifdef HAVE_RATGRING
9885  if (rIsRatGRing(currRing))
9886  {
9887  strat->chainCrit=chainCritPart;
9888  /* enterOnePairNormal get rational part in it */
9889  }
9890 #endif
9891 
9892  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9893  strat->Gebauer = strat->homog || strat->sugarCrit;
9894  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9895  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9896  strat->pairtest = NULL;
9897  /* alway use tailreduction, except:
9898  * - in local rings, - in lex order case, -in ring over extensions */
9901 
9902 #ifdef HAVE_PLURAL
9903  // and r is plural_ring
9904  // hence this holds for r a rational_plural_ring
9905  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9906  { //or it has non-quasi-comm type... later
9907  strat->sugarCrit = FALSE;
9908  strat->Gebauer = FALSE;
9909  strat->honey = FALSE;
9910  }
9911 #endif
9912 
9913  // Coefficient ring?
9914  if (rField_is_Ring(currRing))
9915  {
9916  strat->sugarCrit = FALSE;
9917  strat->Gebauer = FALSE ;
9918  strat->honey = FALSE;
9919  }
9920  #ifdef KDEBUG
9921  if (TEST_OPT_DEBUG)
9922  {
9923  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9924  else PrintS("ideal/module is not homogeneous\n");
9925  }
9926  #endif
9927 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:329
BOOLEAN z2homog
Definition: kutil.h:371
#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:3499
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1954
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:286
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:284
BOOLEAN homog
Definition: kutil.h:369
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4040
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:375
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
unsigned sbaOrder
Definition: kutil.h:310
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:374
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7138
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7176
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
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:3558

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10212 of file kutil.cc.

10213 {
10215  {
10216  if (strat->honey)
10217  {
10218  strat->posInL = posInL15;
10219  // ok -- here is the deal: from my experiments for Singular-2-0
10220  // I conclude that that posInT_EcartpLength is the best of
10221  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10222  // see the table at the end of this file
10223  if (TEST_OPT_OLDSTD)
10224  strat->posInT = posInT15;
10225  else
10226  strat->posInT = posInT_EcartpLength;
10227  }
10228  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10229  {
10230  strat->posInL = posInL11;
10231  strat->posInT = posInT11;
10232  }
10233  else if (TEST_OPT_INTSTRATEGY)
10234  {
10235  strat->posInL = posInL11;
10236  strat->posInT = posInT11;
10237  }
10238  else
10239  {
10240  strat->posInL = posInL0;
10241  strat->posInT = posInT0;
10242  }
10243  //if (strat->minim>0) strat->posInL =posInLSpecial;
10244  if (strat->homog)
10245  {
10246  strat->posInL = posInL110;
10247  strat->posInT = posInT110;
10248  }
10249  }
10250  else
10251  {
10252  if (strat->homog)
10253  {
10254  strat->posInL = posInL11;
10255  strat->posInT = posInT11;
10256  }
10257  else
10258  {
10259  if ((currRing->order[0]==ringorder_c)
10260  ||(currRing->order[0]==ringorder_C))
10261  {
10262  strat->posInL = posInL17_c;
10263  strat->posInT = posInT17_c;
10264  }
10265  else
10266  {
10267  strat->posInL = posInL17;
10268  strat->posInT = posInT17;
10269  }
10270  }
10271  }
10272  if (strat->minim>0) strat->posInL =posInLSpecial;
10273  // for further tests only
10274  if ((BTEST1(11)) || (BTEST1(12)))
10275  strat->posInL = posInL11;
10276  else if ((BTEST1(13)) || (BTEST1(14)))
10277  strat->posInL = posInL13;
10278  else if ((BTEST1(15)) || (BTEST1(16)))
10279  strat->posInL = posInL15;
10280  else if ((BTEST1(17)) || (BTEST1(18)))
10281  strat->posInL = posInL17;
10282  if (BTEST1(11))
10283  strat->posInT = posInT11;
10284  else if (BTEST1(13))
10285  strat->posInT = posInT13;
10286  else if (BTEST1(15))
10287  strat->posInT = posInT15;
10288  else if ((BTEST1(17)))
10289  strat->posInT = posInT17;
10290  else if ((BTEST1(19)))
10291  strat->posInT = posInT19;
10292  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10293  strat->posInT = posInT1;
10294  if (rField_is_Ring(currRing))
10295  {
10296  strat->posInL = posInL11Ring;
10297  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10298  strat->posInL = posInL11Ringls;
10299  strat->posInT = posInT11;
10300  }
10301  strat->posInLDependsOnLength = FALSE;
10302  strat->posInLSba = posInLSig;
10303  //strat->posInL = posInLSig;
10304  strat->posInL = posInLF5C;
10305  /*
10306  if (rField_is_Ring(currRing))
10307  {
10308  strat->posInLSba = posInLSigRing;
10309  strat->posInL = posInL11Ring;
10310  }*/
10311  //strat->posInT = posInTSig;
10312 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6416
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6458
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6528
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6837
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
#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:6404
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5729
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6216
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:5419
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5931
BOOLEAN homog
Definition: kutil.h:369
#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:6158
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7007
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5824
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5572
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661

◆ 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:32
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSL()

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

Definition at line 8155 of file kutil.cc.

8156 {
8157  int i,pos;
8158 
8159  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8160  else i=setmaxT;
8161  strat->ecartS=initec(i);
8162  strat->sevS=initsevS(i);
8163  strat->S_2_R=initS_2_R(i);
8164  strat->fromQ=NULL;
8165  strat->Shdl=idInit(i,F->rank);
8166  strat->S=strat->Shdl->m;
8167  /*- put polys into S -*/
8168  if (Q!=NULL)
8169  {
8170  strat->fromQ=initec(i);
8171  memset(strat->fromQ,0,i*sizeof(int));
8172  for (i=0; i<IDELEMS(Q); i++)
8173  {
8174  if (Q->m[i]!=NULL)
8175  {
8176  LObject h;
8177  h.p = pCopy(Q->m[i]);
8179  {
8180  deleteHC(&h,strat);
8181  }
8183  {
8184  //pContent(h.p);
8185  h.pCleardenom(); // also does a pContent
8186  }
8187  else
8188  {
8189  h.pNorm();
8190  }
8191  if (h.p!=NULL)
8192  {
8193  strat->initEcart(&h);
8194  if (strat->sl==-1)
8195  pos =0;
8196  else
8197  {
8198  pos = posInS(strat,strat->sl,h.p,h.ecart);
8199  }
8200  h.sev = pGetShortExpVector(h.p);
8201  strat->enterS(h,pos,strat,-1);
8202  strat->fromQ[pos]=1;
8203  }
8204  }
8205  }
8206  }
8207  for (i=0; i<IDELEMS(F); i++)
8208  {
8209  if (F->m[i]!=NULL)
8210  {
8211  LObject h;
8212  h.p = pCopy(F->m[i]);
8213  if (h.p!=NULL)
8214  {
8216  {
8217  cancelunit(&h); /*- tries to cancel a unit -*/
8218  deleteHC(&h, strat);
8219  }
8220  if (h.p!=NULL)
8221  {
8223  {
8224  //pContent(h.p);
8225  h.pCleardenom(); // also does a pContent
8226  }
8227  else
8228  {
8229  h.pNorm();
8230  }
8231  strat->initEcart(&h);
8232  if (strat->Ll==-1)
8233  pos =0;
8234  else
8235  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8236  h.sev = pGetShortExpVector(h.p);
8237  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8238  }
8239  }
8240  }
8241  }
8242  /*- test, if a unit is in F -*/
8243 
8244  if ((strat->Ll>=0)
8245 #ifdef HAVE_RINGS
8246  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8247 #endif
8248  && pIsConstant(strat->L[strat->Ll].p))
8249  {
8250  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8251  }
8252 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
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:60
int Ll
Definition: kutil.h:347
int * S_2_R
Definition: kutil.h:338
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:274
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:32
intset fromQ
Definition: kutil.h:315
#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:280
#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:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
ideal Shdl
Definition: kutil.h:297
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 8254 of file kutil.cc.

8255 {
8256  int i,pos;
8257  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8258  else i=setmaxT;
8259  strat->ecartS = initec(i);
8260  strat->sevS = initsevS(i);
8261  strat->sevSig = initsevS(i);
8262  strat->S_2_R = initS_2_R(i);
8263  strat->fromQ = NULL;
8264  strat->Shdl = idInit(i,F->rank);
8265  strat->S = strat->Shdl->m;
8266  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8267  if (strat->sbaOrder != 1)
8268  {
8269  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8270  strat->sevSyz = initsevS(i);
8271  strat->syzmax = i;
8272  strat->syzl = 0;
8273  }
8274  /*- put polys into S -*/
8275  if (Q!=NULL)
8276  {
8277  strat->fromQ=initec(i);
8278  memset(strat->fromQ,0,i*sizeof(int));
8279  for (i=0; i<IDELEMS(Q); i++)
8280  {
8281  if (Q->m[i]!=NULL)
8282  {
8283  LObject h;
8284  h.p = pCopy(Q->m[i]);
8286  {
8287  deleteHC(&h,strat);
8288  }
8290  {
8291  //pContent(h.p);
8292  h.pCleardenom(); // also does a pContent
8293  }
8294  else
8295  {
8296  h.pNorm();
8297  }
8298  if (h.p!=NULL)
8299  {
8300  strat->initEcart(&h);
8301  if (strat->sl==-1)
8302  pos =0;
8303  else
8304  {
8305  pos = posInS(strat,strat->sl,h.p,h.ecart);
8306  }
8307  h.sev = pGetShortExpVector(h.p);
8308  strat->enterS(h,pos,strat,-1);
8309  strat->fromQ[pos]=1;
8310  }
8311  }
8312  }
8313  }
8314  for (i=0; i<IDELEMS(F); i++)
8315  {
8316  if (F->m[i]!=NULL)
8317  {
8318  LObject h;
8319  h.p = pCopy(F->m[i]);
8320  h.sig = pOne();
8321  //h.sig = pInit();
8322  //p_SetCoeff(h.sig,nInit(1),currRing);
8323  p_SetComp(h.sig,i+1,currRing);
8324  // if we are working with the Schreyer order we generate it
8325  // by multiplying the initial signatures with the leading monomial
8326  // of the corresponding initial polynomials generating the ideal
8327  // => we can keep the underlying monomial order and get a Schreyer
8328  // order without any bigger overhead
8329  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8330  {
8331  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8332  }
8333  h.sevSig = pGetShortExpVector(h.sig);
8334 #ifdef DEBUGF5
8335  pWrite(h.p);
8336  pWrite(h.sig);
8337 #endif
8338  if (h.p!=NULL)
8339  {
8341  {
8342  cancelunit(&h); /*- tries to cancel a unit -*/
8343  deleteHC(&h, strat);
8344  }
8345  if (h.p!=NULL)
8346  {
8348  {
8349  //pContent(h.p);
8350  h.pCleardenom(); // also does a pContent
8351  }
8352  else
8353  {
8354  h.pNorm();
8355  }
8356  strat->initEcart(&h);
8357  if (strat->Ll==-1)
8358  pos =0;
8359  else
8360  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8361  h.sev = pGetShortExpVector(h.p);
8362  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8363  }
8364  }
8365  /*
8366  if (strat->sbaOrder != 1)
8367  {
8368  for(j=0;j<i;j++)
8369  {
8370  strat->syz[ctr] = pCopy(F->m[j]);
8371  p_SetCompP(strat->syz[ctr],i+1,currRing);
8372  // add LM(F->m[i]) to the signature to get a Schreyer order
8373  // without changing the underlying polynomial ring at all
8374  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8375  // since p_Add_q() destroys all input
8376  // data we need to recreate help
8377  // each time
8378  poly help = pCopy(F->m[i]);
8379  p_SetCompP(help,j+1,currRing);
8380  pWrite(strat->syz[ctr]);
8381  pWrite(help);
8382  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8383  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8384  printf("%d. SYZ ",ctr);
8385  pWrite(strat->syz[ctr]);
8386  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8387  ctr++;
8388  }
8389  strat->syzl = ps;
8390  }
8391  */
8392  }
8393  }
8394  /*- test, if a unit is in F -*/
8395 
8396  if ((strat->Ll>=0)
8397 #ifdef HAVE_RINGS
8398  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8399 #endif
8400  && pIsConstant(strat->L[strat->Ll].p))
8401  {
8402  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8403  }
8404 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
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:345
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
int * S_2_R
Definition: kutil.h:338
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:276
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:274
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:32
intset fromQ
Definition: kutil.h:315
#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:280
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
unsigned sbaOrder
Definition: kutil.h:310
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:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
unsigned long * sevSyz
Definition: kutil.h:317
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:301
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:345
#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 8406 of file kutil.cc.

8407 {
8408  if( strat->S[0] )
8409  {
8410  if( strat->S[1] && !rField_is_Ring(currRing))
8411  {
8412  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8413  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8414  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8415  }
8416  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8417  /************************************************************
8418  * computing the length of the syzygy array needed
8419  ***********************************************************/
8420  for(i=1; i<=strat->sl; i++)
8421  {
8422  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8423  {
8424  ps += i;
8425  }
8426  }
8427  ps += strat->sl+1;
8428  //comp = pGetComp (strat->P.sig);
8429  comp = strat->currIdx;
8430  strat->syzIdx = initec(comp);
8431  strat->sevSyz = initsevS(ps);
8432  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8433  strat->syzmax = ps;
8434  strat->syzl = 0;
8435  strat->syzidxmax = comp;
8436 #if defined(DEBUGF5) || defined(DEBUGF51)
8437  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8438 #endif
8439  i = 1;
8440  j = 0;
8441  /************************************************************
8442  * generating the leading terms of the principal syzygies
8443  ***********************************************************/
8444  while (i <= strat->sl)
8445  {
8446  /**********************************************************
8447  * principal syzygies start with component index 2
8448  * the array syzIdx starts with index 0
8449  * => the rules for a signature with component comp start
8450  * at strat->syz[strat->syzIdx[comp-2]] !
8451  *********************************************************/
8452  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8453  {
8454  comp = pGetComp(strat->sig[i]);
8455  comp_old = pGetComp(strat->sig[i-1]);
8456  diff = comp - comp_old - 1;
8457  // diff should be zero, but sometimes also the initial generating
8458  // elements of the input ideal reduce to zero. then there is an
8459  // index-gap between the signatures. for these inbetween signatures we
8460  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8461  // in the following.
8462  // doing this, we keep the relation "j = comp - 2" alive, which makes
8463  // jumps way easier when checking criteria
8464  while (diff>0)
8465  {
8466  strat->syzIdx[j] = 0;
8467  diff--;
8468  j++;
8469  }
8470  strat->syzIdx[j] = ctr;
8471  j++;
8472  LObject Q;
8473  int pos;
8474  for (k = 0; k<i; k++)
8475  {
8476  Q.sig = pOne();
8478  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8479  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8480  p_SetCompP (Q.sig, comp, currRing);
8481  poly q = p_One(currRing);
8483  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8484  p_ExpVectorCopy(q,strat->S[i],currRing);
8485  q = p_Neg (q, currRing);
8486  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8487  Q.sig = p_Add_q (Q.sig, q, currRing);
8488  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8489  pos = posInSyz(strat, Q.sig);
8490  enterSyz(Q, strat, pos);
8491  ctr++;
8492  }
8493  }
8494  i++;
8495  }
8496  /**************************************************************
8497  * add syzygies for upcoming first element of new iteration step
8498  **************************************************************/
8499  comp = strat->currIdx;
8500  comp_old = pGetComp(strat->sig[i-1]);
8501  diff = comp - comp_old - 1;
8502  // diff should be zero, but sometimes also the initial generating
8503  // elements of the input ideal reduce to zero. then there is an
8504  // index-gap between the signatures. for these inbetween signatures we
8505  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8506  // in the following.
8507  // doing this, we keep the relation "j = comp - 2" alive, which makes
8508  // jumps way easier when checking criteria
8509  while (diff>0)
8510  {
8511  strat->syzIdx[j] = 0;
8512  diff--;
8513  j++;
8514  }
8515  strat->syzIdx[j] = ctr;
8516  LObject Q;
8517  int pos;
8518  for (k = 0; k<strat->sl+1; k++)
8519  {
8520  Q.sig = pOne();
8522  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8523  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8524  p_SetCompP (Q.sig, comp, currRing);
8525  poly q = p_One(currRing);
8527  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8528  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8529  q = p_Neg (q, currRing);
8530  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8531  Q.sig = p_Add_q (Q.sig, q, currRing);
8532  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8533  pos = posInSyz(strat, Q.sig);
8534  enterSyz(Q, strat, pos);
8535  ctr++;
8536  }
8537 //#if 1
8538 #ifdef DEBUGF5
8539  PrintS("Principal syzygies:\n");
8540  Print("syzl %d\n",strat->syzl);
8541  Print("syzmax %d\n",strat->syzmax);
8542  Print("ps %d\n",ps);
8543  PrintS("--------------------------------\n");
8544  for(i=0;i<=strat->syzl-1;i++)
8545  {
8546  Print("%d - ",i);
8547  pWrite(strat->syz[i]);
8548  }
8549  for(i=0;i<strat->currIdx;i++)
8550  {
8551  Print("%d - %d\n",i,strat->syzIdx[i]);
8552  }
8553  PrintS("--------------------------------\n");
8554 #endif
8555  }
8556 }
polyset sig
Definition: kutil.h:302
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:345
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
#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:311
#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:1312
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:300
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6376
int syzidxmax
Definition: kutil.h:345
#define nCopy(n)
Definition: numbers.h:15
unsigned long * sevSyz
Definition: kutil.h:317
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyset syz
Definition: kutil.h:301
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
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:345
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9692
intset syzIdx
Definition: kutil.h:307

◆ 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:61
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:32
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:59

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

10829 {
10830  if (strat->overflow) return FALSE;
10831  assume(L->p1 != NULL && L->p2 != NULL);
10832  // shift changes: from 0 to -1
10833  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10834  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10835  assume(strat->tailRing != currRing);
10836 
10837  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10838  return FALSE;
10839  // shift changes: extra case inserted
10840  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10841  {
10842  return TRUE;
10843  }
10844  poly p1_max = (strat->R[L->i_r1])->max_exp;
10845  poly p2_max = (strat->R[L->i_r2])->max_exp;
10846 
10847  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10848  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10849  {
10850  p_LmFree(m1, strat->tailRing);
10851  p_LmFree(m2, strat->tailRing);
10852  m1 = NULL;
10853  m2 = NULL;
10854  return FALSE;
10855  }
10856  return TRUE;
10857 }
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:346
#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:336
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
polyrec * poly
Definition: hilb.h:10

◆ kCheckStrongCreation()

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

Definition at line 10866 of file kutil.cc.

10867 {
10868  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10869  //assume(strat->tailRing != currRing);
10870 
10871  poly p1_max = (strat->R[atR])->max_exp;
10872  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10873 
10874  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10875  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10876  {
10877  return FALSE;
10878  }
10879  return TRUE;
10880 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:336
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
polyrec * poly
Definition: hilb.h:10

◆ kCreateZeroPoly()

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

Definition at line 4432 of file kutil.cc.

4433 {
4434 
4435  poly zeroPoly = NULL;
4436 
4437  number tmp1;
4438  poly tmp2, tmp3;
4439 
4440  if (cabsind == -1)
4441  {
4442  cabsind = 0;
4443  for (int i = 1; i <= leadRing->N; i++)
4444  {
4445  cabsind += ind_fact_2(exp[i]);
4446  }
4447 // Print("cabsind: %d\n", cabsind);
4448  }
4449  if (cabsind < leadRing->ch)
4450  {
4451  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4452  }
4453  else
4454  {
4455  zeroPoly = p_ISet(1, tailRing);
4456  }
4457  for (int i = 1; i <= leadRing->N; i++)
4458  {
4459  for (long j = 1; j <= exp[i]; j++)
4460  {
4461  tmp1 = nInit(j);
4462  tmp2 = p_ISet(1, tailRing);
4463  p_SetExp(tmp2, i, 1, tailRing);
4464  p_Setm(tmp2, tailRing);
4465  if (nIsZero(tmp1))
4466  { // should nowbe obsolet, test ! TODO OLIVER
4467  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4468  }
4469  else
4470  {
4471  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4472  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4473  }
4474  }
4475  }
4476  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4477  for (int i = 1; i <= leadRing->N; i++)
4478  {
4479  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4480  }
4481  p_Setm(tmp2, leadRing);
4482  *t_p = zeroPoly;
4483  zeroPoly = pNext(zeroPoly);
4484  pNext(*t_p) = NULL;
4485  pNext(tmp2) = zeroPoly;
4486  return tmp2;
4487 }
#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:1442
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:4240
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:4225
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:1296
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 11826 of file kutil.cc.

11827 {
11828  PrintS("red: ");
11829  if (strat->red==redFirst) PrintS("redFirst\n");
11830  else if (strat->red==redHoney) PrintS("redHoney\n");
11831  else if (strat->red==redEcart) PrintS("redEcart\n");
11832  else if (strat->red==redHomog) PrintS("redHomog\n");
11833  else Print("%p\n",(void*)strat->red);
11834  PrintS("posInT: ");
11835  if (strat->posInT==posInT0) PrintS("posInT0\n");
11836  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11837  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11838  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11839  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11840  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11841  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11842  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11843  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11844  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11845  #ifdef HAVE_RINGS
11846  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11847  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11848  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11849  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11850  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11851  #endif
11852 #ifdef HAVE_MORE_POS_IN_T
11853  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11854  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11855  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11856 #endif
11857  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11858  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11859  else Print("%p\n",(void*)strat->posInT);
11860  PrintS("posInL: ");
11861  if (strat->posInL==posInL0) PrintS("posInL0\n");
11862  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11863  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11864  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11865  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11866  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11867  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11868  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11869  #ifdef HAVE_RINGS
11870  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11871  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11872  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11873  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11874  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11875  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11876  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11877  #endif
11878  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11879  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11880  else Print("%p\n",(void*)strat->posInL);
11881  PrintS("enterS: ");
11882  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11883  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11884  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11885  else Print("%p\n",(void*)strat->enterS);
11886  PrintS("initEcart: ");
11887  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11888  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11889  else Print("%p\n",(void*)strat->initEcart);
11890  PrintS("initEcartPair: ");
11891  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11892  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11893  else Print("%p\n",(void*)strat->initEcartPair);
11894  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11895  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11896  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11897  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11898  PrintS("chainCrit: ");
11899  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11900  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11901  else Print("%p\n",(void*)strat->chainCrit);
11902  Print("posInLDependsOnLength=%d\n",
11903  strat->posInLDependsOnLength);
11904  PrintS(showOption());PrintLn();
11905  PrintS("LDeg: ");
11906  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11907  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11908  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11909  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11910  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11911  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11912  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11913  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11914  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11915  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11916  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11917  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11918  else Print("? (%lx)", (long)currRing->pLDeg);
11919  PrintS(" / ");
11920  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11921  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11922  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11923  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11924  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11925  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11926  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11927  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11928  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11929  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11930  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11931  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11932  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11933  PrintLn();
11934  PrintS("currRing->pFDeg: ");
11935  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11936  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11937  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11938  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11939  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11940  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11941  else Print("? (%lx)", (long)currRing->pFDeg);
11942  PrintLn();
11943  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11944  if(TEST_OPT_DEGBOUND)
11945  Print(" degBound: %d\n", Kstd1_deg);
11946 
11947  if( ecartWeights != NULL )
11948  {
11949  PrintS("ecartWeights: ");
11950  for (int i = rVar(currRing); i > 0; i--)
11951  Print("%hd ", ecartWeights[i]);
11952  PrintLn();
11954  }
11955 
11956 #ifndef SING_NDEBUG
11958 #endif
11959 }
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:6416
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11792
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5496
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
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:5389
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6458
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6528
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6872
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
BOOLEAN noTailReduction
Definition: kutil.h:375
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3270
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6630
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6957
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:6837
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:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6755
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:5783
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
int ak
Definition: kutil.h:349
char * showOption()
Definition: misc_ip.cc:717
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7071
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5729
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
void(* initEcart)(TObject *L)
Definition: kutil.h:274
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:5419
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5931
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:369
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5455
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
BOOLEAN Gebauer
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:394
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5885
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
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:6158
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7007
void rDebugPrint(const ring r)
Definition: ring.cc:4003
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:5824
BOOLEAN sugarCrit
Definition: kutil.h:374
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:11701
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:810
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
ring tailRing
Definition: kutil.h:339
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5572
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5614
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3483
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1037
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
BOOLEAN use_buckets
Definition: kutil.h:380
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:349
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11755
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
int LazyDegree
Definition: kutil.h:349
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5992
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9255

◆ 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:349
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:300
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:4627
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:5128
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
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 7384 of file kutil.cc.

7386 {
7387  int j = 0;
7388  const unsigned long not_sev = ~L->sev;
7389  const unsigned long* sev = strat->sevS;
7390  poly p;
7391  ring r;
7392  L->GetLm(p, r);
7393 
7394  assume(~not_sev == p_GetShortExpVector(p, r));
7395 
7396  if (r == currRing)
7397  {
7398  if(!rField_is_Ring(r))
7399  {
7400  loop
7401  {
7402  if (j > pos) return NULL;
7403  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7404  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7405  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7406  {
7407  break;
7408  }
7409  #else
7410  if (!(sev[j] & not_sev) &&
7411  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7412  p_LmDivisibleBy(strat->S[j], p, r))
7413  {
7414  break;
7415  }
7416  #endif
7417  j++;
7418  }
7419  }
7420  #ifdef HAVE_RINGS
7421  else
7422  {
7423  loop
7424  {
7425  if (j > pos) return NULL;
7426  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7427  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7428  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7429  {
7430  break;
7431  }
7432  #else
7433  if (!(sev[j] & not_sev) &&
7434  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7435  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7436  {
7437  break;
7438  }
7439  #endif
7440  j++;
7441  }
7442  }
7443  #endif
7444  // if called from NF, T objects do not exist:
7445  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7446  {
7447  T->Set(strat->S[j], r, strat->tailRing);
7448  return T;
7449  }
7450  else
7451  {
7452 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7453 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7454 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7455  return strat->S_2_T(j);
7456  }
7457  }
7458  else
7459  {
7460  TObject* t;
7461  if(!rField_is_Ring(r))
7462  {
7463  loop
7464  {
7465  if (j > pos) return NULL;
7466  assume(strat->S_2_R[j] != -1);
7467  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7468  t = strat->S_2_T(j);
7469  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7470  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7471  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7472  {
7473  return t;
7474  }
7475  #else
7476  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7477  {
7478  t = strat->S_2_T(j);
7479  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7480  if (p_LmDivisibleBy(t->t_p, p, r))
7481  {
7482  return t;
7483  }
7484  }
7485  #endif
7486  j++;
7487  }
7488  }
7489  #ifdef HAVE_RINGS
7490  else
7491  {
7492  loop
7493  {
7494  if (j > pos) return NULL;
7495  assume(strat->S_2_R[j] != -1);
7496  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7497  t = strat->S_2_T(j);
7498  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7499  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7500  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7501  {
7502  return t;
7503  }
7504  #else
7505  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7506  {
7507  t = strat->S_2_T(j);
7508  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7509  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7510  {
7511  return t;
7512  }
7513  }
7514  #endif
7515  j++;
7516  }
7517  }
7518  #endif
7519  }
7520 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:346
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:300
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:4627
intset ecartS
Definition: kutil.h:303
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
unsigned long * sevS
Definition: kutil.h:316
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
class sTObject TObject
Definition: kutil.h:59

◆ 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:61
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int tl
Definition: kutil.h:346
unsigned long * sevT
Definition: kutil.h:319
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:4627
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
TSet T
Definition: kutil.h:320
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:300
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:4627
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
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:1442
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:4225
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:4213
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:1296
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:338
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:648
unsigned long * sevT
Definition: kutil.h:319
#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:274
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:8059
#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:315
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9794
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:336
#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:303
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
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:11826
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:9255
#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:338
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
unsigned long * sevT
Definition: kutil.h:319
#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:274
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:8059
#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:315
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9794
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:336
#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:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
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:9255
#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:338
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:648
unsigned long * sevT
Definition: kutil.h:319
#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:274
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:8059
#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:315
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9794
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:336
#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:303
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
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:11826
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:9255
#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:338
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:319
#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:274
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:8059
#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:315
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9794
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:336
#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:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
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:9255
#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:652
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:60
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:60
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:59

◆ 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:60
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:59

◆ 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:60
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:59

◆ 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:2294
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:369
#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:652
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:11280
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:339
#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:650
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:2294
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:369
#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:652
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:11280
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:339
#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:650
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:2294
#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:369
#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:652
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:11280
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:339
#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:650
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:2294
bool sigdrop
Definition: kutil.h:356
#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:369
#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:652
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:11280
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:339
int blockred
Definition: kutil.h:361
#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:650
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:60
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:652
#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:650
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
class sTObject TObject
Definition: kutil.h:59

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

11281 {
11282  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11283  /* initial setup or extending */
11284 
11285  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11286  if (expbound >= currRing->bitmask) return FALSE;
11287  strat->overflow=FALSE;
11288  ring new_tailRing = rModifyRing(currRing,
11289  // Hmmm .. the condition pFDeg == p_Deg
11290  // might be too strong
11291  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11292  (strat->ak==0), // omit_comp if the input is an ideal
11293  expbound); // exp_limit
11294 
11295  if (new_tailRing == currRing) return TRUE;
11296 
11297  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11298  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11299 
11300  if (currRing->pFDeg != currRing->pFDegOrig)
11301  {
11302  new_tailRing->pFDeg = currRing->pFDeg;
11303  new_tailRing->pLDeg = currRing->pLDeg;
11304  }
11305 
11306  if (TEST_OPT_PROT)
11307  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11308  kTest_TS(strat);
11309  assume(new_tailRing != strat->tailRing);
11310  pShallowCopyDeleteProc p_shallow_copy_delete
11311  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11312 
11313  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11314 
11315  int i;
11316  for (i=0; i<=strat->tl; i++)
11317  {
11318  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11319  p_shallow_copy_delete);
11320  }
11321  for (i=0; i<=strat->Ll; i++)
11322  {
11323  assume(strat->L[i].p != NULL);
11324  if (pNext(strat->L[i].p) != strat->tail)
11325  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11326  }
11327  if ((strat->P.t_p != NULL) ||
11328  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11329  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11330 
11331  if ((L != NULL) && (L->tailRing != new_tailRing))
11332  {
11333  if (L->i_r < 0)
11334  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11335  else
11336  {
11337  assume(L->i_r <= strat->tl);
11338  TObject* t_l = strat->R[L->i_r];
11339  assume(t_l != NULL);
11340  L->tailRing = new_tailRing;
11341  L->p = t_l->p;
11342  L->t_p = t_l->t_p;
11343  L->max_exp = t_l->max_exp;
11344  }
11345  }
11346 
11347  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11348  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11349 
11350  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11351  if (strat->tailRing != currRing)
11352  rKillModifiedRing(strat->tailRing);
11353 
11354  strat->tailRing = new_tailRing;
11355  strat->tailBin = new_tailBin;
11356  strat->p_shallow_copy_delete
11357  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11358 
11359  if (strat->kHEdge != NULL)
11360  {
11361  if (strat->t_kHEdge != NULL)
11362  p_LmFree(strat->t_kHEdge, strat->tailRing);
11363  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11364  }
11365 
11366  if (strat->kNoether != NULL)
11367  {
11368  if (strat->t_kNoether != NULL)
11369  p_LmFree(strat->t_kNoether, strat->tailRing);
11371  new_tailRing);
11372  }
11373  kTest_TS(strat);
11374  if (TEST_OPT_PROT)
11375  PrintS("]");
11376  return TRUE;
11377 }
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:323
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:293
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2601
#define TRUE
Definition: auxiliary.h:98
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:334
int ak
Definition: kutil.h:349
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:586
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
BOOLEAN homog
Definition: kutil.h:369
#define kTest_TS(A)
Definition: kutil.h:649
#define assume(x)
Definition: mod2.h:394
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:325
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:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
poly t_kNoether
Definition: kutil.h:327
omBin tailBin
Definition: kutil.h:341
char overflow
Definition: kutil.h:401
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2967
TSet T
Definition: kutil.h:320
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:292
class sTObject TObject
Definition: kutil.h:59

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11379 of file kutil.cc.

11380 {
11381  unsigned long l = 0;
11382  int i;
11383  long e;
11384 
11385  assume(strat->tailRing == currRing);
11386 
11387  for (i=0; i<= strat->Ll; i++)
11388  {
11389  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11390  }
11391  for (i=0; i<=strat->tl; i++)
11392  {
11393  // Hmm ... this we could do in one Step
11394  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11395  }
11396  if (rField_is_Ring(currRing))
11397  {
11398  l *= 2;
11399  }
11400  e = p_GetMaxExp(l, currRing);
11401  if (e <= 1) e = 2;
11402 
11403  kStratChangeTailRing(strat, NULL, NULL, e);
11404 }
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
Definition: p_polys.cc:1174
int Ll
Definition: kutil.h:347
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:346
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:11280
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
TSet T
Definition: kutil.h:320
int l
Definition: cfEzgcd.cc:94

◆ message()

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

Definition at line 7941 of file kutil.cc.

7942 {
7943  if (i != *olddeg)
7944  {
7945  Print("%d",i);
7946  *olddeg = i;
7947  }
7948  if (TEST_OPT_OLDSTD)
7949  {
7950  if (strat->Ll != *reduc)
7951  {
7952  if (strat->Ll != *reduc-1)
7953  Print("(%d)",strat->Ll+1);
7954  else
7955  PrintS("-");
7956  *reduc = strat->Ll;
7957  }
7958  else
7959  PrintS(".");
7960  mflush();
7961  }
7962  else
7963  {
7964  if (red_result == 0)
7965  PrintS("-");
7966  else if (red_result < 0)
7967  PrintS(".");
7968  if ((red_result > 0) || ((strat->Ll % 100)==99))
7969  {
7970  if (strat->Ll != *reduc && strat->Ll > 0)
7971  {
7972  Print("(%d)",strat->Ll+1);
7973  *reduc = strat->Ll;
7974  }
7975  }
7976  }
7977 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:347
#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 7982 of file kutil.cc.

7983 {
7984  //PrintS("\nUsage/Allocation of temporary storage:\n");
7985  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7986  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7987  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7988  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7989  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7990  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7991  /*mflush();*/
7992 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:343
int cv
Definition: kutil.h:366
int cp
Definition: kutil.h:343

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7994 of file kutil.cc.

7995 {
7996  //PrintS("\nUsage/Allocation of temporary storage:\n");
7997  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7998  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7999  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
8000  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
8001  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
8002  /* in usual case strat->cv is 0, it gets changed only in shift routines */
8003  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
8004  /*mflush();*/
8005 }
#define Print
Definition: emacs.cc:83
int cv
Definition: kutil.h:366
int nrsyzcrit
Definition: kutil.h:357
int nrrewcrit
Definition: kutil.h:358

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10762 of file kutil.cc.

10763 {
10764  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10765  return FALSE;
10766  int i,j;
10767  poly newNoether;
10768 
10769 #if 0
10770  if (currRing->weight_all_1)
10771  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10772  else
10773  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10774 #else
10775  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10776 #endif
10777  if (strat->kHEdge==NULL) return FALSE;
10778  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10779  if (strat->tailRing != currRing)
10780  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10781  /* compare old and new noether*/
10782  newNoether = pLmInit(strat->kHEdge);
10783  j = p_FDeg(newNoether,currRing);
10784  for (i=1; i<=(currRing->N); i++)
10785  {
10786  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10787  }
10788  pSetm(newNoether);
10789  if (j < strat->HCord) /*- statistics -*/
10790  {
10791  if (TEST_OPT_PROT)
10792  {
10793  Print("H(%d)",j);
10794  mflush();
10795  }
10796  strat->HCord=j;
10797  #ifdef KDEBUG
10798  if (TEST_OPT_DEBUG)
10799  {
10800  Print("H(%d):",j);
10801  wrp(strat->kHEdge);
10802  PrintLn();
10803  }
10804  #endif
10805  }
10806  if (pCmp(strat->kNoether,newNoether)!=1)
10807  {
10808  pDelete(&strat->kNoether);
10809  strat->kNoether=newNoether;
10810  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10811  if (strat->tailRing != currRing)
10812  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10813 
10814  return TRUE;
10815  }
10816  if (rField_is_Ring(currRing))
10817  pLmDelete(newNoether);
10818  else
10819  pLmFree(newNoether);
10820  return FALSE;
10821 }
#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:323
#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:324
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:349
#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:351
#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:752
poly t_kHEdge
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
poly t_kNoether
Definition: kutil.h:327
#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:297

◆ pairs()

void pairs ( )

◆ pCopyL2p()

poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 11993 of file kutil.cc.

11994 {
11995  /* restores a poly in currRing from LObject */
11996  LObject h = H;
11997  h.Copy();
11998  poly p;
11999  if (h.p == NULL)
12000  {
12001  if (h.t_p != NULL)
12002  {
12003  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
12004  return(p);
12005  }
12006  else
12007  {
12008  /* h.tp == NULL -> the object is NULL */
12009  return(NULL);
12010  }
12011  }
12012  /* we're here if h.p != NULL */
12013  if (h.t_p == NULL)
12014  {
12015  /* then h.p is the whole poly in currRing */
12016  p = h.p;
12017  return(p);
12018  }
12019  /* we're here if h.p != NULL and h.t_p != NULL */
12020  // clean h.p, get poly from t_p
12021  pNext(h.p)=NULL;
12022  pLmDelete(&h.p);
12023  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12024  /* dest. ring: */ currRing);
12025  // no need to clean h: we re-used the polys
12026  return(p);
12027 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#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:339
#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 11962 of file kutil.cc.

11963 {
11964  /* assume: p is completely in currRing */
11965  /* produces an object with LM in curring
11966  and TAIL in tailring */
11967  if (pNext(p)!=NULL)
11968  {
11969  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11970  }
11971  return(p);
11972 }
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:339
#define pNext(p)
Definition: monomials.h:43

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 11976 of file kutil.cc.

11977 {
11978  /* assume: p has LM in curring and TAIL in tailring */
11979  /* convert it to complete currRing */
11980 
11981  /* check that LM is in currRing */
11983 
11984  if (pNext(p)!=NULL)
11985  {
11986  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11987  }
11988  return(p);
11989 }
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:339
#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 5306 of file kutil.cc.

5307 {
5308  if(end < 0 || end >= IDELEMS(F))
5309  end = IDELEMS(F);
5310  if (end<0) return 0;
5311  if(pNext(p) == NULL) return start;
5312  polyset set=F->m;
5313  int o = p_Deg(p,currRing);
5314  int op;
5315  int i;
5316  int an = start;
5317  for(i=start;i<end;i++)
5318  if(set[i] != NULL && pNext(set[i]) == NULL)
5319  an++;
5320  if(an == end-1)
5321  return end;
5322  int en= end;
5323  loop
5324  {
5325  if(an>=en)
5326  return en;
5327  if (an == en-1)
5328  {
5329  op = p_Deg(set[an],currRing);
5330  if ((op < o)
5331  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5332  return en;
5333  return an;
5334  }
5335  i=(an+en) / 2;
5336  op = p_Deg(set[i],currRing);
5337  if ((op < o)
5338  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5339  an=i;
5340  else
5341  en=i;
5342  }
5343 }
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:586
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 6158 of file kutil.cc.

6160 {
6161  if (length<0) return 0;
6162 
6163  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6164  return length+1;
6165 
6166  int i;
6167  int an = 0;
6168  int en= length;
6169  loop
6170  {
6171  if (an >= en-1)
6172  {
6173  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6174  return an;
6175  }
6176  i=(an+en) / 2;
6177  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6178  else en=i;
6179  /*aend. fuer lazy == in !=- machen */
6180  }
6181 }
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:352
int j
Definition: myNF.cc:70
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:282
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 6416 of file kutil.cc.

6418 {
6419  if (length<0) return 0;
6420 
6421  int o = p->GetpFDeg();
6422  int op = set[length].GetpFDeg();
6423 
6424  if ((op > o)
6425  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6426  return length+1;
6427  int i;
6428  int an = 0;
6429  int en= length;
6430  loop
6431  {
6432  if (an >= en-1)
6433  {
6434  op = set[an].GetpFDeg();
6435  if ((op > o)
6436  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6437  return en;
6438  return an;
6439  }
6440  i=(an+en) / 2;
6441  op = set[i].GetpFDeg();
6442  if ((op > o)
6443  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6444  an=i;
6445  else
6446  en=i;
6447  }
6448 }
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 6714 of file kutil.cc.

6716 {
6717  if (length<0) return 0;
6718 
6719  int o = p->GetpFDeg();
6720  int op = set[length].GetpFDeg();
6721 
6722  if ((op > o)
6723  || ((op == o) && (set[length].length >p->length))
6724  || ((op == o) && (set[length].length <= p->length)
6725  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6726  return length+1;
6727  int i;
6728  int an = 0;
6729  int en= length;
6730  loop
6731  {
6732  if (an >= en-1)
6733  {
6734  op = set[an].GetpFDeg();
6735  if ((op > o)
6736  || ((op == o) && (set[an].length >p->length))
6737  || ((op == o) && (set[an].length <=p->length)
6738  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6739  return en;
6740  return an;
6741  }
6742  i=(an+en) / 2;
6743  op = set[i].GetpFDeg();
6744  if ((op > o)
6745  || ((op == o) && (set[i].length > p->length))
6746  || ((op == o) && (set[i].length <= p->length)
6747  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6748  an=i;
6749  else
6750  en=i;
6751  }
6752 }
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 6458 of file kutil.cc.

6460 {
6461  if (length<0) return 0;
6462 
6463  int o = p->GetpFDeg();
6464  int op = set[length].GetpFDeg();
6465 
6466  if ((op > o)
6467  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6468  return length+1;
6469  int i;
6470  int an = 0;
6471  int en= length;
6472  loop
6473  {
6474  if (an >= en-1)
6475  {
6476  op = set[an].GetpFDeg();
6477  if ((op > o)
6478  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6479  return en;
6480  return an;
6481  }
6482  i=(an+en) / 2;
6483  op = set[i].GetpFDeg();
6484  if ((op > o)
6485  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6486  an=i;
6487  else
6488  en=i;
6489  }
6490 }
#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 6528 of file kutil.cc.

6530 {
6531  if (length < 0) return 0;
6532  int an,en,i;
6533  an = 0;
6534  en = length+1;
6535  loop
6536  {
6537  if (an >= en-1)
6538  {
6539  if(an == en)
6540  return en;
6541  if (set[an].FDeg > p->FDeg)
6542  return en;
6543  if (set[an].FDeg < p->FDeg)
6544  return an;
6545  if (set[an].FDeg == p->FDeg)
6546  {
6547  number lcset,lcp;
6548  lcset = pGetCoeff(set[an].p);
6549  lcp = pGetCoeff(p->p);
6550  if(!nGreaterZero(lcset))
6551  {
6552  set[an].p=p_Neg(set[an].p,currRing);
6553  if (set[an].t_p!=NULL)
6554  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6555  lcset=pGetCoeff(set[an].p);
6556  }
6557  if(!nGreaterZero(lcp))
6558  {
6559  p->p=p_Neg(p->p,currRing);
6560  if (p->t_p!=NULL)
6561  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6562  lcp=pGetCoeff(p->p);
6563  }
6564  if(nGreater(lcset, lcp))
6565  {
6566  return en;
6567  }
6568  else
6569  {
6570  return an;
6571  }
6572  }
6573  }
6574  i=(an+en) / 2;
6575  if (set[i].FDeg > p->FDeg)
6576  an=i;
6577  if (set[i].FDeg < p->FDeg)
6578  en=i;
6579  if (set[i].FDeg == p->FDeg)
6580  {
6581  number lcset,lcp;
6582  lcset = pGetCoeff(set[i].p);
6583  lcp = pGetCoeff(p->p);
6584  if(!nGreaterZero(lcset))
6585  {
6586  set[i].p=p_Neg(set[i].p,currRing);
6587  if (set[i].t_p!=NULL)
6588  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6589  lcset=pGetCoeff(set[i].p);
6590  }
6591  if(!nGreaterZero(lcp))
6592  {
6593  p->p=p_Neg(p->p,currRing);
6594  if (p->t_p!=NULL)
6595  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6596  lcp=pGetCoeff(p->p);
6597  }
6598  if(nGreater(lcset, lcp))
6599  {
6600  an = i;
6601  }
6602  else
6603  {
6604  en = i;
6605  }
6606  }
6607  }
6608 }
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 6802 of file kutil.cc.

6804 {
6805  if (length<0) return 0;
6806 
6807  int o = p->GetpFDeg();
6808 
6809  if (set[length].GetpFDeg() > o)
6810  return length+1;
6811 
6812  int i;
6813  int an = 0;
6814  int en= length;
6815  loop
6816  {
6817  if (an >= en-1)
6818  {
6819  if (set[an].GetpFDeg() >= o)
6820  return en;
6821  return an;
6822  }
6823  i=(an+en) / 2;
6824  if (set[i].GetpFDeg() >= o)
6825  an=i;
6826  else
6827  en=i;
6828  }
6829 }
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 6837 of file kutil.cc.

6839 {
6840  if (length<0) return 0;
6841 
6842  int o = p->GetpFDeg() + p->ecart;
6843  int op = set[length].GetpFDeg() + set[length].ecart;
6844 
6845  if ((op > o)
6846  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6847  return length+1;
6848  int i;
6849  int an = 0;
6850  int en= length;
6851  loop
6852  {
6853  if (an >= en-1)
6854  {
6855  op = set[an].GetpFDeg() + set[an].ecart;
6856  if ((op > o)
6857  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6858  return en;
6859  return an;
6860  }
6861  i=(an+en) / 2;
6862  op = set[i].GetpFDeg() + set[i].ecart;
6863  if ((op > o)
6864  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6865  an=i;
6866  else
6867  en=i;
6868  }
6869 }
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 6872 of file kutil.cc.

6874 {
6875  if (length<0) return 0;
6876 
6877  int o = p->GetpFDeg() + p->ecart;
6878  int op = set[length].GetpFDeg() + set[length].ecart;
6879 
6880  if ((op > o)
6881  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6882  return length+1;
6883  int i;
6884  int an = 0;
6885  int en= length;
6886  loop
6887  {
6888  if (an >= en-1)
6889  {
6890  op = set[an].GetpFDeg() + set[an].ecart;
6891  if ((op > o)
6892  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6893  return en;
6894  return an;
6895  }
6896  i=(an+en) / 2;
6897  op = set[i].GetpFDeg() + set[i].ecart;
6898  if ((op > o)
6899  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6900  an=i;
6901  else
6902  en=i;
6903  }
6904 }
#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 6913 of file kutil.cc.

6915 {
6916  if (length<0) return 0;
6917 
6918  int o = p->GetpFDeg() + p->ecart;
6919 
6920  if ((set[length].GetpFDeg() + set[length].ecart > o)
6921  || ((set[length].GetpFDeg() + set[length].ecart == o)
6922  && (set[length].ecart > p->ecart))
6923  || ((set[length].GetpFDeg() + set[length].ecart == o)
6924  && (set[length].ecart == p->ecart)
6925  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6926  return length+1;
6927  int i;
6928  int an = 0;
6929  int en= length;
6930  loop
6931  {
6932  if (an >= en-1)
6933  {
6934  if ((set[an].GetpFDeg() + set[an].ecart > o)
6935  || ((set[an].GetpFDeg() + set[an].ecart == o)
6936  && (set[an].ecart > p->ecart))
6937  || ((set[an].GetpFDeg() + set[an].ecart == o)
6938  && (set[an].ecart == p->ecart)
6939  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6940  return en;
6941  return an;
6942  }
6943  i=(an+en) / 2;
6944  if ((set[i].GetpFDeg() + set[i].ecart > o)
6945  || ((set[i].GetpFDeg() + set[i].ecart == o)
6946  && (set[i].ecart > p->ecart))
6947  || ((set[i].GetpFDeg() +set[i].ecart == o)
6948  && (set[i].ecart == p->ecart)
6949  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6950  an=i;
6951  else
6952  en=i;
6953  }
6954 }
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 6404 of file kutil.cc.

6406 {
6407  return strat->Ll+1;
6408 }
int Ll
Definition: kutil.h:347

◆ posInLF5CRing()

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

Definition at line 6492 of file kutil.cc.

6494 {
6495  if (length<0) return 0;
6496  if(start == (length +1)) return (length+1);
6497  int o = p->GetpFDeg();
6498  int op = set[length].GetpFDeg();
6499 
6500  if ((op > o)
6501  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6502  return length+1;
6503  int i;
6504  int an = start;
6505  int en= length;
6506  loop
6507  {
6508  if (an >= en-1)
6509  {
6510  op = set[an].GetpFDeg();
6511  if ((op > o)
6512  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6513  return en;
6514  return an;
6515  }
6516  i=(an+en) / 2;
6517  op = set[i].GetpFDeg();
6518  if ((op > o)
6519  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6520  an=i;
6521  else
6522  en=i;
6523  }
6524 }
#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 6303 of file kutil.cc.

6305 {
6306  if (length < 0) return 0;
6307  if (set[length].FDeg > p->FDeg)
6308  return length+1;
6309  if (set[length].FDeg == p->FDeg)
6310  if(set[length].GetpLength() > p->GetpLength())
6311  return length+1;
6312  int i;
6313  int an = 0;
6314  int en= length+1;
6315  loop
6316  {
6317  if (an >= en-1)
6318  {
6319  if(an == en)
6320  return en;
6321  if (set[an].FDeg > p->FDeg)
6322  return en;
6323  if(set[an].FDeg == p->FDeg)
6324  {
6325  if(set[an].GetpLength() > p->GetpLength())
6326  return en;
6327  else
6328  {
6329  if(set[an].GetpLength() == p->GetpLength())
6330  {
6331  if(nGreater(set[an].p->coef, p->p->coef))
6332  return en;
6333  else
6334  return an;
6335  }
6336  else
6337  {
6338  return an;
6339  }
6340  }
6341  }
6342  else
6343  return an;
6344  }
6345  i=(an+en) / 2;
6346  if (set[i].FDeg > p->FDeg)
6347  an=i;
6348  else
6349  {
6350  if(set[i].FDeg == p->FDeg)
6351  {
6352  if(set[i].GetpLength() > p->GetpLength())
6353  an=i;
6354  else
6355  {
6356  if(set[i].GetpLength() == p->GetpLength())
6357  {
6358  if(nGreater(set[i].p->coef, p->p->coef))
6359  an = i;
6360  else
6361  en = i;
6362  }
6363  else
6364  {
6365  en=i;
6366  }
6367  }
6368  }
6369  else
6370  en=i;
6371  }
6372  }
6373 }
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 6216 of file kutil.cc.

6218 {
6219  if (length<0) return 0;
6220  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6221  return length+1;
6222 
6223  int i;
6224  int an = 0;
6225  int en= length;
6226  loop
6227  {
6228  if (an >= en-1)
6229  {
6230  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6231  return an;
6232  }
6233  i=(an+en) / 2;
6234  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6235  else en=i;
6236  /*aend. fuer lazy == in !=- machen */
6237  }
6238 }
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 6240 of file kutil.cc.

6242 {
6243  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6244  if (length<0) return 0;
6245  if (pLtCmp(set[length].sig,p->sig)== 1)
6246  return length+1;
6247 
6248  int an,en,i;
6249  an = 0;
6250  en = length+1;
6251  int cmp;
6252  loop
6253  {
6254  if (an >= en-1)
6255  {
6256  if(an == en)
6257  return en;
6258  cmp = pLtCmp(set[an].sig,p->sig);
6259  if (cmp == 1)
6260  return en;
6261  if (cmp == -1)
6262  return an;
6263  if (cmp == 0)
6264  {
6265  if (set[an].FDeg > p->FDeg)
6266  return en;
6267  if (set[an].FDeg < p->FDeg)
6268  return an;
6269  if (set[an].FDeg == p->FDeg)
6270  {
6271  cmp = pLtCmp(set[an].p,p->p);
6272  if(cmp == 1)
6273  return en;
6274  else
6275  return an;
6276  }
6277  }
6278  }
6279  i=(an+en) / 2;
6280  cmp = pLtCmp(set[i].sig,p->sig);
6281  if (cmp == 1)
6282  an = i;
6283  if (cmp == -1)
6284  en = i;
6285  if (cmp == 0)
6286  {
6287  if (set[i].FDeg > p->FDeg)
6288  an = i;
6289  if (set[i].FDeg < p->FDeg)
6290  en = i;
6291  if (set[i].FDeg == p->FDeg)
6292  {
6293  cmp = pLtCmp(set[i].p,p->p);
6294  if(cmp == 1)
6295  an = i;
6296  else
6297  en = i;
6298  }
6299  }
6300  }
6301 }
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 5128 of file kutil.cc.

5130 {
5131  if(length==-1) return 0;
5132  polyset set=strat->S;
5133  int i;
5134  int an = 0;
5135  int en = length;
5136  int cmp_int = currRing->OrdSgn;
5138 #ifdef HAVE_PLURAL
5139  && (currRing->real_var_start==0)
5140 #endif
5141 #if 0
5142  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5143 #endif
5144  )
5145  {
5146  int o=p_Deg(p,currRing);
5147  int oo=p_Deg(set[length],currRing);
5148 
5149  if ((oo<o)
5150  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5151  return length+1;
5152 
5153  loop
5154  {
5155  if (an >= en-1)
5156  {
5157  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5158  {
5159  return an;
5160  }
5161  return en;
5162  }
5163  i=(an+en) / 2;
5164  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5165  else an=i;
5166  }
5167  }
5168  else
5169  {
5170  if (rField_is_Ring(currRing))
5171  {
5172  if (pLmCmp(set[length],p)== -cmp_int)
5173  return length+1;
5174  int cmp;
5175  loop
5176  {
5177  if (an >= en-1)
5178  {
5179  cmp = pLmCmp(set[an],p);
5180  if (cmp == cmp_int) return an;
5181  if (cmp == -cmp_int) return en;
5182  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5183  return an;
5184  }
5185  i = (an+en) / 2;
5186  cmp = pLmCmp(set[i],p);
5187  if (cmp == cmp_int) en = i;
5188  else if (cmp == -cmp_int) an = i;
5189  else
5190  {
5191  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5192  else en = i;
5193  }
5194  }
5195  }
5196  else
5197  if (pLmCmp(set[length],p)== -cmp_int)
5198  return length+1;
5199 
5200  loop
5201  {
5202  if (an >= en-1)
5203  {
5204  if (pLmCmp(set[an],p) == cmp_int) return an;
5205  if (pLmCmp(set[an],p) == -cmp_int) return en;
5206  if ((cmp_int!=1)
5207  && ((strat->ecartS[an])>ecart_p))
5208  return an;
5209  return en;
5210  }
5211  i=(an+en) / 2;
5212  if (pLmCmp(set[i],p) == cmp_int) en=i;
5213  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5214  else
5215  {
5216  if ((cmp_int!=1)
5217  &&((strat->ecartS[i])<ecart_p))
5218  en=i;
5219  else
5220  an=i;
5221  }
5222  }
5223  }
5224 }
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:349
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:586
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
intset ecartS
Definition: kutil.h:303
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 5229 of file kutil.cc.

5230 {
5231  if (length<0) return 0;
5232  polyset set=strat->S;
5233  if(pNext(p) == NULL)
5234  {
5235  int mon = 0;
5236  for(int i = 0;i<=length;i++)
5237  {
5238  if(set[i] != NULL && pNext(set[i]) == NULL)
5239  mon++;
5240  }
5241  int o = p_Deg(p,currRing);
5242  int op = p_Deg(set[mon],currRing);
5243 
5244  if ((op < o)
5245  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5246  return length+1;
5247  int i;
5248  int an = 0;
5249  int en= mon;
5250  loop
5251  {
5252  if (an >= en-1)
5253  {
5254  op = p_Deg(set[an],currRing);
5255  if ((op < o)
5256  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5257  return en;
5258  return an;
5259  }
5260  i=(an+en) / 2;
5261  op = p_Deg(set[i],currRing);
5262  if ((op < o)
5263  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5264  an=i;
5265  else
5266  en=i;
5267  }
5268  }
5269  else /*if(pNext(p) != NULL)*/
5270  {
5271  int o = p_Deg(p,currRing);
5272  int op = p_Deg(set[length],currRing);
5273 
5274  if ((op < o)
5275  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5276  return length+1;
5277  int i;
5278  int an = 0;
5279  for(i=0;i<=length;i++)
5280  if(set[i] != NULL && pNext(set[i]) == NULL)
5281  an++;
5282  int en= length;
5283  loop
5284  {
5285  if (an >= en-1)
5286  {
5287  op = p_Deg(set[an],currRing);
5288  if ((op < o)
5289  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5290  return en;
5291  return an;
5292  }
5293  i=(an+en) / 2;
5294  op = p_Deg(set[i],currRing);
5295  if ((op < o)
5296  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5297  an=i;
5298  else
5299  en=i;
5300  }
5301  }
5302 }
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:586
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#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 6376 of file kutil.cc.

6377 {
6378  if (strat->syzl==0) return 0;
6379  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6380  return strat->syzl;
6381  int i;
6382  int an = 0;
6383  int en= strat->syzl-1;
6384  loop
6385  {
6386  if (an >= en-1)
6387  {
6388  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6389  return an;
6390  }
6391  i=(an+en) / 2;
6392  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6393  else en=i;
6394  /*aend. fuer lazy == in !=- machen */
6395  }
6396 }
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:301
int syzl
Definition: kutil.h:345

◆ posInT0()

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

Definition at line 5350 of file kutil.cc.

5351 {
5352  return (length+1);
5353 }

◆ posInT1()

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

Definition at line 5361 of file kutil.cc.

5362 {
5363  if (length==-1) return 0;
5364 
5365  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5366 
5367  int i;
5368  int an = 0;
5369  int en= length;
5370 
5371  loop
5372  {
5373  if (an >= en-1)
5374  {
5375  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5376  return en;
5377  }
5378  i=(an+en) / 2;
5379  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5380  else an=i;
5381  }
5382 }
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 5419 of file kutil.cc.

5420 {
5421  if (length==-1) return 0;
5422 
5423  int o = p.GetpFDeg();
5424  int op = set[length].GetpFDeg();
5425 
5426  if ((op < o)
5427  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5428  return length+1;
5429 
5430  int i;
5431  int an = 0;
5432  int en= length;
5433 
5434  loop
5435  {
5436  if (an >= en-1)
5437  {
5438  op= set[an].GetpFDeg();
5439  if ((op > o)
5440  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5441  return an;
5442  return en;
5443  }
5444  i=(an+en) / 2;
5445  op = set[i].GetpFDeg();
5446  if (( op > o)
5447  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5448  en=i;
5449  else
5450  an=i;
5451  }
5452 }
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 5572 of file kutil.cc.

5573 {
5574  p.GetpLength();
5575  if (length==-1) return 0;
5576 
5577  int o = p.GetpFDeg();
5578  int op = set[length].GetpFDeg();
5579 
5580  if (( op < o)
5581  || (( op == o) && (set[length].length<p.length))
5582  || (( op == o) && (set[length].length == p.length)
5583  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5584  return length+1;
5585 
5586  int i;
5587  int an = 0;
5588  int en= length;
5589  loop
5590  {
5591  if (an >= en-1)
5592  {
5593  op = set[an].GetpFDeg();
5594  if (( op > o)
5595  || (( op == o) && (set[an].length > p.length))
5596  || (( op == o) && (set[an].length == p.length)
5597  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5598  return an;
5599  return en;
5600  }
5601  i=(an+en) / 2;
5602  op = set[i].GetpFDeg();
5603  if (( op > o)
5604  || (( op == o) && (set[i].length > p.length))
5605  || (( op == o) && (set[i].length == p.length)
5606  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5607  en=i;
5608  else
5609  an=i;
5610  }
5611 }
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 5661 of file kutil.cc.

5662 {
5663  if (length==-1) return 0;
5664 
5665  int o = p.GetpFDeg();
5666 
5667  if (set[length].GetpFDeg() <= o)
5668  return length+1;
5669 
5670  int i;
5671  int an = 0;
5672  int en= length;
5673  loop
5674  {
5675  if (an >= en-1)
5676  {
5677  if (set[an].GetpFDeg() > o)
5678  return an;
5679  return en;
5680  }
5681  i=(an+en) / 2;
5682  if (set[i].GetpFDeg() > o)
5683  en=i;
5684  else
5685  an=i;
5686  }
5687 }
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 5729 of file kutil.cc.

5748 {
5749  if (length==-1) return 0;
5750 
5751  int o = p.GetpFDeg() + p.ecart;
5752  int op = set[length].GetpFDeg()+set[length].ecart;
5753 
5754  if ((op < o)
5755  || ((op == o)
5756  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5757  return length+1;
5758 
5759  int i;
5760  int an = 0;
5761  int en= length;
5762  loop
5763  {
5764  if (an >= en-1)
5765  {
5766  op = set[an].GetpFDeg()+set[an].ecart;
5767  if (( op > o)
5768  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5769  return an;
5770  return en;
5771  }
5772  i=(an+en) / 2;
5773  op = set[i].GetpFDeg()+set[i].ecart;
5774  if (( op > o)
5775  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5776  en=i;
5777  else
5778  an=i;
5779  }
5780 }
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 5824 of file kutil.cc.

5845 {
5846  if (length==-1) return 0;
5847 
5848  int o = p.GetpFDeg() + p.ecart;
5849  int op = set[length].GetpFDeg()+set[length].ecart;
5850 
5851  if ((op < o)
5852  || (( op == o) && (set[length].ecart > p.ecart))
5853  || (( op == o) && (set[length].ecart==p.ecart)
5854  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5855  return length+1;
5856 
5857  int i;
5858  int an = 0;
5859  int en= length;
5860  loop
5861  {
5862  if (an >= en-1)
5863  {
5864  op = set[an].GetpFDeg()+set[an].ecart;
5865  if (( op > o)
5866  || (( op == o) && (set[an].ecart < p.ecart))
5867  || (( op == o) && (set[an].ecart==p.ecart)
5868  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5869  return an;
5870  return en;
5871  }
5872  i=(an+en) / 2;
5873  op = set[i].GetpFDeg()+set[i].ecart;
5874  if ((op > o)
5875  || (( op == o) && (set[i].ecart < p.ecart))
5876  || (( op == o) && (set[i].ecart == p.ecart)
5877  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5878  en=i;
5879  else
5880  an=i;
5881  }
5882 }
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 5931 of file kutil.cc.

5932 {
5933  if (length==-1) return 0;
5934 
5935  int cc = (-1+2*currRing->order[0]==ringorder_c);
5936  /* cc==1 for (c,..), cc==-1 for (C,..) */
5937  int o = p.GetpFDeg() + p.ecart;
5938  int c = pGetComp(p.p)*cc;
5939 
5940  if (pGetComp(set[length].p)*cc < c)
5941  return length+1;
5942  if (pGetComp(set[length].p)*cc == c)
5943  {
5944  int op = set[length].GetpFDeg()+set[length].ecart;
5945  if ((op < o)
5946  || ((op == o) && (set[length].ecart > p.ecart))
5947  || ((op == o) && (set[length].ecart==p.ecart)
5948  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5949  return length+1;
5950  }
5951 
5952  int i;
5953  int an = 0;
5954  int en= length;
5955  loop
5956  {
5957  if (an >= en-1)
5958  {
5959  if (pGetComp(set[an].p)*cc < c)
5960  return en;
5961  if (pGetComp(set[an].p)*cc == c)
5962  {
5963  int op = set[an].GetpFDeg()+set[an].ecart;
5964  if ((op > o)
5965  || ((op == o) && (set[an].ecart < p.ecart))
5966  || ((op == o) && (set[an].ecart==p.ecart)
5967  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5968  return an;
5969  }
5970  return en;
5971  }
5972  i=(an+en) / 2;
5973  if (pGetComp(set[i].p)*cc > c)
5974  en=i;
5975  else if (pGetComp(set[i].p)*cc == c)
5976  {
5977  int op = set[i].GetpFDeg()+set[i].ecart;
5978  if ((op > o)
5979  || ((op == o) && (set[i].ecart < p.ecart))
5980  || ((op == o) && (set[i].ecart == p.ecart)
5981  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5982  en=i;
5983  else
5984  an=i;
5985  }
5986  else
5987  an=i;
5988  }
5989 }
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 6058 of file kutil.cc.

6059 {
6060  p.GetpLength();
6061  if (length==-1) return 0;
6062 
6063  int o = p.ecart;
6064  int op=p.GetpFDeg();
6065 
6066  if (set[length].ecart < o)
6067  return length+1;
6068  if (set[length].ecart == o)
6069  {
6070  int oo=set[length].GetpFDeg();
6071  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
6072  return length+1;
6073  }
6074 
6075  int i;
6076  int an = 0;
6077  int en= length;
6078  loop
6079  {
6080  if (an >= en-1)
6081  {
6082  if (set[an].ecart > o)
6083  return an;
6084  if (set[an].ecart == o)
6085  {
6086  int oo=set[an].GetpFDeg();
6087  if((oo > op)
6088  || ((oo==op) && (set[an].length > p.length)))
6089  return an;
6090  }
6091  return en;
6092  }
6093  i=(an+en) / 2;
6094  if (set[i].ecart > o)
6095  en=i;
6096  else if (set[i].ecart == o)
6097  {
6098  int oo=set[i].GetpFDeg();
6099  if ((oo > op)
6100  || ((oo == op) && (set[i].length > p.length)))
6101  en=i;
6102  else
6103  an=i;
6104  }
6105  else
6106  an=i;
6107  }
6108 }
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 5389 of file kutil.cc.

5390 {
5391  p.GetpLength();
5392  if (length==-1)
5393  return 0;
5394  if (set[length].length<p.length)
5395  return length+1;
5396 
5397  int i;
5398  int an = 0;
5399  int en= length;
5400 
5401  loop
5402  {
5403  if (an >= en-1)
5404  {
5405  if (set[an].length>p.length) return an;
5406  return en;
5407  }
5408  i=(an+en) / 2;
5409  if (set[i].length>p.length) en=i;
5410  else an=i;
5411  }
5412 }
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 11701 of file kutil.cc.

11702 {
11703 
11704  if (length==-1) return 0;
11705 
11706  int o = p.ecart;
11707  int op=p.GetpFDeg();
11708  int ol = p.GetpLength();
11709 
11710  if (set[length].ecart < o)
11711  return length+1;
11712  if (set[length].ecart == o)
11713  {
11714  int oo=set[length].GetpFDeg();
11715  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11716  return length+1;
11717  }
11718 
11719  int i;
11720  int an = 0;
11721  int en= length;
11722  loop
11723  {
11724  if (an >= en-1)
11725  {
11726  if (set[an].ecart > o)
11727  return an;
11728  if (set[an].ecart == o)
11729  {
11730  int oo=set[an].GetpFDeg();
11731  if((oo > op)
11732  || ((oo==op) && (set[an].pLength > ol)))
11733  return an;
11734  }
11735  return en;
11736  }
11737  i=(an+en) / 2;
11738  if (set[i].ecart > o)
11739  en=i;
11740  else if (set[i].ecart == o)
11741  {
11742  int oo=set[i].GetpFDeg();
11743  if ((oo > op)
11744  || ((oo == op) && (set[i].pLength > ol)))
11745  en=i;
11746  else
11747  an=i;
11748  }
11749  else
11750  an=i;
11751  }
11752 }
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 5690 of file kutil.cc.

5691 {
5692  int ol = p.GetpLength();
5693  if (length==-1) return 0;
5694 
5695  int op=p.ecart;
5696 
5697  int oo=set[length].ecart;
5698  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5699  return length+1;
5700 
5701  int i;
5702  int an = 0;
5703  int en= length;
5704  loop
5705  {
5706  if (an >= en-1)
5707  {
5708  int oo=set[an].ecart;
5709  if((oo > op)
5710  || ((oo==op) && (set[an].pLength > ol)))
5711  return an;
5712  return en;
5713  }
5714  i=(an+en) / 2;
5715  int oo=set[i].ecart;
5716  if ((oo > op)
5717  || ((oo == op) && (set[i].pLength > ol)))
5718  en=i;
5719  else
5720  an=i;
5721  }
5722 }
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 11755 of file kutil.cc.

11756 {
11757 
11758  if (length==-1) return 0;
11759 
11760  int op=p.GetpFDeg();
11761  int ol = p.GetpLength();
11762 
11763  int oo=set[length].GetpFDeg();
11764  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11765  return length+1;
11766 
11767  int i;
11768  int an = 0;
11769  int en= length;
11770  loop
11771  {
11772  if (an >= en-1)
11773  {
11774  int oo=set[an].GetpFDeg();
11775  if((oo > op)
11776  || ((oo==op) && (set[an].pLength > ol)))
11777  return an;
11778  return en;
11779  }
11780  i=(an+en) / 2;
11781  int oo=set[i].GetpFDeg();
11782  if ((oo > op)
11783  || ((oo == op) && (set[i].pLength > ol)))
11784  en=i;
11785  else
11786  an=i;
11787  }
11788 }
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 11792 of file kutil.cc.

11793 {
11794  int ol = p.GetpLength();
11795  if (length==-1)
11796  return 0;
11797  if (set[length].length<p.length)
11798  return length+1;
11799 
11800  int i;
11801  int an = 0;
11802  int en= length;
11803 
11804  loop
11805  {
11806  if (an >= en-1)
11807  {
11808  if (set[an].pLength>ol) return an;
11809  return en;
11810  }
11811  i=(an+en) / 2;
11812  if (set[i].pLength>ol) en=i;
11813  else an=i;
11814  }
11815 }
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 11057 of file kutil.cc.

11058 {
11059  if(!nCoeff_is_Ring_Z(currRing->cf))
11060  return;
11061  poly pH = h->GetP();
11062  poly p,pp;
11063  p = pH;
11064  bool deleted = FALSE, ok = FALSE;
11065  for(int i = 0; i<=strat->sl; i++)
11066  {
11067  p = pH;
11068  if(pNext(strat->S[i]) == NULL)
11069  {
11070  //pWrite(p);
11071  //pWrite(strat->S[i]);
11072  while(ok == FALSE && p != NULL)
11073  {
11074  if(pLmDivisibleBy(strat->S[i], p))
11075  {
11076  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11077  p_SetCoeff(p,dummy,currRing);
11078  }
11079  if(nIsZero(p->coef))
11080  {
11081  pLmDelete(&p);
11082  h->p = p;
11083  deleted = TRUE;
11084  }
11085  else
11086  {
11087  ok = TRUE;
11088  }
11089  }
11090  if (p!=NULL)
11091  {
11092  pp = pNext(p);
11093  while(pp != NULL)
11094  {
11095  if(pLmDivisibleBy(strat->S[i], pp))
11096  {
11097  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11098  p_SetCoeff(pp,dummy,currRing);
11099  if(nIsZero(pp->coef))
11100  {
11101  pLmDelete(&pNext(p));
11102  pp = pNext(p);
11103  deleted = TRUE;
11104  }
11105  else
11106  {
11107  p = pp;
11108  pp = pNext(p);
11109  }
11110  }
11111  else
11112  {
11113  p = pp;
11114  pp = pNext(p);
11115  }
11116  }
11117  }
11118  }
11119  }
11120  h->SetLmCurrRing();
11121  if((deleted)&&(h->p!=NULL))
11122  strat->initEcart(h);
11123 }
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:274
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:300
#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:344
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11125 of file kutil.cc.

11126 {
11127  if(!nCoeff_is_Ring_Z(currRing->cf))
11128  return;
11129  poly hSig = h->sig;
11130  poly pH = h->GetP();
11131  poly p,pp;
11132  p = pH;
11133  bool deleted = FALSE, ok = FALSE;
11134  for(int i = 0; i<=strat->sl; i++)
11135  {
11136  p = pH;
11137  if(pNext(strat->S[i]) == NULL)
11138  {
11139  while(ok == FALSE && p!=NULL)
11140  {
11141  if(pLmDivisibleBy(strat->S[i], p))
11142  {
11143  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11144  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11145  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11146  {
11147  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11148  p_SetCoeff(p,dummy,currRing);
11149  }
11150  pDelete(&sigMult);
11151  }
11152  if(nIsZero(p->coef))
11153  {
11154  pLmDelete(&p);
11155  h->p = p;
11156  deleted = TRUE;
11157  }
11158  else
11159  {
11160  ok = TRUE;
11161  }
11162  }
11163  if(p == NULL)
11164  return;
11165  pp = pNext(p);
11166  while(pp != NULL)
11167  {
11168  if(pLmDivisibleBy(strat->S[i], pp))
11169  {
11170  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11171  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11172  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11173  {
11174  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11175  p_SetCoeff(pp,dummy,currRing);
11176  if(nIsZero(pp->coef))
11177  {
11178  pLmDelete(&pNext(p));
11179  pp = pNext(p);
11180  deleted = TRUE;
11181  }
11182  else
11183  {
11184  p = pp;
11185  pp = pNext(p);
11186  }
11187  }
11188  else
11189  {
11190  p = pp;
11191  pp = pNext(p);
11192  }
11193  pDelete(&sigMult);
11194  }
11195  else
11196  {
11197  p = pp;
11198  pp = pNext(p);
11199  }
11200  }
11201  }
11202  }
11203  h->SetLmCurrRing();
11204  if(deleted)
11205  strat->initEcart(h);
11206 
11207 }
polyset sig
Definition: kutil.h:302
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:274
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:300
#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:344
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 10889 of file kutil.cc.

10890 {
10892  if(!nCoeff_is_Ring_Z(currRing->cf))
10893  return NULL;
10894  ideal F = idCopy(Forig);
10895  idSkipZeroes(F);
10896  poly pmon;
10897  ring origR = currRing;
10898  ideal monred = idInit(1,1);
10899  for(int i=0; i<idElem(F); i++)
10900  {
10901  if(pNext(F->m[i]) == NULL)
10902  idInsertPoly(monred, pCopy(F->m[i]));
10903  }
10904  int posconst = idPosConstant(F);
10905  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10906  {
10907  idDelete(&F);
10908  idDelete(&monred);
10909  return NULL;
10910  }
10911  int idelemQ = 0;
10912  if(Q!=NULL)
10913  {
10914  idelemQ = IDELEMS(Q);
10915  for(int i=0; i<idelemQ; i++)
10916  {
10917  if(pNext(Q->m[i]) == NULL)
10918  idInsertPoly(monred, pCopy(Q->m[i]));
10919  }
10920  idSkipZeroes(monred);
10921  posconst = idPosConstant(monred);
10922  //the constant, if found, will be from Q
10923  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10924  {
10925  pmon = pCopy(monred->m[posconst]);
10926  idDelete(&F);
10927  idDelete(&monred);
10928  return pmon;
10929  }
10930  }
10931  ring QQ_ring = rCopy0(currRing,FALSE);
10932  nKillChar(QQ_ring->cf);
10933  QQ_ring->cf = nInitChar(n_Q, NULL);
10934  rComplete(QQ_ring,1);
10935  QQ_ring = rAssure_c_dp(QQ_ring);
10936  rChangeCurrRing(QQ_ring);
10937  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10938  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10939  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10940  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10941  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10942  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10943  ideal one = kStd(II, NULL, isNotHomog, NULL);
10944  idSkipZeroes(one);
10945  if(idIsConstant(one))
10946  {
10947  //one should be <1>
10948  for(int i = IDELEMS(II)-1; i>=0; i--)
10949  if(II->m[i] != NULL)
10950  II->m[i+1] = II->m[i];
10951  II->m[0] = pOne();
10952  ideal syz = idSyzygies(II, isNotHomog, NULL);
10953  poly integer = NULL;
10954  for(int i = IDELEMS(syz)-1;i>=0; i--)
10955  {
10956  if(pGetComp(syz->m[i]) == 1)
10957  {
10958  pSetComp(syz->m[i],0);
10959  if(pIsConstant(pHead(syz->m[i])))
10960  {
10961  integer = pHead(syz->m[i]);
10962  break;
10963  }
10964  }
10965  }
10966  rChangeCurrRing(origR);
10967  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10968  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10969  idDelete(&monred);
10970  idDelete(&F);
10971  id_Delete(&II,QQ_ring);
10972  id_Delete(&one,QQ_ring);
10973  id_Delete(&syz,QQ_ring);
10974  p_Delete(&integer,QQ_ring);
10975  rDelete(QQ_ring);
10976  return pmon;
10977  }
10978  else
10979  {
10980  if(idIs0(monred))
10981  {
10982  poly mindegmon = NULL;
10983  for(int i = 0; i<IDELEMS(one); i++)
10984  {
10985  if(pNext(one->m[i]) == NULL)
10986  {
10987  if(mindegmon == NULL)
10988  mindegmon = pCopy(one->m[i]);
10989  else
10990  {
10991  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10992  mindegmon = pCopy(one->m[i]);
10993  }
10994  }
10995  }
10996  if(mindegmon != NULL)
10997  {
10998  for(int i = IDELEMS(II)-1; i>=0; i--)
10999  if(II->m[i] != NULL)
11000  II->m[i+1] = II->m[i];
11001  II->m[0] = pCopy(mindegmon);
11002  ideal syz = idSyzygies(II, isNotHomog, NULL);
11003  bool found = FALSE;
11004  for(int i = IDELEMS(syz)-1;i>=0; i--)
11005  {
11006  if(pGetComp(syz->m[i]) == 1)
11007  {
11008  pSetComp(syz->m[i],0);
11009  if(pIsConstant(pHead(syz->m[i])))
11010  {
11011  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
11012  found = TRUE;
11013  break;
11014  }
11015  }
11016  }
11017  id_Delete(&syz,QQ_ring);
11018  if (found == FALSE)
11019  {
11020  rChangeCurrRing(origR);
11021  idDelete(&monred);
11022  idDelete(&F);
11023  id_Delete(&II,QQ_ring);
11024  id_Delete(&one,QQ_ring);
11025  rDelete(QQ_ring);
11026  return NULL;
11027  }
11028  rChangeCurrRing(origR);
11029  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11030  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11031  idDelete(&monred);
11032  idDelete(&F);
11033  id_Delete(&II,QQ_ring);
11034  id_Delete(&one,QQ_ring);
11035  id_Delete(&syz,QQ_ring);
11036  rDelete(QQ_ring);
11037  return pmon;
11038  }
11039  }
11040  }
11041  rChangeCurrRing(origR);
11042  idDelete(&monred);
11043  idDelete(&F);
11044  id_Delete(&II,QQ_ring);
11045  id_Delete(&one,QQ_ring);
11046  rDelete(QQ_ring);
11047  return NULL;
11048 }
#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:4863
#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:586
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3356
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:1323
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
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:450
#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
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:515
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:278
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
BOOLEAN length_pLength
Definition: kutil.h:384
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
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:365
BOOLEAN homog
Definition: kutil.h:369
#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:321
BOOLEAN LDegLast
Definition: kutil.h:382
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
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:320
omBin lmBin
Definition: kutil.h:340
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:349
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:349

◆ 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:278
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int tl
Definition: kutil.h:346
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
unsigned long * sevT
Definition: kutil.h:319
#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:376
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:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
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:344
TSet T
Definition: kutil.h:320
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:349
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:278
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
int tl
Definition: kutil.h:346
#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:319
#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:376
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:321
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
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:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:349
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:278
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:347
int tl
Definition: kutil.h:346
#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:319
#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:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
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:344
TSet T
Definition: kutil.h:320
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:349
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:60
#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:324
#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:300
#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:344
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:278
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:384
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#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:386
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:346
#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:319
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:376
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:321
BOOLEAN LDegLast
Definition: kutil.h:382
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11057
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
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:349
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:349

◆ 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:278
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:384
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int tl
Definition: kutil.h:346
#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:321
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11057
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
TSet T
Definition: kutil.h:320
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:349
#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:278
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
int tl
Definition: kutil.h:346
unsigned long * sevT
Definition: kutil.h:319
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:376
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:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
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:344
TSet T
Definition: kutil.h:320
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:349
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:278
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:356
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition: kutil.cc:11125
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
#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:1665
int tl
Definition: kutil.h:346
#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:319
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:376
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:321
#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:347
ring tailRing
Definition: kutil.h:339
#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:344
TSet T
Definition: kutil.h:320
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:349
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 7592 of file kutil.cc.

7593 {
7594  LObject L(p, currRing);
7595  return redtail(&L, pos, strat);
7596 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

◆ redtail() [2/2]

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

Definition at line 7522 of file kutil.cc.

7523 {
7524  poly h, hn;
7525  strat->redTailChange=FALSE;
7526 
7527  L->GetP();
7528  poly p = L->p;
7529  if (strat->noTailReduction || pNext(p) == NULL)
7530  return p;
7531 
7532  LObject Ln(strat->tailRing);
7533  TObject* With;
7534  // placeholder in case strat->tl < 0
7535  TObject With_s(strat->tailRing);
7536  h = p;
7537  hn = pNext(h);
7538  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7539  long e;
7540  int l;
7541  BOOLEAN save_HE=strat->kHEdgeFound;
7542  strat->kHEdgeFound |=
7543  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7544 
7545  while(hn != NULL)
7546  {
7547  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7548  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7549  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7550  loop
7551  {
7552  Ln.Set(hn, strat->tailRing);
7553  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7554  if (strat->kHEdgeFound)
7555  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7556  else
7557  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
7558  if (With == NULL) break;
7559  With->length=0;
7560  With->pLength=0;
7561  strat->redTailChange=TRUE;
7562  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7563  {
7564  // reducing the tail would violate the exp bound
7565  if (kStratChangeTailRing(strat, L))
7566  {
7567  strat->kHEdgeFound = save_HE;
7568  return redtail(L, pos, strat);
7569  }
7570  else
7571  return NULL;
7572  }
7573  hn = pNext(h);
7574  if (hn == NULL) goto all_done;
7575  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7576  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7577  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7578  }
7579  h = hn;
7580  hn = pNext(h);
7581  }
7582 
7583  all_done:
7584  if (strat->redTailChange)
7585  {
7586  L->pLength = 0;
7587  }
7588  strat->kHEdgeFound = save_HE;
7589  return p;
7590 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
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:11280
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
int Kstd1_deg
Definition: kutil.cc:236
BOOLEAN kHEdgeFound
Definition: kutil.h:373
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#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:396
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:59

◆ 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:60
#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 7598 of file kutil.cc.

7599 {
7600 #define REDTAIL_CANONICALIZE 100
7601  strat->redTailChange=FALSE;
7602  if (strat->noTailReduction) return L->GetLmCurrRing();
7603  poly h, p;
7604  p = h = L->GetLmTailRing();
7605  if ((h==NULL) || (pNext(h)==NULL))
7606  return L->GetLmCurrRing();
7607 
7608  TObject* With;
7609  // placeholder in case strat->tl < 0
7610  TObject With_s(strat->tailRing);
7611 
7612  LObject Ln(pNext(h), strat->tailRing);
7613  Ln.pLength = L->GetpLength() - 1;
7614 
7615  pNext(h) = NULL;
7616  if (L->p != NULL) pNext(L->p) = NULL;
7617  L->pLength = 1;
7618 
7619  Ln.PrepareRed(strat->use_buckets);
7620 
7621  int cnt=REDTAIL_CANONICALIZE;
7622  while(!Ln.IsNull())
7623  {
7624  loop
7625  {
7626  if (TEST_OPT_IDLIFT)
7627  {
7628  if (Ln.p!=NULL)
7629  {
7630  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7631  }
7632  else
7633  {
7634  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7635  }
7636  }
7637  Ln.SetShortExpVector();
7638  if (withT)
7639  {
7640  int j;
7641  j = kFindDivisibleByInT(strat, &Ln);
7642  if (j < 0) break;
7643  With = &(strat->T[j]);
7644  }
7645  else
7646  {
7647  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7648  if (With == NULL) break;
7649  }
7650  cnt--;
7651  if (cnt==0)
7652  {
7654  /*poly tmp=*/Ln.CanonicalizeP();
7655  if (normalize)
7656  {
7657  Ln.Normalize();
7658  //pNormalize(tmp);
7659  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7660  }
7661  }
7662  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7663  {
7664  With->pNorm();
7665  }
7666  strat->redTailChange=TRUE;
7667  if (ksReducePolyTail(L, With, &Ln))
7668  {
7669  // reducing the tail would violate the exp bound
7670  // set a flag and hope for a retry (in bba)
7671  strat->completeReduce_retry=TRUE;
7672  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7673  do
7674  {
7675  pNext(h) = Ln.LmExtractAndIter();
7676  pIter(h);
7677  L->pLength++;
7678  } while (!Ln.IsNull());
7679  goto all_done;
7680  }
7681  if (Ln.IsNull()) goto all_done;
7682  if (! withT) With_s.Init(currRing);
7683  }
7684  pNext(h) = Ln.LmExtractAndIter();
7685  pIter(h);
7686  pNormalize(h);
7687  L->pLength++;
7688  }
7689 
7690  all_done:
7691  Ln.Delete();
7692  if (L->p != NULL) pNext(L->p) = pNext(p);
7693 
7694  if (strat->redTailChange)
7695  {
7696  L->length = 0;
7697  L->pLength = 0;
7698  }
7699 
7700  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7701  //L->Normalize(); // HANNES: should have a test
7702  kTest_L(L);
7703  return L->GetLmCurrRing();
7704 }
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:350
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
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:400
#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:652
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:339
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:396
class sTObject TObject
Definition: kutil.h:59

◆ 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:60
#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:60
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ring tailRing
Definition: kutil.h:339

◆ redtailBba_Z() [2/2]

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

Definition at line 7823 of file kutil.cc.

7825 {
7826  strat->redTailChange=FALSE;
7827  if (strat->noTailReduction) return L->GetLmCurrRing();
7828  poly h, p;
7829  p = h = L->GetLmTailRing();
7830  if ((h==NULL) || (pNext(h)==NULL))
7831  return L->GetLmCurrRing();
7832 
7833  TObject* With;
7834  // placeholder in case strat->tl < 0
7835  TObject With_s(strat->tailRing);
7836 
7837  LObject Ln(pNext(h), strat->tailRing);
7838  Ln.pLength = L->GetpLength() - 1;
7839 
7840  pNext(h) = NULL;
7841  if (L->p != NULL) pNext(L->p) = NULL;
7842  L->pLength = 1;
7843 
7844  Ln.PrepareRed(strat->use_buckets);
7845 
7846  int cnt=REDTAIL_CANONICALIZE;
7847  while(!Ln.IsNull())
7848  {
7849  loop
7850  {
7851  Ln.SetShortExpVector();
7852  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7853  if (With == NULL) break;
7854  cnt--;
7855  if (cnt==0)
7856  {
7858  /*poly tmp=*/Ln.CanonicalizeP();
7859  }
7860  // we are in Z, do not call pNorm
7861  strat->redTailChange=TRUE;
7862  // test divisibility of coefs:
7863  poly p_Ln=Ln.GetLmCurrRing();
7864  poly p_With=With->GetLmCurrRing();
7865  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7866  if (!nIsZero(z))
7867  {
7868  // subtract z*Ln, add z.Ln to L
7869  poly m=pHead(p_Ln);
7870  pSetCoeff(m,z);
7871  poly mm=pHead(m);
7872  pNext(h) = m;
7873  pIter(h);
7874  L->pLength++;
7875  mm=pNeg(mm);
7876  if (Ln.bucket!=NULL)
7877  {
7878  int dummy=1;
7879  kBucket_Add_q(Ln.bucket,mm,&dummy);
7880  }
7881  else
7882  {
7883  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7884  Ln.GetP();
7885  if (Ln.p!=NULL)
7886  {
7887  Ln.p=pAdd(Ln.p,mm);
7888  if (Ln.t_p!=NULL)
7889  {
7890  pNext(Ln.t_p)=NULL;
7891  p_LmDelete(Ln.t_p,strat->tailRing);
7892  }
7893  }
7894  }
7895  }
7896  else
7897  nDelete(&z);
7898 
7899  if (ksReducePolyTail(L, With, &Ln))
7900  {
7901  // reducing the tail would violate the exp bound
7902  // set a flag and hope for a retry (in bba)
7903  strat->completeReduce_retry=TRUE;
7904  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7905  do
7906  {
7907  pNext(h) = Ln.LmExtractAndIter();
7908  pIter(h);
7909  L->pLength++;
7910  } while (!Ln.IsNull());
7911  goto all_done;
7912  }
7913  if (Ln.IsNull()) goto all_done;
7914  With_s.Init(currRing);
7915  }
7916  pNext(h) = Ln.LmExtractAndIter();
7917  pIter(h);
7918  pNormalize(h);
7919  L->pLength++;
7920  }
7921 
7922  all_done:
7923  Ln.Delete();
7924  if (L->p != NULL) pNext(L->p) = pNext(p);
7925 
7926  if (strat->redTailChange)
7927  {
7928  L->length = 0;
7929  }
7930 
7931  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7932  //L->Normalize(); // HANNES: should have a test
7933  kTest_L(L);
7934  return L->GetLmCurrRing();
7935 }
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:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
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:400
#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:652
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#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:339
#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:380
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:396
class sTObject TObject
Definition: kutil.h:59
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc: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:60
#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:339

◆ redtailBbaBound() [2/2]

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

Definition at line 7706 of file kutil.cc.

7707 {
7708 #define REDTAIL_CANONICALIZE 100
7709  strat->redTailChange=FALSE;
7710  if (strat->noTailReduction) return L->GetLmCurrRing();
7711  poly h, p;
7712  p = h = L->GetLmTailRing();
7713  if ((h==NULL) || (pNext(h)==NULL))
7714  return L->GetLmCurrRing();
7715 
7716  TObject* With;
7717  // placeholder in case strat->tl < 0
7718  TObject With_s(strat->tailRing);
7719 
7720  LObject Ln(pNext(h), strat->tailRing);
7721  Ln.pLength = L->GetpLength() - 1;
7722 
7723  pNext(h) = NULL;
7724  if (L->p != NULL) pNext(L->p) = NULL;
7725  L->pLength = 1;
7726 
7727  Ln.PrepareRed(strat->use_buckets);
7728 
7729  int cnt=REDTAIL_CANONICALIZE;
7730  while(!Ln.IsNull())
7731  {
7732  loop
7733  {
7734  if (TEST_OPT_IDLIFT)
7735  {
7736  if (Ln.p!=NULL)
7737  {
7738  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7739  }
7740  else
7741  {
7742  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7743  }
7744  }
7745  Ln.SetShortExpVector();
7746  if (withT)
7747  {
7748  int j;
7749  j = kFindDivisibleByInT(strat, &Ln);
7750  if (j < 0) break;
7751  With = &(strat->T[j]);
7752  }
7753  else
7754  {
7755  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7756  if (With == NULL) break;
7757  }
7758  cnt--;
7759  if (cnt==0)
7760  {
7762  /*poly tmp=*/Ln.CanonicalizeP();
7763  if (normalize)
7764  {
7765  Ln.Normalize();
7766  //pNormalize(tmp);
7767  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7768  }
7769  }
7770  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7771  {
7772  With->pNorm();
7773  }
7774  strat->redTailChange=TRUE;
7775  if (ksReducePolyTail(L, With, &Ln))
7776  {
7777  // reducing the tail would violate the exp bound
7778  // set a flag and hope for a retry (in bba)
7779  strat->completeReduce_retry=TRUE;
7780  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7781  do
7782  {
7783  pNext(h) = Ln.LmExtractAndIter();
7784  pIter(h);
7785  L->pLength++;
7786  } while (!Ln.IsNull());
7787  goto all_done;
7788  }
7789  if(!Ln.IsNull())
7790  {
7791  Ln.GetP();
7792  Ln.p = pJet(Ln.p,bound);
7793  }
7794  if (Ln.IsNull())
7795  {
7796  goto all_done;
7797  }
7798  if (! withT) With_s.Init(currRing);
7799  }
7800  pNext(h) = Ln.LmExtractAndIter();
7801  pIter(h);
7802  pNormalize(h);
7803  L->pLength++;
7804  }
7805 
7806  all_done:
7807  Ln.Delete();
7808  if (L->p != NULL) pNext(L->p) = pNext(p);
7809 
7810  if (strat->redTailChange)
7811  {
7812  L->length = 0;
7813  L->pLength = 0;
7814  }
7815 
7816  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7817  //L->Normalize(); // HANNES: should have a test
7818  kTest_L(L);
7819  return L->GetLmCurrRing();
7820 }
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:350
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
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:400
#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:652
#define pJet(p, m)
Definition: polys.h:350
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:339
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:396
class sTObject TObject
Definition: kutil.h:59

◆ redtailBbaShift()

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

Definition at line 12774 of file kutil.cc.

12775 {
12776  /* for the shift case need to run it with withT = TRUE */
12777  strat->redTailChange=FALSE;
12778  if (strat->noTailReduction) return L->GetLmCurrRing();
12779  poly h, p;
12780  p = h = L->GetLmTailRing();
12781  if ((h==NULL) || (pNext(h)==NULL))
12782  return L->GetLmCurrRing();
12783 
12784  TObject* With;
12785  // placeholder in case strat->tl < 0
12786  TObject With_s(strat->tailRing);
12787 
12788  LObject Ln(pNext(h), strat->tailRing);
12789  Ln.pLength = L->GetpLength() - 1;
12790 
12791  pNext(h) = NULL;
12792  if (L->p != NULL) pNext(L->p) = NULL;
12793  L->pLength = 1;
12794 
12795  Ln.PrepareRed(strat->use_buckets);
12796 
12797  while(!Ln.IsNull())
12798  {
12799  loop
12800  {
12801  Ln.SetShortExpVector();
12802  if (withT)
12803  {
12804  int j;
12805  j = kFindDivisibleByInT(strat, &Ln);
12806  if (j < 0) break;
12807  With = &(strat->T[j]);
12808  }
12809  else
12810  {
12811  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12812  if (With == NULL) break;
12813  }
12814  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12815  {
12816  With->pNorm();
12817  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12818  }
12819  strat->redTailChange=TRUE;
12820  if (ksReducePolyTail(L, With, &Ln))
12821  {
12822  // reducing the tail would violate the exp bound
12823  // set a flag and hope for a retry (in bba)
12824  strat->completeReduce_retry=TRUE;
12825  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12826  do
12827  {
12828  pNext(h) = Ln.LmExtractAndIter();
12829  pIter(h);
12830  L->pLength++;
12831  } while (!Ln.IsNull());
12832  goto all_done;
12833  }
12834  if (Ln.IsNull()) goto all_done;
12835  if (! withT) With_s.Init(currRing);
12836  }
12837  pNext(h) = Ln.LmExtractAndIter();
12838  pIter(h);
12839  L->pLength++;
12840  }
12841 
12842  all_done:
12843  Ln.Delete();
12844  if (L->p != NULL) pNext(L->p) = pNext(p);
12845 
12846  if (strat->redTailChange)
12847  {
12848  L->length = 0;
12849  }
12850  L->Normalize(); // HANNES: should have a test
12851  kTest_L(L);
12852  return L->GetLmCurrRing();
12853 }
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:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
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:400
#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:652
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:396
class sTObject TObject
Definition: kutil.h:59

◆ 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:60
bool sigdrop
Definition: kutil.h:356
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
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:400
#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:652
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:339
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:396
class sTObject TObject
Definition: kutil.h:59

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 5075 of file kutil.cc.

5076 {
5077  int i,j,at,ecart, s2r;
5078  int fq=0;
5079  unsigned long sev;
5080  poly p;
5081  int new_suc=strat->sl+1;
5082  i= *suc;
5083  if (i<0) i=0;
5084 
5085  for (; i<=strat->sl; i++)
5086  {
5087  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5088  if (at != i)
5089  {
5090  if (new_suc > at) new_suc = at;
5091  p = strat->S[i];
5092  ecart = strat->ecartS[i];
5093  sev = strat->sevS[i];
5094  s2r = strat->S_2_R[i];
5095  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5096  for (j=i; j>=at+1; j--)
5097  {
5098  strat->S[j] = strat->S[j-1];
5099  strat->ecartS[j] = strat->ecartS[j-1];
5100  strat->sevS[j] = strat->sevS[j-1];
5101  strat->S_2_R[j] = strat->S_2_R[j-1];
5102  }
5103  strat->S[at] = p;
5104  strat->ecartS[at] = ecart;
5105  strat->sevS[at] = sev;
5106  strat->S_2_R[at] = s2r;
5107  if (strat->fromQ!=NULL)
5108  {
5109  for (j=i; j>=at+1; j--)
5110  {
5111  strat->fromQ[j] = strat->fromQ[j-1];
5112  }
5113  strat->fromQ[at]=fq;
5114  }
5115  }
5116  }
5117  if (new_suc <= strat->sl) *suc=new_suc;
5118  else *suc=-1;
5119 }
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
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:302
#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:278
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:10212
BOOLEAN honey
Definition: kutil.h:374
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:7941
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
class sLObject LObject
Definition: kutil.h:60
bool sigdrop
Definition: kutil.h:356
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Definition: kutil.cc:5306
#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:359
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:288
void initSba(ideal F, kStrategy strat)
Definition: kstd1.cc:1479
#define pNeg(p)
Definition: polys.h:181
void initSyzRules(kStrategy strat)
Definition: kutil.cc:8406
int tl
Definition: kutil.h:346
#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:11406
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:10314
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:169
#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:272
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int currIdx
Definition: kutil.h:311
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4978
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:354
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:11379
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
BOOLEAN interpt
Definition: kutil.h:368
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:362
#define idPrint(id)
Definition: ideals.h:46
int nrsyzcrit
Definition: kutil.h:357
int nrrewcrit
Definition: kutil.h:358
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:14
#define kTest_TS(A)
Definition: kutil.h:649
poly p_One(const ring r)
Definition: p_polys.cc:1312
int max_lower_index
Definition: kutil.h:312
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9776
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:536
#define pSetExpV(p, e)
Definition: polys.h:97
void messageStatSBA(int hilbcount, kStrategy strat)
Definition: kutil.cc:7994
#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:280
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:11280
LObject P
Definition: kutil.h:296
ideal M
Definition: kutil.h:299
unsigned sbaOrder
Definition: kutil.h:310
void exitSba(kStrategy strat)
Definition: kutil.cc:10387
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4925
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:336
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:300
#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:10828
#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:4627
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
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:3594
int length() const
Definition: intvec.h:86
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6376
ring tailRing
Definition: kutil.h:339
#define TEST_OPT_SB_1
Definition: options.h:113
int blockred
Definition: kutil.h:361
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:9858
#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:10639
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10427
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:301
int sl
Definition: kutil.h:344
void sort(CFArray &A, int l=0)
quick sort A
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:297
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:345
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11826
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9692
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 1665 of file kutil.cc.

1666 {
1667  if(strat->sl < 0) return FALSE;
1668  int i;
1669  for(i=0;i<strat->sl;i++)
1670  {
1671  //Construct the gcd pair between h and S[i]
1672  number d, s, t;
1673  poly m1, m2, gcd;
1674  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1675  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1676  {
1677  nDelete(&d);
1678  nDelete(&s);
1679  nDelete(&t);
1680  }
1681  else
1682  {
1683  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1684  pSetCoeff0(m1, s);
1685  pSetCoeff0(m2, t);
1686  pSetCoeff0(gcd, d);
1687  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);
1688  poly pSigMult = p_Copy(h->sig,currRing);
1689  poly sSigMult = p_Copy(strat->sig[i],currRing);
1690  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1691  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1692  p_LmDelete(m1, strat->tailRing);
1693  p_LmDelete(m2, strat->tailRing);
1694  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1695  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1696  {
1697  #ifdef ADIDEBUG
1698  printf("\nCan replace * (sig = *) with * (sig = *) since of * with sig *\n");
1699  pWrite(h->p);pWrite(h->sig);pWrite(gcd);pWrite(pairsig);pWrite(strat->S[i]);pWrite(strat->sig[i]);
1700  //getchar();
1701  #endif
1702  pDelete(&h->p);
1703  h->p = gcd;
1704  pDelete(&h->sig);
1705  h->sig = pairsig;
1706  pNext(h->sig) = NULL;
1707  strat->initEcart(h);
1708  h->sev = pGetShortExpVector(h->p);
1709  h->sevSig = pGetShortExpVector(h->sig);
1710  h->i_r1 = -1;h->i_r2 = -1;
1711  if(h->lcm != NULL)
1712  {
1713  pLmDelete(h->lcm);
1714  h->lcm = NULL;
1715  }
1716  if (currRing!=strat->tailRing)
1717  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1718  return TRUE;
1719  }
1720  //Delete what you didn't use
1721  pDelete(&gcd);
1722  pDelete(&pairsig);
1723  }
1724  }
1725  return FALSE;
1726 }
polyset sig
Definition: kutil.h:302
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:274
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:300
#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:339
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:344
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 11406 of file kutil.cc.

11407 {
11408  int n = rBlocks(r); // Including trailing zero!
11409  // if sbaOrder == 1 => use (C,monomial order from r)
11410  if (strat->sbaOrder == 1)
11411  {
11412  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11413  {
11414  return r;
11415  }
11416  ring res = rCopy0(r, TRUE, FALSE);
11417  res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
11418  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11419  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11420  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11421  res->wvhdl = wvhdl;
11422  for (int i=1; i<n; i++)
11423  {
11424  res->order[i] = r->order[i-1];
11425  res->block0[i] = r->block0[i-1];
11426  res->block1[i] = r->block1[i-1];
11427  res->wvhdl[i] = r->wvhdl[i-1];
11428  }
11429 
11430  // new 1st block
11431  res->order[0] = ringorder_C; // Prefix
11432  // removes useless secondary component order if defined in old ring
11433  for (int i=rBlocks(res); i>0; --i)
11434  {
11435  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11436  {
11437  res->order[i] = (rRingOrder_t)0;
11438  }
11439  }
11440  rComplete(res, 1);
11441 #ifdef HAVE_PLURAL
11442  if (rIsPluralRing(r))
11443  {
11444  if ( nc_rComplete(r, res, false) ) // no qideal!
11445  {
11446 #ifndef SING_NDEBUG
11447  WarnS("error in nc_rComplete");
11448 #endif
11449  // cleanup?
11450 
11451  // rDelete(res);
11452  // return r;
11453 
11454  // just go on..
11455  }
11456  }
11457 #endif
11458  strat->tailRing = res;
11459  return (res);
11460  }
11461  // if sbaOrder == 3 => degree - position - ring order
11462  if (strat->sbaOrder == 3)
11463  {
11464  ring res = rCopy0(r, TRUE, FALSE);
11465  res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
11466  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11467  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11468  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11469  res->wvhdl = wvhdl;
11470  for (int i=2; i<n+2; i++)
11471  {
11472  res->order[i] = r->order[i-2];
11473  res->block0[i] = r->block0[i-2];
11474  res->block1[i] = r->block1[i-2];
11475  res->wvhdl[i] = r->wvhdl[i-2];
11476  }
11477 
11478  // new 1st block
11479  res->order[0] = ringorder_a; // Prefix
11480  res->block0[0] = 1;
11481  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11482  for (int i=0; i<res->N; ++i)
11483  res->wvhdl[0][i] = 1;
11484  res->block1[0] = si_min(res->N, rVar(res));
11485  // new 2nd block
11486  res->order[1] = ringorder_C; // Prefix
11487  res->wvhdl[1] = NULL;
11488  // removes useless secondary component order if defined in old ring
11489  for (int i=rBlocks(res); i>1; --i)
11490  {
11491  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11492  {
11493  res->order[i] = (rRingOrder_t)0;
11494  }
11495  }
11496  rComplete(res, 1);
11497 #ifdef HAVE_PLURAL
11498  if (rIsPluralRing(r))
11499  {
11500  if ( nc_rComplete(r, res, false) ) // no qideal!
11501  {
11502 #ifndef SING_NDEBUG
11503  WarnS("error in nc_rComplete");
11504 #endif
11505  // cleanup?
11506 
11507  // rDelete(res);
11508  // return r;
11509 
11510  // just go on..
11511  }
11512  }
11513 #endif
11514  strat->tailRing = res;
11515  return (res);
11516  }
11517 
11518  // not sbaOrder == 1 => use Schreyer order
11519  // this is done by a trick when initializing the signatures
11520  // in initSLSba():
11521  // Instead of using the signature 1e_i for F->m[i], we start
11522  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11523  // Schreyer order w.r.t. the underlying monomial order.
11524  // => we do not need to change the underlying polynomial ring at all!
11525 
11526  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11527 
11528  /*
11529  else
11530  {
11531  ring res = rCopy0(r, FALSE, FALSE);
11532  // Create 2 more blocks for prefix/suffix:
11533  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11534  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11535  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11536  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11537 
11538  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11539  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11540 
11541  // new 1st block
11542  int j = 0;
11543  res->order[j] = ringorder_IS; // Prefix
11544  res->block0[j] = res->block1[j] = 0;
11545  // wvhdl[j] = NULL;
11546  j++;
11547 
11548  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11549  {
11550  res->order [j] = r->order [i];
11551  res->block0[j] = r->block0[i];
11552  res->block1[j] = r->block1[i];
11553 
11554  if (r->wvhdl[i] != NULL)
11555  {
11556  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11557  } // else wvhdl[j] = NULL;
11558  }
11559 
11560  // new last block
11561  res->order [j] = ringorder_IS; // Suffix
11562  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11563  // wvhdl[j] = NULL;
11564  j++;
11565 
11566  // res->order [j] = 0; // The End!
11567  res->wvhdl = wvhdl;
11568 
11569  // j == the last zero block now!
11570  assume(j == (n+1));
11571  assume(res->order[0]==ringorder_IS);
11572  assume(res->order[j-1]==ringorder_IS);
11573  assume(res->order[j]==0);
11574 
11575  if (complete)
11576  {
11577  rComplete(res, 1);
11578 
11579 #ifdef HAVE_PLURAL
11580  if (rIsPluralRing(r))
11581  {
11582  if ( nc_rComplete(r, res, false) ) // no qideal!
11583  {
11584  }
11585  }
11586  assume(rIsPluralRing(r) == rIsPluralRing(res));
11587 #endif
11588 
11589 
11590 #ifdef HAVE_PLURAL
11591  ring old_ring = r;
11592 
11593 #endif
11594 
11595  if (r->qideal!=NULL)
11596  {
11597  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11598 
11599  assume(idRankFreeModule(res->qideal, res) == 0);
11600 
11601 #ifdef HAVE_PLURAL
11602  if( rIsPluralRing(res) )
11603  if( nc_SetupQuotient(res, r, true) )
11604  {
11605  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11606  }
11607 
11608 #endif
11609  assume(idRankFreeModule(res->qideal, res) == 0);
11610  }
11611 
11612 #ifdef HAVE_PLURAL
11613  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11614  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11615  assume(rIsSCA(res) == rIsSCA(old_ring));
11616  assume(ncRingType(res) == ncRingType(old_ring));
11617 #endif
11618  }
11619  strat->tailRing = res;
11620  return res;
11621  }
11622  */
11623 
11624  assume(FALSE);
11625  return(NULL);
11626 }
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:5497
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:3356
#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:1323
rRingOrder_t
order stuff
Definition: ring.h:75
unsigned sbaOrder
Definition: kutil.h:310
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#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 4915 of file kutil.cc.

4916 {
4918  // enter also zero divisor * poly, if this is non zero and of smaller degree
4919  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4920  initenterpairs(h, k, ecart, 0, strat, atR);
4921  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4922  clearSbatch(h, k, pos, strat);
4923 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4889
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3847
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4627
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:4676
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 4925 of file kutil.cc.

4926 {
4928  // enter also zero divisor * poly, if this is non zero and of smaller degree
4929  #ifdef ADIDEBUG
4930  printf("\n Trying to add extended spolys\n");
4931  #endif
4932  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4933  if(strat->sigdrop) return;
4934  #ifdef ADIDEBUG
4935  printf("\n Trying to add spolys\n");
4936  #endif
4937  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4938  if(strat->sigdrop) return;
4939  #ifdef ADIDEBUG
4940  printf("\n Trying to add gcd-polys\n");
4941  #endif
4942  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4943  if(strat->sigdrop) return;
4944  clearSbatch(h, k, pos, strat);
4945 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4889
bool sigdrop
Definition: kutil.h:356
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3977
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:4759
#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:4649
static Poly * h
Definition: janet.cc:978

◆ syzCriterion()

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

Definition at line 7138 of file kutil.cc.

7139 {
7140 //#if 1
7141 #ifdef DEBUGF5
7142  PrintS("syzygy criterion checks: ");
7143  pWrite(sig);
7144 #endif
7145  for (int k=0; k<strat->syzl; k++)
7146  {
7147  //printf("-%d",k);
7148 //#if 1
7149 #ifdef DEBUGF5
7150  Print("checking with: %d / %d -- \n",k,strat->syzl);
7151  pWrite(pHead(strat->syz[k]));
7152 #endif
7153  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7154  && (!rField_is_Ring(currRing) ||
7155  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7156  {
7157 //#if 1
7158 #ifdef DEBUGF5
7159  PrintS("DELETE!\n");
7160 #endif
7161  #ifdef ADIDEBUG
7162  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7163  #endif
7164  strat->nrsyzcrit++;
7165  //printf("- T -\n\n");
7166  return TRUE;
7167  }
7168  }
7169  //printf("- F -\n\n");
7170  return FALSE;
7171 }
#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:357
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:317
polyset syz
Definition: kutil.h:301
int syzl
Definition: kutil.h:345

◆ syzCriterionInc()

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

Definition at line 7176 of file kutil.cc.

7177 {
7178 //#if 1
7179  if(sig == NULL)
7180  return FALSE;
7181 #ifdef DEBUGF5
7182  PrintS("--- syzygy criterion checks: ");
7183  pWrite(sig);
7184 #endif
7185  int comp = p_GetComp(sig, currRing);
7186  int min, max;
7187  if (comp<=1)
7188  return FALSE;
7189  else
7190  {
7191  min = strat->syzIdx[comp-2];
7192  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7193  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7194  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7195  if (comp == strat->currIdx)
7196  {
7197  max = strat->syzl;
7198  }
7199  else
7200  {
7201  max = strat->syzIdx[comp-1];
7202  }
7203  for (int k=min; k<max; k++)
7204  {
7205 #ifdef F5DEBUG
7206  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7207  Print("checking with: %d -- ",k);
7208  pWrite(pHead(strat->syz[k]));
7209 #endif
7210  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7211  && (!rField_is_Ring(currRing) ||
7212  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7213  {
7214  #ifdef ADIDEBUG
7215  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7216  #endif
7217  strat->nrsyzcrit++;
7218  return TRUE;
7219  }
7220  }
7221  return FALSE;
7222  }
7223 }
#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:311
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:357
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:317
polyset syz
Definition: kutil.h:301
int syzl
Definition: kutil.h:345
intset syzIdx
Definition: kutil.h:307

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4240 of file kutil.cc.

4241 {
4242  return 1L << arg;
4243 }

◆ updateResult()

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

Definition at line 10427 of file kutil.cc.

10428 {
10429  int l;
10430  if (strat->ak>0)
10431  {
10432  for (l=IDELEMS(r)-1;l>=0;l--)
10433  {
10434  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10435  {
10436  pDelete(&r->m[l]); // and set it to NULL
10437  }
10438  }
10439  int q;
10440  poly p;
10441  if(!rField_is_Ring(currRing))
10442  {
10443  for (l=IDELEMS(r)-1;l>=0;l--)
10444  {
10445  if ((r->m[l]!=NULL)
10446  //&& (strat->syzComp>0)
10447  //&& (pGetComp(r->m[l])<=strat->syzComp)
10448  )
10449  {
10450  for(q=IDELEMS(Q)-1; q>=0;q--)
10451  {
10452  if ((Q->m[q]!=NULL)
10453  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10454  {
10455  if (TEST_OPT_REDSB)
10456  {
10457  p=r->m[l];
10458  r->m[l]=kNF(Q,NULL,p);
10459  pDelete(&p);
10460  }
10461  else
10462  {
10463  pDelete(&r->m[l]); // and set it to NULL
10464  }
10465  break;
10466  }
10467  }
10468  }
10469  }
10470  }
10471  #ifdef HAVE_RINGS
10472  else
10473  {
10474  for (l=IDELEMS(r)-1;l>=0;l--)
10475  {
10476  if ((r->m[l]!=NULL)
10477  //&& (strat->syzComp>0)
10478  //&& (pGetComp(r->m[l])<=strat->syzComp)
10479  )
10480  {
10481  for(q=IDELEMS(Q)-1; q>=0;q--)
10482  {
10483  if ((Q->m[q]!=NULL)
10484  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10485  {
10486  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10487  {
10488  if (TEST_OPT_REDSB)
10489  {
10490  p=r->m[l];
10491  r->m[l]=kNF(Q,NULL,p);
10492  pDelete(&p);
10493  }
10494  else
10495  {
10496  pDelete(&r->m[l]); // and set it to NULL
10497  }
10498  break;
10499  }
10500  }
10501  }
10502  }
10503  }
10504  }
10505  #endif
10506  }
10507  else
10508  {
10509  int q;
10510  poly p;
10511  BOOLEAN reduction_found=FALSE;
10512  if (!rField_is_Ring(currRing))
10513  {
10514  for (l=IDELEMS(r)-1;l>=0;l--)
10515  {
10516  if (r->m[l]!=NULL)
10517  {
10518  for(q=IDELEMS(Q)-1; q>=0;q--)
10519  {
10520  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10521  {
10522  if (TEST_OPT_REDSB)
10523  {
10524  p=r->m[l];
10525  r->m[l]=kNF(Q,NULL,p);
10526  pDelete(&p);
10527  reduction_found=TRUE;
10528  }
10529  else
10530  {
10531  pDelete(&r->m[l]); // and set it to NULL
10532  }
10533  break;
10534  }
10535  }
10536  }
10537  }
10538  }
10539  #ifdef HAVE_RINGS
10540  //Also need divisibility of the leading coefficients
10541  else
10542  {
10543  for (l=IDELEMS(r)-1;l>=0;l--)
10544  {
10545  if (r->m[l]!=NULL)
10546  {
10547  for(q=IDELEMS(Q)-1; q>=0;q--)
10548  {
10549  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10550  {
10551  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10552  {
10553  if (TEST_OPT_REDSB)
10554  {
10555  p=r->m[l];
10556  r->m[l]=kNF(Q,NULL,p);
10557  pDelete(&p);
10558  reduction_found=TRUE;
10559  }
10560  else
10561  {
10562  pDelete(&r->m[l]); // and set it to NULL
10563  }
10564  break;
10565  }
10566  }
10567  }
10568  }
10569  }
10570  }
10571  #endif
10572  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10573  {
10574  #ifdef HAVE_RINGS
10576  {
10577  for (l=IDELEMS(r)-1;l>=0;l--)
10578  {
10579  if (r->m[l]!=NULL)
10580  {
10581  for(q=IDELEMS(r)-1;q>=0;q--)
10582  {
10583  if ((l!=q)
10584  && (r->m[q]!=NULL)
10585  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10586  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10587  )
10588  {
10589  //If they are equal then take the one with the smallest length
10590  if(pLmDivisibleBy(r->m[q],r->m[l])
10591  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10592  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10593  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10594  {
10595  pDelete(&r->m[l]);
10596  break;
10597  }
10598  else
10599  pDelete(&r->m[q]);
10600  }
10601  }
10602  }
10603  }
10604  }
10605  else
10606  #endif
10607  {
10608  for (l=IDELEMS(r)-1;l>=0;l--)
10609  {
10610  if (r->m[l]!=NULL)
10611  {
10612  for(q=IDELEMS(r)-1;q>=0;q--)
10613  {
10614  if ((l!=q)
10615  && (r->m[q]!=NULL)
10616  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10617  )
10618  {
10619  //If they are equal then take the one with the smallest length
10620  if(pLmDivisibleBy(r->m[q],r->m[l])
10621  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10622  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10623  {
10624  pDelete(&r->m[l]);
10625  break;
10626  }
10627  else
10628  pDelete(&r->m[q]);
10629  }
10630  }
10631  }
10632  }
10633  }
10634  }
10635  }
10636  idSkipZeroes(r);
10637 }
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:349
#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 9026 of file kutil.cc.

9027 {
9028  LObject h;
9029  int i, suc=0;
9030  poly redSi=NULL;
9031  BOOLEAN change,any_change;
9032 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9033 // for (i=0; i<=(strat->sl); i++)
9034 // {
9035 // Print("s%d:",i);
9036 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9037 // pWrite(strat->S[i]);
9038 // }
9039 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9040  any_change=FALSE;
9042  {
9043  while (suc != -1)
9044  {
9045  i=suc+1;
9046  while (i<=strat->sl)
9047  {
9048  change=FALSE;
9050  any_change = FALSE;
9051  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9052  {
9053  redSi = pHead(strat->S[i]);
9054  strat->S[i] = redBba(strat->S[i],i-1,strat);
9055  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9056  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9057  if (pCmp(redSi,strat->S[i])!=0)
9058  {
9059  change=TRUE;
9060  any_change=TRUE;
9061  #ifdef KDEBUG
9062  if (TEST_OPT_DEBUG)
9063  {
9064  PrintS("reduce:");
9065  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9066  }
9067  #endif
9068  if (TEST_OPT_PROT)
9069  {
9070  if (strat->S[i]==NULL)
9071  PrintS("V");
9072  else
9073  PrintS("v");
9074  mflush();
9075  }
9076  }
9077  pLmDelete(&redSi);
9078  if (strat->S[i]==NULL)
9079  {
9080  deleteInS(i,strat);
9081  i--;
9082  }
9083  else if (change)
9084  {
9086  {
9087  if (TEST_OPT_CONTENTSB)
9088  {
9089  number n;
9090  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9091  if (!nIsOne(n))
9092  {
9094  denom->n=nInvers(n);
9095  denom->next=DENOMINATOR_LIST;
9096  DENOMINATOR_LIST=denom;
9097  }
9098  nDelete(&n);
9099  }
9100  else
9101  {
9102  //pContent(strat->S[i]);
9103  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9104  }
9105  }
9106  else
9107  {
9108  pNorm(strat->S[i]);
9109  }
9110  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9111  }
9112  }
9113  i++;
9114  }
9115  if (any_change) reorderS(&suc,strat);
9116  else break;
9117  }
9118  if (toT)
9119  {
9120  for (i=0; i<=strat->sl; i++)
9121  {
9122  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9123  {
9124  h.p = redtailBba(strat->S[i],i-1,strat);
9126  {
9127  h.pCleardenom();// also does a pContent
9128  }
9129  }
9130  else
9131  {
9132  h.p = strat->S[i];
9133  }
9134  strat->initEcart(&h);
9135  if (strat->honey)
9136  {
9137  strat->ecartS[i] = h.ecart;
9138  }
9139  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9140  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9141  h.sev = strat->sevS[i];
9142  /*puts the elements of S also to T*/
9143  strat->initEcart(&h);
9144  enterT(h,strat);
9145  strat->S_2_R[i] = strat->tl;
9146  }
9147  }
9148  }
9149  else
9150  {
9151  while (suc != -1)
9152  {
9153  i=suc;
9154  while (i<=strat->sl)
9155  {
9156  change=FALSE;
9157  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9158  {
9159  redSi=pHead((strat->S)[i]);
9160  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9161  if ((strat->S)[i]==NULL)
9162  {
9163  deleteInS(i,strat);
9164  i--;
9165  }
9166  else if (pCmp((strat->S)[i],redSi)!=0)
9167  {
9168  any_change=TRUE;
9169  h.p = strat->S[i];
9170  strat->initEcart(&h);
9171  strat->ecartS[i] = h.ecart;
9173  {
9174  if (TEST_OPT_CONTENTSB)
9175  {
9176  number n;
9177  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9178  if (!nIsOne(n))
9179  {
9181  denom->n=nInvers(n);
9182  denom->next=DENOMINATOR_LIST;
9183  DENOMINATOR_LIST=denom;
9184  }
9185  nDelete(&n);
9186  }
9187  else
9188  {
9189  //pContent(strat->S[i]);
9190  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9191  }
9192  }
9193  else
9194  {
9195  pNorm(strat->S[i]); // == h.p
9196  }
9197  h.sev = pGetShortExpVector(h.p);
9198  strat->sevS[i] = h.sev;
9199  }
9200  pLmDelete(&redSi);
9201  kTest(strat);
9202  }
9203  i++;
9204  }
9205 #ifdef KDEBUG
9206  kTest(strat);
9207 #endif
9208  if (any_change) reorderS(&suc,strat);
9209  else { suc=-1; break; }
9210  if (h.p!=NULL)
9211  {
9212  if (!strat->kHEdgeFound)
9213  {
9214  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9215  }
9216  if (strat->kHEdgeFound)
9217  newHEdge(strat);
9218  }
9219  }
9220  for (i=0; i<=strat->sl; i++)
9221  {
9222  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9223  {
9224  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9225  strat->initEcart(&h);
9226  strat->ecartS[i] = h.ecart;
9227  h.sev = pGetShortExpVector(h.p);
9228  strat->sevS[i] = h.sev;
9229  }
9230  else
9231  {
9232  h.p = strat->S[i];
9233  h.ecart=strat->ecartS[i];
9234  h.sev = strat->sevS[i];
9235  h.length = h.pLength = pLength(h.p);
9236  }
9237  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9238  cancelunit1(&h,&suc,strat->sl,strat);
9239  h.SetpFDeg();
9240  /*puts the elements of S also to T*/
9241  enterT(h,strat);
9242  strat->S_2_R[i] = strat->tl;
9243  }
9244  if (suc!= -1) updateS(toT,strat);
9245  }
9246 #ifdef KDEBUG
9247  kTest(strat);
9248 #endif
9249 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8869
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5075
#define TEST_OPT_CONTENTSB
Definition: options.h:121
int tl
Definition: kutil.h:346
#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:648
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:7598
#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:8957
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2875
void(* initEcart)(TObject *L)
Definition: kutil.h:274
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:315
#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:300
#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:373
intset ecartS
Definition: kutil.h:303
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:750
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
denominator_list next
Definition: kutil.h:67
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9026
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8981
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10762
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:2747

◆ updateSShift()

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

Definition at line 12086 of file kutil.cc.

12087 {
12088  /* to use after updateS(toT=FALSE,strat) */
12089  /* fills T with shifted elt's of S */
12090  int i;
12091  LObject h;
12092  int atT = -1; // or figure out smth better
12093  strat->tl = -1; // init
12094  for (i=0; i<=strat->sl; i++)
12095  {
12096  memset(&h,0,sizeof(h));
12097  h.p = strat->S[i]; // lm in currRing, tail in TR
12098  strat->initEcart(&h);
12099  h.sev = strat->sevS[i];
12100  h.t_p = NULL;
12101  h.GetTP(); // creates correct t_p
12102  /*puts the elements of S with their shifts to T*/
12103  // int atT, int uptodeg, int lV)
12104  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12105  // need a small check for above; we insert >=1 elements
12106  // insert this check into kTest_TS ?
12107  enterTShift(h,strat,atT,uptodeg,lV);
12108  }
12109  /* what about setting strat->tl? */
12110 }
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
int tl
Definition: kutil.h:346
void(* initEcart)(TObject *L)
Definition: kutil.h:274
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12731
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
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.