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, const int ecart_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 654 of file kutil.h.

§ kTest_L

#define kTest_L (   T)    (TRUE)

Definition at line 658 of file kutil.h.

§ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 657 of file kutil.h.

§ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 656 of file kutil.h.

§ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 655 of file kutil.h.

§ messageSets

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

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

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

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

§ 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:9930
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7926
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7967
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:95
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10103
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:4936
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:99
#define TEST_OPT_REDSB
Definition: options.h:99
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void pWrite(poly p)
Definition: polys.h:291
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:10016
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:11361
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9480
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:655
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9761
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:403
#define messageSets(s)
Definition: kutil.h:539
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:11262
LObject P
Definition: kutil.h:296
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9779
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:10813
#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:4899
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:5112
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10624
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10412
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:11196
ideal Shdl
Definition: kutil.h:297
int BOOLEAN
Definition: auxiliary.h:86
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:10179
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11808
#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:9930
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7926
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7967
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:95
#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:99
#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:12607
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10016
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:11361
#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:12068
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:12712
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:655
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9761
#define assume(x)
Definition: mod2.h:403
#define messageSets(s)
Definition: kutil.h:539
#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:11262
LObject P
Definition: kutil.h:296
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9779
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:12096
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10813
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:5112
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10624
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10412
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:86
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10179
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:291
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:746
#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 3250 of file kutil.cc.

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

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

§ chainCritSig()

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

Definition at line 3479 of file kutil.cc.

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

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

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

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

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

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

12176 {
12177  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12178 
12181 
12182  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12183  /* that is create the pairs (f, s \dot g) */
12184 
12185  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
12186 
12187  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12188  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12189 
12190  /* determine how many elements we have to insert for a given s[i] */
12191  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12192  /* hence, a total number of elt's to add is: */
12193  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12194  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12195 
12196 #ifdef KDEBUG
12197  if (TEST_OPT_DEBUG)
12198  {
12199  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
12200  }
12201 #endif
12202 
12203  assume(i<=strat->sl); // from OnePair
12204 
12205  /* these vars hold for all shifts of s[i] */
12206  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12207 
12208  int qfromQ;
12209  if (strat->fromQ != NULL)
12210  {
12211  qfromQ = strat->fromQ[i];
12212  }
12213  else
12214  {
12215  qfromQ = -1;
12216  }
12217 
12218  int j;
12219 
12220  poly q/*, s*/;
12221 
12222  // for the 0th shift: insert the orig. pair
12223  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12224 
12225  for (j=1; j<= toInsert; j++)
12226  {
12227  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12228  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12229  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12230  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12231  // pNext(q) = s; // in tailRing
12232  /* here we need to call enterOnePair with two polys ... */
12233 
12234 #ifdef KDEBUG
12235  //if (TEST_OPT_DEBUG)
12236  //{
12237  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
12238  //}
12239 #endif
12240  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12241  }
12242 }
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:12313
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:403
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 1934 of file kutil.cc.

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

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

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

