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 enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR=-1, bool enterTstrong=FALSE)
 
BOOLEAN sbaCheckGcdPair (LObject *h, kStrategy strat)
 
BOOLEAN enterOneStrongPolySig (int i, poly p, poly sig, int, int, kStrategy strat, int atR=-1)
 
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 enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterOnePairSig (int i, poly p, poly pSig, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterOnePairSigRing (int i, poly p, poly pSig, 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 enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
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 initenterpairsShift (poly h, int k, int ecart, int isFromQ, 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 653 of file kutil.h.

§ kTest_L

#define kTest_L (   T)    (TRUE)

Definition at line 657 of file kutil.h.

§ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 656 of file kutil.h.

§ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 655 of file kutil.h.

§ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 654 of file kutil.h.

§ messageSets

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

Definition at line 538 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 7273 of file kutil.cc.

7274 {
7275  #ifdef ADIDEBUG
7276  printf("\narriRewCrit\n");
7277  #endif
7279  return FALSE;
7280  poly p1 = pOne();
7281  poly p2 = pOne();
7282  for (int ii=strat->sl; ii>start; ii--)
7283  {
7284  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7285  {
7286  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7287  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7288  if (!(pLmCmp(p1,p2) == 1))
7289  {
7290  #ifdef ADIDEBUG
7291  printf("\narriRewCrit deleted: sig, P.sig\n");
7292  #endif
7293  pDelete(&p1);
7294  pDelete(&p2);
7295  return TRUE;
7296  }
7297  }
7298  }
7299  pDelete(&p1);
7300  pDelete(&p2);
7301  return FALSE;
7302 }
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 7304 of file kutil.cc.

7305 {
7306  #ifdef ADIDEBUG
7307  printf("\narriRewCritPre\n");
7308  #endif
7309  //Over Rings, there are still some changes to do: considering coeffs
7311  return FALSE;
7312  int found = -1;
7313  for (int i=strat->Bl; i>-1; i--) {
7314  if (pLmEqual(strat->B[i].sig,sig))
7315  {
7316  found = i;
7317  break;
7318  }
7319  }
7320  if (found != -1)
7321  {
7322  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7323  {
7324  deleteInL(strat->B,&strat->Bl,found,strat);
7325  #ifdef ADIDEBUG
7326  printf("\nDelete!\n");
7327  #endif
7328  }
7329  else
7330  {
7331  #ifdef ADIDEBUG
7332  printf("\nDelete this one!\n");
7333  #endif
7334  return TRUE;
7335  }
7336  }
7337  poly p1 = pOne();
7338  poly p2 = pOne();
7339  for (int ii=strat->sl; ii>-1; ii--)
7340  {
7341  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7342  {
7343  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7344  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7345  if (!(pLmCmp(p1,p2) == 1))
7346  {
7347  pDelete(&p1);
7348  pDelete(&p2);
7349  #ifdef ADIDEBUG
7350  printf("\nDelete this one!\n");
7351  #endif
7352  return TRUE;
7353  }
7354  }
7355  }
7356  pDelete(&p1);
7357  pDelete(&p2);
7358  return FALSE;
7359 }
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:1148
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 1958 of file kstd2.cc.

1959 {
1960  int red_result = 1;
1961  int olddeg,reduc;
1962  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1963  BOOLEAN withT = FALSE;
1964  BITSET save;
1965  SI_SAVE_OPT1(save);
1966 
1967  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1969  initBuchMoraPosRing(strat);
1970  else
1971  initBuchMoraPos(strat);
1972  initHilbCrit(F,Q,&hilb,strat);
1973  initBba(strat);
1974  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1975  /*Shdl=*/initBuchMora(F, Q,strat);
1976  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1977  reduc = olddeg = 0;
1978 
1979 #ifndef NO_BUCKETS
1980  if (!TEST_OPT_NOT_BUCKETS)
1981  strat->use_buckets = 1;
1982 #endif
1983  // redtailBBa against T for inhomogenous input
1984  if (!TEST_OPT_OLDSTD)
1985  withT = ! strat->homog;
1986 
1987  // strat->posInT = posInT_pLength;
1988  kTest_TS(strat);
1989 
1990 #ifdef HAVE_TAIL_RING
1991  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1992  kStratInitChangeTailRing(strat);
1993 #endif
1994  if (BVERBOSE(23))
1995  {
1996  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1997  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1998  kDebugPrint(strat);
1999  }
2000 
2001 
2002 #ifdef KDEBUG
2003  //kDebugPrint(strat);
2004 #endif
2005  /* compute------------------------------------------------------- */
2006  while (strat->Ll >= 0)
2007  {
2008  #ifdef ADIDEBUG
2009  printf("\n ------------------------NEW LOOP\n");
2010  printf("\nShdl = \n");
2011  #if 0
2012  idPrint(strat->Shdl);
2013  #else
2014  for(int ii = 0; ii<=strat->sl;ii++)
2015  p_Write(strat->S[ii],strat->tailRing);
2016  #endif
2017  printf("\n list L\n");
2018  int iii;
2019  #if 1
2020  for(iii = 0; iii<= strat->Ll; iii++)
2021  {
2022  printf("L[%i]:",iii);
2023  p_Write(strat->L[iii].p, currRing);
2024  p_Write(strat->L[iii].p1, currRing);
2025  p_Write(strat->L[iii].p2, currRing);
2026  }
2027  #else
2028  {
2029  printf("L[%i]:",strat->Ll);
2030  p_Write(strat->L[strat->Ll].p, strat->tailRing);
2031  p_Write(strat->L[strat->Ll].p1, strat->tailRing);
2032  p_Write(strat->L[strat->Ll].p2, strat->tailRing);
2033  }
2034  #endif
2035  #if 0
2036  for(iii = 0; iii<= strat->Bl; iii++)
2037  {
2038  printf("B[%i]:",iii);
2039  p_Write(strat->B[iii].p, /*strat->tailRing*/currRing);
2040  p_Write(strat->B[iii].p1, /*strat->tailRing*/currRing);
2041  p_Write(strat->B[iii].p2, strat->tailRing);
2042  }
2043  #endif
2044  //getchar();
2045  #endif
2046  #ifdef KDEBUG
2047  if (TEST_OPT_DEBUG) messageSets(strat);
2048  #endif
2049  if (strat->Ll== 0) strat->interpt=TRUE;
2050  if (TEST_OPT_DEGBOUND
2051  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2052  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2053  {
2054  /*
2055  *stops computation if
2056  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2057  *a predefined number Kstd1_deg
2058  */
2059  while ((strat->Ll >= 0)
2060  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2061  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2062  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2063  )
2064  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2065  if (strat->Ll<0) break;
2066  else strat->noClearS=TRUE;
2067  }
2068  /* picks the last element from the lazyset L */
2069  strat->P = strat->L[strat->Ll];
2070  strat->Ll--;
2071 
2072  if (pNext(strat->P.p) == strat->tail)
2073  {
2074  // deletes the short spoly
2075  if (rField_is_Ring(currRing))
2076  pLmDelete(strat->P.p);
2077  else
2078  pLmFree(strat->P.p);
2079  strat->P.p = NULL;
2080  poly m1 = NULL, m2 = NULL;
2081 
2082  // check that spoly creation is ok
2083  while (strat->tailRing != currRing &&
2084  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2085  {
2086  assume(m1 == NULL && m2 == NULL);
2087  // if not, change to a ring where exponents are at least
2088  // large enough
2089  if (!kStratChangeTailRing(strat))
2090  {
2091  WerrorS("OVERFLOW...");
2092  break;
2093  }
2094  }
2095  // create the real one
2096  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2097  strat->tailRing, m1, m2, strat->R);
2098  }
2099  else if (strat->P.p1 == NULL)
2100  {
2101  if (strat->minim > 0)
2102  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2103  // for input polys, prepare reduction
2104  strat->P.PrepareRed(strat->use_buckets);
2105  }
2106 
2107  if (strat->P.p == NULL && strat->P.t_p == NULL)
2108  {
2109  red_result = 0;
2110  }
2111  else
2112  {
2113  if (TEST_OPT_PROT)
2114  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2115  &olddeg,&reduc,strat, red_result);
2116 
2117  /* reduction of the element chosen from L */
2118  red_result = strat->red(&strat->P,strat);
2119  if (errorreported) break;
2120  }
2121 
2122  if (strat->overflow)
2123  {
2124  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2125  }
2126 
2127  // reduction to non-zero new poly
2128  if (red_result == 1)
2129  {
2130  // get the polynomial (canonicalize bucket, make sure P.p is set)
2131  strat->P.GetP(strat->lmBin);
2132  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2133  // but now, for entering S, T, we reset it
2134  // in the inhomogeneous case: FDeg == pFDeg
2135  if (strat->homog) strat->initEcart(&(strat->P));
2136 
2137  /* statistic */
2138  if (TEST_OPT_PROT) PrintS("s");
2139 
2140  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2141 
2142  // reduce the tail and normalize poly
2143  // in the ring case we cannot expect LC(f) = 1,
2144  // therefore we call pContent instead of pNorm
2146  {
2147  strat->P.pCleardenom();
2149  {
2150  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2151  strat->P.pCleardenom();
2152  }
2153  }
2154  else
2155  {
2156  strat->P.pNorm();
2158  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2159  }
2160 
2161 #ifdef KDEBUG
2162  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2163 #endif /* KDEBUG */
2164 
2165  // min_std stuff
2166  if ((strat->P.p1==NULL) && (strat->minim>0))
2167  {
2168  if (strat->minim==1)
2169  {
2170  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2171  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2172  }
2173  else
2174  {
2175  strat->M->m[minimcnt]=strat->P.p2;
2176  strat->P.p2=NULL;
2177  }
2178  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2179  pNext(strat->M->m[minimcnt])
2180  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2181  strat->tailRing, currRing,
2182  currRing->PolyBin);
2183  minimcnt++;
2184  }
2185 
2186  // enter into S, L, and T
2187  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2188  {
2189  enterT(strat->P, strat);
2190  if (rField_is_Ring(currRing))
2191  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2192  else
2193  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2194  // posInS only depends on the leading term
2195  strat->enterS(strat->P, pos, strat, strat->tl);
2196  #ifdef ADIDEBUG
2197  printf("\nThis element has been added to S:\n");pWrite(strat->P.p);pWrite(strat->P.p1);pWrite(strat->P.p2);
2198  #endif
2199 #if 0
2200  int pl=pLength(strat->P.p);
2201  if (pl==1)
2202  {
2203  //if (TEST_OPT_PROT)
2204  //PrintS("<1>");
2205  }
2206  else if (pl==2)
2207  {
2208  //if (TEST_OPT_PROT)
2209  //PrintS("<2>");
2210  }
2211 #endif
2212  }
2213  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2214 // Print("[%d]",hilbeledeg);
2215  if (strat->P.lcm!=NULL)
2216  {
2217  if (rField_is_Ring(currRing)) pLmDelete(strat->P.lcm);
2218  else pLmFree(strat->P.lcm);
2219  strat->P.lcm=NULL;
2220  }
2221  if (strat->s_poly!=NULL)
2222  {
2223  // the only valid entries are: strat->P.p,
2224  // strat->tailRing (read-only, keep it)
2225  // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2226  if (strat->s_poly(strat))
2227  {
2228  // we are called AFTER enterS, i.e. if we change P
2229  // we have to add it also to S/T
2230  // and add pairs
2231  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2232  enterT(strat->P, strat);
2233  if (rField_is_Ring(currRing))
2234  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2235  else
2236  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2237  strat->enterS(strat->P, pos, strat, strat->tl);
2238  }
2239  }
2240  }
2241  else if (strat->P.p1 == NULL && strat->minim > 0)
2242  {
2243  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2244  }
2245 
2246 #ifdef KDEBUG
2247  memset(&(strat->P), 0, sizeof(strat->P));
2248 #endif /* KDEBUG */
2249  kTest_TS(strat);
2250  }
2251 #ifdef KDEBUG
2252  if (TEST_OPT_DEBUG) messageSets(strat);
2253 #endif /* KDEBUG */
2254 
2255  if (TEST_OPT_SB_1)
2256  {
2257  if(!rField_is_Ring(currRing))
2258  {
2259  int k=1;
2260  int j;
2261  while(k<=strat->sl)
2262  {
2263  j=0;
2264  loop
2265  {
2266  if (j>=k) break;
2267  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2268  j++;
2269  }
2270  k++;
2271  }
2272  }
2273  }
2274  /* complete reduction of the standard basis--------- */
2275  if (TEST_OPT_REDSB)
2276  {
2277  completeReduce(strat);
2278  if (strat->completeReduce_retry)
2279  {
2280  // completeReduce needed larger exponents, retry
2281  // to reduce with S (instead of T)
2282  // and in currRing (instead of strat->tailRing)
2283 #ifdef HAVE_TAIL_RING
2284  if(currRing->bitmask>strat->tailRing->bitmask)
2285  {
2286  strat->completeReduce_retry=FALSE;
2287  cleanT(strat);strat->tailRing=currRing;
2288  int i;
2289  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2290  completeReduce(strat);
2291  }
2292  if (strat->completeReduce_retry)
2293 #endif
2294  Werror("exponent bound is %ld",currRing->bitmask);
2295  }
2296  }
2297  else if (TEST_OPT_PROT) PrintLn();
2298  if (!errorreported)
2299  {
2300  if(nCoeff_is_Ring_Z(currRing->cf))
2301  finalReduceByMon(strat);
2303  {
2304  for(int i = 0;i<=strat->sl;i++)
2305  {
2306  if(!nGreaterZero(pGetCoeff(strat->S[i])))
2307  {
2308  strat->S[i] = pNeg(strat->S[i]);
2309  }
2310  }
2311  }
2312  }
2313  /* release temp data-------------------------------- */
2314  exitBuchMora(strat);
2315 // if (TEST_OPT_WEIGHTM)
2316 // {
2317 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2318 // if (ecartWeights)
2319 // {
2320 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2321 // ecartWeights=NULL;
2322 // }
2323 // }
2324  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
2325  SI_RESTORE_OPT1(save);
2326  if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
2327 
2328  idTest(strat->Shdl);
2329 
2330  return (strat->Shdl);
2331 }
#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:9928
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7924
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7965
#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:10101
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define pNeg(p)
Definition: polys.h:181
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4935
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:10014
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:11359
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9478
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
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:654
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9759
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:538
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:11260
LObject P
Definition: kutil.h:296
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9777
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:10811
#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:4898
ring tailRing
Definition: kutil.h:339
#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:5111
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10622
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10410
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:11194
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:10177
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11806
#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 3995 of file kstd2.cc.

3996 {
3997  int red_result = 1;
3998  int olddeg,reduc;
3999  int hilbeledeg=1,hilbcount=0,minimcnt=0;
4000  BOOLEAN withT = TRUE; // very important for shifts
4001 
4002  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
4004  initBuchMoraPosRing(strat);
4005  else
4006  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
4007  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
4008  initBbaShift(strat); /* DONE */
4009  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
4010  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
4011  updateSShift(strat,uptodeg,lV); /* initializes T */
4012 
4013  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
4014  reduc = olddeg = 0;
4015  strat->lV=lV;
4016 
4017 #ifndef NO_BUCKETS
4018  if (!TEST_OPT_NOT_BUCKETS)
4019  strat->use_buckets = 1;
4020 #endif
4021 
4022  // redtailBBa against T for inhomogenous input
4023  // if (!TEST_OPT_OLDSTD)
4024  // withT = ! strat->homog;
4025 
4026  // strat->posInT = posInT_pLength;
4027  kTest_TS(strat);
4028 
4029 #ifdef HAVE_TAIL_RING
4030  kStratInitChangeTailRing(strat);
4031 #endif
4032 
4033  /* compute------------------------------------------------------- */
4034  while (strat->Ll >= 0)
4035  {
4036 #ifdef KDEBUG
4037  if (TEST_OPT_DEBUG) messageSets(strat);
4038 #endif
4039  if (strat->Ll== 0) strat->interpt=TRUE;
4040  if (TEST_OPT_DEGBOUND
4041  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4042  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
4043  {
4044  /*
4045  *stops computation if
4046  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
4047  *a predefined number Kstd1_deg
4048  */
4049  while ((strat->Ll >= 0)
4050  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
4051  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4052  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
4053  )
4054  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
4055  if (strat->Ll<0) break;
4056  else strat->noClearS=TRUE;
4057  }
4058  /* picks the last element from the lazyset L */
4059  strat->P = strat->L[strat->Ll];
4060  strat->Ll--;
4061 
4062  if (pNext(strat->P.p) == strat->tail)
4063  {
4064  // deletes the short spoly
4065  pLmFree(strat->P.p);
4066  strat->P.p = NULL;
4067  poly m1 = NULL, m2 = NULL;
4068 
4069  // check that spoly creation is ok
4070  while (strat->tailRing != currRing &&
4071  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
4072  {
4073  assume(m1 == NULL && m2 == NULL);
4074  // if not, change to a ring where exponents are at least
4075  // large enough
4076  kStratChangeTailRing(strat);
4077  }
4078  // create the real one
4079  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
4080  strat->tailRing, m1, m2, strat->R);
4081  }
4082  else if (strat->P.p1 == NULL)
4083  {
4084  if (strat->minim > 0)
4085  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
4086  // for input polys, prepare reduction
4087  strat->P.PrepareRed(strat->use_buckets);
4088  }
4089 
4090  poly qq;
4091 
4092  /* here in the nonhomog case we shrink the new spoly */
4093 
4094  if ( ! strat->homog)
4095  {
4096  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
4097  /* in the nonhomog case we have to shrink the polynomial */
4098  assume(strat->P.t_p!=NULL);
4099  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
4100  if (qq != NULL)
4101  {
4102  /* we're here if Shrink is nonzero */
4103  // strat->P.p = NULL;
4104  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
4105  strat->P.p = NULL; // is not set by Delete
4106  strat->P.t_p = qq;
4107  strat->P.GetP(strat->lmBin);
4108  // update sev and length
4109  strat->initEcart(&(strat->P));
4110  strat->P.sev = pGetShortExpVector(strat->P.p);
4111 // strat->P.FDeg = strat->P.pFDeg();
4112 // strat->P.length = strat->P.pLDeg();
4113 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
4114  }
4115  else
4116  {
4117  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
4118 #ifdef KDEBUG
4119  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
4120 #endif
4121  // strat->P.Delete(); // cause error
4122  strat->P.p = NULL;
4123  strat->P.t_p = NULL;
4124  // strat->P.p = NULL; // or delete strat->P.p ?
4125  }
4126  }
4127  /* end shrinking poly in the nonhomog case */
4128 
4129  if (strat->P.p == NULL && strat->P.t_p == NULL)
4130  {
4131  red_result = 0;
4132  }
4133  else
4134  {
4135  if (TEST_OPT_PROT)
4136  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
4137  &olddeg,&reduc,strat, red_result);
4138 
4139  /* reduction of the element chosen from L */
4140  red_result = strat->red(&strat->P,strat);
4141  }
4142 
4143  // reduction to non-zero new poly
4144  if (red_result == 1)
4145  {
4146  /* statistic */
4147  if (TEST_OPT_PROT) PrintS("s");
4148 
4149  // get the polynomial (canonicalize bucket, make sure P.p is set)
4150  strat->P.GetP(strat->lmBin);
4151 
4152  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4153 
4154  // reduce the tail and normalize poly
4156  {
4157  strat->P.pCleardenom();
4159  {
4160  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4161  strat->P.pCleardenom();
4162  }
4163  }
4164  else
4165  {
4166  strat->P.pNorm();
4168  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4169  }
4170 
4171  // here we must shrink again! and optionally reduce again
4172  // or build shrink into redtailBba!
4173 
4174 #ifdef KDEBUG
4175  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4176 #endif
4177 
4178  // min_std stuff
4179  if ((strat->P.p1==NULL) && (strat->minim>0))
4180  {
4181  if (strat->minim==1)
4182  {
4183  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4184  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4185  }
4186  else
4187  {
4188  strat->M->m[minimcnt]=strat->P.p2;
4189  strat->P.p2=NULL;
4190  }
4191  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4192  pNext(strat->M->m[minimcnt])
4193  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4194  strat->tailRing, currRing,
4195  currRing->PolyBin);
4196  minimcnt++;
4197  }
4198 
4199  /* here in the nonhomog case we shrink the reduced poly AGAIN */
4200 
4201  if ( ! strat->homog)
4202  {
4203  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
4204  /* assume strat->P.t_p != NULL */
4205  /* in the nonhomog case we have to shrink the polynomial */
4206  assume(strat->P.t_p!=NULL); // poly qq defined above
4207  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
4208  if (qq != NULL)
4209  {
4210  /* we're here if Shrink is nonzero */
4211  // strat->P.p = NULL;
4212  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
4213  strat->P.p = NULL; // is not set by Delete
4214  strat->P.t_p = qq;
4215  strat->P.GetP(strat->lmBin);
4216  // update sev and length
4217  strat->initEcart(&(strat->P));
4218  strat->P.sev = pGetShortExpVector(strat->P.p);
4219  }
4220  else
4221  {
4222  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
4223 #ifdef PDEBUG
4224  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
4225 #endif
4226  // strat->P.Delete(); // cause error
4227  strat->P.p = NULL;
4228  strat->P.t_p = NULL;
4229  // strat->P.p = NULL; // or delete strat->P.p ?
4230  goto red_shrink2zero;
4231  }
4232  }
4233  /* end shrinking poly AGAIN in the nonhomog case */
4234 
4235 
4236  // enter into S, L, and T
4237  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4238  // enterT(strat->P, strat); // this was here before Shift stuff
4239  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
4240  // the default value for atT = -1 as in bba
4241  /* strat->P.GetP(); */
4242  // because shifts are counted with .p structure // done before, but ?
4243  enterTShift(strat->P,strat,-1,uptodeg, lV);
4244  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
4245  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
4246  // posInS only depends on the leading term
4247  strat->enterS(strat->P, pos, strat, strat->tl);
4248 
4249  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4250 // Print("[%d]",hilbeledeg);
4251  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
4252  }
4253  else
4254  {
4255  red_shrink2zero:
4256  if (strat->P.p1 == NULL && strat->minim > 0)
4257  {
4258  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4259  }
4260  }
4261 #ifdef KDEBUG
4262  memset(&(strat->P), 0, sizeof(strat->P));
4263 #endif
4264  kTest_TS(strat);
4265  }
4266 #ifdef KDEBUG
4267  if (TEST_OPT_DEBUG) messageSets(strat);
4268 #endif
4269  /* complete reduction of the standard basis--------- */
4270  /* shift case: look for elt's in S such that they are divisible by elt in T */
4271  // if (TEST_OPT_SB_1)
4272  if (TEST_OPT_REDSB)
4273  {
4274  int k=0;
4275  int j=-1;
4276  while(k<=strat->sl)
4277  {
4278 // loop
4279 // {
4280 // if (j>=k) break;
4281 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
4282 // j++;
4283 // }
4284  LObject Ln (strat->S[k],currRing, strat->tailRing);
4285  Ln.SetShortExpVector();
4286  j = kFindDivisibleByInT(strat, &Ln, j+1);
4287  if (j<0) { k++; j=-1;}
4288  else
4289  {
4290  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
4291  {
4292  j = kFindDivisibleByInT(strat, &Ln, j+1);
4293  if (j<0) { k++; j=-1;}
4294  else
4295  {
4296  deleteInS(k,strat);
4297  }
4298  }
4299  else
4300  {
4301  deleteInS(k,strat);
4302  }
4303  }
4304  }
4305  }
4306 
4307  if (TEST_OPT_REDSB)
4308  { completeReduce(strat, TRUE); //shift: withT = TRUE
4309  if (strat->completeReduce_retry)
4310  {
4311  // completeReduce needed larger exponents, retry
4312  // to reduce with S (instead of T)
4313  // and in currRing (instead of strat->tailRing)
4314 #ifdef HAVE_TAIL_RING
4315  if(currRing->bitmask>strat->tailRing->bitmask)
4316  {
4317  strat->completeReduce_retry=FALSE;
4318  cleanT(strat);strat->tailRing=currRing;
4319  int i;
4320  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
4321  completeReduce(strat);
4322  }
4323  if (strat->completeReduce_retry)
4324 #endif
4325  Werror("exponent bound is %ld",currRing->bitmask);
4326  }
4327  }
4328  else if (TEST_OPT_PROT) PrintLn();
4329 
4330  /* release temp data-------------------------------- */
4331  exitBuchMora(strat);
4332 // if (TEST_OPT_WEIGHTM)
4333 // {
4334 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
4335 // if (ecartWeights)
4336 // {
4337 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
4338 // ecartWeights=NULL;
4339 // }
4340 // }
4341  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
4342  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
4343  return (strat->Shdl);
4344 }
#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:9928
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7924
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7965
#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:1041
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:12605
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10014
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:11359
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
void updateSShift(kStrategy strat, int uptodeg, int lV)
Definition: kutil.cc:12066
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:12710
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:654
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9759
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:538
#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:11260
LObject P
Definition: kutil.h:296
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9777
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:12094
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10811
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:4508
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:5111
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10622
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10410
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:10177
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 = 0;
400  loop
401  {
402  i++;
403  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
404  if (i == r->N) 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 = 0;
460  loop
461  {
462  i++;
463  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
464  if (i == r->N) break; // does divide, try next monom
465  }
466  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
467  pIter(h);
468  }
469  }
470 }
return
Definition: syzextra.cc:280
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
void pWrite(poly p)
Definition: polys.h: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:749
#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 3253 of file kutil.cc.

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

3467 {
3468  if (strat->pairtest!=NULL)
3469  {
3470  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3471  strat->pairtest=NULL;
3472  }
3473  /*
3474  *the elements of B enter L
3475  */
3476  kMergeBintoL(strat);
3477 }
#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:3207
int BOOLEAN
Definition: auxiliary.h:85

§ chainCritSig()

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

Definition at line 3482 of file kutil.cc.

3483 {
3484  int i,j,l;
3485  kMergeBintoLSba(strat);
3486  j = strat->Ll;
3487  loop /*cannot be changed into a for !!! */
3488  {
3489  if (j <= 0)
3490  {
3491  /*now L[0] cannot be canceled any more and the tail can be removed*/
3492  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3493  break;
3494  }
3495  if (strat->L[j].p2 == p)
3496  {
3497  i = j-1;
3498  loop
3499  {
3500  if (i < 0) break;
3501  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3502  {
3503  /*L[i] could be canceled but we search for a better one to cancel*/
3504  strat->c3++;
3505  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3506  && (pNext(strat->L[l].p) == strat->tail)
3507  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3508  && pDivisibleBy(p,strat->L[l].lcm))
3509  {
3510  /*
3511  *"NOT equal(...)" because in case of "equal" the element L[l]
3512  *is "older" and has to be from theoretical point of view behind
3513  *L[i], but we do not want to reorder L
3514  */
3515  strat->L[i].p2 = strat->tail;
3516  /*
3517  *L[l] will be canceled, we cannot cancel L[i] later on,
3518  *so we mark it with "tail"
3519  */
3520  deleteInL(strat->L,&strat->Ll,l,strat);
3521  i--;
3522  }
3523  else
3524  {
3525  deleteInL(strat->L,&strat->Ll,i,strat);
3526  }
3527  j--;
3528  }
3529  i--;
3530  }
3531  }
3532  else if (strat->L[j].p2 == strat->tail)
3533  {
3534  /*now L[j] cannot be canceled any more and the tail can be removed*/
3535  strat->L[j].p2 = p;
3536  }
3537  j--;
3538  }
3539 }
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:1148
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:3230
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:1041
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 10622 of file kutil.cc.