1514 {
1515  number d, s, t;
1516  assume(atR >= 0);
1517  poly m1, m2, gcd,si;
1518  if(!enterTstrong)
1519  {
1520  assume(i<=strat->sl);
1521  si = strat->S[i];
1522  }
1523  else
1524  {
1525  assume(i<=strat->tl);
1526  si = strat->T[i].p;
1527  }
1528  //printf("\n--------------------------------\n");
1529  //pWrite(p);pWrite(si);
1530  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1531 
1532  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1533  {
1534  nDelete(&d);
1535  nDelete(&s);
1536  nDelete(&t);
1537  return FALSE;
1538  }
1539 
1540  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1541  //p_Test(m1,strat->tailRing);
1542  //p_Test(m2,strat->tailRing);
1543  /*if(!enterTstrong)
1544  {
1545  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1546  {
1547  memset(&(strat->P), 0, sizeof(strat->P));
1548  kStratChangeTailRing(strat);
1549  strat->P = *(strat->R[atR]);
1550  p_LmFree(m1, strat->tailRing);
1551  p_LmFree(m2, strat->tailRing);
1552  p_LmFree(gcd, currRing);
1553  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1554  }
1555  }*/
1556  pSetCoeff0(m1, s);
1557  pSetCoeff0(m2, t);
1558  pSetCoeff0(gcd, d);
1559  p_Test(m1,strat->tailRing);
1560  p_Test(m2,strat->tailRing);
1561  //printf("\n===================================\n");
1562  //pWrite(m1);pWrite(m2);pWrite(gcd);
1563 #ifdef KDEBUG
1564  if (TEST_OPT_DEBUG)
1565  {
1566  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1567  PrintS("m1 = ");
1568  p_wrp(m1, strat->tailRing);
1569  PrintS(" ; m2 = ");
1570  p_wrp(m2, strat->tailRing);
1571  PrintS(" ; gcd = ");
1572  wrp(gcd);
1573  PrintS("\n--- create strong gcd poly: ");
1574  Print("\n p: %d", i);
1575  wrp(p);
1576  Print("\n strat->S[%d]: ", i);
1577  wrp(si);
1578  PrintS(" ---> ");
1579  }
1580 #endif
1581 
1582  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1583  p_LmDelete(m1, strat->tailRing);
1584  p_LmDelete(m2, strat->tailRing);
1585 #ifdef KDEBUG
1586  if (TEST_OPT_DEBUG)
1587  {
1588  wrp(gcd);
1589  PrintLn();
1590  }
1591 #endif
1592 
1593  LObject h;
1594  h.p = gcd;
1595  h.tailRing = strat->tailRing;
1596  int posx;
1597  h.pCleardenom();
1598  strat->initEcart(&h);
1599  h.sev = pGetShortExpVector(h.p);
1600  h.i_r1 = -1;h.i_r2 = -1;
1601  if (currRing!=strat->tailRing)
1602  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1603  if(!enterTstrong)
1604  {
1605  #if 1
1606  h.p1 = p;h.p2 = strat->S[i];
1607  #endif
1608  if (atR >= 0)
1609  {
1610  h.i_r2 = strat->S_2_R[i];
1611  h.i_r1 = atR;
1612  }
1613  else
1614  {
1615  h.i_r1 = -1;
1616  h.i_r2 = -1;
1617  }
1618  if (strat->Ll==-1)
1619  posx =0;
1620  else
1621  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1622  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1623  }
1624  else
1625  {
1626  if(h.IsNull()) return FALSE;
1627  //int red_result;
1628  //reduzieren ist teur!!!
1629  //if(strat->L != NULL)
1630  //red_result = strat->red(&h,strat);
1631  if(!h.IsNull())
1632  {
1633  enterT(h, strat,-1);
1634  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1635  //strat->enterS(h,pos,strat,-1);
1636  }
1637  }
1638  //#if 1
1639  #ifdef ADIDEBUG
1640  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1641  #endif
1642  return TRUE;
1643 }
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:95
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:99
void pWrite(poly p)
Definition: polys.h:291
#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:9480
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:403
#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:293
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 1708 of file kutil.cc.

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

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

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

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

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

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

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

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

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

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

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

10373 {
10374  /*- release temp data -*/
10376  cleanTSbaRing(strat);
10377  else
10378  cleanT(strat);
10379  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10380  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10381  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10382  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10383  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10384  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10385  if(strat->syzmax>0)
10386  {
10387  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10388  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10389  if (strat->sbaOrder == 1)
10390  {
10391  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10392  }
10393  }
10394  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10395  /*- set L: should be empty -*/
10396  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10397  /*- set B: should be empty -*/
10398  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10399  /*- set sig: no need for the signatures anymore -*/
10400  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10401  pLmDelete(&strat->tail);
10402  strat->syzComp=0;
10403 }
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:116
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,strat->P.ecart);
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
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:7926
CanonicalForm cd(bCommonDen(FF))
Definition: cfModGcd.cc:4030
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:99
#define TEST_OPT_REDSB
Definition: options.h:99
void pWrite(poly p)
Definition: polys.h:291
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:11361
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9480
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 posInSMonFirst(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5213
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6477
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:403
#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:11262
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:298
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:10813
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:5112
#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:86

§ faugereRewCriterion()

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

Definition at line 7213 of file kutil.cc.

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

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

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

§ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4209 of file kutil.cc.

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

§ 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:9240

§ 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:9240

§ initBuchMora()

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

Definition at line 10103 of file kutil.cc.

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

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

§ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9930 of file kutil.cc.

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

§ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10016 of file kutil.cc.

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

§ initBuchMoraShift()

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

Definition at line 12096 of file kutil.cc.

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

§ initenterpairsShift()

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

Definition at line 12639 of file kutil.cc.

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

§ initHilbCrit()

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

Definition at line 9761 of file kutil.cc.

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

8045 {
8046  int i,pos;
8047 
8048  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8049  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8050  strat->ecartS=initec(i);
8051  strat->sevS=initsevS(i);
8052  strat->S_2_R=initS_2_R(i);
8053  strat->fromQ=NULL;
8054  strat->Shdl=idInit(i,F->rank);
8055  strat->S=strat->Shdl->m;
8056  /*- put polys into S -*/
8057  if (Q!=NULL)
8058  {
8059  strat->fromQ=initec(i);
8060  memset(strat->fromQ,0,i*sizeof(int));
8061  for (i=0; i<IDELEMS(Q); i++)
8062  {
8063  if (Q->m[i]!=NULL)
8064  {
8065  LObject h;
8066  h.p = pCopy(Q->m[i]);
8068  {
8069  //pContent(h.p);
8070  h.pCleardenom(); // also does a pContent
8071  }
8072  else
8073  {
8074  h.pNorm();
8075  }
8077  {
8078  deleteHC(&h, strat);
8079  }
8080  if (h.p!=NULL)
8081  {
8082  strat->initEcart(&h);
8083  if (strat->sl==-1)
8084  pos =0;
8085  else
8086  {
8087  pos = posInS(strat,strat->sl,h.p,h.ecart);
8088  }
8089  h.sev = pGetShortExpVector(h.p);
8090  strat->enterS(h,pos,strat,-1);
8091  strat->fromQ[pos]=1;
8092  }
8093  }
8094  }
8095  }
8096  for (i=0; i<IDELEMS(F); i++)
8097  {
8098  if (F->m[i]!=NULL)
8099  {
8100  LObject h;
8101  h.p = pCopy(F->m[i]);
8103  {
8104  cancelunit(&h); /*- tries to cancel a unit -*/
8105  deleteHC(&h, strat);
8106  }
8107  if (h.p!=NULL)
8108  // do not rely on the input being a SB!
8109  {
8111  {
8112  //pContent(h.p);
8113  h.pCleardenom(); // also does a pContent
8114  }
8115  else
8116  {
8117  h.pNorm();
8118  }
8119  strat->initEcart(&h);
8120  if (strat->sl==-1)
8121  pos =0;
8122  else
8123  pos = posInS(strat,strat->sl,h.p,h.ecart);
8124  h.sev = pGetShortExpVector(h.p);
8125  strat->enterS(h,pos,strat,-1);
8126  }
8127  }
8128  }
8129  /*- test, if a unit is in F -*/
8130  if ((strat->sl>=0)
8131 #ifdef HAVE_RINGS
8132  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8133 #endif
8134  && pIsConstant(strat->S[0]))
8135  {
8136  while (strat->sl>0) deleteInS(strat->sl,strat);
8137  }
8138 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:5112
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:747
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:9342
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 10299 of file kutil.cc.

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

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

§ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10197 of file kutil.cc.

10198 {
10200  {
10201  if (strat->honey)
10202  {
10203  strat->posInL = posInL15;
10204  // ok -- here is the deal: from my experiments for Singular-2-0
10205  // I conclude that that posInT_EcartpLength is the best of
10206  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10207  // see the table at the end of this file
10208  if (TEST_OPT_OLDSTD)
10209  strat->posInT = posInT15;
10210  else
10211  strat->posInT = posInT_EcartpLength;
10212  }
10213  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10214  {
10215  strat->posInL = posInL11;
10216  strat->posInT = posInT11;
10217  }
10218  else if (TEST_OPT_INTSTRATEGY)
10219  {
10220  strat->posInL = posInL11;
10221  strat->posInT = posInT11;
10222  }
10223  else
10224  {
10225  strat->posInL = posInL0;
10226  strat->posInT = posInT0;
10227  }
10228  //if (strat->minim>0) strat->posInL =posInLSpecial;
10229  if (strat->homog)
10230  {
10231  strat->posInL = posInL110;
10232  strat->posInT = posInT110;
10233  }
10234  }
10235  else
10236  {
10237  if (strat->homog)
10238  {
10239  strat->posInL = posInL11;
10240  strat->posInT = posInT11;
10241  }
10242  else
10243  {
10244  if ((currRing->order[0]==ringorder_c)
10245  ||(currRing->order[0]==ringorder_C))
10246  {
10247  strat->posInL = posInL17_c;
10248  strat->posInT = posInT17_c;
10249  }
10250  else
10251  {
10252  strat->posInL = posInL17;
10253  strat->posInT = posInT17;
10254  }
10255  }
10256  }
10257  if (strat->minim>0) strat->posInL =posInLSpecial;
10258  // for further tests only
10259  if ((BTEST1(11)) || (BTEST1(12)))
10260  strat->posInL = posInL11;
10261  else if ((BTEST1(13)) || (BTEST1(14)))
10262  strat->posInL = posInL13;
10263  else if ((BTEST1(15)) || (BTEST1(16)))
10264  strat->posInL = posInL15;
10265  else if ((BTEST1(17)) || (BTEST1(18)))
10266  strat->posInL = posInL17;
10267  if (BTEST1(11))
10268  strat->posInT = posInT11;
10269  else if (BTEST1(13))
10270  strat->posInT = posInT13;
10271  else if (BTEST1(15))
10272  strat->posInT = posInT15;
10273  else if ((BTEST1(17)))
10274  strat->posInT = posInT17;
10275  else if ((BTEST1(19)))
10276  strat->posInT = posInT19;
10277  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10278  strat->posInT = posInT1;
10279  if (rField_is_Ring(currRing))
10280  {
10281  strat->posInL = posInL11Ring;
10282  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10283  strat->posInL = posInL11Ringls;
10284  strat->posInT = posInT11;
10285  }
10286  strat->posInLDependsOnLength = FALSE;
10287  strat->posInLSba = posInLSig;
10288  //strat->posInL = posInLSig;
10289  strat->posInL = posInLF5C;
10290  /*
10291  if (rField_is_Ring(currRing))
10292  {
10293  strat->posInLSba = posInLSigRing;
10294  strat->posInL = posInL11Ring;
10295  }*/
10296  //strat->posInT = posInTSig;
10297 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
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:6898
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
#define FALSE
Definition: auxiliary.h:95
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
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:99
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6389
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
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:6699
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6201
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:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

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

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

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

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

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

10852 {
10853  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10854  //assume(strat->tailRing != currRing);
10855 
10856  poly p1_max = (strat->R[atR])->max_exp;
10857  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10858 
10859  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10860  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10861  {
10862  return FALSE;
10863  }
10864  return TRUE;
10865 }
#define FALSE
Definition: auxiliary.h:95
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:99
#define assume(x)
Definition: mod2.h:403
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 4416 of file kutil.cc.

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

11809 {
11810  PrintS("red: ");
11811  if (strat->red==redFirst) PrintS("redFirst\n");
11812  else if (strat->red==redHoney) PrintS("redHoney\n");
11813  else if (strat->red==redEcart) PrintS("redEcart\n");
11814  else if (strat->red==redHomog) PrintS("redHomog\n");
11815  else Print("%p\n",(void*)strat->red);
11816  PrintS("posInT: ");
11817  if (strat->posInT==posInT0) PrintS("posInT0\n");
11818  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11819  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11820  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11821  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11822  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11823  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11824  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11825  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11826  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11827  #ifdef HAVE_RINGS
11828  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11829  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11830  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11831  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11832  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11833  #endif
11834 #ifdef HAVE_MORE_POS_IN_T
11835  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11836  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11837  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11838 #endif
11839  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11840  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11841  else Print("%p\n",(void*)strat->posInT);
11842  PrintS("posInL: ");
11843  if (strat->posInL==posInL0) PrintS("posInL0\n");
11844  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11845  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11846  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11847  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11848  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11849  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11850  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11851  #ifdef HAVE_RINGS
11852  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11853  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11854  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11855  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11856  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11857  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11858  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11859  #endif
11860  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11861  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11862  else Print("%p\n",(void*)strat->posInL);
11863  PrintS("enterS: ");
11864  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11865  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11866  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11867  else Print("%p\n",(void*)strat->enterS);
11868  PrintS("initEcart: ");
11869  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11870  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11871  else Print("%p\n",(void*)strat->initEcart);
11872  PrintS("initEcartPair: ");
11873  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11874  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11875  else Print("%p\n",(void*)strat->initEcartPair);
11876  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11877  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11878  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11879  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11880  PrintS("chainCrit: ");
11881  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11882  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11883  else Print("%p\n",(void*)strat->chainCrit);
11884  Print("posInLDependsOnLength=%d\n",
11885  strat->posInLDependsOnLength);
11886  PrintS(showOption());PrintLn();
11887  PrintS("LDeg: ");
11888  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11889  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11890  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11891  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11892  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11893  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11894  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11895  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11896  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11897  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11898  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11899  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11900  else Print("? (%lx)", (long)currRing->pLDeg);
11901  PrintS(" / ");
11902  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11903  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11904  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11905  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11906  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11907  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11908  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11909  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11910  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11911  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11912  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11913  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11914  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11915  PrintLn();
11916  PrintS("currRing->pFDeg: ");
11917  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11918  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11919  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11920  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11921  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11922  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11923  else Print("? (%lx)", (long)currRing->pFDeg);
11924  PrintLn();
11925  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11926  if(TEST_OPT_DEGBOUND)
11927  Print(" degBound: %d\n", Kstd1_deg);
11928 
11929  if( ecartWeights != NULL )
11930  {
11931  PrintS("ecartWeights: ");
11932  for (int i = rVar(currRing); i > 0; i--)
11933  Print("%hd ", ecartWeights[i]);
11934  PrintLn();
11936  }
11937 
11938 #ifndef SING_NDEBUG
11940 #endif
11941 }
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:6401
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11774
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:5481
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6898
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:5374
#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 posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
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:6857
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:5346
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3250
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6615
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6942
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:711
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5768
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:7056
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
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:6699
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
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:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
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:5440
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
BOOLEAN Gebauer
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:403
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:5870
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:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
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:5809
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:11683
#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:5557
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5599
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3463
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:6100
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:6043
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:11737
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
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:5977
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9240

§ 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:5112
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 7369 of file kutil.cc.

7371 {
7372  int j = 0;
7373  const unsigned long not_sev = ~L->sev;
7374  const unsigned long* sev = strat->sevS;
7375  poly p;
7376  ring r;
7377  L->GetLm(p, r);
7378 
7379  assume(~not_sev == p_GetShortExpVector(p, r));
7380 
7381  if (r == currRing)
7382  {
7383  if(!rField_is_Ring(r))
7384  {
7385  loop
7386  {
7387  if (j > pos) return NULL;
7388  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7389  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7390  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7391  {
7392  break;
7393  }
7394  #else
7395  if (!(sev[j] & not_sev) &&
7396  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7397  p_LmDivisibleBy(strat->S[j], p, r))
7398  {
7399  break;
7400  }
7401  #endif
7402  j++;
7403  }
7404  }
7405  #ifdef HAVE_RINGS
7406  else
7407  {
7408  loop
7409  {
7410  if (j > pos) return NULL;
7411  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7412  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7413  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7414  {
7415  break;
7416  }
7417  #else
7418  if (!(sev[j] & not_sev) &&
7419  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7420  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7421  {
7422  break;
7423  }
7424  #endif
7425  j++;
7426  }
7427  }
7428  #endif
7429  // if called from NF, T objects do not exist:
7430  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7431  {
7432  T->Set(strat->S[j], r, strat->tailRing);
7433  return T;
7434  }
7435  else
7436  {
7437 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7438 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7439 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7440  return strat->S_2_T(j);
7441  }
7442  }
7443  else
7444  {
7445  TObject* t;
7446  if(!rField_is_Ring(r))
7447  {
7448  loop
7449  {
7450  if (j > pos) return NULL;
7451  assume(strat->S_2_R[j] != -1);
7452  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7453  t = strat->S_2_T(j);
7454  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7455  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7456  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7457  {
7458  return t;
7459  }
7460  #else
7461  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7462  {
7463  t = strat->S_2_T(j);
7464  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7465  if (p_LmDivisibleBy(t->t_p, p, r))
7466  {
7467  return t;
7468  }
7469  }
7470  #endif
7471  j++;
7472  }
7473  }
7474  #ifdef HAVE_RINGS
7475  else
7476  {
7477  loop
7478  {
7479  if (j > pos) return NULL;
7480  assume(strat->S_2_R[j] != -1);
7481  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7482  t = strat->S_2_T(j);
7483  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7484  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7485  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7486  {
7487  return t;
7488  }
7489  #else
7490  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7491  {
7492  t = strat->S_2_T(j);
7493  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7494  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7495  {
7496  return t;
7497  }
7498  }
7499  #endif
7500  j++;
7501  }
7502  }
7503  #endif
7504  }
7505 }
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:403
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:4209
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:4197
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:654
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:8044
#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:403
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:9779
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:11808
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:9240
#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:8044
#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:403
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:9779
static int si_max(const int a, const int b)
Definition: auxiliary.h:121
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:9240
#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:654
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:8044
#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:403
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:9779
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:11808
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:9240
#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:8044
#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:403
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:9779
static int si_max(const int a, const int b)
Definition: auxiliary.h:121
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:9240
#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:86
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:403
const ring R
Definition: DebugPrint.cc:36
#define kTest_L(T)
Definition: kutil.h:658
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:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define kTest_L(T)
Definition: kutil.h:658
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:11262
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:656
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:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define kTest_L(T)
Definition: kutil.h:658
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:11262
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:656
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:95
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:99
void pWrite(poly p)
Definition: polys.h:291
#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:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define kTest_L(T)
Definition: kutil.h:658
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:11262
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:656
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:95
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:99
void pWrite(poly p)
Definition: polys.h:291
#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:270
#define assume(x)
Definition: mod2.h:403
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:658
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:11262
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:656
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:403
#define kTest_L(T)
Definition: kutil.h:658
#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:656
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:86
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:403
#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:86

§ kStratChangeTailRing()

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

Definition at line 11262 of file kutil.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6391 {
6392  return strat->Ll+1;
6393 }
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 6477 of file kutil.cc.

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

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

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

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

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

Definition at line 5213 of file kutil.cc.

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

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

5336 {
5337  return (length+1);
5338 }

§ posInT1()

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

Definition at line 5346 of file kutil.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

§ 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:95
#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:99
unsigned long * sevT
Definition: kutil.h:319
void pWrite(poly p)
Definition: polys.h:291
#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:403
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:11042
#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:99
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:403
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:11042
#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:95
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:291
#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:403
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:11107
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:95
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:1645
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:99
unsigned long * sevT
Definition: kutil.h:319
void pWrite(poly p)
Definition: polys.h:291
#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:403
#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 7577 of file kutil.cc.

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

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

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

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

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

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

5060 {
5061  int i,j,at,ecart, s2r;
5062  int fq=0;
5063  unsigned long sev;
5064  poly p;
5065  int new_suc=strat->sl+1;
5066  i= *suc;
5067  if (i<0) i=0;
5068 
5069  for (; i<=strat->sl; i++)
5070  {
5071  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5072  if (at != i)
5073  {
5074  if (new_suc > at) new_suc = at;
5075  p = strat->S[i];
5076  ecart = strat->ecartS[i];
5077  sev = strat->sevS[i];
5078  s2r = strat->S_2_R[i];
5079  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5080  for (j=i; j>=at+1; j--)
5081  {
5082  strat->S[j] = strat->S[j-1];
5083  strat->ecartS[j] = strat->ecartS[j-1];
5084  strat->sevS[j] = strat->sevS[j-1];
5085  strat->S_2_R[j] = strat->S_2_R[j-1];
5086  }
5087  strat->S[at] = p;
5088  strat->ecartS[at] = ecart;
5089  strat->sevS[at] = sev;
5090  strat->S_2_R[at] = s2r;
5091  if (strat->fromQ!=NULL)
5092  {
5093  for (j=i; j>=at+1; j--)
5094  {
5095  strat->fromQ[j] = strat->fromQ[j-1];
5096  }
5097  strat->fromQ[at]=fq;
5098  }
5099  }
5100  }
5101  if (new_suc <= strat->sl) *suc=new_suc;
5102  else *suc=-1;
5103 }
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:5112
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:10197
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:7926
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:5291
#define FALSE
Definition: auxiliary.h:95
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:8391
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:99
#define TEST_OPT_REDSB
Definition: options.h:99
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:11388
void pWrite(poly p)
Definition: polys.h:291
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:10299
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:4962
#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:11361
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9480
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:655
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:9761
#define assume(x)
Definition: mod2.h:403
#define messageSets(s)
Definition: kutil.h:539
#define pSetExpV(p, e)
Definition: polys.h:97
void messageStatSBA(int hilbcount, kStrategy strat)
Definition: kutil.cc:7979
#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:11262
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:10372
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:4909
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:10813
#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:6361
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:9843
#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:10624
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10412
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:86
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:11808
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9677
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 1645 of file kutil.cc.

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

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

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

4910 {
4912  // enter also zero divisor * poly, if this is non zero and of smaller degree
4913  #ifdef ADIDEBUG
4914  printf("\n Trying to add extended spolys\n");
4915  #endif
4916  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4917  if(strat->sigdrop) return;
4918  #ifdef ADIDEBUG
4919  printf("\n Trying to add spolys\n");
4920  #endif
4921  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4922  if(strat->sigdrop) return;
4923  #ifdef ADIDEBUG
4924  printf("\n Trying to add gcd-polys\n");
4925  #endif
4926  initenterstrongPairsSig(h, hSig, hFrom,k, ecart, 0, strat, atR);
4927  if(strat->sigdrop) return;
4928  clearSbatch(h, k, pos, strat);
4929 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4873
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:3957
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:4743
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static Poly * h
Definition: janet.cc:978
void initenterstrongPairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4633

§ syzCriterion()

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

Definition at line 7123 of file kutil.cc.

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

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

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

§ updateResult()

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

Definition at line 10412 of file kutil.cc.

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

§ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9011 of file kutil.cc.

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

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