10623 {
10624  int i;
10625  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10626  LObject L;
10627 
10628 #ifdef KDEBUG
10629  // need to set this: during tailreductions of T[i], T[i].max is out of
10630  // sync
10631  sloppy_max = TRUE;
10632 #endif
10633 
10634  strat->noTailReduction = FALSE;
10635  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10636  if (TEST_OPT_PROT)
10637  {
10638  PrintLn();
10639 // if (timerv) writeTime("standard base computed:");
10640  }
10641  if (TEST_OPT_PROT)
10642  {
10643  Print("(S:%d)",strat->sl);mflush();
10644  }
10645  for (i=strat->sl; i>=low; i--)
10646  {
10647  int end_pos=strat->sl;
10648  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10649  if (strat->ak==0) end_pos=i-1;
10650  TObject* T_j = strat->s_2_t(i);
10651  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10652  {
10653  L = *T_j;
10654  #ifdef KDEBUG
10655  if (TEST_OPT_DEBUG)
10656  {
10657  Print("test S[%d]:",i);
10658  p_wrp(L.p,currRing,strat->tailRing);
10659  PrintLn();
10660  }
10661  #endif
10663  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10664  else
10665  strat->S[i] = redtail(&L, strat->sl, strat);
10666  #ifdef KDEBUG
10667  if (TEST_OPT_DEBUG)
10668  {
10669  Print("to (tailR) S[%d]:",i);
10670  p_wrp(strat->S[i],currRing,strat->tailRing);
10671  PrintLn();
10672  }
10673  #endif
10674 
10675  if (strat->redTailChange)
10676  {
10677  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10678  if (pNext(T_j->p) != NULL)
10679  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10680  else
10681  T_j->max_exp = NULL;
10682  }
10684  T_j->pCleardenom();
10685  }
10686  else
10687  {
10688  assume(currRing == strat->tailRing);
10689  #ifdef KDEBUG
10690  if (TEST_OPT_DEBUG)
10691  {
10692  Print("test S[%d]:",i);
10693  p_wrp(strat->S[i],currRing,strat->tailRing);
10694  PrintLn();
10695  }
10696  #endif
10698  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10699  else
10700  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10702  {
10703  if (TEST_OPT_CONTENTSB)
10704  {
10705  number n;
10706  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10707  if (!nIsOne(n))
10708  {
10710  denom->n=nInvers(n);
10711  denom->next=DENOMINATOR_LIST;
10712  DENOMINATOR_LIST=denom;
10713  }
10714  nDelete(&n);
10715  }
10716  else
10717  {
10718  //pContent(strat->S[i]);
10719  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10720  }
10721  }
10722  #ifdef KDEBUG
10723  if (TEST_OPT_DEBUG)
10724  {
10725  Print("to (-tailR) S[%d]:",i);
10726  p_wrp(strat->S[i],currRing,strat->tailRing);
10727  PrintLn();
10728  }
10729  #endif
10730  }
10731  if (TEST_OPT_PROT)
10732  PrintS("-");
10733  }
10734  if (TEST_OPT_PROT) PrintLn();
10735 #ifdef KDEBUG
10736  sloppy_max = FALSE;
10737 #endif
10738 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7505
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:7581
#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:2843
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:749
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:2715
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 4544 of file kutil.cc.

4545 {
4546  // Initialize
4547  long exp[50]; // The exponent of \hat{X} (basepoint)
4548  long cexp[50]; // The current exponent for iterating over all
4549  long ind[50]; // The power of 2 in the i-th component of exp
4550  long cind[50]; // analog for cexp
4551  long mult[50]; // How to multiply the elements of G
4552  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4553  long habsind = 0; // The abs. index of the coefficient of h
4554  long step[50]; // The last increases
4555  for (int i = 1; i <= currRing->N; i++)
4556  {
4557  exp[i] = 0;
4558  cexp[i] = exp[i];
4559  ind[i] = 0;
4560  step[i] = 500000;
4561  cind[i] = ind[i];
4562  }
4563  long bound = currRing->ch;
4564  step[1] = 500000;
4565 #ifdef OLI_DEBUG
4566  PrintS("-------------\npoly :");
4567 // wrp(p);
4568  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4569  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4570  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4571  Print("bound : %d\n", bound);
4572  Print("cind : %d\n", cabsind);
4573 #endif
4574  if (cabsind == 0)
4575  {
4576  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4577  {
4578  return idInit(1, 1);
4579  }
4580  }
4581  ideal G0 = idInit(1, 1);
4582  // Now the whole simplex
4583  do
4584  {
4585  // Build s-polynomial
4586  // 2**ind-def * mult * g - exp-def * h
4587  poly t_p;
4588  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4589 #ifdef OLI_DEBUG
4590  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4591  PrintS("zPoly : ");
4592  wrp(zeroPoly);
4593  PrintLn();
4594 #endif
4595  // Add to ideal
4596  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4597  IDELEMS(G0) += 1;
4598  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4599  }
4600  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4601  idSkipZeroes(G0);
4602  return G0;
4603 }
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:4415
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4349
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:3555
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:657
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 1148 of file kutil.cc.

1149 {
1150  if (set[j].lcm!=NULL)
1151  {
1152 #ifdef HAVE_RINGS
1153  if (pGetCoeff(set[j].lcm) != NULL)
1154  pLmDelete(set[j].lcm);
1155  else
1156 #endif
1157  pLmFree(set[j].lcm);
1158  }
1159  if (set[j].sig!=NULL)
1160  {
1161 #ifdef HAVE_RINGS
1162  if (pGetCoeff(set[j].sig) != NULL)
1163  pLmDelete(set[j].sig);
1164  else
1165 #endif
1166  pLmFree(set[j].sig);
1167  }
1168  if (set[j].p!=NULL)
1169  {
1170  if (pNext(set[j].p) == strat->tail)
1171  {
1172 #ifdef HAVE_RINGS
1173  if (pGetCoeff(set[j].p) != NULL)
1174  pLmDelete(set[j].p);
1175  else
1176 #endif
1177  pLmFree(set[j].p);
1178  /*- tail belongs to several int spolys -*/
1179  }
1180  else
1181  {
1182  // search p in T, if it is there, do not delete it
1183  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1184  {
1185  // assure that for global orderings kFindInT fails
1186  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1187  set[j].Delete();
1188  }
1189  }
1190  }
1191  if (*length > 0 && j < *length)
1192  {
1193 #ifdef ENTER_USE_MEMMOVE
1194  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1195 #else
1196  int i;
1197  for (i=j; i < (*length); i++)
1198  set[i] = set[i+1];
1199 #endif
1200  }
1201 #ifdef KDEBUG
1202  memset(&(set[*length]),0,sizeof(LObject));
1203 #endif
1204  (*length)--;
1205 }
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:749
#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 1041 of file kutil.cc.

1042 {
1043 #ifdef ENTER_USE_MEMMOVE
1044  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1045  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1046  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1047  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1048 #else
1049  int j;
1050  for (j=i; j<strat->sl; j++)
1051  {
1052  strat->S[j] = strat->S[j+1];
1053  strat->ecartS[j] = strat->ecartS[j+1];
1054  strat->sevS[j] = strat->sevS[j+1];
1055  strat->S_2_R[j] = strat->S_2_R[j+1];
1056  }
1057 #endif
1058  if (strat->lenS!=NULL)
1059  {
1060 #ifdef ENTER_USE_MEMMOVE
1061  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1062 #else
1063  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1064 #endif
1065  }
1066  if (strat->lenSw!=NULL)
1067  {
1068 #ifdef ENTER_USE_MEMMOVE
1069  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1070 #else
1071  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1072 #endif
1073  }
1074  if (strat->fromQ!=NULL)
1075  {
1076 #ifdef ENTER_USE_MEMMOVE
1077  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1078 #else
1079  for (j=i; j<strat->sl; j++)
1080  {
1081  strat->fromQ[j] = strat->fromQ[j+1];
1082  }
1083 #endif
1084  }
1085  strat->S[strat->sl] = NULL;
1086  strat->sl--;
1087 }
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 1093 of file kutil.cc.

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

4660 {
4661  if (nIsOne(pGetCoeff(h))) return;
4662  number gcd;
4663  bool go = false;
4664  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4665  {
4666  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4667  go = true;
4668  }
4669  else
4670  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4671  if (go || !nIsOne(gcd))
4672  {
4673  poly p = h->next;
4674  if (!go)
4675  {
4676  number tmp = gcd;
4677  gcd = n_Ann(gcd,currRing->cf);
4678  nDelete(&tmp);
4679  }
4680  p_Test(p,strat->tailRing);
4681  p = pp_Mult_nn(p, gcd, strat->tailRing);
4682  nDelete(&gcd);
4683 
4684  if (p != NULL)
4685  {
4686  if (TEST_OPT_PROT)
4687  {
4688  PrintS("Z");
4689  }
4690 #ifdef KDEBUG
4691  if (TEST_OPT_DEBUG)
4692  {
4693  PrintS("--- create zero spoly: ");
4694  p_wrp(h,currRing,strat->tailRing);
4695  PrintS(" ---> ");
4696  }
4697 #endif
4698  poly tmp = pInit();
4699  pSetCoeff0(tmp, pGetCoeff(p));
4700  for (int i = 1; i <= rVar(currRing); i++)
4701  {
4702  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4703  }
4705  {
4706  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4707  }
4708  p_Setm(tmp, currRing);
4709  p = p_LmFreeAndNext(p, strat->tailRing);
4710  pNext(tmp) = p;
4711  LObject Lp;
4712  Lp.Init();
4713  Lp.p = tmp;
4714  Lp.tailRing = strat->tailRing;
4715  int posx;
4716  if (Lp.p!=NULL)
4717  {
4718  strat->initEcart(&Lp);
4719  if (strat->Ll==-1)
4720  posx =0;
4721  else
4722  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4723  Lp.sev = pGetShortExpVector(Lp.p);
4724  if (strat->tailRing != currRing)
4725  {
4726  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4727  }
4728 #ifdef KDEBUG
4729  if (TEST_OPT_DEBUG)
4730  {
4731  p_wrp(tmp,currRing,strat->tailRing);
4732  PrintLn();
4733  }
4734 #endif
4735  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4736  }
4737  }
4738  }
4739  nDelete(&gcd);
4740 }
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:1210
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 4742 of file kutil.cc.

4743 {
4744  if (nIsOne(pGetCoeff(h))) return;
4745  number gcd;
4746  bool go = false;
4747  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4748  {
4749  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4750  go = true;
4751  }
4752  else
4753  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4754  if (go || !nIsOne(gcd))
4755  {
4756  poly p = h->next;
4757  if (!go)
4758  {
4759  number tmp = gcd;
4760  gcd = n_Ann(gcd,currRing->cf);
4761  nDelete(&tmp);
4762  }
4763  p_Test(p,strat->tailRing);
4764  p = pp_Mult_nn(p, gcd, strat->tailRing);
4765 
4766  if (p != NULL)
4767  {
4768  if (TEST_OPT_PROT)
4769  {
4770  PrintS("Z");
4771  }
4772 #ifdef KDEBUG
4773  if (TEST_OPT_DEBUG)
4774  {
4775  PrintS("--- create zero spoly: ");
4776  p_wrp(h,currRing,strat->tailRing);
4777  PrintS(" ---> ");
4778  }
4779 #endif
4780  poly tmp = pInit();
4781  pSetCoeff0(tmp, pGetCoeff(p));
4782  for (int i = 1; i <= rVar(currRing); i++)
4783  {
4784  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4785  }
4787  {
4788  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4789  }
4790  p_Setm(tmp, currRing);
4791  p = p_LmFreeAndNext(p, strat->tailRing);
4792  pNext(tmp) = p;
4793  LObject Lp;
4794  Lp.Init();
4795  Lp.p = tmp;
4796  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4797  #if EXT_POLY_NEW
4798  Lp.sig = pp_Mult_nn(hSig, gcd, currRing);
4799  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4800  {
4801  #ifdef ADIDEBUG
4802  printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig);
4803  #endif
4804  strat->sigdrop = TRUE;
4805  //Try to reduce it as far as we can via redRing
4806  int red_result = redRing(&Lp,strat);
4807  #ifdef ADIDEBUG
4808  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
4809  #endif
4810  if(red_result == 0)
4811  {
4812  // Cancel the sigdrop
4813  #ifdef ADIDEBUG
4814  printf("\nCancel the sigdrop. It reduced to 0\n");
4815  #endif
4816  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4817  strat->sigdrop = FALSE;
4818  return;
4819  }
4820  else
4821  {
4822  #ifdef ADIDEBUG
4823  printf("\nSigdrop. end\n");
4824  #endif
4825  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4826  #if 1
4827  strat->enterS(Lp,0,strat,strat->tl);
4828  #endif
4829  return;
4830  }
4831 
4832  }
4833  #else
4834  Lp.sig = pOne();
4835  if(strat->Ll >= 0)
4836  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4837  else
4838  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4839  #endif
4840  Lp.tailRing = strat->tailRing;
4841  int posx;
4842  if (Lp.p!=NULL)
4843  {
4844  strat->initEcart(&Lp);
4845  if (strat->Ll==-1)
4846  posx =0;
4847  else
4848  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4849  Lp.sev = pGetShortExpVector(Lp.p);
4850  if (strat->tailRing != currRing)
4851  {
4852  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4853  }
4854 #ifdef KDEBUG
4855  if (TEST_OPT_DEBUG)
4856  {
4857  p_wrp(tmp,currRing,strat->tailRing);
4858  PrintLn();
4859  }
4860 #endif
4861  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4862  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4863  }
4864  }
4865  nDelete(&gcd);
4866  }
4867  nDelete(&gcd);
4868 }
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:1210
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 1210 of file kutil.cc.

1211 {
1212  // this should be corrected
1213  assume(p.FDeg == p.pFDeg());
1214 
1215  if ((*length)>=0)
1216  {
1217  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1218  if (at <= (*length))
1219 #ifdef ENTER_USE_MEMMOVE
1220  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1221 #else
1222  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1223 #endif
1224  }
1225  else at = 0;
1226  (*set)[at] = p;
1227  (*length)++;
1228 }
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

§ enterOnePairLift()

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

Definition at line 2220 of file kutil.cc.

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

§ enterOnePairManyShifts()

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

Definition at line 12173 of file kutil.cc.

12174 {
12175  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12176 
12179 
12180  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12181  /* that is create the pairs (f, s \dot g) */
12182 
12183  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
12184 
12185  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12186  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12187 
12188  /* determine how many elements we have to insert for a given s[i] */
12189  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12190  /* hence, a total number of elt's to add is: */
12191  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12192  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12193 
12194 #ifdef KDEBUG
12195  if (TEST_OPT_DEBUG)
12196  {
12197  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
12198  }
12199 #endif
12200 
12201  assume(i<=strat->sl); // from OnePair
12202 
12203  /* these vars hold for all shifts of s[i] */
12204  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12205 
12206  int qfromQ;
12207  if (strat->fromQ != NULL)
12208  {
12209  qfromQ = strat->fromQ[i];
12210  }
12211  else
12212  {
12213  qfromQ = -1;
12214  }
12215 
12216  int j;
12217 
12218  poly q/*, s*/;
12219 
12220  // for the 0th shift: insert the orig. pair
12221  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12222 
12223  for (j=1; j<= toInsert; j++)
12224  {
12225  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12226  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12227  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12228  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12229  // pNext(q) = s; // in tailRing
12230  /* here we need to call enterOnePair with two polys ... */
12231 
12232 #ifdef KDEBUG
12233  //if (TEST_OPT_DEBUG)
12234  //{
12235  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
12236  //}
12237 #endif
12238  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12239  }
12240 }
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:12311
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
#define TEST_OPT_DEBUG
Definition: options.h:103
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

§ enterOnePairNormal()

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

Definition at line 1937 of file kutil.cc.

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

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

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

§ enterOnePairSig()

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

§ enterOnePairSigRing()

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

§ enterOneStrongPoly()

BOOLEAN enterOneStrongPoly ( int  i,
poly  p,
int  ,
int  ,
kStrategy  strat,
int  atR = -1,
bool  enterTstrong = FALSE 
)

Definition at line 1516 of file kutil.cc.

1517 {
1518  number d, s, t;
1519  assume(atR >= 0);
1520  poly m1, m2, gcd,si;
1521  if(!enterTstrong)
1522  {
1523  assume(i<=strat->sl);
1524  si = strat->S[i];
1525  }
1526  else
1527  {
1528  assume(i<=strat->tl);
1529  si = strat->T[i].p;
1530  }
1531  //printf("\n--------------------------------\n");
1532  //pWrite(p);pWrite(si);
1533  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1534 
1535  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1536  {
1537  nDelete(&d);
1538  nDelete(&s);
1539  nDelete(&t);
1540  return FALSE;
1541  }
1542 
1543  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1544  //p_Test(m1,strat->tailRing);
1545  //p_Test(m2,strat->tailRing);
1546  /*if(!enterTstrong)
1547  {
1548  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1549  {
1550  memset(&(strat->P), 0, sizeof(strat->P));
1551  kStratChangeTailRing(strat);
1552  strat->P = *(strat->R[atR]);
1553  p_LmFree(m1, strat->tailRing);
1554  p_LmFree(m2, strat->tailRing);
1555  p_LmFree(gcd, currRing);
1556  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1557  }
1558  }*/
1559  pSetCoeff0(m1, s);
1560  pSetCoeff0(m2, t);
1561  pSetCoeff0(gcd, d);
1562  p_Test(m1,strat->tailRing);
1563  p_Test(m2,strat->tailRing);
1564  //printf("\n===================================\n");
1565  //pWrite(m1);pWrite(m2);pWrite(gcd);
1566 #ifdef KDEBUG
1567  if (TEST_OPT_DEBUG)
1568  {
1569  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1570  PrintS("m1 = ");
1571  p_wrp(m1, strat->tailRing);
1572  PrintS(" ; m2 = ");
1573  p_wrp(m2, strat->tailRing);
1574  PrintS(" ; gcd = ");
1575  wrp(gcd);
1576  PrintS("\n--- create strong gcd poly: ");
1577  Print("\n p: %d", i);
1578  wrp(p);
1579  Print("\n strat->S[%d]: ", i);
1580  wrp(si);
1581  PrintS(" ---> ");
1582  }
1583 #endif
1584 
1585  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1586  p_LmDelete(m1, strat->tailRing);
1587  p_LmDelete(m2, strat->tailRing);
1588 #ifdef KDEBUG
1589  if (TEST_OPT_DEBUG)
1590  {
1591  wrp(gcd);
1592  PrintLn();
1593  }
1594 #endif
1595 
1596  LObject h;
1597  h.p = gcd;
1598  h.tailRing = strat->tailRing;
1599  int posx;
1600  h.pCleardenom();
1601  strat->initEcart(&h);
1602  h.sev = pGetShortExpVector(h.p);
1603  h.i_r1 = -1;h.i_r2 = -1;
1604  if (currRing!=strat->tailRing)
1605  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1606  if(!enterTstrong)
1607  {
1608  #if 1
1609  h.p1 = p;h.p2 = strat->S[i];
1610  #endif
1611  if (atR >= 0)
1612  {
1613  h.i_r2 = strat->S_2_R[i];
1614  h.i_r1 = atR;
1615  }
1616  else
1617  {
1618  h.i_r1 = -1;
1619  h.i_r2 = -1;
1620  }
1621  if (strat->Ll==-1)
1622  posx =0;
1623  else
1624  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1625  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1626  }
1627  else
1628  {
1629  if(h.IsNull()) return FALSE;
1630  //int red_result;
1631  //reduzieren ist teur!!!
1632  //if(strat->L != NULL)
1633  //red_result = strat->red(&h,strat);
1634  if(!h.IsNull())
1635  {
1636  enterT(h, strat,-1);
1637  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1638  //strat->enterS(h,pos,strat,-1);
1639  }
1640  }
1641  //#if 1
1642  #ifdef ADIDEBUG
1643  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1644  #endif
1645  return TRUE;
1646 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
const CanonicalForm int s
Definition: facAbsFact.cc:55
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
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
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9478
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 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
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 p_Test(p, r)
Definition: p_polys.h:160
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:697
LSet L
Definition: kutil.h:321
#define nIsZero(n)
Definition: numbers.h:19
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:978
TSet T
Definition: kutil.h:320
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:292
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

§ enterOneStrongPolySig()

BOOLEAN enterOneStrongPolySig ( int  i,
poly  p,
poly  sig,
int  ,
int  ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1711 of file kutil.cc.

1712 {
1713  number d, s, t;
1714  assume(atR >= 0);
1715  poly m1, m2, gcd,si;
1716  assume(i<=strat->sl);
1717  si = strat->S[i];
1718  //printf("\n--------------------------------\n");
1719  //pWrite(p);pWrite(si);
1720  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1721 
1722  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1723  {
1724  nDelete(&d);
1725  nDelete(&s);
1726  nDelete(&t);
1727  return FALSE;
1728  }
1729 
1730  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1731  //p_Test(m1,strat->tailRing);
1732  //p_Test(m2,strat->tailRing);
1733  /*if(!enterTstrong)
1734  {
1735  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1736  {
1737  memset(&(strat->P), 0, sizeof(strat->P));
1738  kStratChangeTailRing(strat);
1739  strat->P = *(strat->R[atR]);
1740  p_LmFree(m1, strat->tailRing);
1741  p_LmFree(m2, strat->tailRing);
1742  p_LmFree(gcd, currRing);
1743  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1744  }
1745  }*/
1746  pSetCoeff0(m1, s);
1747  pSetCoeff0(m2, t);
1748  pSetCoeff0(gcd, d);
1749  p_Test(m1,strat->tailRing);
1750  p_Test(m2,strat->tailRing);
1751  //printf("\n===================================\n");
1752  //pWrite(m1);pWrite(m2);pWrite(gcd);
1753 #ifdef KDEBUG
1754  if (TEST_OPT_DEBUG)
1755  {
1756  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1757  PrintS("m1 = ");
1758  p_wrp(m1, strat->tailRing);
1759  PrintS(" ; m2 = ");
1760  p_wrp(m2, strat->tailRing);
1761  PrintS(" ; gcd = ");
1762  wrp(gcd);
1763  PrintS("\n--- create strong gcd poly: ");
1764  Print("\n p: %d", i);
1765  wrp(p);
1766  Print("\n strat->S[%d]: ", i);
1767  wrp(si);
1768  PrintS(" ---> ");
1769  }
1770 #endif
1771 
1772  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1773 
1774 #ifdef KDEBUG
1775  if (TEST_OPT_DEBUG)
1776  {
1777  wrp(gcd);
1778  PrintLn();
1779  }
1780 #endif
1781 
1782  //Check and set the signatures
1783  poly pSigMult = p_Copy(sig,currRing);
1784  poly sSigMult = p_Copy(strat->sig[i],currRing);
1785  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1786  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1787  p_LmDelete(m1, strat->tailRing);
1788  p_LmDelete(m2, strat->tailRing);
1789  poly pairsig;
1790  if(pLmCmp(pSigMult,sSigMult) == 0)
1791  {
1792  //Same lm, have to add them
1793  pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1794  //This might be zero
1795  }
1796  else
1797  {
1798  //Set the sig to either pSigMult or sSigMult
1799  if(pLtCmp(pSigMult,sSigMult)==1)
1800  {
1801  pairsig = pSigMult;
1802  pDelete(&sSigMult);
1803  }
1804  else
1805  {
1806  pairsig = sSigMult;
1807  pDelete(&pSigMult);
1808  }
1809  }
1810 
1811  LObject h;
1812  h.p = gcd;
1813  h.tailRing = strat->tailRing;
1814  h.sig = pairsig;
1815  int posx;
1816  h.pCleardenom();
1817  strat->initEcart(&h);
1818  h.sev = pGetShortExpVector(h.p);
1819  h.i_r1 = -1;h.i_r2 = -1;
1820  if (currRing!=strat->tailRing)
1821  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1822  if(h.sig == NULL)
1823  {
1824  #ifdef ADIDEBUG
1825  printf("\nPossible sigdrop in enterpairstrongSig (due to lost of sig)\n");
1826  #endif
1827  //sigdrop since we loose the signature
1828  strat->sigdrop = TRUE;
1829  //Try to reduce it as far as we can via redRing
1830  int red_result = redRing(&h,strat);
1831  #ifdef ADIDEBUG
1832  printf("\nAfter redRing reduce:\n");pWrite(h.p);
1833  #endif
1834  if(red_result == 0)
1835  {
1836  // Cancel the sigdrop
1837  #ifdef ADIDEBUG
1838  printf("\nCancel the sigdrop. It reduced to 0\n");
1839  #endif
1840  p_Delete(&h.sig,currRing);h.sig = NULL;
1841  strat->sigdrop = FALSE;
1842  return FALSE;
1843  }
1844  else
1845  {
1846  #ifdef ADIDEBUG
1847  printf("\nSigdrop. end\n");
1848  #endif
1849  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1850  #if 1
1851  strat->enterS(h,0,strat,strat->tl);
1852  #endif
1853  return FALSE;
1854  }
1855  }
1856  if(!nGreaterZero(pGetCoeff(h.sig)))
1857  {
1858  h.sig = pNeg(h.sig);
1859  h.p = pNeg(h.p);
1860  }
1861 
1862  if(rField_is_Ring(currRing) && pLtCmp(h.sig,sig) == -1)
1863  {
1864  #ifdef ADIDEBUG
1865  printf("\nSigDrop in enteronestrongpolySig\n");
1866  pWrite(h.sig);
1867  pWrite(p);pWrite(sig);
1868  pWrite(strat->S[i]);pWrite(strat->sig[i]);
1869  #endif
1870  strat->sigdrop = TRUE;
1871  // Completely reduce it
1872  int red_result = redRing(&h,strat);
1873  if(red_result == 0)
1874  {
1875  // Reduced to 0
1876  #ifdef ADIDEBUG
1877  printf("\nCancel the sigdrop after redRing (=0)\n");
1878  #endif
1879  strat->sigdrop = FALSE;
1880  p_Delete(&h.sig,currRing);h.sig = NULL;
1881  return FALSE;
1882  }
1883  else
1884  {
1885  #ifdef ADIDEBUG
1886  printf("\nAfter redRing still sigdrop:\n");pWrite(h.p);
1887  #endif
1888  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1889  // 0 - add just the original poly causing the sigdrop, 1 - add also this
1890  #if 1
1891  strat->enterS(h,0,strat, strat->tl+1);
1892  #endif
1893  return FALSE;
1894  }
1895  }
1896  #ifdef ADIDEBUG
1897  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);pWrite(h.sig);
1898  #endif
1899  //Check for sigdrop
1900  if(gcd != NULL && pLtCmp(sig,pairsig) > 0 && pLtCmp(strat->sig[i],pairsig) > 0)
1901  {
1902  #ifdef ADIDEBUG
1903  printf("\nSigDrop in strongpair\noriginals: ");pWrite(sig);pWrite(strat->sig[i]);
1904  printf("\nnow: ");pWrite(pairsig);
1905  #endif
1906  strat->sigdrop = TRUE;
1907  //Enter this element to S
1908  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1909  strat->enterS(h,strat->sl+1,strat,strat->tl+1);
1910  }
1911  #if 1
1912  h.p1 = p;h.p2 = strat->S[i];
1913  #endif
1914  if (atR >= 0)
1915  {
1916  h.i_r2 = strat->S_2_R[i];
1917  h.i_r1 = atR;
1918  }
1919  else
1920  {
1921  h.i_r1 = -1;
1922  h.i_r2 = -1;
1923  }
1924  if (strat->Ll==-1)
1925  posx =0;
1926  else
1927  posx = strat->posInLSba(strat->L,strat->Ll,&h,strat);
1928  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1929  return TRUE;
1930 }
polyset sig
Definition: kutil.h:302
const CanonicalForm int s
Definition: facAbsFact.cc:55
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
bool sigdrop
Definition: kutil.h:356
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
#define pNeg(p)
Definition: polys.h:181
int tl
Definition: kutil.h:346
#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
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
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 nGreaterZero(n)
Definition: numbers.h:27
#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(* 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
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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
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
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
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:292
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

§ enterpairs()

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

Definition at line 4935 of file kutil.cc.

4936 {
4937  int j=pos;
4938 
4940  initenterpairs(h,k,ecart,0,strat, atR);
4941  if ( (!strat->fromT)
4942  && ((strat->syzComp==0)
4943  ||(pGetComp(h)<=strat->syzComp)))
4944  {
4945  unsigned long h_sev = pGetShortExpVector(h);
4946  loop
4947  {
4948  if (j > k) break;
4949  clearS(h,h_sev, &j,&k,strat);
4950  j++;
4951  }
4952  }
4953 }
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:3830
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 12605 of file kutil.cc.

12606 {
12607  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12608  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12609  int j=pos;
12610 
12612  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12613  if ( (!strat->fromT)
12614  && ((strat->syzComp==0)
12615  ||(pGetComp(h)<=strat->syzComp)))
12616  {
12617  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12618  unsigned long h_sev = pGetShortExpVector(h);
12619  loop
12620  {
12621  if (j > k) break;
12622  clearS(h,h_sev, &j,&k,strat);
12623  j++;
12624  }
12625  //Print("end clearS sl=%d\n",strat->sl);
12626  }
12627  // PrintS("end enterpairs\n");
12628 }
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:12637
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 4961 of file kutil.cc.

4962 {
4963  int j=pos;
4965  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4966  if ( (!strat->fromT)
4967  && ((strat->syzComp==0)
4968  ||(pGetComp(h)<=strat->syzComp)))
4969  {
4970  unsigned long h_sev = pGetShortExpVector(h);
4971  loop
4972  {
4973  if (j > k) break;
4974  clearS(h,h_sev, &j,&k,strat);
4975  j++;
4976  }
4977  }
4978 }
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:3900
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 9238 of file kutil.cc.

9239 {
9240  strat->news = TRUE;
9241  /*- puts p to the standardbasis s at position at -*/
9242  if (strat->sl == IDELEMS(strat->Shdl)-1)
9243  {
9244  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9245  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9246  (IDELEMS(strat->Shdl)+setmaxTinc)
9247  *sizeof(unsigned long));
9248  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9249  IDELEMS(strat->Shdl)*sizeof(int),
9250  (IDELEMS(strat->Shdl)+setmaxTinc)
9251  *sizeof(int));
9252  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9253  IDELEMS(strat->Shdl)*sizeof(int),
9254  (IDELEMS(strat->Shdl)+setmaxTinc)
9255  *sizeof(int));
9256  if (strat->lenS!=NULL)
9257  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9258  IDELEMS(strat->Shdl)*sizeof(int),
9259  (IDELEMS(strat->Shdl)+setmaxTinc)
9260  *sizeof(int));
9261  if (strat->lenSw!=NULL)
9262  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9263  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9264  (IDELEMS(strat->Shdl)+setmaxTinc)
9265  *sizeof(wlen_type));
9266  if (strat->fromQ!=NULL)
9267  {
9268  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9269  IDELEMS(strat->Shdl)*sizeof(int),
9270  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9271  }
9272  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9273  IDELEMS(strat->Shdl)+=setmaxTinc;
9274  strat->Shdl->m=strat->S;
9275  }
9276  if (atS <= strat->sl)
9277  {
9278 #ifdef ENTER_USE_MEMMOVE
9279  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9280  (strat->sl - atS + 1)*sizeof(poly));
9281  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9282  (strat->sl - atS + 1)*sizeof(int));
9283  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9284  (strat->sl - atS + 1)*sizeof(unsigned long));
9285  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9286  (strat->sl - atS + 1)*sizeof(int));
9287  if (strat->lenS!=NULL)
9288  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9289  (strat->sl - atS + 1)*sizeof(int));
9290  if (strat->lenSw!=NULL)
9291  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9292  (strat->sl - atS + 1)*sizeof(wlen_type));
9293 #else
9294  for (i=strat->sl+1; i>=atS+1; i--)
9295  {
9296  strat->S[i] = strat->S[i-1];
9297  strat->ecartS[i] = strat->ecartS[i-1];
9298  strat->sevS[i] = strat->sevS[i-1];
9299  strat->S_2_R[i] = strat->S_2_R[i-1];
9300  }
9301  if (strat->lenS!=NULL)
9302  for (i=strat->sl+1; i>=atS+1; i--)
9303  strat->lenS[i] = strat->lenS[i-1];
9304  if (strat->lenSw!=NULL)
9305  for (i=strat->sl+1; i>=atS+1; i--)
9306  strat->lenSw[i] = strat->lenSw[i-1];
9307 #endif
9308  }
9309  if (strat->fromQ!=NULL)
9310  {
9311 #ifdef ENTER_USE_MEMMOVE
9312  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9313  (strat->sl - atS + 1)*sizeof(int));
9314 #else
9315  for (i=strat->sl+1; i>=atS+1; i--)
9316  {
9317  strat->fromQ[i] = strat->fromQ[i-1];
9318  }
9319 #endif
9320  strat->fromQ[atS]=0;
9321  }
9322 
9323  /*- save result -*/
9324  strat->S[atS] = p.p;
9325  if (strat->honey) strat->ecartS[atS] = p.ecart;
9326  if (p.sev == 0)
9327  p.sev = pGetShortExpVector(p.p);
9328  else
9329  assume(p.sev == pGetShortExpVector(p.p));
9330  strat->sevS[atS] = p.sev;
9331  strat->ecartS[atS] = p.ecart;
9332  strat->S_2_R[atS] = atR;
9333  strat->sl++;
9334 }
#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:3555
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 9340 of file kutil.cc.

9341 {
9342  strat->news = TRUE;
9343  /*- puts p to the standardbasis s at position at -*/
9344  if (strat->sl == IDELEMS(strat->Shdl)-1)
9345  {
9346  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9347  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9348  (IDELEMS(strat->Shdl)+setmaxTinc)
9349  *sizeof(unsigned long));
9350  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9351  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9352  (IDELEMS(strat->Shdl)+setmaxTinc)
9353  *sizeof(unsigned long));
9354  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9355  IDELEMS(strat->Shdl)*sizeof(int),
9356  (IDELEMS(strat->Shdl)+setmaxTinc)
9357  *sizeof(int));
9358  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9359  IDELEMS(strat->Shdl)*sizeof(int),
9360  (IDELEMS(strat->Shdl)+setmaxTinc)
9361  *sizeof(int));
9362  if (strat->lenS!=NULL)
9363  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9364  IDELEMS(strat->Shdl)*sizeof(int),
9365  (IDELEMS(strat->Shdl)+setmaxTinc)
9366  *sizeof(int));
9367  if (strat->lenSw!=NULL)
9368  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9369  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9370  (IDELEMS(strat->Shdl)+setmaxTinc)
9371  *sizeof(wlen_type));
9372  if (strat->fromQ!=NULL)
9373  {
9374  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9375  IDELEMS(strat->Shdl)*sizeof(int),
9376  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9377  }
9378  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9379  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
9380  IDELEMS(strat->Shdl)+=setmaxTinc;
9381  strat->Shdl->m=strat->S;
9382  }
9383  // in a signature-based algorithm the following situation will never
9384  // appear due to the fact that the critical pairs are already sorted
9385  // by increasing signature.
9386  // True. However, in the case of integers we need to put the element
9387  // that caused the signature drop on the first position
9388  if (atS <= strat->sl)
9389  {
9390 #ifdef ENTER_USE_MEMMOVE
9391  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9392  (strat->sl - atS + 1)*sizeof(poly));
9393  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9394  (strat->sl - atS + 1)*sizeof(poly));
9395  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9396  (strat->sl - atS + 1)*sizeof(unsigned long));
9397  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9398  (strat->sl - atS + 1)*sizeof(int));
9399  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9400  (strat->sl - atS + 1)*sizeof(unsigned long));
9401  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9402  (strat->sl - atS + 1)*sizeof(int));
9403  if (strat->lenS!=NULL)
9404  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9405  (strat->sl - atS + 1)*sizeof(int));
9406  if (strat->lenSw!=NULL)
9407  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9408  (strat->sl - atS + 1)*sizeof(wlen_type));
9409 #else
9410  for (i=strat->sl+1; i>=atS+1; i--)
9411  {
9412  strat->S[i] = strat->S[i-1];
9413  strat->ecartS[i] = strat->ecartS[i-1];
9414  strat->sevS[i] = strat->sevS[i-1];
9415  strat->S_2_R[i] = strat->S_2_R[i-1];
9416  strat->sig[i] = strat->sig[i-1];
9417  strat->sevSig[i] = strat->sevSig[i-1];
9418  }
9419  if (strat->lenS!=NULL)
9420  for (i=strat->sl+1; i>=atS+1; i--)
9421  strat->lenS[i] = strat->lenS[i-1];
9422  if (strat->lenSw!=NULL)
9423  for (i=strat->sl+1; i>=atS+1; i--)
9424  strat->lenSw[i] = strat->lenSw[i-1];
9425 #endif
9426  }
9427  if (strat->fromQ!=NULL)
9428  {
9429 #ifdef ENTER_USE_MEMMOVE
9430  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9431  (strat->sl - atS + 1)*sizeof(int));
9432 #else
9433  for (i=strat->sl+1; i>=atS+1; i--)
9434  {
9435  strat->fromQ[i] = strat->fromQ[i-1];
9436  }
9437 #endif
9438  strat->fromQ[atS]=0;
9439  }
9440 
9441  /*- save result -*/
9442  strat->S[atS] = p.p;
9443  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9444  if (strat->honey) strat->ecartS[atS] = p.ecart;
9445  if (p.sev == 0)
9446  p.sev = pGetShortExpVector(p.p);
9447  else
9448  assume(p.sev == pGetShortExpVector(p.p));
9449  strat->sevS[atS] = p.sev;
9450  // during the interreduction process of a signature-based algorithm we do not
9451  // compute the signature at this point, but when the whole interreduction
9452  // process finishes, i.e. f5c terminates!
9453  if (p.sig != NULL)
9454  {
9455  if (p.sevSig == 0)
9456  p.sevSig = pGetShortExpVector(p.sig);
9457  else
9458  assume(p.sevSig == pGetShortExpVector(p.sig));
9459  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9460  }
9461  strat->ecartS[atS] = p.ecart;
9462  strat->S_2_R[atS] = atR;
9463  strat->sl++;
9464 #ifdef DEBUGF5
9465  int k;
9466  Print("--- LIST S: %d ---\n",strat->sl);
9467  for(k=0;k<=strat->sl;k++)
9468  {
9469  pWrite(strat->sig[k]);
9470  }
9471  PrintS("--- LIST S END ---\n");
9472 #endif
9473 }
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:3555
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 9675 of file kutil.cc.

9676 {
9677  #ifdef ADIDEBUG
9678  printf("\n Entersyz:\n");pWrite(p.sig);
9679  #endif
9680  int i;
9681  strat->newt = TRUE;
9682  if (strat->syzl == strat->syzmax-1)
9683  {
9684  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9685  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9686  (strat->syzmax)*sizeof(unsigned long),
9687  ((strat->syzmax)+setmaxTinc)
9688  *sizeof(unsigned long));
9689  strat->syzmax += setmaxTinc;
9690  }
9691  if (atT < strat->syzl)
9692  {
9693 #ifdef ENTER_USE_MEMMOVE
9694  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9695  (strat->syzl-atT+1)*sizeof(poly));
9696  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9697  (strat->syzl-atT+1)*sizeof(unsigned long));
9698 #endif
9699  for (i=strat->syzl; i>=atT+1; i--)
9700  {
9701 #ifndef ENTER_USE_MEMMOVE
9702  strat->syz[i] = strat->syz[i-1];
9703  strat->sevSyz[i] = strat->sevSyz[i-1];
9704 #endif
9705  }
9706  }
9707  //i = strat->syzl;
9708  i = atT;
9709  //Makes sure the syz saves just the signature
9710  #ifdef HAVE_RINGS
9712  pNext(p.sig) = NULL;
9713  #endif
9714  strat->syz[atT] = p.sig;
9715  strat->sevSyz[atT] = p.sevSig;
9716  strat->syzl++;
9717 #if F5DEBUG
9718  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9719  pWrite(strat->syz[atT]);
9720 #endif
9721  // recheck pairs in strat->L with new rule and delete correspondingly
9722  int cc = strat->Ll;
9723  while (cc>-1)
9724  {
9725  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9726  //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);
9727  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9728  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9729  #ifdef HAVE_RINGS
9730  &&((!rField_is_Ring(currRing))
9731  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9732  #endif
9733  )
9734  {
9735  //printf("\nYES!\n");
9736  #ifdef ADIDEBUG
9737  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9738  #endif
9739  deleteInL(strat->L,&strat->Ll,cc,strat);
9740  }
9741  cc--;
9742  }
9743 //#if 1
9744 #ifdef DEBUGF5
9745  PrintS("--- Syzygies ---\n");
9746  Print("syzl %d\n",strat->syzl);
9747  Print("syzmax %d\n",strat->syzmax);
9748  PrintS("--------------------------------\n");
9749  for(i=0;i<=strat->syzl-1;i++)
9750  {
9751  Print("%d - ",i);
9752  pWrite(strat->syz[i]);
9753  }
9754  PrintS("--------------------------------\n");
9755 #endif
9756 }
#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:1148
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:3555
#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 9478 of file kutil.cc.

9479 {
9480  int i;
9481 
9482  pp_Test(p.p, currRing, p.tailRing);
9483  assume(strat->tailRing == p.tailRing);
9484  // redMoraNF complains about this -- but, we don't really
9485  // neeed this so far
9486  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9487  assume(p.FDeg == p.pFDeg());
9488  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9489 
9490 #ifdef KDEBUG
9491  // do not put an LObject twice into T:
9492  for(i=strat->tl;i>=0;i--)
9493  {
9494  if (p.p==strat->T[i].p)
9495  {
9496  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9497  return;
9498  }
9499  }
9500 #endif
9501 
9502 #ifdef HAVE_TAIL_RING
9503  if (currRing!=strat->tailRing)
9504  {
9505  p.t_p=p.GetLmTailRing();
9506  }
9507 #endif
9508  strat->newt = TRUE;
9509  if (atT < 0)
9510  atT = strat->posInT(strat->T, strat->tl, p);
9511  if (strat->tl == strat->tmax-1)
9512  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9513  if (atT <= strat->tl)
9514  {
9515 #ifdef ENTER_USE_MEMMOVE
9516  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9517  (strat->tl-atT+1)*sizeof(TObject));
9518  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9519  (strat->tl-atT+1)*sizeof(unsigned long));
9520 #endif
9521  for (i=strat->tl+1; i>=atT+1; i--)
9522  {
9523 #ifndef ENTER_USE_MEMMOVE
9524  strat->T[i] = strat->T[i-1];
9525  strat->sevT[i] = strat->sevT[i-1];
9526 #endif
9527  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9528  }
9529  }
9530 
9531  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9532  {
9534  (strat->tailRing != NULL ?
9535  strat->tailRing : currRing),
9536  strat->tailBin);
9537  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9538  }
9539  strat->T[atT] = (TObject) p;
9540  #ifdef ADIDEBUG
9541  printf("\nenterT: add in position %i\n",atT);
9542  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9543  #endif
9544  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9545 
9546  if (pNext(p.p) != NULL)
9547  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9548  else
9549  strat->T[atT].max_exp = NULL;
9550 
9551  strat->tl++;
9552  strat->R[strat->tl] = &(strat->T[atT]);
9553  strat->T[atT].i_r = strat->tl;
9554  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9555  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9556  kTest_T(&(strat->T[atT]));
9557 }
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:655
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 9563 of file kutil.cc.

9564 {
9566  int i;
9567 
9568  pp_Test(p.p, currRing, p.tailRing);
9569  assume(strat->tailRing == p.tailRing);
9570  // redMoraNF complains about this -- but, we don't really
9571  // neeed this so far
9572  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9573  assume(p.FDeg == p.pFDeg());
9574  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9575 
9576 #ifdef KDEBUG
9577  // do not put an LObject twice into T:
9578  for(i=strat->tl;i>=0;i--)
9579  {
9580  if (p.p==strat->T[i].p)
9581  {
9582  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9583  return;
9584  }
9585  }
9586 #endif
9587 
9588 #ifdef HAVE_TAIL_RING
9589  if (currRing!=strat->tailRing)
9590  {
9591  p.t_p=p.GetLmTailRing();
9592  }
9593 #endif
9594  strat->newt = TRUE;
9595  if (atT < 0)
9596  atT = strat->posInT(strat->T, strat->tl, p);
9597  if (strat->tl == strat->tmax-1)
9598  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9599  if (atT <= strat->tl)
9600  {
9601 #ifdef ENTER_USE_MEMMOVE
9602  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9603  (strat->tl-atT+1)*sizeof(TObject));
9604  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9605  (strat->tl-atT+1)*sizeof(unsigned long));
9606 #endif
9607  for (i=strat->tl+1; i>=atT+1; i--)
9608  {
9609 #ifndef ENTER_USE_MEMMOVE
9610  strat->T[i] = strat->T[i-1];
9611  strat->sevT[i] = strat->sevT[i-1];
9612 #endif
9613  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9614  }
9615  }
9616 
9617  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9618  {
9620  (strat->tailRing != NULL ?
9621  strat->tailRing : currRing),
9622  strat->tailBin);
9623  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9624  }
9625  strat->T[atT] = (TObject) p;
9626  #ifdef ADIDEBUG
9627  printf("\nenterT_strong: add in position %i\n",atT);
9628  pWrite(p.p);
9629  #endif
9630  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9631 
9632  if (pNext(p.p) != NULL)
9633  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9634  else
9635  strat->T[atT].max_exp = NULL;
9636 
9637  strat->tl++;
9638  strat->R[strat->tl] = &(strat->T[atT]);
9639  strat->T[atT].i_r = strat->tl;
9640  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9641  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9642  #if 1
9644  && !n_IsUnit(p.p->coef, currRing->cf))
9645  {
9646  #ifdef ADIDEBUG
9647  printf("\nDas ist p:\n");pWrite(p.p);
9648  #endif
9649  for(i=strat->tl;i>=0;i--)
9650  {
9651  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9652  {
9653  #ifdef ADIDEBUG
9654  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9655  #endif
9656  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9657  }
9658  }
9659  }
9660  /*
9661  printf("\nThis is T:\n");
9662  for(i=strat->tl;i>=0;i--)
9663  {
9664  pWrite(strat->T[i].p);
9665  }
9666  //getchar();*/
9667  #endif
9668  kTest_T(&(strat->T[atT]));
9669 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
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
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1516
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:655
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 12710 of file kutil.cc.

12711 {
12712  /* determine how many elements we have to insert */
12713  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12714  /* hence, a total number of elt's to add is: */
12715  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12716 
12717  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12718 
12719 #ifdef PDEBUG
12720  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12721 #endif
12722  int i;
12723 
12724  if (atT < 0)
12725  atT = strat->posInT(strat->T, strat->tl, p);
12726 
12727  /* can call enterT in a sequence, e.g. */
12728 
12729  /* shift0 = it's our model for further shifts */
12730  enterT(p,strat,atT);
12731  LObject qq;
12732  for (i=1; i<=toInsert; i++) // toIns - 1?
12733  {
12734  qq = p; //qq.Copy();
12735  qq.p = NULL;
12736  qq.max_exp = NULL;
12737  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12738  qq.GetP();
12739  // update q.sev
12740  qq.sev = pGetShortExpVector(qq.p);
12741  /* enter it into T, first el't is with the shift 0 */
12742  // compute the position for qq
12743  atT = strat->posInT(strat->T, strat->tl, qq);
12744  enterT(qq,strat,atT);
12745  }
12746 /* Q: what to do with this one in the orig enterT ? */
12747 /* strat->R[strat->tl] = &(strat->T[atT]); */
12748 /* Solution: it is done by enterT each time separately */
12749 }
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:9478
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 10177 of file kutil.cc.

10178 {
10179  /*- release temp data -*/
10180  cleanT(strat);
10181  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10182  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10183  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10184  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10185  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10186  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10187  /*- set L: should be empty -*/
10188  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10189  /*- set B: should be empty -*/
10190  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10191  pLmDelete(&strat->tail);
10192  strat->syzComp=0;
10193 }
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 10370 of file kutil.cc.

10371 {
10372  /*- release temp data -*/
10374  cleanTSbaRing(strat);
10375  else
10376  cleanT(strat);
10377  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10378  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10379  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10380  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10381  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10382  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10383  if(strat->syzmax>0)
10384  {
10385  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10386  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10387  if (strat->sbaOrder == 1)
10388  {
10389  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10390  }
10391  }
10392  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10393  /*- set L: should be empty -*/
10394  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10395  /*- set B: should be empty -*/
10396  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10397  /*- set sig: no need for the signatures anymore -*/
10398  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10399  pLmDelete(&strat->tail);
10400  strat->syzComp=0;
10401 }
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 3674 of file kstd2.cc.

3677 {
3678  int Ll_old, red_result = 1;
3679  int pos = 0;
3680  hilbeledeg=1;
3681  hilbcount=0;
3682  minimcnt=0;
3683  srmax = 0; // strat->sl is 0 at this point
3684  reduc = olddeg = lrmax = 0;
3685  // we cannot use strat->T anymore
3686  //cleanT(strat);
3687  //strat->tl = -1;
3688  Ll_old = strat->Ll;
3689  while (strat->tl >= 0)
3690  {
3691  if(!strat->T[strat->tl].is_redundant)
3692  {
3693  LObject h;
3694  h.p = strat->T[strat->tl].p;
3695  h.tailRing = strat->T[strat->tl].tailRing;
3696  h.t_p = strat->T[strat->tl].t_p;
3697  if (h.p!=NULL)
3698  {
3699  if (currRing->OrdSgn==-1)
3700  {
3701  cancelunit(&h);
3702  deleteHC(&h, strat);
3703  }
3704  if (h.p!=NULL)
3705  {
3707  {
3708  //pContent(h.p);
3709  h.pCleardenom(); // also does a pContent
3710  }
3711  else
3712  {
3713  h.pNorm();
3714  }
3715  strat->initEcart(&h);
3717  pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
3718  else
3719  pos = strat->Ll+1;
3720  h.sev = pGetShortExpVector(h.p);
3721  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
3722  }
3723  }
3724  }
3725  strat->tl--;
3726  }
3727  strat->sl = -1;
3728 #if 0
3729 //#ifdef HAVE_TAIL_RING
3730  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
3731  kStratInitChangeTailRing(strat);
3732 #endif
3733  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
3734  //strat->sl = -1;
3735  /* picks the last element from the lazyset L */
3736  while (strat->Ll>Ll_old)
3737  {
3738  strat->P = strat->L[strat->Ll];
3739  strat->Ll--;
3740 //#if 1
3741 #ifdef DEBUGF5
3742  PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3743  PrintS("-------------------------------------------------\n");
3744  pWrite(pHead(strat->P.p));
3745  pWrite(pHead(strat->P.p1));
3746  pWrite(pHead(strat->P.p2));
3747  printf("%d\n",strat->tl);
3748  PrintS("-------------------------------------------------\n");
3749 #endif
3750  if (pNext(strat->P.p) == strat->tail)
3751  {
3752  // deletes the short spoly
3753  if (rField_is_Ring(currRing))
3754  pLmDelete(strat->P.p);
3755  else
3756  pLmFree(strat->P.p);
3757 
3758  // TODO: needs some masking
3759  // TODO: masking needs to vanish once the signature
3760  // sutff is completely implemented
3761  strat->P.p = NULL;
3762  poly m1 = NULL, m2 = NULL;
3763 
3764  // check that spoly creation is ok
3765  while (strat->tailRing != currRing &&
3766  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3767  {
3768  assume(m1 == NULL && m2 == NULL);
3769  // if not, change to a ring where exponents are at least
3770  // large enough
3771  if (!kStratChangeTailRing(strat))
3772  {
3773  WerrorS("OVERFLOW...");
3774  break;
3775  }
3776  }
3777  // create the real one
3778  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3779  strat->tailRing, m1, m2, strat->R);
3780  }
3781  else if (strat->P.p1 == NULL)
3782  {
3783  if (strat->minim > 0)
3784  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3785  // for input polys, prepare reduction
3786  if(!rField_is_Ring(currRing))
3787  strat->P.PrepareRed(strat->use_buckets);
3788  }
3789 
3790  if (strat->P.p == NULL && strat->P.t_p == NULL)
3791  {
3792  red_result = 0;
3793  }
3794  else
3795  {
3796  if (TEST_OPT_PROT)
3797  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3798  &olddeg,&reduc,strat, red_result);
3799 
3800 #ifdef DEBUGF5
3801  PrintS("Poly before red: ");
3802  pWrite(strat->P.p);
3803 #endif
3804  /* complete reduction of the element chosen from L */
3805  red_result = strat->red2(&strat->P,strat);
3806  if (errorreported) break;
3807  }
3808 
3809  if (strat->overflow)
3810  {
3811  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
3812  }
3813 
3814  // reduction to non-zero new poly
3815  if (red_result == 1)
3816  {
3817  // get the polynomial (canonicalize bucket, make sure P.p is set)
3818  strat->P.GetP(strat->lmBin);
3819  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
3820  // but now, for entering S, T, we reset it
3821  // in the inhomogeneous case: FDeg == pFDeg
3822  if (strat->homog) strat->initEcart(&(strat->P));
3823 
3824  /* statistic */
3825  if (TEST_OPT_PROT) PrintS("s");
3826  int pos;
3827  #if 1
3828  if(!rField_is_Ring(currRing))
3829  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3830  else
3831  pos = posInSMonFirst(strat,strat->sl,strat->P.p);
3832  #else
3833  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3834  #endif
3835  // reduce the tail and normalize poly
3836  // in the ring case we cannot expect LC(f) = 1,
3837  // therefore we call pContent instead of pNorm
3838 #if F5CTAILRED
3839  BOOLEAN withT = TRUE;
3841  {
3842  strat->P.pCleardenom();
3844  {
3845  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3846  strat->P.pCleardenom();
3847  }
3848  }
3849  else
3850  {
3851  strat->P.pNorm();
3853  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3854  }
3855 #endif
3856 #ifdef KDEBUG
3857  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3858 #endif /* KDEBUG */
3859 
3860  // min_std stuff
3861  if ((strat->P.p1==NULL) && (strat->minim>0))
3862  {
3863  if (strat->minim==1)
3864  {
3865  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3866  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3867  }
3868  else
3869  {
3870  strat->M->m[minimcnt]=strat->P.p2;
3871  strat->P.p2=NULL;
3872  }
3873  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3874  pNext(strat->M->m[minimcnt])
3875  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3876  strat->tailRing, currRing,
3877  currRing->PolyBin);
3878  minimcnt++;
3879  }
3880 
3881  // enter into S, L, and T
3882  // here we need to recompute new signatures, but those are trivial ones
3883  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3884  {
3885  enterT(strat->P, strat);
3886  // posInS only depends on the leading term
3887  strat->enterS(strat->P, pos, strat, strat->tl);
3888 //#if 1
3889 #ifdef DEBUGF5
3890  PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
3891  pWrite(pHead(strat->S[strat->sl]));
3892  pWrite(strat->sig[strat->sl]);
3893 #endif
3894  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3895  }
3896  // Print("[%d]",hilbeledeg);
3897  if (strat->P.lcm!=NULL)
3898 #ifdef HAVE_RINGS
3899  pLmDelete(strat->P.lcm);
3900 #else
3901  pLmFree(strat->P.lcm);
3902 #endif
3903  if (strat->sl>srmax) srmax = strat->sl;
3904  }
3905  else
3906  {
3907  // adds signature of the zero reduction to
3908  // strat->syz. This is the leading term of
3909  // syzygy and can be used in syzCriterion()
3910  // the signature is added if and only if the
3911  // pair was not detected by the rewritten criterion in strat->red = redSig
3912  if (strat->P.p1 == NULL && strat->minim > 0)
3913  {
3914  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3915  }
3916  }
3917 
3918 #ifdef KDEBUG
3919  memset(&(strat->P), 0, sizeof(strat->P));
3920 #endif /* KDEBUG */
3921  }
3922  int cc = 0;
3923  while (cc<strat->tl+1)
3924  {
3925  strat->T[cc].sig = pOne();
3926  p_SetComp(strat->T[cc].sig,cc+1,currRing);
3927  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
3928  strat->sig[cc] = strat->T[cc].sig;
3929  strat->sevSig[cc] = strat->T[cc].sevSig;
3930  strat->T[cc].is_sigsafe = TRUE;
3931  cc++;
3932  }
3933  strat->max_lower_index = strat->tl;
3934  // set current signature index of upcoming iteration step
3935  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
3936  // the corresponding syzygy rules correctly
3937  strat->currIdx = cc+1;
3938  for (int cd=strat->Ll; cd>=0; cd--)
3939  {
3940  p_SetComp(strat->L[cd].sig,cc+1,currRing);
3941  cc++;
3942  }
3943  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
3944  strat->Shdl->m[cc] = NULL;
3945  #if 0
3946  printf("\nAfter f5c sorting\n");
3947  for(int i=0;i<=strat->sl;i++)
3948  pWrite(pHead(strat->S[i]));
3949  getchar();
3950  #endif
3951 //#if 1
3952 #if DEBUGF5
3953  PrintS("------------------- STRAT S ---------------------\n");
3954  cc = 0;
3955  while (cc<strat->tl+1)
3956  {
3957  pWrite(pHead(strat->S[cc]));
3958  pWrite(strat->sig[cc]);
3959  printf("- - - - - -\n");
3960  cc++;
3961  }
3962  PrintS("-------------------------------------------------\n");
3963  PrintS("------------------- STRAT T ---------------------\n");
3964  cc = 0;
3965  while (cc<strat->tl+1)
3966  {
3967  pWrite(pHead(strat->T[cc].p));
3968  pWrite(strat->T[cc].sig);
3969  printf("- - - - - -\n");
3970  cc++;
3971  }
3972  PrintS("-------------------------------------------------\n");
3973  PrintS("------------------- STRAT L ---------------------\n");
3974  cc = 0;
3975  while (cc<strat->Ll+1)
3976  {
3977  pWrite(pHead(strat->L[cc].p));
3978  pWrite(pHead(strat->L[cc].p1));
3979  pWrite(pHead(strat->L[cc].p2));
3980  pWrite(strat->L[cc].sig);
3981  printf("- - - - - -\n");
3982  cc++;
3983  }
3984  PrintS("-------------------------------------------------\n");
3985  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
3986 #endif
3987 
3988 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
Definition: kutil.cc:5212
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:7924
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:6475
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:1210
#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:11359
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9478
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:11260
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:10811
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:5111
#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 7211 of file kutil.cc.

7212 {
7213  //printf("Faugere Rewritten Criterion\n");
7215  return FALSE;
7216 //#if 1
7217 #ifdef DEBUGF5
7218  PrintS("rewritten criterion checks: ");
7219  pWrite(sig);
7220 #endif
7221  for(int k = strat->sl; k>=start; k--)
7222  {
7223 //#if 1
7224 #ifdef DEBUGF5
7225  PrintS("checking with: ");
7226  pWrite(strat->sig[k]);
7227  pWrite(pHead(strat->S[k]));
7228 #endif
7229  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7230  {
7231 //#if 1
7232 #ifdef DEBUGF5
7233  PrintS("DELETE!\n");
7234 #endif
7235  #ifdef ADIDEBUG
7236  printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
7237  #endif
7238  strat->nrrewcrit++;
7239  return TRUE;
7240  }
7241  //k--;
7242  }
7243 #ifdef DEBUGF5
7244  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7245  for(int kk = 0; kk<strat->sl+1; kk++)
7246  {
7247  pWrite(pHead(strat->S[kk]));
7248  }
7249  PrintS("------------------------------\n");
7250 #endif
7251  return FALSE;
7252 }
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 11194 of file kutil.cc.

11195 {
11196  if(!nCoeff_is_Ring_Z(currRing->cf))
11197  return;
11198  poly p,pp;
11199  for(int j = 0; j<=strat->sl; j++)
11200  {
11201  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11202  {
11203  for(int i = 0; i<=strat->sl; i++)
11204  {
11205  if((i != j) && (strat->S[i] != NULL))
11206  {
11207  p = strat->S[i];
11208  if(pLmDivisibleBy(strat->S[j], p))
11209  {
11210  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11211  p_SetCoeff(p,dummy,currRing);
11212  }
11213  pp = pNext(p);
11214  if((pp == NULL) && (nIsZero(p->coef)))
11215  {
11216  deleteInS(i, strat);
11217  }
11218  else
11219  {
11220  while(pp != NULL)
11221  {
11222  if(pLmDivisibleBy(strat->S[j], pp))
11223  {
11224  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11225  p_SetCoeff(pp,dummy,currRing);
11226  if(nIsZero(pp->coef))
11227  {
11228  pLmDelete(&pNext(p));
11229  pp = pNext(p);
11230  }
11231  else
11232  {
11233  p = pp;
11234  pp = pNext(p);
11235  }
11236  }
11237  else
11238  {
11239  p = pp;
11240  pp = pNext(p);
11241  }
11242  }
11243  }
11244  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11245  {
11246  if(pNext(strat->S[i]) == NULL)
11247  strat->S[i]=NULL;
11248  else
11249  strat->S[i]=pNext(strat->S[i]);
11250  }
11251  }
11252  }
11253  //idPrint(strat->Shdl);
11254  }
11255  }
11256  //idSkipZeroes(strat->Shdl);
11257 }
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:1041
#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 4347 of file kstd2.cc.

4348 {
4349  /* todo main call */
4350 
4351  /* assume: ring is prepared, ideal is copied into shifted ring */
4352  /* uptodeg and lVblock are correct - test them! */
4353 
4354  /* check whether the ideal is in V */
4355 
4356 // if (0)
4357  if (! ideal_isInV(I,lVblock) )
4358  {
4359  WerrorS("The input ideal contains incorrectly encoded elements! ");
4360  return(NULL);
4361  }
4362 
4363  // kStrategy strat = new skStrategy;
4364  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
4365  /* at the moment:
4366 - no quotient (check)
4367 - no *w, no *hilb
4368  */
4369  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
4370  int newIdeal, intvec *vw) */
4371  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
4372  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
4373  idSkipZeroes(RS);
4374  return(RS);
4375 }
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:751
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 4196 of file kutil.cc.

4197 {
4198  long ind = 0;
4199  if (arg <= 0) return 0;
4200  while (arg%2 == 0)
4201  {
4202  arg = arg / 2;
4203  ind++;
4204  }
4205  return ind;
4206 }

§ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4208 of file kutil.cc.

4209 {
4210  long ind = 0;
4211  if (arg <= 0) return 0;
4212  if (arg%2 == 1) { arg--; }
4213  while (arg > 0)
4214  {
4215  ind += ind2(arg);
4216  arg = arg - 2;
4217  }
4218  return ind;
4219 }
long ind2(long arg)
Definition: kutil.cc:4196

§ 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:1249
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:536
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
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:1290
BOOLEAN homog
Definition: kutil.h:369
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
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:1234
int LazyPass
Definition: kutil.h:349
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9238

§ initBbaShift()

void initBbaShift ( kStrategy  strat)

Definition at line 4508 of file kstd2.cc.

4509 {
4510  /* setting global variables ------------------- */
4511  strat->enterS = enterSBba; /* remains as is, we change enterT! */
4512 
4513  strat->red = redFirstShift; /* no redHomog ! */
4514 
4515  if (currRing->pLexOrder && strat->honey)
4516  strat->initEcart = initEcartNormal;
4517  else
4518  strat->initEcart = initEcartBBA;
4519  if (strat->honey)
4521  else
4523 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
4524 // {
4525 // //interred machen Aenderung
4526 // pFDegOld=currRing->pFDeg;
4527 // pLDegOld=pLDeg;
4528 // //h=ggetid("ecart");
4529 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
4530 // //{
4531 // // ecartWeights=iv2array(IDINTVEC(h));
4532 // //}
4533 // //else
4534 // {
4535 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
4536 // /*uses automatic computation of the ecartWeights to set them*/
4537 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
4538 // }
4539 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
4540 // if (TEST_OPT_PROT)
4541 // {
4542 // for(int i=1; i<=rVar(currRing); i++)
4543 // Print(" %d",ecartWeights[i]);
4544 // PrintLn();
4545 // mflush();
4546 // }
4547 // }
4548 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1249
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:4381
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:1256
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
void initEcartNormal(TObject *h)
Definition: kutil.cc:1234
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9238

§ initBuchMora()

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

Definition at line 10101 of file kutil.cc.

10102 {
10103  strat->interpt = BTEST1(OPT_INTERRUPT);
10104  strat->kHEdge=NULL;
10106  /*- creating temp data structures------------------- -*/
10107  strat->cp = 0;
10108  strat->c3 = 0;
10109  strat->tail = pInit();
10110  /*- set s -*/
10111  strat->sl = -1;
10112  /*- set L -*/
10113  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10114  strat->Ll = -1;
10115  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10116  /*- set B -*/
10117  strat->Bmax = setmaxL;
10118  strat->Bl = -1;
10119  strat->B = initL();
10120  /*- set T -*/
10121  strat->tl = -1;
10122  strat->tmax = setmaxT;
10123  strat->T = initT();
10124  strat->R = initR();
10125  strat->sevT = initsevT();
10126  /*- init local data struct.---------------------------------------- -*/
10127  strat->P.ecart=0;
10128  strat->P.length=0;
10129  strat->P.pLength=0;
10131  {
10132  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10133  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10134  }
10136  {
10137  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10138  }
10139  else
10140  {
10141  if(TEST_OPT_SB_1)
10142  {
10143  int i;
10144  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10145  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10146  {
10147  P->m[i-strat->newIdeal] = F->m[i];
10148  F->m[i] = NULL;
10149  }
10150  initSSpecial(F,Q,P,strat);
10151  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10152  {
10153  F->m[i] = P->m[i-strat->newIdeal];
10154  P->m[i-strat->newIdeal] = NULL;
10155  }
10156  idDelete(&P);
10157  }
10158  else
10159  {
10160  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10161  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10162  }
10163  }
10164  strat->fromT = FALSE;
10166  if ((!TEST_OPT_SB_1)
10167  || (rField_is_Ring(currRing))
10168  )
10169  {
10170  updateS(TRUE,strat);
10171  }
10172  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10173  strat->fromQ=NULL;
10174  assume(kTest_TS(strat));
10175 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
#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:8138
#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:8544
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:654
#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:749
#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:9009
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 9777 of file kutil.cc.

9778 {
9780  strat->chainCrit=chainCritNormal;
9781  if (TEST_OPT_SB_1)
9782  strat->chainCrit=chainCritOpt_1;
9783 #ifdef HAVE_RINGS
9784  if (rField_is_Ring(currRing))
9785  {
9787  strat->chainCrit=chainCritRing;
9788  }
9789 #endif
9790 #ifdef HAVE_RATGRING
9791  if (rIsRatGRing(currRing))
9792  {
9793  strat->chainCrit=chainCritPart;
9794  /* enterOnePairNormal get rational part in it */
9795  }
9796 #endif
9797  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9798  && (!rIsPluralRing(currRing)))
9800 
9801  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9802  strat->Gebauer = strat->homog || strat->sugarCrit;
9803  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9804  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9805  strat->pairtest = NULL;
9806  /* alway use tailreduction, except:
9807  * - in local rings, - in lex order case, -in ring over extensions */
9809  //if(rHasMixedOrdering(currRing)==2)
9810  //{
9811  // strat->noTailReduction =TRUE;
9812  //}
9813 
9814 #ifdef HAVE_PLURAL
9815  // and r is plural_ring
9816  // hence this holds for r a rational_plural_ring
9817  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9818  { //or it has non-quasi-comm type... later
9819  strat->sugarCrit = FALSE;
9820  strat->Gebauer = FALSE;
9821  strat->honey = FALSE;
9822  }
9823 #endif
9824 
9825  // Coefficient ring?
9826  if (rField_is_Ring(currRing))
9827  {
9828  strat->sugarCrit = FALSE;
9829  strat->Gebauer = FALSE ;
9830  strat->honey = FALSE;
9831  }
9832  #ifdef KDEBUG
9833  if (TEST_OPT_DEBUG)
9834  {
9835  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9836  else PrintS("ideal/module is not homogeneous\n");
9837  }
9838  #endif
9839 }
#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:3253
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
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1937
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:4023
#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:3466
void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2220
void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3541

§ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9928 of file kutil.cc.

9929 {
9931  {
9932  if (strat->honey)
9933  {
9934  strat->posInL = posInL15;
9935  // ok -- here is the deal: from my experiments for Singular-2-0
9936  // I conclude that that posInT_EcartpLength is the best of
9937  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9938  // see the table at the end of this file
9939  if (TEST_OPT_OLDSTD)
9940  strat->posInT = posInT15;
9941  else
9942  strat->posInT = posInT_EcartpLength;
9943  }
9944  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9945  {
9946  strat->posInL = posInL11;
9947  strat->posInT = posInT11;
9948  }
9949  else if (TEST_OPT_INTSTRATEGY)
9950  {
9951  strat->posInL = posInL11;
9952  strat->posInT = posInT11;
9953  }
9954  else
9955  {
9956  strat->posInL = posInL0;
9957  strat->posInT = posInT0;
9958  }
9959  //if (strat->minim>0) strat->posInL =posInLSpecial;
9960  if (strat->homog)
9961  {
9962  strat->posInL = posInL110;
9963  strat->posInT = posInT110;
9964  }
9965  }
9966  else
9967  {
9968  if (strat->homog)
9969  {
9970  strat->posInL = posInL11;
9971  strat->posInT = posInT11;
9972  }
9973  else
9974  {
9975  if ((currRing->order[0]==ringorder_c)
9976  ||(currRing->order[0]==ringorder_C))
9977  {
9978  strat->posInL = posInL17_c;
9979  strat->posInT = posInT17_c;
9980  }
9981  else
9982  {
9983  strat->posInL = posInL17;
9984  strat->posInT = posInT17;
9985  }
9986  }
9987  }
9988  if (strat->minim>0) strat->posInL =posInLSpecial;
9989  // for further tests only
9990  if ((BTEST1(11)) || (BTEST1(12)))
9991  strat->posInL = posInL11;
9992  else if ((BTEST1(13)) || (BTEST1(14)))
9993  strat->posInL = posInL13;
9994  else if ((BTEST1(15)) || (BTEST1(16)))
9995  strat->posInL = posInL15;
9996  else if ((BTEST1(17)) || (BTEST1(18)))
9997  strat->posInL = posInL17;
9998  if (BTEST1(11))
9999  strat->posInT = posInT11;
10000  else if (BTEST1(13))
10001  strat->posInT = posInT13;
10002  else if (BTEST1(15))
10003  strat->posInT = posInT15;
10004  else if ((BTEST1(17)))
10005  strat->posInT = posInT17;
10006  else if ((BTEST1(19)))
10007  strat->posInT = posInT19;
10008  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10009  strat->posInT = posInT1;
10011 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6399
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:6896
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5344
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6785
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:5712
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:6697
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5333
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9912
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:5402
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5914
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:6141
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6990
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5807
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5555
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6098
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6041
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5673
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5644

§ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10014 of file kutil.cc.

10015 {
10017  {
10018  if (strat->honey)
10019  {
10020  strat->posInL = posInL15Ring;
10021  // ok -- here is the deal: from my experiments for Singular-2-0
10022  // I conclude that that posInT_EcartpLength is the best of
10023  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10024  // see the table at the end of this file
10025  if (TEST_OPT_OLDSTD)
10026  strat->posInT = posInT15Ring;
10027  else
10028  strat->posInT = posInT_EcartpLength;
10029  }
10030  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10031  {
10032  strat->posInL = posInL11Ring;
10033  strat->posInT = posInT11;
10034  }
10035  else if (TEST_OPT_INTSTRATEGY)
10036  {
10037  strat->posInL = posInL11Ring;
10038  strat->posInT = posInT11;
10039  }
10040  else
10041  {
10042  strat->posInL = posInL0Ring;
10043  strat->posInT = posInT0;
10044  }
10045  //if (strat->minim>0) strat->posInL =posInLSpecial;
10046  if (strat->homog)
10047  {
10048  strat->posInL = posInL110Ring;
10049  strat->posInT = posInT110Ring;
10050  }
10051  }
10052  else
10053  {
10054  if (strat->homog)
10055  {
10056  //printf("\nHere 3\n");
10057  strat->posInL = posInL11Ring;
10058  strat->posInT = posInT11Ring;
10059  }
10060  else
10061  {
10062  if ((currRing->order[0]==ringorder_c)
10063  ||(currRing->order[0]==ringorder_C))
10064  {
10065  strat->posInL = posInL17_cRing;
10066  strat->posInT = posInT17_cRing;
10067  }
10068  else
10069  {
10070  strat->posInL = posInL11Ringls;
10071  strat->posInT = posInT17Ring;
10072  }
10073  }
10074  }
10075  if (strat->minim>0) strat->posInL =posInLSpecial;
10076  // for further tests only
10077  if ((BTEST1(11)) || (BTEST1(12)))
10078  strat->posInL = posInL11Ring;
10079  else if ((BTEST1(13)) || (BTEST1(14)))
10080  strat->posInL = posInL13;
10081  else if ((BTEST1(15)) || (BTEST1(16)))
10082  strat->posInL = posInL15Ring;
10083  else if ((BTEST1(17)) || (BTEST1(18)))
10084  strat->posInL = posInL17Ring;
10085  if (BTEST1(11))
10086  strat->posInT = posInT11Ring;
10087  else if (BTEST1(13))
10088  strat->posInT = posInT13;
10089  else if (BTEST1(15))
10090  strat->posInT = posInT15Ring;
10091  else if ((BTEST1(17)))
10092  strat->posInT = posInT17Ring;
10093  else if ((BTEST1(19)))
10094  strat->posInT = posInT19;
10095  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10096  strat->posInT = posInT1;
10098 }
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:6441
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6511
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6855
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5344
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6940
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6785
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6738
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5766
#define BTEST1(a)
Definition: options.h:32
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7054
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:5333
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9912
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:5402
BOOLEAN homog
Definition: kutil.h:369
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5438
#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:5868
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6167
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6098
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6041
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5673
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5975
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5644

§ initBuchMoraShift()

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

Definition at line 12094 of file kutil.cc.

12095 {
12096  strat->interpt = BTEST1(OPT_INTERRUPT);
12097  strat->kHEdge=NULL;
12099  /*- creating temp data structures------------------- -*/
12100  strat->cp = 0;
12101  strat->c3 = 0;
12102  strat->cv = 0;
12103  strat->tail = pInit();
12104  /*- set s -*/
12105  strat->sl = -1;
12106  /*- set L -*/
12107  strat->Lmax = setmaxL;
12108  strat->Ll = -1;
12109  strat->L = initL();
12110  /*- set B -*/
12111  strat->Bmax = setmaxL;
12112  strat->Bl = -1;
12113  strat->B = initL();
12114  /*- set T -*/
12115  strat->tl = -1;
12116  strat->tmax = setmaxT;
12117  strat->T = initT();
12118  strat->R = initR();
12119  strat->sevT = initsevT();
12120  /*- init local data struct.---------------------------------------- -*/
12121  strat->P.ecart=0;
12122  strat->P.length=0;
12124  {
12125  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12126  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12127  }
12129  {
12130  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12131  }
12132  {
12133  if(TEST_OPT_SB_1)
12134  {
12135  int i;
12136  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12137  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12138  {
12139  P->m[i-strat->newIdeal] = F->m[i];
12140  F->m[i] = NULL;
12141  }
12142  initSSpecial(F,Q,P,strat);
12143  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12144  {
12145  F->m[i] = P->m[i-strat->newIdeal];
12146  P->m[i-strat->newIdeal] = NULL;
12147  }
12148  idDelete(&P);
12149  }
12150  else
12151  {
12152  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12153  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12154  }
12155  }
12156  strat->fromT = FALSE;
12157  if (!TEST_OPT_SB_1)
12158  {
12159  /* the only change: we do not fill the set T*/
12160  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12161  }
12162  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12163  strat->fromQ=NULL;
12164  /* more changes: fill the set T with all the shifts of elts of S*/
12165  /* is done by other procedure */
12166 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
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:8138
#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:8544
#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:749
#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:9009
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 1242 of file kutil.cc.

1243 {
1244  h->FDeg = h->pFDeg();
1245  (*h).ecart = 0;
1246  h->length=h->pLength=pLength(h->p);
1247 }
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 1234 of file kutil.cc.

1235 {
1236  h->FDeg = h->pFDeg();
1237  h->ecart = h->pLDeg() - h->FDeg;
1238  // h->length is set by h->pLDeg
1239  h->length=h->pLength=pLength(h->p);
1240 }
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 1249 of file kutil.cc.

1250 {
1251  Lp->FDeg = Lp->pFDeg();
1252  (*Lp).ecart = 0;
1253  (*Lp).length = 0;
1254 }

§ initEcartPairMora()

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

Definition at line 1256 of file kutil.cc.

1257 {
1258  Lp->FDeg = Lp->pFDeg();
1259  (*Lp).ecart = si_max(ecartF,ecartG);
1260  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1261  (*Lp).length = 0;
1262 }
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

§ initenterpairsShift()

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

Definition at line 12637 of file kutil.cc.

12638 {
12639  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12640  // atR = -1;
12641  if ((strat->syzComp==0)
12642  || (pGetComp(h)<=strat->syzComp))
12643  {
12644  int j;
12645  BOOLEAN new_pair=FALSE;
12646 
12647  if (pGetComp(h)==0)
12648  {
12649  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12650  if ((isFromQ)&&(strat->fromQ!=NULL))
12651  {
12652  for (j=0; j<=k; j++)
12653  {
12654  if (!strat->fromQ[j])
12655  {
12656  new_pair=TRUE;
12657  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12658  // other side pairs:
12659  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12660  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12661  }
12662  }
12663  }
12664  else
12665  {
12666  new_pair=TRUE;
12667  for (j=0; j<=k; j++)
12668  {
12669  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12670  // other side pairs
12671  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12672  }
12673  /* HERE we put (h, s*h) pairs */
12674  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
12675  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12676  }
12677  }
12678  else
12679  {
12680  for (j=0; j<=k; j++)
12681  {
12682  if ((pGetComp(h)==pGetComp(strat->S[j]))
12683  || (pGetComp(strat->S[j])==0))
12684  {
12685  new_pair=TRUE;
12686  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
12687  // other side pairs
12688  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12689  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12690  }
12691  }
12692  /* HERE we put (h, s*h) pairs */
12693  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12694  }
12695 
12696  if (new_pair)
12697  {
12698  strat->chainCrit(h,ecart,strat);
12699  }
12700 
12701  }
12702 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
polyset S
Definition: kutil.h:300
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12173
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12248

§ initHilbCrit()

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

Definition at line 9759 of file kutil.cc.

9760 {
9761 
9762  //if the ordering is local, then hilb criterion
9763  //can be used also if the ideal is not homogenous
9765  {
9767  *hilb=NULL;
9768  else
9769  return;
9770  }
9771  if (strat->homog!=isHomog)
9772  {
9773  *hilb=NULL;
9774  }
9775 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
#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:751
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 8042 of file kutil.cc.

8043 {
8044  int i,pos;
8045 
8046  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8047  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8048  strat->ecartS=initec(i);
8049  strat->sevS=initsevS(i);
8050  strat->S_2_R=initS_2_R(i);
8051  strat->fromQ=NULL;
8052  strat->Shdl=idInit(i,F->rank);
8053  strat->S=strat->Shdl->m;
8054  /*- put polys into S -*/
8055  if (Q!=NULL)
8056  {
8057  strat->fromQ=initec(i);
8058  memset(strat->fromQ,0,i*sizeof(int));
8059  for (i=0; i<IDELEMS(Q); i++)
8060  {
8061  if (Q->m[i]!=NULL)
8062  {
8063  LObject h;
8064  h.p = pCopy(Q->m[i]);
8066  {
8067  //pContent(h.p);
8068  h.pCleardenom(); // also does a pContent
8069  }
8070  else
8071  {
8072  h.pNorm();
8073  }
8075  {
8076  deleteHC(&h, strat);
8077  }
8078  if (h.p!=NULL)
8079  {
8080  strat->initEcart(&h);
8081  if (strat->sl==-1)
8082  pos =0;
8083  else
8084  {
8085  pos = posInS(strat,strat->sl,h.p,h.ecart);
8086  }
8087  h.sev = pGetShortExpVector(h.p);
8088  strat->enterS(h,pos,strat,-1);
8089  strat->fromQ[pos]=1;
8090  }
8091  }
8092  }
8093  }
8094  for (i=0; i<IDELEMS(F); i++)
8095  {
8096  if (F->m[i]!=NULL)
8097  {
8098  LObject h;
8099  h.p = pCopy(F->m[i]);
8101  {
8102  cancelunit(&h); /*- tries to cancel a unit -*/
8103  deleteHC(&h, strat);
8104  }
8105  if (h.p!=NULL)
8106  // do not rely on the input being a SB!
8107  {
8109  {
8110  //pContent(h.p);
8111  h.pCleardenom(); // also does a pContent
8112  }
8113  else
8114  {
8115  h.pNorm();
8116  }
8117  strat->initEcart(&h);
8118  if (strat->sl==-1)
8119  pos =0;
8120  else
8121  pos = posInS(strat,strat->sl,h.p,h.ecart);
8122  h.sev = pGetShortExpVector(h.p);
8123  strat->enterS(h,pos,strat,-1);
8124  }
8125  }
8126  }
8127  /*- test, if a unit is in F -*/
8128  if ((strat->sl>=0)
8129 #ifdef HAVE_RINGS
8130  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8131 #endif
8132  && pIsConstant(strat->S[0]))
8133  {
8134  while (strat->sl>0) deleteInS(strat->sl,strat);
8135  }
8136 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
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:1041
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:5111
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:750
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1249
BOOLEAN honey
Definition: kutil.h:374
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9340
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:697
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:536
int currIdx
Definition: kutil.h:311
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
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:1290
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:1256
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
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:865
#define IDELEMS(i)
Definition: simpleideals.h:24
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3508
#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:1234
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 10297 of file kutil.cc.

10298 {
10299  strat->interpt = BTEST1(OPT_INTERRUPT);
10300  strat->kHEdge=NULL;
10302  /*- creating temp data structures------------------- -*/
10303  strat->cp = 0;
10304  strat->c3 = 0;
10305  strat->tail = pInit();
10306  /*- set s -*/
10307  strat->sl = -1;
10308  /*- set ps -*/
10309  strat->syzl = -1;
10310  /*- set L -*/
10311  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10312  strat->Ll = -1;
10313  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10314  /*- set B -*/
10315  strat->Bmax = setmaxL;
10316  strat->Bl = -1;
10317  strat->B = initL();
10318  /*- set T -*/
10319  strat->tl = -1;
10320  strat->tmax = setmaxT;
10321  strat->T = initT();
10322  strat->R = initR();
10323  strat->sevT = initsevT();
10324  /*- init local data struct.---------------------------------------- -*/
10325  strat->P.ecart=0;
10326  strat->P.length=0;
10328  {
10329  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10330  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10331  }
10333  {
10334  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10335  }
10336  else
10337  {
10338  if(TEST_OPT_SB_1)
10339  {
10340  int i;
10341  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10342  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10343  {
10344  P->m[i-strat->newIdeal] = F->m[i];
10345  F->m[i] = NULL;
10346  }
10347  initSSpecialSba(F,Q,P,strat);
10348  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10349  {
10350  F->m[i] = P->m[i-strat->newIdeal];
10351  P->m[i-strat->newIdeal] = NULL;
10352  }
10353  idDelete(&P);
10354  }
10355  else
10356  {
10357  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10358  }
10359  }
10360  strat->fromT = FALSE;
10361  if (!TEST_OPT_SB_1)
10362  {
10363  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10364  }
10365  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10366  //strat->fromQ=NULL;
10367  assume(kTest_TS(strat));
10368 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
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:8689
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:8237
#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:654
#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:749
#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:9009
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 9841 of file kutil.cc.

9842 {
9843  //strat->enterOnePair=enterOnePairNormal;
9845  //strat->chainCrit=chainCritNormal;
9846  strat->chainCrit = chainCritSig;
9847  /******************************************
9848  * rewCrit1 and rewCrit2 are already set in
9849  * kSba() in kstd1.cc
9850  *****************************************/
9851  //strat->rewCrit1 = faugereRewCriterion;
9852  if (strat->sbaOrder == 1)
9853  {
9854  strat->syzCrit = syzCriterionInc;
9855  }
9856  else
9857  {
9858  strat->syzCrit = syzCriterion;
9859  }
9860 #ifdef HAVE_RINGS
9861  if (rField_is_Ring(currRing))
9862  {
9864  strat->chainCrit=chainCritRing;
9865  }
9866 #endif
9867 #ifdef HAVE_RATGRING
9868  if (rIsRatGRing(currRing))
9869  {
9870  strat->chainCrit=chainCritPart;
9871  /* enterOnePairNormal get rational part in it */
9872  }
9873 #endif
9874 
9875  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9876  strat->Gebauer = strat->homog || strat->sugarCrit;
9877  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9878  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9879  strat->pairtest = NULL;
9880  /* alway use tailreduction, except:
9881  * - in local rings, - in lex order case, -in ring over extensions */
9884 
9885 #ifdef HAVE_PLURAL
9886  // and r is plural_ring
9887  // hence this holds for r a rational_plural_ring
9888  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9889  { //or it has non-quasi-comm type... later
9890  strat->sugarCrit = FALSE;
9891  strat->Gebauer = FALSE;
9892  strat->honey = FALSE;
9893  }
9894 #endif
9895 
9896  // Coefficient ring?
9897  if (rField_is_Ring(currRing))
9898  {
9899  strat->sugarCrit = FALSE;
9900  strat->Gebauer = FALSE ;
9901  strat->honey = FALSE;
9902  }
9903  #ifdef KDEBUG
9904  if (TEST_OPT_DEBUG)
9905  {
9906  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9907  else PrintS("ideal/module is not homogeneous\n");
9908  }
9909  #endif
9910 }
#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
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3482
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1937
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:4023
#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:751
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7121
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7159
#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 enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3541

§ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10195 of file kutil.cc.

10196 {
10198  {
10199  if (strat->honey)
10200  {
10201  strat->posInL = posInL15;
10202  // ok -- here is the deal: from my experiments for Singular-2-0
10203  // I conclude that that posInT_EcartpLength is the best of
10204  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10205  // see the table at the end of this file
10206  if (TEST_OPT_OLDSTD)
10207  strat->posInT = posInT15;
10208  else
10209  strat->posInT = posInT_EcartpLength;
10210  }
10211  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10212  {
10213  strat->posInL = posInL11;
10214  strat->posInT = posInT11;
10215  }
10216  else if (TEST_OPT_INTSTRATEGY)
10217  {
10218  strat->posInL = posInL11;
10219  strat->posInT = posInT11;
10220  }
10221  else
10222  {
10223  strat->posInL = posInL0;
10224  strat->posInT = posInT0;
10225  }
10226  //if (strat->minim>0) strat->posInL =posInLSpecial;
10227  if (strat->homog)
10228  {
10229  strat->posInL = posInL110;
10230  strat->posInT = posInT110;
10231  }
10232  }
10233  else
10234  {
10235  if (strat->homog)
10236  {
10237  strat->posInL = posInL11;
10238  strat->posInT = posInT11;
10239  }
10240  else
10241  {
10242  if ((currRing->order[0]==ringorder_c)
10243  ||(currRing->order[0]==ringorder_C))
10244  {
10245  strat->posInL = posInL17_c;
10246  strat->posInT = posInT17_c;
10247  }
10248  else
10249  {
10250  strat->posInL = posInL17;
10251  strat->posInT = posInT17;
10252  }
10253  }
10254  }
10255  if (strat->minim>0) strat->posInL =posInLSpecial;
10256  // for further tests only
10257  if ((BTEST1(11)) || (BTEST1(12)))
10258  strat->posInL = posInL11;
10259  else if ((BTEST1(13)) || (BTEST1(14)))
10260  strat->posInL = posInL13;
10261  else if ((BTEST1(15)) || (BTEST1(16)))
10262  strat->posInL = posInL15;
10263  else if ((BTEST1(17)) || (BTEST1(18)))
10264  strat->posInL = posInL17;
10265  if (BTEST1(11))
10266  strat->posInT = posInT11;
10267  else if (BTEST1(13))
10268  strat->posInT = posInT13;
10269  else if (BTEST1(15))
10270  strat->posInT = posInT15;
10271  else if ((BTEST1(17)))
10272  strat->posInT = posInT17;
10273  else if ((BTEST1(19)))
10274  strat->posInT = posInT19;
10275  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10276  strat->posInT = posInT1;
10277  if (rField_is_Ring(currRing))
10278  {
10279  strat->posInL = posInL11Ring;
10280  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10281  strat->posInL = posInL11Ringls;
10282  strat->posInT = posInT11;
10283  }
10284  strat->posInLDependsOnLength = FALSE;
10285  strat->posInLSba = posInLSig;
10286  //strat->posInL = posInLSig;
10287  strat->posInL = posInLF5C;
10288  /*
10289  if (rField_is_Ring(currRing))
10290  {
10291  strat->posInLSba = posInLSigRing;
10292  strat->posInL = posInL11Ring;
10293  }*/
10294  //strat->posInT = posInTSig;
10295 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6399
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:6896
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6441
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6511
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5344
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6785
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:6387
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5712
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:6697
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5333
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6199
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:5402
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5914
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:6141
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6990
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5807
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5555
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6098
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6041
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5673
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5644

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

8139 {
8140  int i,pos;
8141 
8142  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8143  else i=setmaxT;
8144  strat->ecartS=initec(i);
8145  strat->sevS=initsevS(i);
8146  strat->S_2_R=initS_2_R(i);
8147  strat->fromQ=NULL;
8148  strat->Shdl=idInit(i,F->rank);
8149  strat->S=strat->Shdl->m;
8150  /*- put polys into S -*/
8151  if (Q!=NULL)
8152  {
8153  strat->fromQ=initec(i);
8154  memset(strat->fromQ,0,i*sizeof(int));
8155  for (i=0; i<IDELEMS(Q); i++)
8156  {
8157  if (Q->m[i]!=NULL)
8158  {
8159  LObject h;
8160  h.p = pCopy(Q->m[i]);
8162  {
8163  deleteHC(&h,strat);
8164  }
8166  {
8167  //pContent(h.p);
8168  h.pCleardenom(); // also does a pContent
8169  }
8170  else
8171  {
8172  h.pNorm();
8173  }
8174  if (h.p!=NULL)
8175  {
8176  strat->initEcart(&h);
8177  if (strat->sl==-1)
8178  pos =0;
8179  else
8180  {
8181  pos = posInS(strat,strat->sl,h.p,h.ecart);
8182  }
8183  h.sev = pGetShortExpVector(h.p);
8184  strat->enterS(h,pos,strat,-1);
8185  strat->fromQ[pos]=1;
8186  }
8187  }
8188  }
8189  }
8190  for (i=0; i<IDELEMS(F); i++)
8191  {
8192  if (F->m[i]!=NULL)
8193  {
8194  LObject h;
8195  h.p = pCopy(F->m[i]);
8196  if (h.p!=NULL)
8197  {
8199  {
8200  cancelunit(&h); /*- tries to cancel a unit -*/
8201  deleteHC(&h, strat);
8202  }
8203  if (h.p!=NULL)
8204  {
8206  {
8207  //pContent(h.p);
8208  h.pCleardenom(); // also does a pContent
8209  }
8210  else
8211  {
8212  h.pNorm();
8213  }
8214  strat->initEcart(&h);
8215  if (strat->Ll==-1)
8216  pos =0;
8217  else
8218  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8219  h.sev = pGetShortExpVector(h.p);
8220  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8221  }
8222  }
8223  }
8224  }
8225  /*- test, if a unit is in F -*/
8226 
8227  if ((strat->Ll>=0)
8228 #ifdef HAVE_RINGS
8229  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8230 #endif
8231  && pIsConstant(strat->L[strat->Ll].p))
8232  {
8233  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8234  }
8235 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
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:1210
#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:1148
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:5111
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 8237 of file kutil.cc.

8238 {
8239  int i,pos;
8240  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8241  else i=setmaxT;
8242  strat->ecartS = initec(i);
8243  strat->sevS = initsevS(i);
8244  strat->sevSig = initsevS(i);
8245  strat->S_2_R = initS_2_R(i);
8246  strat->fromQ = NULL;
8247  strat->Shdl = idInit(i,F->rank);
8248  strat->S = strat->Shdl->m;
8249  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8250  if (strat->sbaOrder != 1)
8251  {
8252  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8253  strat->sevSyz = initsevS(i);
8254  strat->syzmax = i;
8255  strat->syzl = 0;
8256  }
8257  /*- put polys into S -*/
8258  if (Q!=NULL)
8259  {
8260  strat->fromQ=initec(i);
8261  memset(strat->fromQ,0,i*sizeof(int));
8262  for (i=0; i<IDELEMS(Q); i++)
8263  {
8264  if (Q->m[i]!=NULL)
8265  {
8266  LObject h;
8267  h.p = pCopy(Q->m[i]);
8269  {
8270  deleteHC(&h,strat);
8271  }
8273  {
8274  //pContent(h.p);
8275  h.pCleardenom(); // also does a pContent
8276  }
8277  else
8278  {
8279  h.pNorm();
8280  }
8281  if (h.p!=NULL)
8282  {
8283  strat->initEcart(&h);
8284  if (strat->sl==-1)
8285  pos =0;
8286  else
8287  {
8288  pos = posInS(strat,strat->sl,h.p,h.ecart);
8289  }
8290  h.sev = pGetShortExpVector(h.p);
8291  strat->enterS(h,pos,strat,-1);
8292  strat->fromQ[pos]=1;
8293  }
8294  }
8295  }
8296  }
8297  for (i=0; i<IDELEMS(F); i++)
8298  {
8299  if (F->m[i]!=NULL)
8300  {
8301  LObject h;
8302  h.p = pCopy(F->m[i]);
8303  h.sig = pOne();
8304  //h.sig = pInit();
8305  //p_SetCoeff(h.sig,nInit(1),currRing);
8306  p_SetComp(h.sig,i+1,currRing);
8307  // if we are working with the Schreyer order we generate it
8308  // by multiplying the initial signatures with the leading monomial
8309  // of the corresponding initial polynomials generating the ideal
8310  // => we can keep the underlying monomial order and get a Schreyer
8311  // order without any bigger overhead
8312  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8313  {
8314  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8315  }
8316  h.sevSig = pGetShortExpVector(h.sig);
8317 #ifdef DEBUGF5
8318  pWrite(h.p);
8319  pWrite(h.sig);
8320 #endif
8321  if (h.p!=NULL)
8322  {
8324  {
8325  cancelunit(&h); /*- tries to cancel a unit -*/
8326  deleteHC(&h, strat);
8327  }
8328  if (h.p!=NULL)
8329  {
8331  {
8332  //pContent(h.p);
8333  h.pCleardenom(); // also does a pContent
8334  }
8335  else
8336  {
8337  h.pNorm();
8338  }
8339  strat->initEcart(&h);
8340  if (strat->Ll==-1)
8341  pos =0;
8342  else
8343  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8344  h.sev = pGetShortExpVector(h.p);
8345  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8346  }
8347  }
8348  /*
8349  if (strat->sbaOrder != 1)
8350  {
8351  for(j=0;j<i;j++)
8352  {
8353  strat->syz[ctr] = pCopy(F->m[j]);
8354  p_SetCompP(strat->syz[ctr],i+1,currRing);
8355  // add LM(F->m[i]) to the signature to get a Schreyer order
8356  // without changing the underlying polynomial ring at all
8357  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8358  // since p_Add_q() destroys all input
8359  // data we need to recreate help
8360  // each time
8361  poly help = pCopy(F->m[i]);
8362  p_SetCompP(help,j+1,currRing);
8363  pWrite(strat->syz[ctr]);
8364  pWrite(help);
8365  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8366  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8367  printf("%d. SYZ ",ctr);
8368  pWrite(strat->syz[ctr]);
8369  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8370  ctr++;
8371  }
8372  strat->syzl = ps;
8373  }
8374  */
8375  }
8376  }
8377  /*- test, if a unit is in F -*/
8378 
8379  if ((strat->Ll>=0)
8380 #ifdef HAVE_RINGS
8381  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8382 #endif
8383  && pIsConstant(strat->L[strat->Ll].p))
8384  {
8385  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8386  }
8387 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
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:1210
#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:1148
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:5111
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 8389 of file kutil.cc.

8390 {
8391  if( strat->S[0] )
8392  {
8393  if( strat->S[1] && !rField_is_Ring(currRing))
8394  {
8395  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8396  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8397  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8398  }
8399  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8400  /************************************************************
8401  * computing the length of the syzygy array needed
8402  ***********************************************************/
8403  for(i=1; i<=strat->sl; i++)
8404  {
8405  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8406  {
8407  ps += i;
8408  }
8409  }
8410  ps += strat->sl+1;
8411  //comp = pGetComp (strat->P.sig);
8412  comp = strat->currIdx;
8413  strat->syzIdx = initec(comp);
8414  strat->sevSyz = initsevS(ps);
8415  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8416  strat->syzmax = ps;
8417  strat->syzl = 0;
8418  strat->syzidxmax = comp;
8419 #if defined(DEBUGF5) || defined(DEBUGF51)
8420  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8421 #endif
8422  i = 1;
8423  j = 0;
8424  /************************************************************
8425  * generating the leading terms of the principal syzygies
8426  ***********************************************************/
8427  while (i <= strat->sl)
8428  {
8429  /**********************************************************
8430  * principal syzygies start with component index 2
8431  * the array syzIdx starts with index 0
8432  * => the rules for a signature with component comp start
8433  * at strat->syz[strat->syzIdx[comp-2]] !
8434  *********************************************************/
8435  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8436  {
8437  comp = pGetComp(strat->sig[i]);
8438  comp_old = pGetComp(strat->sig[i-1]);
8439  diff = comp - comp_old - 1;
8440  // diff should be zero, but sometimes also the initial generating
8441  // elements of the input ideal reduce to zero. then there is an
8442  // index-gap between the signatures. for these inbetween signatures we
8443  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8444  // in the following.
8445  // doing this, we keep the relation "j = comp - 2" alive, which makes
8446  // jumps way easier when checking criteria
8447  while (diff>0)
8448  {
8449  strat->syzIdx[j] = 0;
8450  diff--;
8451  j++;
8452  }
8453  strat->syzIdx[j] = ctr;
8454  j++;
8455  LObject Q;
8456  int pos;
8457  for (k = 0; k<i; k++)
8458  {
8459  Q.sig = pOne();
8461  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8462  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8463  p_SetCompP (Q.sig, comp, currRing);
8464  poly q = p_One(currRing);
8466  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8467  p_ExpVectorCopy(q,strat->S[i],currRing);
8468  q = p_Neg (q, currRing);
8469  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8470  Q.sig = p_Add_q (Q.sig, q, currRing);
8471  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8472  pos = posInSyz(strat, Q.sig);
8473  enterSyz(Q, strat, pos);
8474  ctr++;
8475  }
8476  }
8477  i++;
8478  }
8479  /**************************************************************
8480  * add syzygies for upcoming first element of new iteration step
8481  **************************************************************/
8482  comp = strat->currIdx;
8483  comp_old = pGetComp(strat->sig[i-1]);
8484  diff = comp - comp_old - 1;
8485  // diff should be zero, but sometimes also the initial generating
8486  // elements of the input ideal reduce to zero. then there is an
8487  // index-gap between the signatures. for these inbetween signatures we
8488  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8489  // in the following.
8490  // doing this, we keep the relation "j = comp - 2" alive, which makes
8491  // jumps way easier when checking criteria
8492  while (diff>0)
8493  {
8494  strat->syzIdx[j] = 0;
8495  diff--;
8496  j++;
8497  }
8498  strat->syzIdx[j] = ctr;
8499  LObject Q;
8500  int pos;
8501  for (k = 0; k<strat->sl+1; k++)
8502  {
8503  Q.sig = pOne();
8505  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8506  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8507  p_SetCompP (Q.sig, comp, currRing);
8508  poly q = p_One(currRing);
8510  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8511  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8512  q = p_Neg (q, currRing);
8513  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8514  Q.sig = p_Add_q (Q.sig, q, currRing);
8515  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8516  pos = posInSyz(strat, Q.sig);
8517  enterSyz(Q, strat, pos);
8518  ctr++;
8519  }
8520 //#if 1
8521 #ifdef DEBUGF5
8522  PrintS("Principal syzygies:\n");
8523  Print("syzl %d\n",strat->syzl);
8524  Print("syzmax %d\n",strat->syzmax);
8525  Print("ps %d\n",ps);
8526  PrintS("--------------------------------\n");
8527  for(i=0;i<=strat->syzl-1;i++)
8528  {
8529  Print("%d - ",i);
8530  pWrite(strat->syz[i]);
8531  }
8532  for(i=0;i<strat->currIdx;i++)
8533  {
8534  Print("%d - %d\n",i,strat->syzIdx[i]);
8535  }
8536  PrintS("--------------------------------\n");
8537 #endif
8538  }
8539 }
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:4588
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:6359
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:9675
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 10811 of file kutil.cc.

10812 {
10813  if (strat->overflow) return FALSE;
10814  assume(L->p1 != NULL && L->p2 != NULL);
10815  // shift changes: from 0 to -1
10816  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10817  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10818  assume(strat->tailRing != currRing);
10819 
10820  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10821  return FALSE;
10822  // shift changes: extra case inserted
10823  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10824  {
10825  return TRUE;
10826  }
10827  poly p1_max = (strat->R[L->i_r1])->max_exp;
10828  poly p2_max = (strat->R[L->i_r2])->max_exp;
10829 
10830  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10831  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10832  {
10833  p_LmFree(m1, strat->tailRing);
10834  p_LmFree(m2, strat->tailRing);
10835  m1 = NULL;
10836  m2 = NULL;
10837  return FALSE;
10838  }
10839  return TRUE;
10840 }
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 10849 of file kutil.cc.

10850 {
10851  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10852  //assume(strat->tailRing != currRing);
10853 
10854  poly p1_max = (strat->R[atR])->max_exp;
10855  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10856 
10857  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10858  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10859  {
10860  return FALSE;
10861  }
10862  return TRUE;
10863 }
#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 4415 of file kutil.cc.

4416 {
4417 
4418  poly zeroPoly = NULL;
4419 
4420  number tmp1;
4421  poly tmp2, tmp3;
4422 
4423  if (cabsind == -1)
4424  {
4425  cabsind = 0;
4426  for (int i = 1; i <= leadRing->N; i++)
4427  {
4428  cabsind += ind_fact_2(exp[i]);
4429  }
4430 // Print("cabsind: %d\n", cabsind);
4431  }
4432  if (cabsind < leadRing->ch)
4433  {
4434  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4435  }
4436  else
4437  {
4438  zeroPoly = p_ISet(1, tailRing);
4439  }
4440  for (int i = 1; i <= leadRing->N; i++)
4441  {
4442  for (long j = 1; j <= exp[i]; j++)
4443  {
4444  tmp1 = nInit(j);
4445  tmp2 = p_ISet(1, tailRing);
4446  p_SetExp(tmp2, i, 1, tailRing);
4447  p_Setm(tmp2, tailRing);
4448  if (nIsZero(tmp1))
4449  { // should nowbe obsolet, test ! TODO OLIVER
4450  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4451  }
4452  else
4453  {
4454  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4455  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4456  }
4457  }
4458  }
4459  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4460  for (int i = 1; i <= leadRing->N; i++)
4461  {
4462  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4463  }
4464  p_Setm(tmp2, leadRing);
4465  *t_p = zeroPoly;
4466  zeroPoly = pNext(zeroPoly);
4467  pNext(*t_p) = NULL;
4468  pNext(tmp2) = zeroPoly;
4469  return tmp2;
4470 }
#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:4223
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:4208
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 11806 of file kutil.cc.

11807 {
11808  PrintS("red: ");
11809  if (strat->red==redFirst) PrintS("redFirst\n");
11810  else if (strat->red==redHoney) PrintS("redHoney\n");
11811  else if (strat->red==redEcart) PrintS("redEcart\n");
11812  else if (strat->red==redHomog) PrintS("redHomog\n");
11813  else Print("%p\n",(void*)strat->red);
11814  PrintS("posInT: ");
11815  if (strat->posInT==posInT0) PrintS("posInT0\n");
11816  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11817  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11818  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11819  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11820  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11821  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11822  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11823  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11824  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11825  #ifdef HAVE_RINGS
11826  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11827  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11828  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11829  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11830  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11831  #endif
11832 #ifdef HAVE_MORE_POS_IN_T
11833  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11834  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11835  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11836 #endif
11837  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11838  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11839  else Print("%p\n",(void*)strat->posInT);
11840  PrintS("posInL: ");
11841  if (strat->posInL==posInL0) PrintS("posInL0\n");
11842  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11843  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11844  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11845  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11846  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11847  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11848  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11849  #ifdef HAVE_RINGS
11850  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11851  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11852  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11853  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11854  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11855  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11856  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11857  #endif
11858  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11859  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11860  else Print("%p\n",(void*)strat->posInL);
11861  PrintS("enterS: ");
11862  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11863  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11864  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11865  else Print("%p\n",(void*)strat->enterS);
11866  PrintS("initEcart: ");
11867  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11868  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11869  else Print("%p\n",(void*)strat->initEcart);
11870  PrintS("initEcartPair: ");
11871  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11872  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11873  else Print("%p\n",(void*)strat->initEcartPair);
11874  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11875  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11876  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11877  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11878  PrintS("chainCrit: ");
11879  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11880  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11881  else Print("%p\n",(void*)strat->chainCrit);
11882  Print("posInLDependsOnLength=%d\n",
11883  strat->posInLDependsOnLength);
11884  PrintS(showOption());PrintLn();
11885  PrintS("LDeg: ");
11886  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11887  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11888  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11889  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11890  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11891  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11892  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11893  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11894  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11895  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11896  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11897  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11898  else Print("? (%lx)", (long)currRing->pLDeg);
11899  PrintS(" / ");
11900  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11901  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11902  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11903  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11904  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11905  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11906  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11907  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11908  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11909  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11910  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11911  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11912  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11913  PrintLn();
11914  PrintS("currRing->pFDeg: ");
11915  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11916  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11917  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11918  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11919  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11920  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11921  else Print("? (%lx)", (long)currRing->pFDeg);
11922  PrintLn();
11923  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11924  if(TEST_OPT_DEGBOUND)
11925  Print(" degBound: %d\n", Kstd1_deg);
11926 
11927  if( ecartWeights != NULL )
11928  {
11929  PrintS("ecartWeights: ");
11930  for (int i = rVar(currRing); i > 0; i--)
11931  Print("%hd ", ecartWeights[i]);
11932  PrintLn();
11934  }
11935 
11936 #ifndef SING_NDEBUG
11938 #endif
11939 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1249
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6399
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11772
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:5479
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6896
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:5372
#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:6441
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6511
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:6855
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:5344
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3253
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6613
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6940
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:6820
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:6785
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6738
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:5766
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:7054
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5712
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:536
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:6697
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5333
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
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:5402
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5914
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:5438
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
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:1242
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5868
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:6141
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6990
void rDebugPrint(const ring r)
Definition: ring.cc:3998
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:5807
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:11681
#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:5555
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3466
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:6098
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:6041
void initEcartNormal(TObject *h)
Definition: kutil.cc:1234
int LazyPass
Definition: kutil.h:349
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11735
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5673
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:5975
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5644
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9238

§ 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:4588
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:5111
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 7367 of file kutil.cc.

7369 {
7370  int j = 0;
7371  const unsigned long not_sev = ~L->sev;
7372  const unsigned long* sev = strat->sevS;
7373  poly p;
7374  ring r;
7375  L->GetLm(p, r);
7376 
7377  assume(~not_sev == p_GetShortExpVector(p, r));
7378 
7379  if (r == currRing)
7380  {
7381  if(!rField_is_Ring(r))
7382  {
7383  loop
7384  {
7385  if (j > pos) return NULL;
7386  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7387  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7388  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7389  {
7390  break;
7391  }
7392  #else
7393  if (!(sev[j] & not_sev) &&
7394  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7395  p_LmDivisibleBy(strat->S[j], p, r))
7396  {
7397  break;
7398  }
7399  #endif
7400  j++;
7401  }
7402  }
7403  #ifdef HAVE_RINGS
7404  else
7405  {
7406  loop
7407  {
7408  if (j > pos) return NULL;
7409  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7410  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7411  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7412  {
7413  break;
7414  }
7415  #else
7416  if (!(sev[j] & not_sev) &&
7417  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7418  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7419  {
7420  break;
7421  }
7422  #endif
7423  j++;
7424  }
7425  }
7426  #endif
7427  // if called from NF, T objects do not exist:
7428  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7429  {
7430  T->Set(strat->S[j], r, strat->tailRing);
7431  return T;
7432  }
7433  else
7434  {
7435 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7436 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7437 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7438  return strat->S_2_T(j);
7439  }
7440  }
7441  else
7442  {
7443  TObject* t;
7444  if(!rField_is_Ring(r))
7445  {
7446  loop
7447  {
7448  if (j > pos) return NULL;
7449  assume(strat->S_2_R[j] != -1);
7450  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7451  t = strat->S_2_T(j);
7452  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7453  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7454  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7455  {
7456  return t;
7457  }
7458  #else
7459  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7460  {
7461  t = strat->S_2_T(j);
7462  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7463  if (p_LmDivisibleBy(t->t_p, p, r))
7464  {
7465  return t;
7466  }
7467  }
7468  #endif
7469  j++;
7470  }
7471  }
7472  #ifdef HAVE_RINGS
7473  else
7474  {
7475  loop
7476  {
7477  if (j > pos) return NULL;
7478  assume(strat->S_2_R[j] != -1);
7479  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7480  t = strat->S_2_T(j);
7481  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7482  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7483  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7484  {
7485  return t;
7486  }
7487  #else
7488  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7489  {
7490  t = strat->S_2_T(j);
7491  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7492  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7493  {
7494  return t;
7495  }
7496  }
7497  #endif
7498  j++;
7499  }
7500  }
7501  #endif
7502  }
7503 }
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:4588
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:4588
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:4588
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:4208
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:4196
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 3377 of file kstd2.cc.

3378 {
3379  assume(q!=NULL);
3380  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3381 
3382 // lazy_reduce flags: can be combined by |
3383 //#define KSTD_NF_LAZY 1
3384  // do only a reduction of the leading term
3385 //#define KSTD_NF_NONORM 4
3386  // only global: avoid normalization, return a multiply of NF
3387  poly p;
3388 
3389  //if ((idIs0(F))&&(Q==NULL))
3390  // return pCopy(q); /*F=0*/
3391  //strat->ak = idRankFreeModule(F);
3392  /*- creating temp data structures------------------- -*/
3393  BITSET save1;
3394  SI_SAVE_OPT1(save1);
3396  initBuchMoraCrit(strat);
3397  strat->initEcart = initEcartBBA;
3398  strat->enterS = enterSBba;
3399 #ifndef NO_BUCKETS
3401 #endif
3402  /*- set S -*/
3403  strat->sl = -1;
3404  /*- init local data struct.---------------------------------------- -*/
3405  /*Shdl=*/initS(F,Q,strat);
3406  /*- compute------------------------------------------------------- -*/
3407  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3408  //{
3409  // for (i=strat->sl;i>=0;i--)
3410  // pNorm(strat->S[i]);
3411  //}
3412  kTest(strat);
3413  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3414  if (BVERBOSE(23)) kDebugPrint(strat);
3415  int max_ind;
3416  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3417  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3418  {
3419  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3420  if (rField_is_Ring(currRing))
3421  {
3422  p = redtailBba_Z(p,max_ind,strat);
3423  }
3424  else
3425  {
3427  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3428  }
3429  }
3430  /*- release temp data------------------------------- -*/
3431  assume(strat->L==NULL); /* strat->L unused */
3432  assume(strat->B==NULL); /* strat->B unused */
3433  omFree(strat->sevS);
3434  omFree(strat->ecartS);
3435  assume(strat->T==NULL);//omfree(strat->T);
3436  assume(strat->sevT==NULL);//omfree(strat->sevT);
3437  assume(strat->R==NULL);//omfree(strat->R);
3438  omfree(strat->S_2_R);
3439  omfree(strat->fromQ);
3440  idDelete(&strat->Shdl);
3441  SI_RESTORE_OPT1(save1);
3442  if (TEST_OPT_PROT) PrintLn();
3443  return p;
3444 }
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:653
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:1654
#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:8042
#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:1242
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:9777
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:11806
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:9238
#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 3516 of file kstd2.cc.

3517 {
3518  assume(!idIs0(q));
3519  assume(!(idIs0(F)&&(Q==NULL)));
3520 // lazy_reduce flags: can be combined by |
3521 //#define KSTD_NF_LAZY 1
3522  // do only a reduction of the leading term
3523 //#define KSTD_NF_NONORM 4
3524  // only global: avoid normalization, return a multiply of NF
3525  poly p;
3526  int i;
3527  ideal res;
3528  int max_ind;
3529 
3530  //if (idIs0(q))
3531  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3532  //if ((idIs0(F))&&(Q==NULL))
3533  // return idCopy(q); /*F=0*/
3534  //strat->ak = idRankFreeModule(F);
3535  /*- creating temp data structures------------------- -*/
3536  BITSET save1;
3537  SI_SAVE_OPT1(save1);
3539  initBuchMoraCrit(strat);
3540  strat->initEcart = initEcartBBA;
3541  strat->enterS = enterSBba;
3542  /*- set S -*/
3543  strat->sl = -1;
3544 #ifndef NO_BUCKETS
3546 #endif
3547  /*- init local data struct.---------------------------------------- -*/
3548  /*Shdl=*/initS(F,Q,strat);
3549  /*- compute------------------------------------------------------- -*/
3550  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3552  for (i=IDELEMS(q)-1; i>=0; i--)
3553  {
3554  if (q->m[i]!=NULL)
3555  {
3556  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3557  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3558  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3559  {
3560  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3561  if (rField_is_Ring(currRing))
3562  {
3563  p = redtailBba_Z(p,max_ind,strat);
3564  }
3565  else
3566  {
3567  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3568  }
3569  }
3570  res->m[i]=p;
3571  }
3572  //else
3573  // res->m[i]=NULL;
3574  }
3575  /*- release temp data------------------------------- -*/
3576  assume(strat->L==NULL); /* strat->L unused */
3577  assume(strat->B==NULL); /* strat->B unused */
3578  omFree(strat->sevS);
3579  omFree(strat->ecartS);
3580  assume(strat->T==NULL);//omfree(strat->T);
3581  assume(strat->sevT==NULL);//omfree(strat->sevT);
3582  assume(strat->R==NULL);//omfree(strat->R);
3583  omfree(strat->S_2_R);
3584  omfree(strat->fromQ);
3585  idDelete(&strat->Shdl);
3586  SI_RESTORE_OPT1(save1);
3587  if (TEST_OPT_PROT) PrintLn();
3588  return res;
3589 }
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:1654
#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:8042
#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:1242
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:9777
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:9238
#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 3446 of file kstd2.cc.

3447 {
3448  assume(q!=NULL);
3449  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3450 
3451 // lazy_reduce flags: can be combined by |
3452 //#define KSTD_NF_LAZY 1
3453  // do only a reduction of the leading term
3454 //#define KSTD_NF_NONORM 4
3455  // only global: avoid normalization, return a multiply of NF
3456  poly p;
3457 
3458  //if ((idIs0(F))&&(Q==NULL))
3459  // return pCopy(q); /*F=0*/
3460  //strat->ak = idRankFreeModule(F);
3461  /*- creating temp data structures------------------- -*/
3462  BITSET save1;
3463  SI_SAVE_OPT1(save1);
3465  initBuchMoraCrit(strat);
3466  strat->initEcart = initEcartBBA;
3467  strat->enterS = enterSBba;
3468 #ifndef NO_BUCKETS
3470 #endif
3471  /*- set S -*/
3472  strat->sl = -1;
3473  /*- init local data struct.---------------------------------------- -*/
3474  /*Shdl=*/initS(F,Q,strat);
3475  /*- compute------------------------------------------------------- -*/
3476  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3477  //{
3478  // for (i=strat->sl;i>=0;i--)
3479  // pNorm(strat->S[i]);
3480  //}
3481  kTest(strat);
3482  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3483  if (BVERBOSE(23)) kDebugPrint(strat);
3484  int max_ind;
3485  p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3486  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3487  {
3488  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3489  if (rField_is_Ring(currRing))
3490  {
3491  p = redtailBba_Z(p,max_ind,strat);
3492  }
3493  else
3494  {
3496  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3497  //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3498  }
3499  }
3500  /*- release temp data------------------------------- -*/
3501  assume(strat->L==NULL); /* strat->L unused */
3502  assume(strat->B==NULL); /* strat->B unused */
3503  omFree(strat->sevS);
3504  omFree(strat->ecartS);
3505  assume(strat->T==NULL);//omfree(strat->T);
3506  assume(strat->sevT==NULL);//omfree(strat->sevT);
3507  assume(strat->R==NULL);//omfree(strat->R);
3508  omfree(strat->S_2_R);
3509  omfree(strat->fromQ);
3510  idDelete(&strat->Shdl);
3511  SI_RESTORE_OPT1(save1);
3512  if (TEST_OPT_PROT) PrintLn();
3513  return p;
3514 }
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:1802
#define kTest(A)
Definition: kutil.h:653
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:8042
#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:1242
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:9777
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:11806
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:9238
#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 3591 of file kstd2.cc.

3592 {
3593  assume(!idIs0(q));
3594  assume(!(idIs0(F)&&(Q==NULL)));
3595 // lazy_reduce flags: can be combined by |
3596 //#define KSTD_NF_LAZY 1
3597  // do only a reduction of the leading term
3598 //#define KSTD_NF_NONORM 4
3599  // only global: avoid normalization, return a multiply of NF
3600  poly p;
3601  int i;
3602  ideal res;
3603  int max_ind;
3604 
3605  //if (idIs0(q))
3606  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3607  //if ((idIs0(F))&&(Q==NULL))
3608  // return idCopy(q); /*F=0*/
3609  //strat->ak = idRankFreeModule(F);
3610  /*- creating temp data structures------------------- -*/
3611  BITSET save1;
3612  SI_SAVE_OPT1(save1);
3614  initBuchMoraCrit(strat);
3615  strat->initEcart = initEcartBBA;
3616  strat->enterS = enterSBba;
3617  /*- set S -*/
3618  strat->sl = -1;
3619 #ifndef NO_BUCKETS
3621 #endif
3622  /*- init local data struct.---------------------------------------- -*/
3623  /*Shdl=*/initS(F,Q,strat);
3624  /*- compute------------------------------------------------------- -*/
3625  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3627  for (i=IDELEMS(q)-1; i>=0; i--)
3628  {
3629  if (q->m[i]!=NULL)
3630  {
3631  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3632  p = redNFBound(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3633  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3634  {
3635  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3636  if (rField_is_Ring(currRing))
3637  {
3638  p = redtailBba_Z(p,max_ind,strat);
3639  }
3640  else
3641  {
3642  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3643  }
3644  }
3645  res->m[i]=p;
3646  }
3647  //else
3648  // res->m[i]=NULL;
3649  }
3650  /*- release temp data------------------------------- -*/
3651  assume(strat->L==NULL); /* strat->L unused */
3652  assume(strat->B==NULL); /* strat->B unused */
3653  omFree(strat->sevS);
3654  omFree(strat->ecartS);
3655  assume(strat->T==NULL);//omfree(strat->T);
3656  assume(strat->sevT==NULL);//omfree(strat->sevT);
3657  assume(strat->R==NULL);//omfree(strat->R);
3658  omfree(strat->S_2_R);
3659  omfree(strat->fromQ);
3660  idDelete(&strat->Shdl);
3661  SI_RESTORE_OPT1(save1);
3662  if (TEST_OPT_PROT) PrintLn();
3663  return res;
3664 }
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:1802
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:8042
#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:1242
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:9777
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:9238
#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:657
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:657
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:11260
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:655
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:657
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:11260
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:655
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:657
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:11260
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:655
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:657
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:11260
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:655
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:657
#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:655
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 11260 of file kutil.cc.

11261 {
11262  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11263  /* initial setup or extending */
11264 
11265  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11266  if (expbound >= currRing->bitmask) return FALSE;
11267  strat->overflow=FALSE;
11268  ring new_tailRing = rModifyRing(currRing,
11269  // Hmmm .. the condition pFDeg == p_Deg
11270  // might be too strong
11271  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11272  (strat->ak==0), // omit_comp if the input is an ideal
11273  expbound); // exp_limit
11274 
11275  if (new_tailRing == currRing) return TRUE;
11276 
11277  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11278  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11279 
11280  if (currRing->pFDeg != currRing->pFDegOrig)
11281  {
11282  new_tailRing->pFDeg = currRing->pFDeg;
11283  new_tailRing->pLDeg = currRing->pLDeg;
11284  }
11285 
11286  if (TEST_OPT_PROT)
11287  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11288  kTest_TS(strat);
11289  assume(new_tailRing != strat->tailRing);
11290  pShallowCopyDeleteProc p_shallow_copy_delete
11291  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11292 
11293  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11294 
11295  int i;
11296  for (i=0; i<=strat->tl; i++)
11297  {
11298  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11299  p_shallow_copy_delete);
11300  }
11301  for (i=0; i<=strat->Ll; i++)
11302  {
11303  assume(strat->L[i].p != NULL);
11304  if (pNext(strat->L[i].p) != strat->tail)
11305  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11306  }
11307  if ((strat->P.t_p != NULL) ||
11308  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11309  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11310 
11311  if ((L != NULL) && (L->tailRing != new_tailRing))
11312  {
11313  if (L->i_r < 0)
11314  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11315  else
11316  {
11317  assume(L->i_r <= strat->tl);
11318  TObject* t_l = strat->R[L->i_r];
11319  assume(t_l != NULL);
11320  L->tailRing = new_tailRing;
11321  L->p = t_l->p;
11322  L->t_p = t_l->t_p;
11323  L->max_exp = t_l->max_exp;
11324  }
11325  }
11326 
11327  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11328  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11329 
11330  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11331  if (strat->tailRing != currRing)
11332  rKillModifiedRing(strat->tailRing);
11333 
11334  strat->tailRing = new_tailRing;
11335  strat->tailBin = new_tailBin;
11336  strat->p_shallow_copy_delete
11337  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11338 
11339  if (strat->kHEdge != NULL)
11340  {
11341  if (strat->t_kHEdge != NULL)
11342  p_LmFree(strat->t_kHEdge, strat->tailRing);
11343  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11344  }
11345 
11346  if (strat->kNoether != NULL)
11347  {
11348  if (strat->t_kNoether != NULL)
11349  p_LmFree(strat->t_kNoether, strat->tailRing);
11351  new_tailRing);
11352  }
11353  kTest_TS(strat);
11354  if (TEST_OPT_PROT)
11355  PrintS("]");
11356  return TRUE;
11357 }
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:2596
#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:654
#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:2962
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 11359 of file kutil.cc.

11360 {
11361  unsigned long l = 0;
11362  int i;
11363  long e;
11364 
11365  assume(strat->tailRing == currRing);
11366 
11367  for (i=0; i<= strat->Ll; i++)
11368  {
11369  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11370  }
11371  for (i=0; i<=strat->tl; i++)
11372  {
11373  // Hmm ... this we could do in one Step
11374  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11375  }
11376  if (rField_is_Ring(currRing))
11377  {
11378  l *= 2;
11379  }
11380  e = p_GetMaxExp(l, currRing);
11381  if (e <= 1) e = 2;
11382 
11383  kStratChangeTailRing(strat, NULL, NULL, e);
11384 }
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:11260
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 7924 of file kutil.cc.

7925 {
7926  if (i != *olddeg)
7927  {
7928  Print("%d",i);
7929  *olddeg = i;
7930  }
7931  if (TEST_OPT_OLDSTD)
7932  {
7933  if (strat->Ll != *reduc)
7934  {
7935  if (strat->Ll != *reduc-1)
7936  Print("(%d)",strat->Ll+1);
7937  else
7938  PrintS("-");
7939  *reduc = strat->Ll;
7940  }
7941  else
7942  PrintS(".");
7943  mflush();
7944  }
7945  else
7946  {
7947  if (red_result == 0)
7948  PrintS("-");
7949  else if (red_result < 0)
7950  PrintS(".");
7951  if ((red_result > 0) || ((strat->Ll % 100)==99))
7952  {
7953  if (strat->Ll != *reduc && strat->Ll > 0)
7954  {
7955  Print("(%d)",strat->Ll+1);
7956  *reduc = strat->Ll;
7957  }
7958  }
7959  }
7960 }
#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 7965 of file kutil.cc.

7966 {
7967  //PrintS("\nUsage/Allocation of temporary storage:\n");
7968  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7969  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7970  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7971  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7972  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7973  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7974  /*mflush();*/
7975 }
#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 7977 of file kutil.cc.

7978 {
7979  //PrintS("\nUsage/Allocation of temporary storage:\n");
7980  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7981  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7982  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
7983  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7984  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7985  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7986  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7987  /*mflush();*/
7988 }
#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 10745 of file kutil.cc.

10746 {
10747  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10748  return FALSE;
10749  int i,j;
10750  poly newNoether;
10751 
10752 #if 0
10753  if (currRing->weight_all_1)
10754  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10755  else
10756  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10757 #else
10758  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10759 #endif
10760  if (strat->kHEdge==NULL) return FALSE;
10761  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10762  if (strat->tailRing != currRing)
10763  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10764  /* compare old and new noether*/
10765  newNoether = pLmInit(strat->kHEdge);
10766  j = p_FDeg(newNoether,currRing);
10767  for (i=1; i<=(currRing->N); i++)
10768  {
10769  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10770  }
10771  pSetm(newNoether);
10772  if (j < strat->HCord) /*- statistics -*/
10773  {
10774  if (TEST_OPT_PROT)
10775  {
10776  Print("H(%d)",j);
10777  mflush();
10778  }
10779  strat->HCord=j;
10780  #ifdef KDEBUG
10781  if (TEST_OPT_DEBUG)
10782  {
10783  Print("H(%d):",j);
10784  wrp(strat->kHEdge);
10785  PrintLn();
10786  }
10787  #endif
10788  }
10789  if (pCmp(strat->kNoether,newNoether)!=1)
10790  {
10791  pDelete(&strat->kNoether);
10792  strat->kNoether=newNoether;
10793  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10794  if (strat->tailRing != currRing)
10795  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10796 
10797  return TRUE;
10798  }
10799  if (rField_is_Ring(currRing))
10800  pLmDelete(newNoether);
10801  else
10802  pLmFree(newNoether);
10803  return FALSE;
10804 }
#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:751
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 11973 of file kutil.cc.

11974 {
11975  /* restores a poly in currRing from LObject */
11976  LObject h = H;
11977  h.Copy();
11978  poly p;
11979  if (h.p == NULL)
11980  {
11981  if (h.t_p != NULL)
11982  {
11983  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11984  return(p);
11985  }
11986  else
11987  {
11988  /* h.tp == NULL -> the object is NULL */
11989  return(NULL);
11990  }
11991  }
11992  /* we're here if h.p != NULL */
11993  if (h.t_p == NULL)
11994  {
11995  /* then h.p is the whole poly in currRing */
11996  p = h.p;
11997  return(p);
11998  }
11999  /* we're here if h.p != NULL and h.t_p != NULL */
12000  // clean h.p, get poly from t_p
12001  pNext(h.p)=NULL;
12002  pLmDelete(&h.p);
12003  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12004  /* dest. ring: */ currRing);
12005  // no need to clean h: we re-used the polys
12006  return(p);
12007 }
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 11942 of file kutil.cc.

11943 {
11944  /* assume: p is completely in currRing */
11945  /* produces an object with LM in curring
11946  and TAIL in tailring */
11947  if (pNext(p)!=NULL)
11948  {
11949  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11950  }
11951  return(p);
11952 }
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 11956 of file kutil.cc.

11957 {
11958  /* assume: p has LM in curring and TAIL in tailring */
11959  /* convert it to complete currRing */
11960 
11961  /* check that LM is in currRing */
11963 
11964  if (pNext(p)!=NULL)
11965  {
11966  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11967  }
11968  return(p);
11969 }
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 5289 of file kutil.cc.

5290 {
5291  if(end < 0 || end >= IDELEMS(F))
5292  end = IDELEMS(F);
5293  if (end<0) return 0;
5294  if(pNext(p) == NULL) return start;
5295  polyset set=F->m;
5296  int o = p_Deg(p,currRing);
5297  int op;
5298  int i;
5299  int an = start;
5300  for(i=start;i<end;i++)
5301  if(set[i] != NULL && pNext(set[i]) == NULL)
5302  an++;
5303  if(an == end-1)
5304  return end;
5305  int en= end;
5306  loop
5307  {
5308  if(an>=en)
5309  return en;
5310  if (an == en-1)
5311  {
5312  op = p_Deg(set[an],currRing);
5313  if ((op < o)
5314  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5315  return en;
5316  return an;
5317  }
5318  i=(an+en) / 2;
5319  op = p_Deg(set[i],currRing);
5320  if ((op < o)
5321  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5322  an=i;
5323  else
5324  en=i;
5325  }
5326 }
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 6141 of file kutil.cc.

6143 {
6144  if (length<0) return 0;
6145 
6146  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6147  return length+1;
6148 
6149  int i;
6150  int an = 0;
6151  int en= length;
6152  loop
6153  {
6154  if (an >= en-1)
6155  {
6156  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6157  return an;
6158  }
6159  i=(an+en) / 2;
6160  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6161  else en=i;
6162  /*aend. fuer lazy == in !=- machen */
6163  }
6164 }
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 6399 of file kutil.cc.

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

6699 {
6700  if (length<0) return 0;
6701 
6702  int o = p->GetpFDeg();
6703  int op = set[length].GetpFDeg();
6704 
6705  if ((op > o)
6706  || ((op == o) && (set[length].length >p->length))
6707  || ((op == o) && (set[length].length <= p->length)
6708  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6709  return length+1;
6710  int i;
6711  int an = 0;
6712  int en= length;
6713  loop
6714  {
6715  if (an >= en-1)
6716  {
6717  op = set[an].GetpFDeg();
6718  if ((op > o)
6719  || ((op == o) && (set[an].length >p->length))
6720  || ((op == o) && (set[an].length <=p->length)
6721  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6722  return en;
6723  return an;
6724  }
6725  i=(an+en) / 2;
6726  op = set[i].GetpFDeg();
6727  if ((op > o)
6728  || ((op == o) && (set[i].length > p->length))
6729  || ((op == o) && (set[i].length <= p->length)
6730  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6731  an=i;
6732  else
6733  en=i;
6734  }
6735 }
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 6441 of file kutil.cc.

6443 {
6444  if (length<0) return 0;
6445 
6446  int o = p->GetpFDeg();
6447  int op = set[length].GetpFDeg();
6448 
6449  if ((op > o)
6450  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6451  return length+1;
6452  int i;
6453  int an = 0;
6454  int en= length;
6455  loop
6456  {
6457  if (an >= en-1)
6458  {
6459  op = set[an].GetpFDeg();
6460  if ((op > o)
6461  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6462  return en;
6463  return an;
6464  }
6465  i=(an+en) / 2;
6466  op = set[i].GetpFDeg();
6467  if ((op > o)
6468  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6469  an=i;
6470  else
6471  en=i;
6472  }
6473 }
#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 6511 of file kutil.cc.

6513 {
6514  if (length < 0) return 0;
6515  int an,en,i;
6516  an = 0;
6517  en = length+1;
6518  loop
6519  {
6520  if (an >= en-1)
6521  {
6522  if(an == en)
6523  return en;
6524  if (set[an].FDeg > p->FDeg)
6525  return en;
6526  if (set[an].FDeg < p->FDeg)
6527  return an;
6528  if (set[an].FDeg == p->FDeg)
6529  {
6530  number lcset,lcp;
6531  lcset = pGetCoeff(set[an].p);
6532  lcp = pGetCoeff(p->p);
6533  if(!nGreaterZero(lcset))
6534  {
6535  set[an].p=p_Neg(set[an].p,currRing);
6536  if (set[an].t_p!=NULL)
6537  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6538  lcset=pGetCoeff(set[an].p);
6539  }
6540  if(!nGreaterZero(lcp))
6541  {
6542  p->p=p_Neg(p->p,currRing);
6543  if (p->t_p!=NULL)
6544  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6545  lcp=pGetCoeff(p->p);
6546  }
6547  if(nGreater(lcset, lcp))
6548  {
6549  return en;
6550  }
6551  else
6552  {
6553  return an;
6554  }
6555  }
6556  }
6557  i=(an+en) / 2;
6558  if (set[i].FDeg > p->FDeg)
6559  an=i;
6560  if (set[i].FDeg < p->FDeg)
6561  en=i;
6562  if (set[i].FDeg == p->FDeg)
6563  {
6564  number lcset,lcp;
6565  lcset = pGetCoeff(set[i].p);
6566  lcp = pGetCoeff(p->p);
6567  if(!nGreaterZero(lcset))
6568  {
6569  set[i].p=p_Neg(set[i].p,currRing);
6570  if (set[i].t_p!=NULL)
6571  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6572  lcset=pGetCoeff(set[i].p);
6573  }
6574  if(!nGreaterZero(lcp))
6575  {
6576  p->p=p_Neg(p->p,currRing);
6577  if (p->t_p!=NULL)
6578  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6579  lcp=pGetCoeff(p->p);
6580  }
6581  if(nGreater(lcset, lcp))
6582  {
6583  an = i;
6584  }
6585  else
6586  {
6587  en = i;
6588  }
6589  }
6590  }
6591 }
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 6785 of file kutil.cc.

6787 {
6788  if (length<0) return 0;
6789 
6790  int o = p->GetpFDeg();
6791 
6792  if (set[length].GetpFDeg() > o)
6793  return length+1;
6794 
6795  int i;
6796  int an = 0;
6797  int en= length;
6798  loop
6799  {
6800  if (an >= en-1)
6801  {
6802  if (set[an].GetpFDeg() >= o)
6803  return en;
6804  return an;
6805  }
6806  i=(an+en) / 2;
6807  if (set[i].GetpFDeg() >= o)
6808  an=i;
6809  else
6810  en=i;
6811  }
6812 }
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 6820 of file kutil.cc.

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

6857 {
6858  if (length<0) return 0;
6859 
6860  int o = p->GetpFDeg() + p->ecart;
6861  int op = set[length].GetpFDeg() + set[length].ecart;
6862 
6863  if ((op > o)
6864  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6865  return length+1;
6866  int i;
6867  int an = 0;
6868  int en= length;
6869  loop
6870  {
6871  if (an >= en-1)
6872  {
6873  op = set[an].GetpFDeg() + set[an].ecart;
6874  if ((op > o)
6875  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6876  return en;
6877  return an;
6878  }
6879  i=(an+en) / 2;
6880  op = set[i].GetpFDeg() + set[i].ecart;
6881  if ((op > o)
6882  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6883  an=i;
6884  else
6885  en=i;
6886  }
6887 }
#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 6896 of file kutil.cc.

6898 {
6899  if (length<0) return 0;
6900 
6901  int o = p->GetpFDeg() + p->ecart;
6902 
6903  if ((set[length].GetpFDeg() + set[length].ecart > o)
6904  || ((set[length].GetpFDeg() + set[length].ecart == o)
6905  && (set[length].ecart > p->ecart))
6906  || ((set[length].GetpFDeg() + set[length].ecart == o)
6907  && (set[length].ecart == p->ecart)
6908  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6909  return length+1;
6910  int i;
6911  int an = 0;
6912  int en= length;
6913  loop
6914  {
6915  if (an >= en-1)
6916  {
6917  if ((set[an].GetpFDeg() + set[an].ecart > o)
6918  || ((set[an].GetpFDeg() + set[an].ecart == o)
6919  && (set[an].ecart > p->ecart))
6920  || ((set[an].GetpFDeg() + set[an].ecart == o)
6921  && (set[an].ecart == p->ecart)
6922  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6923  return en;
6924  return an;
6925  }
6926  i=(an+en) / 2;
6927  if ((set[i].GetpFDeg() + set[i].ecart > o)
6928  || ((set[i].GetpFDeg() + set[i].ecart == o)
6929  && (set[i].ecart > p->ecart))
6930  || ((set[i].GetpFDeg() +set[i].ecart == o)
6931  && (set[i].ecart == p->ecart)
6932  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6933  an=i;
6934  else
6935  en=i;
6936  }
6937 }
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 6387 of file kutil.cc.

6389 {
6390  return strat->Ll+1;
6391 }
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 6475 of file kutil.cc.

6477 {
6478  if (length<0) return 0;
6479  if(start == (length +1)) return (length+1);
6480  int o = p->GetpFDeg();
6481  int op = set[length].GetpFDeg();
6482 
6483  if ((op > o)
6484  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6485  return length+1;
6486  int i;
6487  int an = start;
6488  int en= length;
6489  loop
6490  {
6491  if (an >= en-1)
6492  {
6493  op = set[an].GetpFDeg();
6494  if ((op > o)
6495  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6496  return en;
6497  return an;
6498  }
6499  i=(an+en) / 2;
6500  op = set[i].GetpFDeg();
6501  if ((op > o)
6502  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6503  an=i;
6504  else
6505  en=i;
6506  }
6507 }
#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 6286 of file kutil.cc.

6288 {
6289  if (length < 0) return 0;
6290  if (set[length].FDeg > p->FDeg)
6291  return length+1;
6292  if (set[length].FDeg == p->FDeg)
6293  if(set[length].GetpLength() > p->GetpLength())
6294  return length+1;
6295  int i;
6296  int an = 0;
6297  int en= length+1;
6298  loop
6299  {
6300  if (an >= en-1)
6301  {
6302  if(an == en)
6303  return en;
6304  if (set[an].FDeg > p->FDeg)
6305  return en;
6306  if(set[an].FDeg == p->FDeg)
6307  {
6308  if(set[an].GetpLength() > p->GetpLength())
6309  return en;
6310  else
6311  {
6312  if(set[an].GetpLength() == p->GetpLength())
6313  {
6314  if(nGreater(set[an].p->coef, p->p->coef))
6315  return en;
6316  else
6317  return an;
6318  }
6319  else
6320  {
6321  return an;
6322  }
6323  }
6324  }
6325  else
6326  return an;
6327  }
6328  i=(an+en) / 2;
6329  if (set[i].FDeg > p->FDeg)
6330  an=i;
6331  else
6332  {
6333  if(set[i].FDeg == p->FDeg)
6334  {
6335  if(set[i].GetpLength() > p->GetpLength())
6336  an=i;
6337  else
6338  {
6339  if(set[i].GetpLength() == p->GetpLength())
6340  {
6341  if(nGreater(set[i].p->coef, p->p->coef))
6342  an = i;
6343  else
6344  en = i;
6345  }
6346  else
6347  {
6348  en=i;
6349  }
6350  }
6351  }
6352  else
6353  en=i;
6354  }
6355  }
6356 }
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 6199 of file kutil.cc.

6201 {
6202  if (length<0) return 0;
6203  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6204  return length+1;
6205 
6206  int i;
6207  int an = 0;
6208  int en= length;
6209  loop
6210  {
6211  if (an >= en-1)
6212  {
6213  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6214  return an;
6215  }
6216  i=(an+en) / 2;
6217  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6218  else en=i;
6219  /*aend. fuer lazy == in !=- machen */
6220  }
6221 }
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 6223 of file kutil.cc.

6225 {
6226  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6227  if (length<0) return 0;
6228  if (pLtCmp(set[length].sig,p->sig)== 1)
6229  return length+1;
6230 
6231  int an,en,i;
6232  an = 0;
6233  en = length+1;
6234  int cmp;
6235  loop
6236  {
6237  if (an >= en-1)
6238  {
6239  if(an == en)
6240  return en;
6241  cmp = pLtCmp(set[an].sig,p->sig);
6242  if (cmp == 1)
6243  return en;
6244  if (cmp == -1)
6245  return an;
6246  if (cmp == 0)
6247  {
6248  if (set[an].FDeg > p->FDeg)
6249  return en;
6250  if (set[an].FDeg < p->FDeg)
6251  return an;
6252  if (set[an].FDeg == p->FDeg)
6253  {
6254  cmp = pLtCmp(set[an].p,p->p);
6255  if(cmp == 1)
6256  return en;
6257  else
6258  return an;
6259  }
6260  }
6261  }
6262  i=(an+en) / 2;
6263  cmp = pLtCmp(set[i].sig,p->sig);
6264  if (cmp == 1)
6265  an = i;
6266  if (cmp == -1)
6267  en = i;
6268  if (cmp == 0)
6269  {
6270  if (set[i].FDeg > p->FDeg)
6271  an = i;
6272  if (set[i].FDeg < p->FDeg)
6273  en = i;
6274  if (set[i].FDeg == p->FDeg)
6275  {
6276  cmp = pLtCmp(set[i].p,p->p);
6277  if(cmp == 1)
6278  an = i;
6279  else
6280  en = i;
6281  }
6282  }
6283  }
6284 }
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 5111 of file kutil.cc.

5113 {
5114  if(length==-1) return 0;
5115  polyset set=strat->S;
5116  int i;
5117  int an = 0;
5118  int en = length;
5119  int cmp_int = currRing->OrdSgn;
5121 #ifdef HAVE_PLURAL
5122  && (currRing->real_var_start==0)
5123 #endif
5124 #if 0
5125  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5126 #endif
5127  )
5128  {
5129  int o=p_Deg(p,currRing);
5130  int oo=p_Deg(set[length],currRing);
5131 
5132  if ((oo<o)
5133  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5134  return length+1;
5135 
5136  loop
5137  {
5138  if (an >= en-1)
5139  {
5140  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5141  {
5142  return an;
5143  }
5144  return en;
5145  }
5146  i=(an+en) / 2;
5147  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5148  else an=i;
5149  }
5150  }
5151  else
5152  {
5153  if (rField_is_Ring(currRing))
5154  {
5155  if (pLmCmp(set[length],p)== -cmp_int)
5156  return length+1;
5157  int cmp;
5158  loop
5159  {
5160  if (an >= en-1)
5161  {
5162  cmp = pLmCmp(set[an],p);
5163  if (cmp == cmp_int) return an;
5164  if (cmp == -cmp_int) return en;
5165  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5166  return an;
5167  }
5168  i = (an+en) / 2;
5169  cmp = pLmCmp(set[i],p);
5170  if (cmp == cmp_int) en = i;
5171  else if (cmp == -cmp_int) an = i;
5172  else
5173  {
5174  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5175  else en = i;
5176  }
5177  }
5178  }
5179  else
5180  if (pLmCmp(set[length],p)== -cmp_int)
5181  return length+1;
5182 
5183  loop
5184  {
5185  if (an >= en-1)
5186  {
5187  if (pLmCmp(set[an],p) == cmp_int) return an;
5188  if (pLmCmp(set[an],p) == -cmp_int) return en;
5189  if ((cmp_int!=1)
5190  && ((strat->ecartS[an])>ecart_p))
5191  return an;
5192  return en;
5193  }
5194  i=(an+en) / 2;
5195  if (pLmCmp(set[i],p) == cmp_int) en=i;
5196  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5197  else
5198  {
5199  if ((cmp_int!=1)
5200  &&((strat->ecartS[i])<ecart_p))
5201  en=i;
5202  else
5203  an=i;
5204  }
5205  }
5206  }
5207 }
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:751
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 5212 of file kutil.cc.

5213 {
5214  if (length<0) return 0;
5215  polyset set=strat->S;
5216  if(pNext(p) == NULL)
5217  {
5218  int mon = 0;
5219  for(int i = 0;i<=length;i++)
5220  {
5221  if(set[i] != NULL && pNext(set[i]) == NULL)
5222  mon++;
5223  }
5224  int o = p_Deg(p,currRing);
5225  int op = p_Deg(set[mon],currRing);
5226 
5227  if ((op < o)
5228  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5229  return length+1;
5230  int i;
5231  int an = 0;
5232  int en= mon;
5233  loop
5234  {
5235  if (an >= en-1)
5236  {
5237  op = p_Deg(set[an],currRing);
5238  if ((op < o)
5239  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5240  return en;
5241  return an;
5242  }
5243  i=(an+en) / 2;
5244  op = p_Deg(set[i],currRing);
5245  if ((op < o)
5246  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5247  an=i;
5248  else
5249  en=i;
5250  }
5251  }
5252  else /*if(pNext(p) != NULL)*/
5253  {
5254  int o = p_Deg(p,currRing);
5255  int op = p_Deg(set[length],currRing);
5256 
5257  if ((op < o)
5258  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5259  return length+1;
5260  int i;
5261  int an = 0;
5262  for(i=0;i<=length;i++)
5263  if(set[i] != NULL && pNext(set[i]) == NULL)
5264  an++;
5265  int en= length;
5266  loop
5267  {
5268  if (an >= en-1)
5269  {
5270  op = p_Deg(set[an],currRing);
5271  if ((op < o)
5272  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5273  return en;
5274  return an;
5275  }
5276  i=(an+en) / 2;
5277  op = p_Deg(set[i],currRing);
5278  if ((op < o)
5279  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5280  an=i;
5281  else
5282  en=i;
5283  }
5284  }
5285 }
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 6359 of file kutil.cc.

6360 {
6361  if (strat->syzl==0) return 0;
6362  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6363  return strat->syzl;
6364  int i;
6365  int an = 0;
6366  int en= strat->syzl-1;
6367  loop
6368  {
6369  if (an >= en-1)
6370  {
6371  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6372  return an;
6373  }
6374  i=(an+en) / 2;
6375  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6376  else en=i;
6377  /*aend. fuer lazy == in !=- machen */
6378  }
6379 }
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 5333 of file kutil.cc.

5334 {
5335  return (length+1);
5336 }

§ posInT1()

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

Definition at line 5344 of file kutil.cc.

5345 {
5346  if (length==-1) return 0;
5347 
5348  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5349 
5350  int i;
5351  int an = 0;
5352  int en= length;
5353 
5354  loop
5355  {
5356  if (an >= en-1)
5357  {
5358  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5359  return en;
5360  }
5361  i=(an+en) / 2;
5362  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5363  else an=i;
5364  }
5365 }
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 5402 of file kutil.cc.

5403 {
5404  if (length==-1) return 0;
5405 
5406  int o = p.GetpFDeg();
5407  int op = set[length].GetpFDeg();
5408 
5409  if ((op < o)
5410  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5411  return length+1;
5412 
5413  int i;
5414  int an = 0;
5415  int en= length;
5416 
5417  loop
5418  {
5419  if (an >= en-1)
5420  {
5421  op= set[an].GetpFDeg();
5422  if ((op > o)
5423  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5424  return an;
5425  return en;
5426  }
5427  i=(an+en) / 2;
5428  op = set[i].GetpFDeg();
5429  if (( op > o)
5430  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5431  en=i;
5432  else
5433  an=i;
5434  }
5435 }
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 5555 of file kutil.cc.

5556 {
5557  p.GetpLength();
5558  if (length==-1) return 0;
5559 
5560  int o = p.GetpFDeg();
5561  int op = set[length].GetpFDeg();
5562 
5563  if (( op < o)
5564  || (( op == o) && (set[length].length<p.length))
5565  || (( op == o) && (set[length].length == p.length)
5566  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5567  return length+1;
5568 
5569  int i;
5570  int an = 0;
5571  int en= length;
5572  loop
5573  {
5574  if (an >= en-1)
5575  {
5576  op = set[an].GetpFDeg();
5577  if (( op > o)
5578  || (( op == o) && (set[an].length > p.length))
5579  || (( op == o) && (set[an].length == p.length)
5580  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5581  return an;
5582  return en;
5583  }
5584  i=(an+en) / 2;
5585  op = set[i].GetpFDeg();
5586  if (( op > o)
5587  || (( op == o) && (set[i].length > p.length))
5588  || (( op == o) && (set[i].length == p.length)
5589  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5590  en=i;
5591  else
5592  an=i;
5593  }
5594 }
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 5644 of file kutil.cc.

5645 {
5646  if (length==-1) return 0;
5647 
5648  int o = p.GetpFDeg();
5649 
5650  if (set[length].GetpFDeg() <= o)
5651  return length+1;
5652 
5653  int i;
5654  int an = 0;
5655  int en= length;
5656  loop
5657  {
5658  if (an >= en-1)
5659  {
5660  if (set[an].GetpFDeg() > o)
5661  return an;
5662  return en;
5663  }
5664  i=(an+en) / 2;
5665  if (set[i].GetpFDeg() > o)
5666  en=i;
5667  else
5668  an=i;
5669  }
5670 }
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 5712 of file kutil.cc.

5731 {
5732  if (length==-1) return 0;
5733 
5734  int o = p.GetpFDeg() + p.ecart;
5735  int op = set[length].GetpFDeg()+set[length].ecart;
5736 
5737  if ((op < o)
5738  || ((op == o)
5739  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5740  return length+1;
5741 
5742  int i;
5743  int an = 0;
5744  int en= length;
5745  loop
5746  {
5747  if (an >= en-1)
5748  {
5749  op = set[an].GetpFDeg()+set[an].ecart;
5750  if (( op > o)
5751  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5752  return an;
5753  return en;
5754  }
5755  i=(an+en) / 2;
5756  op = set[i].GetpFDeg()+set[i].ecart;
5757  if (( op > o)
5758  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5759  en=i;
5760  else
5761  an=i;
5762  }
5763 }
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 5807 of file kutil.cc.

5828 {
5829  if (length==-1) return 0;
5830 
5831  int o = p.GetpFDeg() + p.ecart;
5832  int op = set[length].GetpFDeg()+set[length].ecart;
5833 
5834  if ((op < o)
5835  || (( op == o) && (set[length].ecart > p.ecart))
5836  || (( op == o) && (set[length].ecart==p.ecart)
5837  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5838  return length+1;
5839 
5840  int i;
5841  int an = 0;
5842  int en= length;
5843  loop
5844  {
5845  if (an >= en-1)
5846  {
5847  op = set[an].GetpFDeg()+set[an].ecart;
5848  if (( op > o)
5849  || (( op == o) && (set[an].ecart < p.ecart))
5850  || (( op == o) && (set[an].ecart==p.ecart)
5851  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5852  return an;
5853  return en;
5854  }
5855  i=(an+en) / 2;
5856  op = set[i].GetpFDeg()+set[i].ecart;
5857  if ((op > o)
5858  || (( op == o) && (set[i].ecart < p.ecart))
5859  || (( op == o) && (set[i].ecart == p.ecart)
5860  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5861  en=i;
5862  else
5863  an=i;
5864  }
5865 }
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 5914 of file kutil.cc.

5915 {
5916  if (length==-1) return 0;
5917 
5918  int cc = (-1+2*currRing->order[0]==ringorder_c);
5919  /* cc==1 for (c,..), cc==-1 for (C,..) */
5920  int o = p.GetpFDeg() + p.ecart;
5921  int c = pGetComp(p.p)*cc;
5922 
5923  if (pGetComp(set[length].p)*cc < c)
5924  return length+1;
5925  if (pGetComp(set[length].p)*cc == c)
5926  {
5927  int op = set[length].GetpFDeg()+set[length].ecart;
5928  if ((op < o)
5929  || ((op == o) && (set[length].ecart > p.ecart))
5930  || ((op == o) && (set[length].ecart==p.ecart)
5931  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5932  return length+1;
5933  }
5934 
5935  int i;
5936  int an = 0;
5937  int en= length;
5938  loop
5939  {
5940  if (an >= en-1)
5941  {
5942  if (pGetComp(set[an].p)*cc < c)
5943  return en;
5944  if (pGetComp(set[an].p)*cc == c)
5945  {
5946  int op = set[an].GetpFDeg()+set[an].ecart;
5947  if ((op > o)
5948  || ((op == o) && (set[an].ecart < p.ecart))
5949  || ((op == o) && (set[an].ecart==p.ecart)
5950  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5951  return an;
5952  }
5953  return en;
5954  }
5955  i=(an+en) / 2;
5956  if (pGetComp(set[i].p)*cc > c)
5957  en=i;
5958  else if (pGetComp(set[i].p)*cc == c)
5959  {
5960  int op = set[i].GetpFDeg()+set[i].ecart;
5961  if ((op > o)
5962  || ((op == o) && (set[i].ecart < p.ecart))
5963  || ((op == o) && (set[i].ecart == p.ecart)
5964  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5965  en=i;
5966  else
5967  an=i;
5968  }
5969  else
5970  an=i;
5971  }
5972 }
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 6041 of file kutil.cc.

6042 {
6043  p.GetpLength();
6044  if (length==-1) return 0;
6045 
6046  int o = p.ecart;
6047  int op=p.GetpFDeg();
6048 
6049  if (set[length].ecart < o)
6050  return length+1;
6051  if (set[length].ecart == o)
6052  {
6053  int oo=set[length].GetpFDeg();
6054  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
6055  return length+1;
6056  }
6057 
6058  int i;
6059  int an = 0;
6060  int en= length;
6061  loop
6062  {
6063  if (an >= en-1)
6064  {
6065  if (set[an].ecart > o)
6066  return an;
6067  if (set[an].ecart == o)
6068  {
6069  int oo=set[an].GetpFDeg();
6070  if((oo > op)
6071  || ((oo==op) && (set[an].length > p.length)))
6072  return an;
6073  }
6074  return en;
6075  }
6076  i=(an+en) / 2;
6077  if (set[i].ecart > o)
6078  en=i;
6079  else if (set[i].ecart == o)
6080  {
6081  int oo=set[i].GetpFDeg();
6082  if ((oo > op)
6083  || ((oo == op) && (set[i].length > p.length)))
6084  en=i;
6085  else
6086  an=i;
6087  }
6088  else
6089  an=i;
6090  }
6091 }
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 5372 of file kutil.cc.

5373 {
5374  p.GetpLength();
5375  if (length==-1)
5376  return 0;
5377  if (set[length].length<p.length)
5378  return length+1;
5379 
5380  int i;
5381  int an = 0;
5382  int en= length;
5383 
5384  loop
5385  {
5386  if (an >= en-1)
5387  {
5388  if (set[an].length>p.length) return an;
5389  return en;
5390  }
5391  i=(an+en) / 2;
5392  if (set[i].length>p.length) en=i;
5393  else an=i;
5394  }
5395 }
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 11681 of file kutil.cc.

11682 {
11683 
11684  if (length==-1) return 0;
11685 
11686  int o = p.ecart;
11687  int op=p.GetpFDeg();
11688  int ol = p.GetpLength();
11689 
11690  if (set[length].ecart < o)
11691  return length+1;
11692  if (set[length].ecart == o)
11693  {
11694  int oo=set[length].GetpFDeg();
11695  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11696  return length+1;
11697  }
11698 
11699  int i;
11700  int an = 0;
11701  int en= length;
11702  loop
11703  {
11704  if (an >= en-1)
11705  {
11706  if (set[an].ecart > o)
11707  return an;
11708  if (set[an].ecart == o)
11709  {
11710  int oo=set[an].GetpFDeg();
11711  if((oo > op)
11712  || ((oo==op) && (set[an].pLength > ol)))
11713  return an;
11714  }
11715  return en;
11716  }
11717  i=(an+en) / 2;
11718  if (set[i].ecart > o)
11719  en=i;
11720  else if (set[i].ecart == o)
11721  {
11722  int oo=set[i].GetpFDeg();
11723  if ((oo > op)
11724  || ((oo == op) && (set[i].pLength > ol)))
11725  en=i;
11726  else
11727  an=i;
11728  }
11729  else
11730  an=i;
11731  }
11732 }
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 5673 of file kutil.cc.

5674 {
5675  int ol = p.GetpLength();
5676  if (length==-1) return 0;
5677 
5678  int op=p.ecart;
5679 
5680  int oo=set[length].ecart;
5681  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5682  return length+1;
5683 
5684  int i;
5685  int an = 0;
5686  int en= length;
5687  loop
5688  {
5689  if (an >= en-1)
5690  {
5691  int oo=set[an].ecart;
5692  if((oo > op)
5693  || ((oo==op) && (set[an].pLength > ol)))
5694  return an;
5695  return en;
5696  }
5697  i=(an+en) / 2;
5698  int oo=set[i].ecart;
5699  if ((oo > op)
5700  || ((oo == op) && (set[i].pLength > ol)))
5701  en=i;
5702  else
5703  an=i;
5704  }
5705 }
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 11735 of file kutil.cc.

11736 {
11737 
11738  if (length==-1) return 0;
11739 
11740  int op=p.GetpFDeg();
11741  int ol = p.GetpLength();
11742 
11743  int oo=set[length].GetpFDeg();
11744  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11745  return length+1;
11746 
11747  int i;
11748  int an = 0;
11749  int en= length;
11750  loop
11751  {
11752  if (an >= en-1)
11753  {
11754  int oo=set[an].GetpFDeg();
11755  if((oo > op)
11756  || ((oo==op) && (set[an].pLength > ol)))
11757  return an;
11758  return en;
11759  }
11760  i=(an+en) / 2;
11761  int oo=set[i].GetpFDeg();
11762  if ((oo > op)
11763  || ((oo == op) && (set[i].pLength > ol)))
11764  en=i;
11765  else
11766  an=i;
11767  }
11768 }
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 11772 of file kutil.cc.

11773 {
11774  int ol = p.GetpLength();
11775  if (length==-1)
11776  return 0;
11777  if (set[length].length<p.length)
11778  return length+1;
11779 
11780  int i;
11781  int an = 0;
11782  int en= length;
11783 
11784  loop
11785  {
11786  if (an >= en-1)
11787  {
11788  if (set[an].pLength>ol) return an;
11789  return en;
11790  }
11791  i=(an+en) / 2;
11792  if (set[i].pLength>ol) en=i;
11793  else an=i;
11794  }
11795 }
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 11040 of file kutil.cc.

11041 {
11042  if(!nCoeff_is_Ring_Z(currRing->cf))
11043  return;
11044  poly pH = h->GetP();
11045  poly p,pp;
11046  p = pH;
11047  bool deleted = FALSE, ok = FALSE;
11048  for(int i = 0; i<=strat->sl; i++)
11049  {
11050  p = pH;
11051  if(pNext(strat->S[i]) == NULL)
11052  {
11053  //pWrite(p);
11054  //pWrite(strat->S[i]);
11055  while(ok == FALSE && p != NULL)
11056  {
11057  if(pLmDivisibleBy(strat->S[i], p))
11058  {
11059  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11060  p_SetCoeff(p,dummy,currRing);
11061  }
11062  if(nIsZero(p->coef))
11063  {
11064  pLmDelete(&p);
11065  h->p = p;
11066  deleted = TRUE;
11067  }
11068  else
11069  {
11070  ok = TRUE;
11071  }
11072  }
11073  pp = pNext(p);
11074  while(pp != NULL)
11075  {
11076  if(pLmDivisibleBy(strat->S[i], pp))
11077  {
11078  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11079  p_SetCoeff(pp,dummy,currRing);
11080  if(nIsZero(pp->coef))
11081  {
11082  pLmDelete(&pNext(p));
11083  pp = pNext(p);
11084  deleted = TRUE;
11085  }
11086  else
11087  {
11088  p = pp;
11089  pp = pNext(p);
11090  }
11091  }
11092  else
11093  {
11094  p = pp;
11095  pp = pNext(p);
11096  }
11097  }
11098  }
11099  }
11100  h->SetLmCurrRing();
11101  if(deleted)
11102  strat->initEcart(h);
11103 }
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 11105 of file kutil.cc.

11106 {
11107  if(!nCoeff_is_Ring_Z(currRing->cf))
11108  return;
11109  poly hSig = h->sig;
11110  poly pH = h->GetP();
11111  poly p,pp;
11112  p = pH;
11113  bool deleted = FALSE, ok = FALSE;
11114  for(int i = 0; i<=strat->sl; i++)
11115  {
11116  p = pH;
11117  if(pNext(strat->S[i]) == NULL)
11118  {
11119  while(ok == FALSE && p!=NULL)
11120  {
11121  if(pLmDivisibleBy(strat->S[i], p))
11122  {
11123  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11124  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11125  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11126  {
11127  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11128  p_SetCoeff(p,dummy,currRing);
11129  }
11130  pDelete(&sigMult);
11131  }
11132  if(nIsZero(p->coef))
11133  {
11134  pLmDelete(&p);
11135  h->p = p;
11136  deleted = TRUE;
11137  }
11138  else
11139  {
11140  ok = TRUE;
11141  }
11142  }
11143  if(p == NULL)
11144  return;
11145  pp = pNext(p);
11146  while(pp != NULL)
11147  {
11148  if(pLmDivisibleBy(strat->S[i], pp))
11149  {
11150  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11151  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11152  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11153  {
11154  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11155  p_SetCoeff(pp,dummy,currRing);
11156  if(nIsZero(pp->coef))
11157  {
11158  pLmDelete(&pNext(p));
11159  pp = pNext(p);
11160  deleted = TRUE;
11161  }
11162  else
11163  {
11164  p = pp;
11165  pp = pNext(p);
11166  }
11167  }
11168  else
11169  {
11170  p = pp;
11171  pp = pNext(p);
11172  }
11173  pDelete(&sigMult);
11174  }
11175  else
11176  {
11177  p = pp;
11178  pp = pNext(p);
11179  }
11180  }
11181  }
11182  }
11183  h->SetLmCurrRing();
11184  if(deleted)
11185  strat->initEcart(h);
11186 
11187 }
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 10872 of file kutil.cc.

10873 {
10875  if(!nCoeff_is_Ring_Z(currRing->cf))
10876  return NULL;
10877  ideal F = idCopy(Forig);
10878  idSkipZeroes(F);
10879  poly pmon;
10880  ring origR = currRing;
10881  ideal monred = idInit(1,1);
10882  for(int i=0; i<idElem(F); i++)
10883  {
10884  if(pNext(F->m[i]) == NULL)
10885  idInsertPoly(monred, pCopy(F->m[i]));
10886  }
10887  int posconst = idPosConstant(F);
10888  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10889  {
10890  idDelete(&F);
10891  idDelete(&monred);
10892  return NULL;
10893  }
10894  int idelemQ = 0;
10895  if(Q!=NULL)
10896  {
10897  idelemQ = IDELEMS(Q);
10898  for(int i=0; i<idelemQ; i++)
10899  {
10900  if(pNext(Q->m[i]) == NULL)
10901  idInsertPoly(monred, pCopy(Q->m[i]));
10902  }
10903  idSkipZeroes(monred);
10904  posconst = idPosConstant(monred);
10905  //the constant, if found, will be from Q
10906  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10907  {
10908  pmon = pCopy(monred->m[posconst]);
10909  idDelete(&F);
10910  idDelete(&monred);
10911  return pmon;
10912  }
10913  }
10914  ring QQ_ring = rCopy0(currRing,FALSE);
10915  nKillChar(QQ_ring->cf);
10916  QQ_ring->cf = nInitChar(n_Q, NULL);
10917  rComplete(QQ_ring,1);
10918  QQ_ring = rAssure_c_dp(QQ_ring);
10919  rChangeCurrRing(QQ_ring);
10920  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10921  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10922  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10923  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10924  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10925  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10926  ideal one = kStd(II, NULL, isNotHomog, NULL);
10927  idSkipZeroes(one);
10928  if(idIsConstant(one))
10929  {
10930  //one should be <1>
10931  for(int i = IDELEMS(II)-1; i>=0; i--)
10932  if(II->m[i] != NULL)
10933  II->m[i+1] = II->m[i];
10934  II->m[0] = pOne();
10935  ideal syz = idSyzygies(II, isNotHomog, NULL);
10936  poly integer = NULL;
10937  for(int i = IDELEMS(syz)-1;i>=0; i--)
10938  {
10939  if(pGetComp(syz->m[i]) == 1)
10940  {
10941  pSetComp(syz->m[i],0);
10942  if(pIsConstant(pHead(syz->m[i])))
10943  {
10944  integer = pHead(syz->m[i]);
10945  break;
10946  }
10947  }
10948  }
10949  rChangeCurrRing(origR);
10950  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10951  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10952  idDelete(&monred);
10953  idDelete(&F);
10954  id_Delete(&II,QQ_ring);
10955  id_Delete(&one,QQ_ring);
10956  id_Delete(&syz,QQ_ring);
10957  p_Delete(&integer,QQ_ring);
10958  rDelete(QQ_ring);
10959  return pmon;
10960  }
10961  else
10962  {
10963  if(idIs0(monred))
10964  {
10965  poly mindegmon = NULL;
10966  for(int i = 0; i<IDELEMS(one); i++)
10967  {
10968  if(pNext(one->m[i]) == NULL)
10969  {
10970  if(mindegmon == NULL)
10971  mindegmon = pCopy(one->m[i]);
10972  else
10973  {
10974  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10975  mindegmon = pCopy(one->m[i]);
10976  }
10977  }
10978  }
10979  if(mindegmon != NULL)
10980  {
10981  for(int i = IDELEMS(II)-1; i>=0; i--)
10982  if(II->m[i] != NULL)
10983  II->m[i+1] = II->m[i];
10984  II->m[0] = pCopy(mindegmon);
10985  ideal syz = idSyzygies(II, isNotHomog, NULL);
10986  bool found = FALSE;
10987  for(int i = IDELEMS(syz)-1;i>=0; i--)
10988  {
10989  if(pGetComp(syz->m[i]) == 1)
10990  {
10991  pSetComp(syz->m[i],0);
10992  if(pIsConstant(pHead(syz->m[i])))
10993  {
10994  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10995  found = TRUE;
10996  break;
10997  }
10998  }
10999  }
11000  id_Delete(&syz,QQ_ring);
11001  if (found == FALSE)
11002  {
11003  rChangeCurrRing(origR);
11004  idDelete(&monred);
11005  idDelete(&F);
11006  id_Delete(&II,QQ_ring);
11007  id_Delete(&one,QQ_ring);
11008  rDelete(QQ_ring);
11009  return NULL;
11010  }
11011  rChangeCurrRing(origR);
11012  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11013  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11014  idDelete(&monred);
11015  idDelete(&F);
11016  id_Delete(&II,QQ_ring);
11017  id_Delete(&one,QQ_ring);
11018  id_Delete(&syz,QQ_ring);
11019  rDelete(QQ_ring);
11020  return pmon;
11021  }
11022  }
11023  }
11024  rChangeCurrRing(origR);
11025  idDelete(&monred);
11026  idDelete(&F);
11027  id_Delete(&II,QQ_ring);
11028  id_Delete(&one,QQ_ring);
11029  rDelete(QQ_ring);
11030  return NULL;
11031 }
#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:4858
#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:3351
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:1321
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:448
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10
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:496
#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:334
#define idIsConstant(I)
Definition: ideals.h:40

§ redFirstShift()

int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 4381 of file kstd2.cc.

4382 {
4383  if (h->IsNull()) return 0;
4384 
4385  int at, reddeg,d;
4386  int pass = 0;
4387  int j = 0;
4388 
4389  if (! strat->homog)
4390  {
4391  d = h->GetpFDeg() + h->ecart;
4392  reddeg = strat->LazyDegree+d;
4393  }
4394  h->SetShortExpVector();
4395  loop
4396  {
4397  j = kFindDivisibleByInT(strat, h);
4398  if (j < 0)
4399  {
4400  h->SetDegStuffReturnLDeg(strat->LDegLast);
4401  return 1;
4402  }
4403 
4404  if (!TEST_OPT_INTSTRATEGY)
4405  strat->T[j].pNorm();
4406 #ifdef KDEBUG
4407  if (TEST_OPT_DEBUG)
4408  {
4409  PrintS("reduce ");
4410  h->wrp();
4411  PrintS(" with ");
4412  strat->T[j].wrp();
4413  }
4414 #endif
4415  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
4416  if (!h->IsNull())
4417  {
4418  poly qq=p_Shrink(h->GetTP(),strat->lV,strat->tailRing);
4419  h->p=NULL;
4420  h->t_p=qq;
4421  if (qq!=NULL) h->GetP(strat->lmBin);
4422  }
4423 
4424 #ifdef KDEBUG
4425  if (TEST_OPT_DEBUG)
4426  {
4427  PrintS(" to ");
4428  wrp(h->p);
4429  PrintLn();
4430  }
4431 #endif
4432  if (h->IsNull())
4433  {
4434  if (h->lcm!=NULL) pLmFree(h->lcm);
4435  h->Clear();
4436  return 0;
4437  }
4438  h->SetShortExpVector();
4439 
4440 #if 0
4441  if ((strat->syzComp!=0) && !strat->honey)
4442  {
4443  if ((strat->syzComp>0) &&
4444  (h->Comp() > strat->syzComp))
4445  {
4446  assume(h->MinComp() > strat->syzComp);
4447 #ifdef KDEBUG
4448  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
4449 #endif
4450  if (strat->homog)
4451  h->SetDegStuffReturnLDeg(strat->LDegLast);
4452  return -2;
4453  }
4454  }
4455 #endif
4456  if (!strat->homog)
4457  {
4458  if (!TEST_OPT_OLDSTD && strat->honey)
4459  {
4460  h->SetpFDeg();
4461  if (strat->T[j].ecart <= h->ecart)
4462  h->ecart = d - h->GetpFDeg();
4463  else
4464  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
4465 
4466  d = h->GetpFDeg() + h->ecart;
4467  }
4468  else
4469  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
4470  /*- try to reduce the s-polynomial -*/
4471  pass++;
4472  /*
4473  *test whether the polynomial should go to the lazyset L
4474  *-if the degree jumps
4475  *-if the number of pre-defined reductions jumps
4476  */
4477  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
4478  && ((d >= reddeg) || (pass > strat->LazyPass)))
4479  {
4480  h->SetLmCurrRing();
4481  if (strat->posInLDependsOnLength)
4482  h->SetLength(strat->length_pLength);
4483  at = strat->posInL(strat->L,strat->Ll,h,strat);
4484  if (at <= strat->Ll)
4485  {
4486  //int dummy=strat->sl;
4487  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
4488  //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
4489  if (kFindDivisibleByInT(strat, h) < 0)
4490  return 1;
4491  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
4492 #ifdef KDEBUG
4493  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
4494 #endif
4495  h->Clear();
4496  return -1;
4497  }
4498  }
4499  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
4500  {
4501  reddeg = d+1;
4502  Print(".%d",d);mflush();
4503  }
4504  }
4505  }
4506 }
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:1210
#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 536 of file kstd2.cc.

537 {
538  if (strat->tl<0) return 1;
539  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
540  assume(h->FDeg == h->pFDeg());
541 
542  poly h_p;
543  int i,j,at,pass, ii;
544  unsigned long not_sev;
545  // long reddeg,d;
546 
547  pass = j = 0;
548  // d = reddeg = h->GetpFDeg();
549  h->SetShortExpVector();
550  int li;
551  h_p = h->GetLmTailRing();
552  not_sev = ~ h->sev;
553  loop
554  {
555  j = kFindDivisibleByInT(strat, h);
556  if (j < 0) return 1;
557 
558  li = strat->T[j].pLength;
559  ii = j;
560  /*
561  * the polynomial to reduce with (up to the moment) is;
562  * pi with length li
563  */
564  i = j;
565 #if 1
566  if (TEST_OPT_LENGTH)
567  loop
568  {
569  /*- search the shortest possible with respect to length -*/
570  i++;
571  if (i > strat->tl)
572  break;
573  if (li<=1)
574  break;
575  if ((strat->T[i].pLength < li)
576  &&
577  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
578  h_p, not_sev, strat->tailRing))
579  {
580  /*
581  * the polynomial to reduce with is now;
582  */
583  li = strat->T[i].pLength;
584  ii = i;
585  }
586  }
587 #endif
588 
589  /*
590  * end of search: have to reduce with pi
591  */
592 #ifdef KDEBUG
593  if (TEST_OPT_DEBUG)
594  {
595  PrintS("red:");
596  h->wrp();
597  PrintS(" with ");
598  strat->T[ii].wrp();
599  }
600 #endif
601  assume(strat->fromT == FALSE);
602 
603  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
604 #if SBA_PRINT_REDUCTION_STEPS
605  sba_interreduction_steps++;
606 #endif
607 #if SBA_PRINT_OPERATIONS
608  sba_interreduction_operations += pLength(strat->T[ii].p);
609 #endif
610 
611 #ifdef KDEBUG
612  if (TEST_OPT_DEBUG)
613  {
614  PrintS("\nto ");
615  h->wrp();
616  PrintLn();
617  }
618 #endif
619 
620  h_p = h->GetLmTailRing();
621  if (h_p == NULL)
622  {
623  if (h->lcm!=NULL) pLmFree(h->lcm);
624 #ifdef KDEBUG
625  h->lcm=NULL;
626 #endif
627  return 0;
628  }
629  h->SetShortExpVector();
630  not_sev = ~ h->sev;
631  /*
632  * try to reduce the s-polynomial h
633  *test first whether h should go to the lazyset L
634  *-if the degree jumps
635  *-if the number of pre-defined reductions jumps
636  */
637  pass++;
638  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
639  {
640  h->SetLmCurrRing();
641  at = strat->posInL(strat->L,strat->Ll,h,strat);
642  if (at <= strat->Ll)
643  {
644  int dummy=strat->sl;
645  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
646  return 1;
647  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
648 #ifdef KDEBUG
649  if (TEST_OPT_DEBUG)
650  Print(" lazy: -> L%d\n",at);
651 #endif
652  h->Clear();
653  return -1;
654  }
655  }
656  }
657 }
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:1210
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 1450 of file kstd2.cc.

1451 {
1452  if (strat->tl<0) return 1;
1453  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1454  assume(h->FDeg == h->pFDeg());
1455  poly h_p;
1456  int i,j,at,pass,ei, ii, h_d;
1457  unsigned long not_sev;
1458  long reddeg,d;
1459 
1460  pass = j = 0;
1461  d = reddeg = h->GetpFDeg() + h->ecart;
1462  h->SetShortExpVector();
1463  int li;
1464  h_p = h->GetLmTailRing();
1465  not_sev = ~ h->sev;
1466 
1467  h->PrepareRed(strat->use_buckets);
1468  loop
1469  {
1470  j=kFindDivisibleByInT(strat, h);
1471  if (j < 0) return 1;
1472 
1473  ei = strat->T[j].ecart;
1474  li = strat->T[j].pLength;
1475  ii = j;
1476  /*
1477  * the polynomial to reduce with (up to the moment) is;
1478  * pi with ecart ei
1479  */
1480  i = j;
1481  if (TEST_OPT_LENGTH)
1482  loop
1483  {
1484  /*- takes the first possible with respect to ecart -*/
1485  i++;
1486  if (i > strat->tl)
1487  break;
1488  //if (ei < h->ecart)
1489  // break;
1490  if (li<=1)
1491  break;
1492  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1493  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1494  &&
1495  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1496  h_p, not_sev, strat->tailRing))
1497  {
1498  /*
1499  * the polynomial to reduce with is now;
1500  */
1501  ei = strat->T[i].ecart;
1502  li = strat->T[i].pLength;
1503  ii = i;
1504  }
1505  }
1506 
1507  /*
1508  * end of search: have to reduce with pi
1509  */
1510  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1511  {
1512  h->GetTP(); // clears bucket
1513  h->SetLmCurrRing();
1514  /*
1515  * It is not possible to reduce h with smaller ecart;
1516  * if possible h goes to the lazy-set L,i.e
1517  * if its position in L would be not the last one
1518  */
1519  if (strat->Ll >= 0) /* L is not empty */
1520  {
1521  at = strat->posInL(strat->L,strat->Ll,h,strat);
1522  if(at <= strat->Ll)
1523  /*- h will not become the next element to reduce -*/
1524  {
1525  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1526 #ifdef KDEBUG
1527  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1528 #endif
1529  h->Clear();
1530  return -1;
1531  }
1532  }
1533  }
1534 #ifdef KDEBUG
1535  if (TEST_OPT_DEBUG)
1536  {
1537  PrintS("red:");
1538  h->wrp();
1539  PrintS(" with ");
1540  strat->T[ii].wrp();
1541  }
1542 #endif
1543  assume(strat->fromT == FALSE);
1544 
1545  number coef;
1546  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),&coef,strat);
1547 #if SBA_PRINT_REDUCTION_STEPS
1548  sba_interreduction_steps++;
1549 #endif
1550 #if SBA_PRINT_OPERATIONS
1551  sba_interreduction_operations += pLength(strat->T[ii].p);
1552 #endif
1553 #ifdef KDEBUG
1554  if (TEST_OPT_DEBUG)
1555  {
1556  PrintS("\nto:");
1557  h->wrp();
1558  PrintLn();
1559  }
1560 #endif
1561  if(h->IsNull())
1562  {
1563  h->Clear();
1564  if (h->lcm!=NULL) pLmFree(h->lcm);
1565  #ifdef KDEBUG
1566  h->lcm=NULL;
1567  #endif
1568  return 0;
1569  }
1570  if (TEST_OPT_IDLIFT)
1571  {
1572  if (h->p!=NULL)
1573  {
1574  if(p_GetComp(h->p,currRing)>strat->syzComp)
1575  {
1576  h->Delete();
1577  return 0;
1578  }
1579  }
1580  else if (h->t_p!=NULL)
1581  {
1582  if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1583  {
1584  h->Delete();
1585  return 0;
1586  }
1587  }
1588  }
1589  h->SetShortExpVector();
1590  not_sev = ~ h->sev;
1591  h_d = h->SetpFDeg();
1592  /* compute the ecart */
1593  if (ei <= h->ecart)
1594  h->ecart = d-h_d;
1595  else
1596  h->ecart = d-h_d+ei-h->ecart;
1597 
1598  /*
1599  * try to reduce the s-polynomial h
1600  *test first whether h should go to the lazyset L
1601  *-if the degree jumps
1602  *-if the number of pre-defined reductions jumps
1603  */
1604  pass++;
1605  d = h_d + h->ecart;
1606  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1607  {
1608  h->GetTP(); // clear bucket
1609  h->SetLmCurrRing();
1610  at = strat->posInL(strat->L,strat->Ll,h,strat);
1611  if (at <= strat->Ll)
1612  {
1613  int dummy=strat->sl;
1614  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1615  return 1;
1616  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1617 #ifdef KDEBUG
1618  if (TEST_OPT_DEBUG)
1619  Print(" degree jumped: -> L%d\n",at);
1620 #endif
1621  h->Clear();
1622  return -1;
1623  }
1624  }
1625  else if (d > reddeg)
1626  {
1627  if (d>=(long)strat->tailRing->bitmask)
1628  {
1629  if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
1630  {
1631  strat->overflow=TRUE;
1632  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1633  h->GetP();
1634  at = strat->posInL(strat->L,strat->Ll,h,strat);
1635  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1636  h->Clear();
1637  return -1;
1638  }
1639  }
1640  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1641  {
1642  //h->wrp(); Print("<%d>\n",h->GetpLength());
1643  reddeg = d;
1644  Print(".%ld",d); mflush();
1645  }
1646  }
1647  }
1648 }
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:1210
#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 1290 of file kstd2.cc.

1291 {
1292  if (strat->tl<0) return 1;
1293  int at,i,ii,li;
1294  int j = 0;
1295  int pass = 0;
1296  assume(h->pFDeg() == h->FDeg);
1297  long reddeg = h->GetpFDeg();
1298  long d;
1299  unsigned long not_sev;
1300 
1301  h->SetShortExpVector();
1302  poly h_p = h->GetLmTailRing();
1303  not_sev = ~ h->sev;
1304  loop
1305  {
1306  j = kFindDivisibleByInT(strat, h);
1307  if (j < 0) return 1;
1308 
1309  li = strat->T[j].pLength;
1310  #if 0
1311  if (li==0)
1312  {
1313  li=strat->T[j].pLength=pLength(strat->T[j].p);
1314  }
1315  #endif
1316  ii = j;
1317  /*
1318  * the polynomial to reduce with (up to the moment) is;
1319  * pi with length li
1320  */
1321 
1322  i = j;
1323 #if 1
1324  if (TEST_OPT_LENGTH)
1325  loop
1326  {
1327  /*- search the shortest possible with respect to length -*/
1328  i++;
1329  if (i > strat->tl)
1330  break;
1331  if (li<=1)
1332  break;
1333  #if 0
1334  if (strat->T[i].pLength==0)
1335  {
1336  PrintS("!");
1337  strat->T[i].pLength=pLength(strat->T[i].p);
1338  }
1339  #endif
1340  if ((strat->T[i].pLength < li)
1341  &&
1342  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1343  h_p, not_sev, strat->tailRing))
1344  {
1345  /*
1346  * the polynomial to reduce with is now;
1347  */
1348  PrintS("+");
1349  li = strat->T[i].pLength;
1350  ii = i;
1351  }
1352  }
1353 #endif
1354 
1355  /*
1356  * end of search: have to reduce with pi
1357  */
1358 
1359 
1360 #ifdef KDEBUG
1361  if (TEST_OPT_DEBUG)
1362  {
1363  PrintS("red:");
1364  h->wrp();
1365  PrintS(" with ");
1366  strat->T[ii].wrp();
1367  }
1368 #endif
1369 
1370  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
1371 #if SBA_PRINT_REDUCTION_STEPS
1372  sba_interreduction_steps++;
1373 #endif
1374 #if SBA_PRINT_OPERATIONS
1375  sba_interreduction_operations += pLength(strat->T[ii].p);
1376 #endif
1377 
1378 #ifdef KDEBUG
1379  if (TEST_OPT_DEBUG)
1380  {
1381  PrintS("\nto ");
1382  h->wrp();
1383  PrintLn();
1384  }
1385 #endif
1386 
1387  h_p=h->GetLmTailRing();
1388 
1389  if (h_p == NULL)
1390  {
1391  if (h->lcm!=NULL) pLmFree(h->lcm);
1392 #ifdef KDEBUG
1393  h->lcm=NULL;
1394 #endif
1395  return 0;
1396  }
1397  h->SetShortExpVector();
1398  not_sev = ~ h->sev;
1399  d = h->SetpFDeg();
1400  /*- try to reduce the s-polynomial -*/
1401  pass++;
1402  if (//!TEST_OPT_REDTHROUGH &&
1403  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1404  {
1405  h->SetLmCurrRing();
1406  at = strat->posInL(strat->L,strat->Ll,h,strat);
1407  if (at <= strat->Ll)
1408  {
1409 #if 1
1410  int dummy=strat->sl;
1411  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1412  return 1;
1413 #endif
1414 #ifdef KDEBUG
1415  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
1416 #endif
1417  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1418  h->Clear();
1419  return -1;
1420  }
1421  }
1422  else if (d != reddeg)
1423  {
1424  if (d>=(long)strat->tailRing->bitmask)
1425  {
1426  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
1427  {
1428  strat->overflow=TRUE;
1429  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1430  h->GetP();
1431  at = strat->posInL(strat->L,strat->Ll,h,strat);
1432  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1433  h->Clear();
1434  return -1;
1435  }
1436  }
1437  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
1438  {
1439  Print(".%ld",d);mflush();
1440  reddeg = d;
1441  }
1442  }
1443  }
1444 }
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:1210
#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 1654 of file kstd2.cc.

1655 {
1656  if (h==NULL) return NULL;
1657  int j;
1658  max_ind=strat->sl;
1659 
1660  if (0 > strat->sl)
1661  {
1662  return h;
1663  }
1664  LObject P(h);
1665  P.SetShortExpVector();
1666  P.bucket = kBucketCreate(currRing);
1667  kBucketInit(P.bucket,P.p,pLength(P.p));
1668  kbTest(P.bucket);
1669 #ifdef HAVE_RINGS
1671 #endif
1672 #ifdef KDEBUG
1673 // if (TEST_OPT_DEBUG)
1674 // {
1675 // PrintS("redNF: starting S:\n");
1676 // for( j = 0; j <= max_ind; j++ )
1677 // {
1678 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1679 // pWrite(strat->S[j]);
1680 // }
1681 // };
1682 #endif
1683 
1684  loop
1685  {
1686  j=kFindDivisibleByInS(strat,&max_ind,&P);
1687  if (j>=0)
1688  {
1689 #ifdef HAVE_RINGS
1690  if (!is_ring)
1691  {
1692 #endif
1693  int sl=pSize(strat->S[j]);
1694  int jj=j;
1695  loop
1696  {
1697  int sll;
1698  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1699  if (jj<0) break;
1700  sll=pSize(strat->S[jj]);
1701  if (sll<sl)
1702  {
1703  #ifdef KDEBUG
1704  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1705  #endif
1706  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1707  j=jj;
1708  sl=sll;
1709  }
1710  }
1711  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1712  {
1713  pNorm(strat->S[j]);
1714  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1715  }
1716 #ifdef HAVE_RINGS
1717  }
1718 #endif
1719  nNormalize(pGetCoeff(P.p));
1720 #ifdef KDEBUG
1721  if (TEST_OPT_DEBUG)
1722  {
1723  PrintS("red:");
1724  wrp(h);
1725  PrintS(" with ");
1726  wrp(strat->S[j]);
1727  }
1728 #endif
1729 #ifdef HAVE_PLURAL
1730  if (rIsPluralRing(currRing))
1731  {
1732  number coef;
1733  nc_kBucketPolyRed(P.bucket,strat->S[j],&coef);
1734  nDelete(&coef);
1735  }
1736  else
1737 #endif
1738  {
1739  number coef;
1740  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1741  nDelete(&coef);
1742  }
1743  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1744  if (h==NULL)
1745  {
1746  kBucketDestroy(&P.bucket);
1747 
1748 #ifdef KDEBUG
1749 // if (TEST_OPT_DEBUG)
1750 // {
1751 // PrintS("redNF: starting S:\n");
1752 // for( j = 0; j <= max_ind; j++ )
1753 // {
1754 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1755 // pWrite(strat->S[j]);
1756 // }
1757 // };
1758 #endif
1759 
1760  return NULL;
1761  }
1762  kbTest(P.bucket);
1763  P.p=h;
1764  P.t_p=NULL;
1765  P.SetShortExpVector();
1766 #ifdef KDEBUG
1767  if (TEST_OPT_DEBUG)
1768  {
1769  PrintS("\nto:");
1770  wrp(h);
1771  PrintLn();
1772  }
1773 #endif
1774  }
1775  else
1776  {
1777  P.p=kBucketClear(P.bucket);
1778  kBucketDestroy(&P.bucket);
1779  pNormalize(P.p);
1780 
1781 #ifdef KDEBUG
1782 // if (TEST_OPT_DEBUG)
1783 // {
1784 // PrintS("redNF: starting S:\n");
1785 // for( j = 0; j <= max_ind; j++ )
1786 // {
1787 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1788 // pWrite(strat->S[j]);
1789 // }
1790 // };
1791 #endif
1792 
1793  return P.p;
1794  }
1795  }
1796 }
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
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
#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:1210
#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:11040
#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(nIsZero(pGetCoeff(h->p))) return 2;
457  j = kFindDivisibleByInT(strat, h);
458  if(j < 0)
459  {
460  if(strat->tl >= 0)
461  h->i_r1 = strat->tl;
462  else
463  h->i_r1 = -1;
464  if (h->GetLmTailRing() == NULL)
465  {
466  if (h->lcm!=NULL) pLmDelete(h->lcm);
467  h->Clear();
468  return 0;
469  }
470  return 1;
471  }
472  }
473  //printf("\nFound one: ");pWrite(strat->T[j].p);
474  //enterT(*h, strat);
475  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
476  //printf("\nAfter small red: ");pWrite(h->p);
477  if (h->GetLmTailRing() == NULL)
478  {
479  if (h->lcm!=NULL) pLmDelete(h->lcm);
480 #ifdef KDEBUG
481  h->lcm=NULL;
482 #endif
483  h->Clear();
484  return 0;
485  }
486  h->SetShortExpVector();
487  d = h->SetpFDeg();
488  /*- try to reduce the s-polynomial -*/
489  pass++;
490  if (!TEST_OPT_REDTHROUGH &&
491  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
492  {
493  h->SetLmCurrRing();
494  if (strat->posInLDependsOnLength)
495  h->SetLength(strat->length_pLength);
496  at = strat->posInL(strat->L,strat->Ll,h,strat);
497  if (at <= strat->Ll)
498  {
499 #ifdef KDEBUG
500  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
501 #endif
502  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
503  h->Clear();
504  return -1;
505  }
506  }
507  if (d != reddeg)
508  {
509  if (d >= (long)strat->tailRing->bitmask)
510  {
511  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
512  {
513  strat->overflow=TRUE;
514  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
515  h->GetP();
516  at = strat->posInL(strat->L,strat->Ll,h,strat);
517  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
518  h->Clear();
519  return -1;
520  }
521  }
522  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
523  {
524  Print(".%ld",d);mflush();
525  reddeg = d;
526  }
527  }
528  }
529 }
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:1210
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:11040
#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 697 of file kstd2.cc.

698 {
699  if (strat->tl<0) return 1;
700  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
701  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
702  assume(h->FDeg == h->pFDeg());
703 //#if 1
704 #ifdef DEBUGF5
705  PrintS("------- IN REDSIG -------\n");
706  Print("p: ");
707  pWrite(pHead(h->p));
708  PrintS("p1: ");
709  pWrite(pHead(h->p1));
710  PrintS("p2: ");
711  pWrite(pHead(h->p2));
712  PrintS("---------------------------\n");
713 #endif
714  poly h_p;
715  int i,j,at,pass, ii;
716  int start=0;
717  int sigSafe;
718  unsigned long not_sev;
719  // long reddeg,d;
720 
721  pass = j = 0;
722  // d = reddeg = h->GetpFDeg();
723  h->SetShortExpVector();
724  int li;
725  h_p = h->GetLmTailRing();
726  not_sev = ~ h->sev;
727  loop
728  {
729  j = kFindDivisibleByInT(strat, h, start);
730  if (j < 0)
731  {
732  return 1;
733  }
734 
735  li = strat->T[j].pLength;
736  ii = j;
737  /*
738  * the polynomial to reduce with (up to the moment) is;
739  * pi with length li
740  */
741  i = j;
742 #if 1
743  if (TEST_OPT_LENGTH)
744  loop
745  {
746  /*- search the shortest possible with respect to length -*/
747  i++;
748  if (i > strat->tl)
749  break;
750  if (li<=1)
751  break;
752  if ((strat->T[i].pLength < li)
753  &&
754  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
755  h_p, not_sev, strat->tailRing))
756  {
757  /*
758  * the polynomial to reduce with is now;
759  */
760  li = strat->T[i].pLength;
761  ii = i;
762  }
763  }
764  start = ii+1;
765 #endif
766 
767  /*
768  * end of search: have to reduce with pi
769  */
770 #ifdef KDEBUG
771  if (TEST_OPT_DEBUG)
772  {
773  PrintS("red:");
774  h->wrp();
775  PrintS(" with ");
776  strat->T[ii].wrp();
777  }
778 #endif
779  assume(strat->fromT == FALSE);
780 //#if 1
781 #ifdef DEBUGF5
782  Print("BEFORE REDUCTION WITH %d:\n",ii);
783  PrintS("--------------------------------\n");
784  pWrite(h->sig);
785  pWrite(strat->T[ii].sig);
786  pWrite(h->GetLmCurrRing());
787  pWrite(pHead(h->p1));
788  pWrite(pHead(h->p2));
789  pWrite(pHead(strat->T[ii].p));
790  PrintS("--------------------------------\n");
791  printf("INDEX OF REDUCER T: %d\n",ii);
792 #endif
793  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
794 #if SBA_PRINT_REDUCTION_STEPS
795  if (sigSafe != 3)
796  sba_reduction_steps++;
797 #endif
798 #if SBA_PRINT_OPERATIONS
799  if (sigSafe != 3)
800  sba_operations += pLength(strat->T[ii].p);
801 #endif
802  // if reduction has taken place, i.e. the reduction was sig-safe
803  // otherwise start is already at the next position and the loop
804  // searching reducers in T goes on from index start
805 //#if 1
806 #ifdef DEBUGF5
807  Print("SigSAFE: %d\n",sigSafe);
808 #endif
809  if (sigSafe != 3)
810  {
811  // start the next search for reducers in T from the beginning
812  start = 0;
813 #ifdef KDEBUG
814  if (TEST_OPT_DEBUG)
815  {
816  PrintS("\nto ");
817  h->wrp();
818  PrintLn();
819  }
820 #endif
821 
822  h_p = h->GetLmTailRing();
823  if (h_p == NULL)
824  {
825  if (h->lcm!=NULL) pLmFree(h->lcm);
826 #ifdef KDEBUG
827  h->lcm=NULL;
828 #endif
829  return 0;
830  }
831  h->SetShortExpVector();
832  not_sev = ~ h->sev;
833  /*
834  * try to reduce the s-polynomial h
835  *test first whether h should go to the lazyset L
836  *-if the degree jumps
837  *-if the number of pre-defined reductions jumps
838  */
839  pass++;
840  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
841  {
842  h->SetLmCurrRing();
843  at = strat->posInL(strat->L,strat->Ll,h,strat);
844  if (at <= strat->Ll)
845  {
846  int dummy=strat->sl;
847  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
848  {
849  return 1;
850  }
851  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
852 #ifdef KDEBUG
853  if (TEST_OPT_DEBUG)
854  Print(" lazy: -> L%d\n",at);
855 #endif
856  h->Clear();
857  return -1;
858  }
859  }
860  }
861  }
862 }
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:1210
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 865 of file kstd2.cc.

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

7576 {
7577  LObject L(p, currRing);
7578  return redtail(&L, pos, strat);
7579 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7505
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 7505 of file kutil.cc.

7506 {
7507  poly h, hn;
7508  strat->redTailChange=FALSE;
7509 
7510  L->GetP();
7511  poly p = L->p;
7512  if (strat->noTailReduction || pNext(p) == NULL)
7513  return p;
7514 
7515  LObject Ln(strat->tailRing);
7516  TObject* With;
7517  // placeholder in case strat->tl < 0
7518  TObject With_s(strat->tailRing);
7519  h = p;
7520  hn = pNext(h);
7521  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7522  long e;
7523  int l;
7524  BOOLEAN save_HE=strat->kHEdgeFound;
7525  strat->kHEdgeFound |=
7526  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7527 
7528  while(hn != NULL)
7529  {
7530  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7531  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7532  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7533  loop
7534  {
7535  Ln.Set(hn, strat->tailRing);
7536  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7537  if (strat->kHEdgeFound)
7538  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7539  else
7540  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
7541  if (With == NULL) break;
7542  With->length=0;
7543  With->pLength=0;
7544  strat->redTailChange=TRUE;
7545  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7546  {
7547  // reducing the tail would violate the exp bound
7548  if (kStratChangeTailRing(strat, L))
7549  {
7550  strat->kHEdgeFound = save_HE;
7551  return redtail(L, pos, strat);
7552  }
7553  else
7554  return NULL;
7555  }
7556  hn = pNext(h);
7557  if (hn == NULL) goto all_done;
7558  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7559  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7560  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7561  }
7562  h = hn;
7563  hn = pNext(h);
7564  }
7565 
7566  all_done:
7567  if (strat->redTailChange)
7568  {
7569  L->pLength = 0;
7570  }
7571  strat->kHEdgeFound = save_HE;
7572  return p;
7573 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7505
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:11260
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
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:4588
#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 7581 of file kutil.cc.

7582 {
7583 #define REDTAIL_CANONICALIZE 100
7584  strat->redTailChange=FALSE;
7585  if (strat->noTailReduction) return L->GetLmCurrRing();
7586  poly h, p;
7587  p = h = L->GetLmTailRing();
7588  if ((h==NULL) || (pNext(h)==NULL))
7589  return L->GetLmCurrRing();
7590 
7591  TObject* With;
7592  // placeholder in case strat->tl < 0
7593  TObject With_s(strat->tailRing);
7594 
7595  LObject Ln(pNext(h), strat->tailRing);
7596  Ln.pLength = L->GetpLength() - 1;
7597 
7598  pNext(h) = NULL;
7599  if (L->p != NULL) pNext(L->p) = NULL;
7600  L->pLength = 1;
7601 
7602  Ln.PrepareRed(strat->use_buckets);
7603 
7604  int cnt=REDTAIL_CANONICALIZE;
7605  while(!Ln.IsNull())
7606  {
7607  loop
7608  {
7609  if (TEST_OPT_IDLIFT)
7610  {
7611  if (Ln.p!=NULL)
7612  {
7613  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7614  }
7615  else
7616  {
7617  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7618  }
7619  }
7620  Ln.SetShortExpVector();
7621  if (withT)
7622  {
7623  int j;
7624  j = kFindDivisibleByInT(strat, &Ln);
7625  if (j < 0) break;
7626  With = &(strat->T[j]);
7627  }
7628  else
7629  {
7630  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7631  if (With == NULL) break;
7632  }
7633  cnt--;
7634  if (cnt==0)
7635  {
7637  /*poly tmp=*/Ln.CanonicalizeP();
7638  if (normalize)
7639  {
7640  Ln.Normalize();
7641  //pNormalize(tmp);
7642  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7643  }
7644  }
7645  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7646  {
7647  With->pNorm();
7648  }
7649  strat->redTailChange=TRUE;
7650  if (ksReducePolyTail(L, With, &Ln))
7651  {
7652  // reducing the tail would violate the exp bound
7653  // set a flag and hope for a retry (in bba)
7654  strat->completeReduce_retry=TRUE;
7655  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7656  do
7657  {
7658  pNext(h) = Ln.LmExtractAndIter();
7659  pIter(h);
7660  L->pLength++;
7661  } while (!Ln.IsNull());
7662  goto all_done;
7663  }
7664  if (Ln.IsNull()) goto all_done;
7665  if (! withT) With_s.Init(currRing);
7666  }
7667  pNext(h) = Ln.LmExtractAndIter();
7668  pIter(h);
7669  pNormalize(h);
7670  L->pLength++;
7671  }
7672 
7673  all_done:
7674  Ln.Delete();
7675  if (L->p != NULL) pNext(L->p) = pNext(p);
7676 
7677  if (strat->redTailChange)
7678  {
7679  L->length = 0;
7680  L->pLength = 0;
7681  }
7682 
7683  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7684  //L->Normalize(); // HANNES: should have a test
7685  kTest_L(L);
7686  return L->GetLmCurrRing();
7687 }
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:657
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
#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 7806 of file kutil.cc.

7808 {
7809  strat->redTailChange=FALSE;
7810  if (strat->noTailReduction) return L->GetLmCurrRing();
7811  poly h, p;
7812  p = h = L->GetLmTailRing();
7813  if ((h==NULL) || (pNext(h)==NULL))
7814  return L->GetLmCurrRing();
7815 
7816  TObject* With;
7817  // placeholder in case strat->tl < 0
7818  TObject With_s(strat->tailRing);
7819 
7820  LObject Ln(pNext(h), strat->tailRing);
7821  Ln.pLength = L->GetpLength() - 1;
7822 
7823  pNext(h) = NULL;
7824  if (L->p != NULL) pNext(L->p) = NULL;
7825  L->pLength = 1;
7826 
7827  Ln.PrepareRed(strat->use_buckets);
7828 
7829  int cnt=REDTAIL_CANONICALIZE;
7830  while(!Ln.IsNull())
7831  {
7832  loop
7833  {
7834  Ln.SetShortExpVector();
7835  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7836  if (With == NULL) break;
7837  cnt--;
7838  if (cnt==0)
7839  {
7841  /*poly tmp=*/Ln.CanonicalizeP();
7842  }
7843  // we are in Z, do not call pNorm
7844  strat->redTailChange=TRUE;
7845  // test divisibility of coefs:
7846  poly p_Ln=Ln.GetLmCurrRing();
7847  poly p_With=With->GetLmCurrRing();
7848  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7849  if (!nIsZero(z))
7850  {
7851  // subtract z*Ln, add z.Ln to L
7852  poly m=pHead(p_Ln);
7853  pSetCoeff(m,z);
7854  poly mm=pHead(m);
7855  pNext(h) = m;
7856  pIter(h);
7857  L->pLength++;
7858  mm=pNeg(mm);
7859  if (Ln.bucket!=NULL)
7860  {
7861  int dummy=1;
7862  kBucket_Add_q(Ln.bucket,mm,&dummy);
7863  }
7864  else
7865  {
7866  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7867  Ln.GetP();
7868  if (Ln.p!=NULL)
7869  {
7870  Ln.p=pAdd(Ln.p,mm);
7871  if (Ln.t_p!=NULL)
7872  {
7873  pNext(Ln.t_p)=NULL;
7874  p_LmDelete(Ln.t_p,strat->tailRing);
7875  }
7876  }
7877  }
7878  }
7879  else
7880  nDelete(&z);
7881 
7882  if (ksReducePolyTail(L, With, &Ln))
7883  {
7884  // reducing the tail would violate the exp bound
7885  // set a flag and hope for a retry (in bba)
7886  strat->completeReduce_retry=TRUE;
7887  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7888  do
7889  {
7890  pNext(h) = Ln.LmExtractAndIter();
7891  pIter(h);
7892  L->pLength++;
7893  } while (!Ln.IsNull());
7894  goto all_done;
7895  }
7896  if (Ln.IsNull()) goto all_done;
7897  With_s.Init(currRing);
7898  }
7899  pNext(h) = Ln.LmExtractAndIter();
7900  pIter(h);
7901  pNormalize(h);
7902  L->pLength++;
7903  }
7904 
7905  all_done:
7906  Ln.Delete();
7907  if (L->p != NULL) pNext(L->p) = pNext(p);
7908 
7909  if (strat->redTailChange)
7910  {
7911  L->length = 0;
7912  }
7913 
7914  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7915  //L->Normalize(); // HANNES: should have a test
7916  kTest_L(L);
7917  return L->GetLmCurrRing();
7918 }
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:657
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
#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 7689 of file kutil.cc.

7690 {
7691 #define REDTAIL_CANONICALIZE 100
7692  strat->redTailChange=FALSE;
7693  if (strat->noTailReduction) return L->GetLmCurrRing();
7694  poly h, p;
7695  p = h = L->GetLmTailRing();
7696  if ((h==NULL) || (pNext(h)==NULL))
7697  return L->GetLmCurrRing();
7698 
7699  TObject* With;
7700  // placeholder in case strat->tl < 0
7701  TObject With_s(strat->tailRing);
7702 
7703  LObject Ln(pNext(h), strat->tailRing);
7704  Ln.pLength = L->GetpLength() - 1;
7705 
7706  pNext(h) = NULL;
7707  if (L->p != NULL) pNext(L->p) = NULL;
7708  L->pLength = 1;
7709 
7710  Ln.PrepareRed(strat->use_buckets);
7711 
7712  int cnt=REDTAIL_CANONICALIZE;
7713  while(!Ln.IsNull())
7714  {
7715  loop
7716  {
7717  if (TEST_OPT_IDLIFT)
7718  {
7719  if (Ln.p!=NULL)
7720  {
7721  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7722  }
7723  else
7724  {
7725  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7726  }
7727  }
7728  Ln.SetShortExpVector();
7729  if (withT)
7730  {
7731  int j;
7732  j = kFindDivisibleByInT(strat, &Ln);
7733  if (j < 0) break;
7734  With = &(strat->T[j]);
7735  }
7736  else
7737  {
7738  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7739  if (With == NULL) break;
7740  }
7741  cnt--;
7742  if (cnt==0)
7743  {
7745  /*poly tmp=*/Ln.CanonicalizeP();
7746  if (normalize)
7747  {
7748  Ln.Normalize();
7749  //pNormalize(tmp);
7750  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7751  }
7752  }
7753  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7754  {
7755  With->pNorm();
7756  }
7757  strat->redTailChange=TRUE;
7758  if (ksReducePolyTail(L, With, &Ln))
7759  {
7760  // reducing the tail would violate the exp bound
7761  // set a flag and hope for a retry (in bba)
7762  strat->completeReduce_retry=TRUE;
7763  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7764  do
7765  {
7766  pNext(h) = Ln.LmExtractAndIter();
7767  pIter(h);
7768  L->pLength++;
7769  } while (!Ln.IsNull());
7770  goto all_done;
7771  }
7772  if(!Ln.IsNull())
7773  {
7774  Ln.GetP();
7775  Ln.p = pJet(Ln.p,bound);
7776  }
7777  if (Ln.IsNull())
7778  {
7779  goto all_done;
7780  }
7781  if (! withT) With_s.Init(currRing);
7782  }
7783  pNext(h) = Ln.LmExtractAndIter();
7784  pIter(h);
7785  pNormalize(h);
7786  L->pLength++;
7787  }
7788 
7789  all_done:
7790  Ln.Delete();
7791  if (L->p != NULL) pNext(L->p) = pNext(p);
7792 
7793  if (strat->redTailChange)
7794  {
7795  L->length = 0;
7796  L->pLength = 0;
7797  }
7798 
7799  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7800  //L->Normalize(); // HANNES: should have a test
7801  kTest_L(L);
7802  return L->GetLmCurrRing();
7803 }
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:657
#define pJet(p, m)
Definition: polys.h:350
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
#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 12753 of file kutil.cc.

12754 {
12755  /* for the shift case need to run it with withT = TRUE */
12756  strat->redTailChange=FALSE;
12757  if (strat->noTailReduction) return L->GetLmCurrRing();
12758  poly h, p;
12759  p = h = L->GetLmTailRing();
12760  if ((h==NULL) || (pNext(h)==NULL))
12761  return L->GetLmCurrRing();
12762 
12763  TObject* With;
12764  // placeholder in case strat->tl < 0
12765  TObject With_s(strat->tailRing);
12766 
12767  LObject Ln(pNext(h), strat->tailRing);
12768  Ln.pLength = L->GetpLength() - 1;
12769 
12770  pNext(h) = NULL;
12771  if (L->p != NULL) pNext(L->p) = NULL;
12772  L->pLength = 1;
12773 
12774  Ln.PrepareRed(strat->use_buckets);
12775 
12776  while(!Ln.IsNull())
12777  {
12778  loop
12779  {
12780  Ln.SetShortExpVector();
12781  if (withT)
12782  {
12783  int j;
12784  j = kFindDivisibleByInT(strat, &Ln);
12785  if (j < 0) break;
12786  With = &(strat->T[j]);
12787  }
12788  else
12789  {
12790  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12791  if (With == NULL) break;
12792  }
12793  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12794  {
12795  With->pNorm();
12796  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12797  }
12798  strat->redTailChange=TRUE;
12799  if (ksReducePolyTail(L, With, &Ln))
12800  {
12801  // reducing the tail would violate the exp bound
12802  // set a flag and hope for a retry (in bba)
12803  strat->completeReduce_retry=TRUE;
12804  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12805  do
12806  {
12807  pNext(h) = Ln.LmExtractAndIter();
12808  pIter(h);
12809  L->pLength++;
12810  } while (!Ln.IsNull());
12811  goto all_done;
12812  }
12813  if (Ln.IsNull()) goto all_done;
12814  if (! withT) With_s.Init(currRing);
12815  }
12816  pNext(h) = Ln.LmExtractAndIter();
12817  pIter(h);
12818  L->pLength++;
12819  }
12820 
12821  all_done:
12822  Ln.Delete();
12823  if (L->p != NULL) pNext(L->p) = pNext(p);
12824 
12825  if (strat->redTailChange)
12826  {
12827  L->length = 0;
12828  }
12829  L->Normalize(); // HANNES: should have a test
12830  kTest_L(L);
12831  return L->GetLmCurrRing();
12832 }
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:657
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
#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 1162 of file kstd2.cc.

1163 {
1164 #define REDTAIL_CANONICALIZE 100
1165  strat->redTailChange=FALSE;
1166  if (strat->noTailReduction) return L->GetLmCurrRing();
1167  poly h, p;
1168  p = h = L->GetLmTailRing();
1169  if ((h==NULL) || (pNext(h)==NULL))
1170  return L->GetLmCurrRing();
1171 
1172  TObject* With;
1173  // placeholder in case strat->tl < 0
1174  TObject With_s(strat->tailRing);
1175 
1176  LObject Ln(pNext(h), strat->tailRing);
1177  Ln.sig = L->sig;
1178  Ln.sevSig = L->sevSig;
1179  Ln.pLength = L->GetpLength() - 1;
1180 
1181  pNext(h) = NULL;
1182  if (L->p != NULL) pNext(L->p) = NULL;
1183  L->pLength = 1;
1184 
1185  Ln.PrepareRed(strat->use_buckets);
1186 
1187  int cnt=REDTAIL_CANONICALIZE;
1188  while(!Ln.IsNull())
1189  {
1190  loop
1191  {
1192  if(rField_is_Ring(currRing) && strat->sigdrop)
1193  break;
1194  Ln.SetShortExpVector();
1195  if (withT)
1196  {
1197  int j;
1198  j = kFindDivisibleByInT(strat, &Ln);
1199  if (j < 0) break;
1200  With = &(strat->T[j]);
1201  }
1202  else
1203  {
1204  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
1205  if (With == NULL) break;
1206  }
1207  cnt--;
1208  if (cnt==0)
1209  {
1211  /*poly tmp=*/Ln.CanonicalizeP();
1213  {
1214  Ln.Normalize();
1215  //pNormalize(tmp);
1216  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1217  }
1218  }
1219  if (normalize && (!TEST_OPT_INTSTRATEGY) && !rField_is_Ring(currRing) && (!nIsOne(pGetCoeff(With->p))))
1220  {
1221  With->pNorm();
1222  }
1223  strat->redTailChange=TRUE;
1224  #ifdef ADIDEBUG
1225  printf("\nWill TAILreduce * with *:\n");p_Write(Ln.p,strat->tailRing);pWrite(Ln.sig);
1226  p_Write(With->p,strat->tailRing);pWrite(With->sig);pWrite(L->sig);
1227  #endif
1228  int ret = ksReducePolyTailSig(L, With, &Ln, strat);
1230  L->sig = Ln.sig;
1231  //Because Ln.sig is set to L->sig, but in ksReducePolyTailSig -> ksReducePolySig
1232  // I delete it an then set Ln.sig. Hence L->sig is lost
1233  #ifdef ADIDEBUG
1234  printf("\nAfter small TAILreduce:\n");pWrite(Ln.p);pWrite(Ln.sig);pWrite(L->sig);
1235  #endif
1236 #if SBA_PRINT_REDUCTION_STEPS
1237  if (ret != 3)
1238  sba_reduction_steps++;
1239 #endif
1240 #if SBA_PRINT_OPERATIONS
1241  if (ret != 3)
1242  sba_operations += pLength(With->p);
1243 #endif
1244  if (ret)
1245  {
1246  // reducing the tail would violate the exp bound
1247  // set a flag and hope for a retry (in bba)
1248  strat->completeReduce_retry=TRUE;
1249  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
1250  do
1251  {
1252  pNext(h) = Ln.LmExtractAndIter();
1253  pIter(h);
1254  L->pLength++;
1255  } while (!Ln.IsNull());
1256  goto all_done;
1257  }
1258  if (Ln.IsNull()) goto all_done;
1259  if (! withT) With_s.Init(currRing);
1260  if(rField_is_Ring(currRing) && strat->sigdrop)
1261  {
1262  //Cannot break the loop here so easily
1263  break;
1264  }
1265  }
1266  pNext(h) = Ln.LmExtractAndIter();
1267  pIter(h);
1268  if(!rField_is_Ring(currRing))
1269  pNormalize(h);
1270  L->pLength++;
1271  }
1272  all_done:
1273  Ln.Delete();
1274  if (L->p != NULL) pNext(L->p) = pNext(p);
1275 
1276  if (strat->redTailChange)
1277  {
1278  L->length = 0;
1279  }
1280  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
1281  //L->Normalize(); // HANNES: should have a test
1282  kTest_L(L);
1283  return L->GetLmCurrRing();
1284 }
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:657
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:659
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 5058 of file kutil.cc.

5059 {
5060  int i,j,at,ecart, s2r;
5061  int fq=0;
5062  unsigned long sev;
5063  poly p;
5064  int new_suc=strat->sl+1;
5065  i= *suc;
5066  if (i<0) i=0;
5067 
5068  for (; i<=strat->sl; i++)
5069  {
5070  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5071  if (at != i)
5072  {
5073  if (new_suc > at) new_suc = at;
5074  p = strat->S[i];
5075  ecart = strat->ecartS[i];
5076  sev = strat->sevS[i];
5077  s2r = strat->S_2_R[i];
5078  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5079  for (j=i; j>=at+1; j--)
5080  {
5081  strat->S[j] = strat->S[j-1];
5082  strat->ecartS[j] = strat->ecartS[j-1];
5083  strat->sevS[j] = strat->sevS[j-1];
5084  strat->S_2_R[j] = strat->S_2_R[j-1];
5085  }
5086  strat->S[at] = p;
5087  strat->ecartS[at] = ecart;
5088  strat->sevS[at] = sev;
5089  strat->S_2_R[at] = s2r;
5090  if (strat->fromQ!=NULL)
5091  {
5092  for (j=i; j>=at+1; j--)
5093  {
5094  strat->fromQ[j] = strat->fromQ[j-1];
5095  }
5096  strat->fromQ[at]=fq;
5097  }
5098  }
5099  }
5100  if (new_suc <= strat->sl) *suc=new_suc;
5101  else *suc=-1;
5102 }
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:5111
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 2333 of file kstd2.cc.

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

1649 {
1650  if(strat->sl < 0) return FALSE;
1651  int i;
1652  for(i=0;i<strat->sl;i++)
1653  {
1654  //Construct the gcd pair between h and S[i]
1655  number d, s, t;
1656  poly m1, m2, gcd;
1657  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1658  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1659  {
1660  nDelete(&d);
1661  nDelete(&s);
1662  nDelete(&t);
1663  }
1664  else
1665  {
1666  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1667  pSetCoeff0(m1, s);
1668  pSetCoeff0(m2, t);
1669  pSetCoeff0(gcd, d);
1670  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);
1671  poly pSigMult = p_Copy(h->sig,currRing);
1672  poly sSigMult = p_Copy(strat->sig[i],currRing);
1673  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1674  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1675  p_LmDelete(m1, strat->tailRing);
1676  p_LmDelete(m2, strat->tailRing);
1677  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1678  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1679  {
1680  #ifdef ADIDEBUG
1681  printf("\nCan replace * (sig = *) with * (sig = *) since of * with sig *\n");
1682  pWrite(h->p);pWrite(h->sig);pWrite(gcd);pWrite(pairsig);pWrite(strat->S[i]);pWrite(strat->sig[i]);
1683  //getchar();
1684  #endif
1685  pDelete(&h->p);
1686  h->p = gcd;
1687  pDelete(&h->sig);
1688  h->sig = pairsig;
1689  pNext(h->sig) = NULL;
1690  strat->initEcart(h);
1691  h->sev = pGetShortExpVector(h->p);
1692  h->sevSig = pGetShortExpVector(h->sig);
1693  h->i_r1 = -1;h->i_r2 = -1;
1694  if(h->lcm != NULL)
1695  {
1696  pLmDelete(h->lcm);
1697  h->lcm = NULL;
1698  }
1699  if (currRing!=strat->tailRing)
1700  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1701  return TRUE;
1702  }
1703  //Delete what you didn't use
1704  pDelete(&gcd);
1705  pDelete(&pairsig);
1706  }
1707  }
1708  return FALSE;
1709 }
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 11386 of file kutil.cc.

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

4899 {
4901  // enter also zero divisor * poly, if this is non zero and of smaller degree
4902  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4903  initenterpairs(h, k, ecart, 0, strat, atR);
4904  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4905  clearSbatch(h, k, pos, strat);
4906 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4872
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3830
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4610
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:4659
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 4908 of file kutil.cc.

4909 {
4911  // enter also zero divisor * poly, if this is non zero and of smaller degree
4912  #ifdef ADIDEBUG
4913  printf("\n Trying to add extended spolys\n");
4914  #endif
4915  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4916  if(strat->sigdrop) return;
4917  #ifdef ADIDEBUG
4918  printf("\n Trying to add spolys\n");
4919  #endif
4920  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4921  if(strat->sigdrop) return;
4922  #ifdef ADIDEBUG
4923  printf("\n Trying to add gcd-polys\n");
4924  #endif
4925  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4926  if(strat->sigdrop) return;
4927  clearSbatch(h, k, pos, strat);
4928 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4872
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:3960
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:4742
#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:4632
static Poly * h
Definition: janet.cc:978

§ syzCriterion()

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

Definition at line 7121 of file kutil.cc.

7122 {
7123 //#if 1
7124 #ifdef DEBUGF5
7125  PrintS("syzygy criterion checks: ");
7126  pWrite(sig);
7127 #endif
7128  for (int k=0; k<strat->syzl; k++)
7129  {
7130  //printf("-%d",k);
7131 //#if 1
7132 #ifdef DEBUGF5
7133  Print("checking with: %d / %d -- \n",k,strat->syzl);
7134  pWrite(pHead(strat->syz[k]));
7135 #endif
7136  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7137  && (!rField_is_Ring(currRing) ||
7138  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7139  {
7140 //#if 1
7141 #ifdef DEBUGF5
7142  PrintS("DELETE!\n");
7143 #endif
7144  #ifdef ADIDEBUG
7145  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7146  #endif
7147  strat->nrsyzcrit++;
7148  //printf("- T -\n\n");
7149  return TRUE;
7150  }
7151  }
7152  //printf("- F -\n\n");
7153  return FALSE;
7154 }
#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 7159 of file kutil.cc.

7160 {
7161 //#if 1
7162  if(sig == NULL)
7163  return FALSE;
7164 #ifdef DEBUGF5
7165  PrintS("--- syzygy criterion checks: ");
7166  pWrite(sig);
7167 #endif
7168  int comp = p_GetComp(sig, currRing);
7169  int min, max;
7170  if (comp<=1)
7171  return FALSE;
7172  else
7173  {
7174  min = strat->syzIdx[comp-2];
7175  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7176  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7177  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7178  if (comp == strat->currIdx)
7179  {
7180  max = strat->syzl;
7181  }
7182  else
7183  {
7184  max = strat->syzIdx[comp-1];
7185  }
7186  for (int k=min; k<max; k++)
7187  {
7188 #ifdef F5DEBUG
7189  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7190  Print("checking with: %d -- ",k);
7191  pWrite(pHead(strat->syz[k]));
7192 #endif
7193  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7194  && (!rField_is_Ring(currRing) ||
7195  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7196  {
7197  #ifdef ADIDEBUG
7198  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7199  #endif
7200  strat->nrsyzcrit++;
7201  return TRUE;
7202  }
7203  }
7204  return FALSE;
7205  }
7206 }
#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 4223 of file kutil.cc.

4224 {
4225  return 1L << arg;
4226 }

§ updateResult()

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

Definition at line 10410 of file kutil.cc.

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

9010 {
9011  LObject h;
9012  int i, suc=0;
9013  poly redSi=NULL;
9014  BOOLEAN change,any_change;
9015 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9016 // for (i=0; i<=(strat->sl); i++)
9017 // {
9018 // Print("s%d:",i);
9019 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9020 // pWrite(strat->S[i]);
9021 // }
9022 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9023  any_change=FALSE;
9025  {
9026  while (suc != -1)
9027  {
9028  i=suc+1;
9029  while (i<=strat->sl)
9030  {
9031  change=FALSE;
9033  any_change = FALSE;
9034  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9035  {
9036  redSi = pHead(strat->S[i]);
9037  strat->S[i] = redBba(strat->S[i],i-1,strat);
9038  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9039  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9040  if (pCmp(redSi,strat->S[i])!=0)
9041  {
9042  change=TRUE;
9043  any_change=TRUE;
9044  #ifdef KDEBUG
9045  if (TEST_OPT_DEBUG)
9046  {
9047  PrintS("reduce:");
9048  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9049  }
9050  #endif
9051  if (TEST_OPT_PROT)
9052  {
9053  if (strat->S[i]==NULL)
9054  PrintS("V");
9055  else
9056  PrintS("v");
9057  mflush();
9058  }
9059  }
9060  pLmDelete(&redSi);
9061  if (strat->S[i]==NULL)
9062  {
9063  deleteInS(i,strat);
9064  i--;
9065  }
9066  else if (change)
9067  {
9069  {
9070  if (TEST_OPT_CONTENTSB)
9071  {
9072  number n;
9073  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9074  if (!nIsOne(n))
9075  {
9077  denom->n=nInvers(n);
9078  denom->next=DENOMINATOR_LIST;
9079  DENOMINATOR_LIST=denom;
9080  }
9081  nDelete(&n);
9082  }
9083  else
9084  {
9085  //pContent(strat->S[i]);
9086  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9087  }
9088  }
9089  else
9090  {
9091  pNorm(strat->S[i]);
9092  }
9093  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9094  }
9095  }
9096  i++;
9097  }
9098  if (any_change) reorderS(&suc,strat);
9099  else break;
9100  }
9101  if (toT)
9102  {
9103  for (i=0; i<=strat->sl; i++)
9104  {
9105  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9106  {
9107  h.p = redtailBba(strat->S[i],i-1,strat);
9109  {
9110  h.pCleardenom();// also does a pContent
9111  }
9112  }
9113  else
9114  {
9115  h.p = strat->S[i];
9116  }
9117  strat->initEcart(&h);
9118  if (strat->honey)
9119  {
9120  strat->ecartS[i] = h.ecart;
9121  }
9122  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9123  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9124  h.sev = strat->sevS[i];
9125  /*puts the elements of S also to T*/
9126  strat->initEcart(&h);
9127  enterT(h,strat);
9128  strat->S_2_R[i] = strat->tl;
9129  }
9130  }
9131  }
9132  else
9133  {
9134  while (suc != -1)
9135  {
9136  i=suc;
9137  while (i<=strat->sl)
9138  {
9139  change=FALSE;
9140  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9141  {
9142  redSi=pHead((strat->S)[i]);
9143  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9144  if ((strat->S)[i]==NULL)
9145  {
9146  deleteInS(i,strat);
9147  i--;
9148  }
9149  else if (pCmp((strat->S)[i],redSi)!=0)
9150  {
9151  any_change=TRUE;
9152  h.p = strat->S[i];
9153  strat->initEcart(&h);
9154  strat->ecartS[i] = h.ecart;
9156  {
9157  if (TEST_OPT_CONTENTSB)
9158  {
9159  number n;
9160  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9161  if (!nIsOne(n))
9162  {
9164  denom->n=nInvers(n);
9165  denom->next=DENOMINATOR_LIST;
9166  DENOMINATOR_LIST=denom;
9167  }
9168  nDelete(&n);
9169  }
9170  else
9171  {
9172  //pContent(strat->S[i]);
9173  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9174  }
9175  }
9176  else
9177  {
9178  pNorm(strat->S[i]); // == h.p
9179  }
9180  h.sev = pGetShortExpVector(h.p);
9181  strat->sevS[i] = h.sev;
9182  }
9183  pLmDelete(&redSi);
9184  kTest(strat);
9185  }
9186  i++;
9187  }
9188 #ifdef KDEBUG
9189  kTest(strat);
9190 #endif
9191  if (any_change) reorderS(&suc,strat);
9192  else { suc=-1; break; }
9193  if (h.p!=NULL)
9194  {
9195  if (!strat->kHEdgeFound)
9196  {
9197  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9198  }
9199  if (strat->kHEdgeFound)
9200  newHEdge(strat);
9201  }
9202  }
9203  for (i=0; i<=strat->sl; i++)
9204  {
9205  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9206  {
9207  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9208  strat->initEcart(&h);
9209  strat->ecartS[i] = h.ecart;
9210  h.sev = pGetShortExpVector(h.p);
9211  strat->sevS[i] = h.sev;
9212  }
9213  else
9214  {
9215  h.p = strat->S[i];
9216  h.ecart=strat->ecartS[i];
9217  h.sev = strat->sevS[i];
9218  h.length = h.pLength = pLength(h.p);
9219  }
9220  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9221  cancelunit1(&h,&suc,strat->sl,strat);
9222  h.SetpFDeg();
9223  /*puts the elements of S also to T*/
9224  enterT(h,strat);
9225  strat->S_2_R[i] = strat->tl;
9226  }
9227  if (suc!= -1) updateS(toT,strat);
9228  }
9229 #ifdef KDEBUG
9230  kTest(strat);
9231 #endif
9232 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7505
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:8852
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5058
#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:653
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1041
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7581
#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:8940
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9478
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2843
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:749
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:9009
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:8964
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10745
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:2715

§ updateSShift()

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

Definition at line 12066 of file kutil.cc.

12067 {
12068  /* to use after updateS(toT=FALSE,strat) */
12069  /* fills T with shifted elt's of S */
12070  int i;
12071  LObject h;
12072  int atT = -1; // or figure out smth better
12073  strat->tl = -1; // init
12074  for (i=0; i<=strat->sl; i++)
12075  {
12076  memset(&h,0,sizeof(h));
12077  h.p = strat->S[i]; // lm in currRing, tail in TR
12078  strat->initEcart(&h);
12079  h.sev = strat->sevS[i];
12080  h.t_p = NULL;
12081  h.GetTP(); // creates correct t_p
12082  /*puts the elements of S with their shifts to T*/
12083  // int atT, int uptodeg, int lV)
12084  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12085  // need a small check for above; we insert >=1 elements
12086  // insert this check into kTest_TS ?
12087  enterTShift(h,strat,atT,uptodeg,lV);
12088  }
12089  /* what about setting strat->tl? */
12090 }
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:12710
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.