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 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 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)
 
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 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 394 of file kutil.h.

§ HAVE_TAIL_RING

#define HAVE_TAIL_RING

Definition at line 25 of file kutil.h.

§ KINLINE

#define KINLINE

Definition at line 51 of file kutil.h.

§ kTest

#define kTest (   A)    (TRUE)

Definition at line 653 of file kutil.h.

§ kTest_L

#define kTest_L (   T)    (TRUE)

Definition at line 657 of file kutil.h.

§ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 656 of file kutil.h.

§ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 655 of file kutil.h.

§ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 654 of file kutil.h.

§ messageSets

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

Definition at line 538 of file kutil.h.

§ NO_KINLINE

#define NO_KINLINE   1

Definition at line 52 of file kutil.h.

§ setmax

#define setmax   16

Definition at line 28 of file kutil.h.

§ setmaxL

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

Definition at line 29 of file kutil.h.

§ setmaxLinc

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

Definition at line 30 of file kutil.h.

§ setmaxT

#define setmaxT   64

Definition at line 32 of file kutil.h.

§ setmaxTinc

#define setmaxTinc   32

Definition at line 33 of file kutil.h.

Typedef Documentation

§ denominator_list

Definition at line 65 of file kutil.h.

§ intset

typedef int* intset

Definition at line 55 of file kutil.h.

§ LObject

typedef class sLObject LObject

Definition at line 60 of file kutil.h.

§ LSet

typedef LObject* LSet

Definition at line 62 of file kutil.h.

§ TObject

typedef class sTObject TObject

Definition at line 59 of file kutil.h.

§ TSet

typedef TObject* TSet

Definition at line 61 of file kutil.h.

§ wlen_set

typedef wlen_type* wlen_set

Definition at line 57 of file kutil.h.

§ wlen_type

typedef int64 wlen_type

Definition at line 56 of file kutil.h.

Function Documentation

§ arriRewCriterion()

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

Definition at line 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:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:97
#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:101
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:298
#define pOne()
Definition: polys.h:298
polyset S
Definition: kutil.h:302
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:346
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:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:97
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:101
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:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
LSet B
Definition: kutil.h:324
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:346
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 1166 of file kInline.h.

1167 {
1168  return FALSE;
1169 }
#define FALSE
Definition: auxiliary.h:97

§ bba()

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

Definition at line 1800 of file kstd2.cc.

1801 {
1802  int red_result = 1;
1803  int olddeg,reduc;
1804  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1805  BOOLEAN withT = FALSE;
1806  BITSET save;
1807  SI_SAVE_OPT1(save);
1808 
1809  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1811  initBuchMoraPosRing(strat);
1812  else
1813  initBuchMoraPos(strat);
1814  initHilbCrit(F,Q,&hilb,strat);
1815  initBba(strat);
1816  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1817  /*Shdl=*/initBuchMora(F, Q,strat);
1818  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1819  reduc = olddeg = 0;
1820 
1821 #ifndef NO_BUCKETS
1822  if (!TEST_OPT_NOT_BUCKETS)
1823  strat->use_buckets = 1;
1824 #endif
1825  // redtailBBa against T for inhomogenous input
1826  if (!TEST_OPT_OLDSTD)
1827  withT = ! strat->homog;
1828 
1829  // strat->posInT = posInT_pLength;
1830  kTest_TS(strat);
1831 
1832 #ifdef HAVE_TAIL_RING
1833  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1834  kStratInitChangeTailRing(strat);
1835 #endif
1836  if (BVERBOSE(23))
1837  {
1838  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1839  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1840  kDebugPrint(strat);
1841  }
1842 
1843 
1844 #ifdef KDEBUG
1845  //kDebugPrint(strat);
1846 #endif
1847  /* compute------------------------------------------------------- */
1848  while (strat->Ll >= 0)
1849  {
1850  #ifdef ADIDEBUG
1851  printf("\n ------------------------NEW LOOP\n");
1852  printf("\nShdl = \n");
1853  #if 0
1854  idPrint(strat->Shdl);
1855  #else
1856  for(int ii = 0; ii<=strat->sl;ii++)
1857  p_Write(strat->S[ii],strat->tailRing);
1858  #endif
1859  printf("\n list L\n");
1860  int iii;
1861  #if 1
1862  for(iii = 0; iii<= strat->Ll; iii++)
1863  {
1864  printf("L[%i]:",iii);
1865  p_Write(strat->L[iii].p, currRing);
1866  p_Write(strat->L[iii].p1, currRing);
1867  p_Write(strat->L[iii].p2, currRing);
1868  }
1869  #else
1870  {
1871  printf("L[%i]:",strat->Ll);
1872  p_Write(strat->L[strat->Ll].p, strat->tailRing);
1873  p_Write(strat->L[strat->Ll].p1, strat->tailRing);
1874  p_Write(strat->L[strat->Ll].p2, strat->tailRing);
1875  }
1876  #endif
1877  #if 0
1878  for(iii = 0; iii<= strat->Bl; iii++)
1879  {
1880  printf("B[%i]:",iii);
1881  p_Write(strat->B[iii].p, /*strat->tailRing*/currRing);
1882  p_Write(strat->B[iii].p1, /*strat->tailRing*/currRing);
1883  p_Write(strat->B[iii].p2, strat->tailRing);
1884  }
1885  #endif
1886  //getchar();
1887  #endif
1888  #ifdef KDEBUG
1889  if (TEST_OPT_DEBUG) messageSets(strat);
1890  #endif
1891  if (strat->Ll== 0) strat->interpt=TRUE;
1892  if (TEST_OPT_DEGBOUND
1893  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1894  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1895  {
1896  /*
1897  *stops computation if
1898  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1899  *a predefined number Kstd1_deg
1900  */
1901  while ((strat->Ll >= 0)
1902  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1903  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1904  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1905  )
1906  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1907  if (strat->Ll<0) break;
1908  else strat->noClearS=TRUE;
1909  }
1910  /* picks the last element from the lazyset L */
1911  strat->P = strat->L[strat->Ll];
1912  strat->Ll--;
1913 
1914  if (pNext(strat->P.p) == strat->tail)
1915  {
1916  // deletes the short spoly
1917  if (rField_is_Ring(currRing))
1918  pLmDelete(strat->P.p);
1919  else
1920  pLmFree(strat->P.p);
1921  strat->P.p = NULL;
1922  poly m1 = NULL, m2 = NULL;
1923 
1924  // check that spoly creation is ok
1925  while (strat->tailRing != currRing &&
1926  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1927  {
1928  assume(m1 == NULL && m2 == NULL);
1929  // if not, change to a ring where exponents are at least
1930  // large enough
1931  if (!kStratChangeTailRing(strat))
1932  {
1933  WerrorS("OVERFLOW...");
1934  break;
1935  }
1936  }
1937  // create the real one
1938  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
1939  strat->tailRing, m1, m2, strat->R);
1940  }
1941  else if (strat->P.p1 == NULL)
1942  {
1943  if (strat->minim > 0)
1944  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
1945  // for input polys, prepare reduction
1946  strat->P.PrepareRed(strat->use_buckets);
1947  }
1948 
1949  if (strat->P.p == NULL && strat->P.t_p == NULL)
1950  {
1951  red_result = 0;
1952  }
1953  else
1954  {
1955  if (TEST_OPT_PROT)
1956  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
1957  &olddeg,&reduc,strat, red_result);
1958 
1959  /* reduction of the element chosen from L */
1960  red_result = strat->red(&strat->P,strat);
1961  if (errorreported) break;
1962  }
1963 
1964  if (strat->overflow)
1965  {
1966  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
1967  }
1968 
1969  // reduction to non-zero new poly
1970  if (red_result == 1)
1971  {
1972  // get the polynomial (canonicalize bucket, make sure P.p is set)
1973  strat->P.GetP(strat->lmBin);
1974  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
1975  // but now, for entering S, T, we reset it
1976  // in the inhomogeneous case: FDeg == pFDeg
1977  if (strat->homog) strat->initEcart(&(strat->P));
1978 
1979  /* statistic */
1980  if (TEST_OPT_PROT) PrintS("s");
1981 
1982  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1983 
1984  // reduce the tail and normalize poly
1985  // in the ring case we cannot expect LC(f) = 1,
1986  // therefore we call pContent instead of pNorm
1988  {
1989  strat->P.pCleardenom();
1991  {
1992  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1993  strat->P.pCleardenom();
1994  }
1995  }
1996  else
1997  {
1998  strat->P.pNorm();
2000  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2001  }
2002 
2003 #ifdef KDEBUG
2004  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2005 #endif /* KDEBUG */
2006 
2007  // min_std stuff
2008  if ((strat->P.p1==NULL) && (strat->minim>0))
2009  {
2010  if (strat->minim==1)
2011  {
2012  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2013  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2014  }
2015  else
2016  {
2017  strat->M->m[minimcnt]=strat->P.p2;
2018  strat->P.p2=NULL;
2019  }
2020  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2021  pNext(strat->M->m[minimcnt])
2022  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2023  strat->tailRing, currRing,
2024  currRing->PolyBin);
2025  minimcnt++;
2026  }
2027 
2028  // enter into S, L, and T
2029  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2030  {
2031  enterT(strat->P, strat);
2032  if (rField_is_Ring(currRing))
2033  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2034  else
2035  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2036  // posInS only depends on the leading term
2037  strat->enterS(strat->P, pos, strat, strat->tl);
2038  #ifdef ADIDEBUG
2039  printf("\nThis element has been added to S:\n");pWrite(strat->P.p);pWrite(strat->P.p1);pWrite(strat->P.p2);
2040  #endif
2041 #if 0
2042  int pl=pLength(strat->P.p);
2043  if (pl==1)
2044  {
2045  //if (TEST_OPT_PROT)
2046  //PrintS("<1>");
2047  }
2048  else if (pl==2)
2049  {
2050  //if (TEST_OPT_PROT)
2051  //PrintS("<2>");
2052  }
2053 #endif
2054  }
2055  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2056 // Print("[%d]",hilbeledeg);
2057  if (strat->P.lcm!=NULL)
2058  {
2059  if (rField_is_Ring(currRing)) pLmDelete(strat->P.lcm);
2060  else pLmFree(strat->P.lcm);
2061  strat->P.lcm=NULL;
2062  }
2063  if (strat->s_poly!=NULL)
2064  {
2065  // the only valid entries are: strat->P.p,
2066  // strat->tailRing (read-only, keep it)
2067  // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2068  if (strat->s_poly(strat))
2069  {
2070  // we are called AFTER enterS, i.e. if we change P
2071  // we have to add it also to S/T
2072  // and add pairs
2073  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2074  enterT(strat->P, strat);
2075  if (rField_is_Ring(currRing))
2076  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2077  else
2078  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2079  strat->enterS(strat->P, pos, strat, strat->tl);
2080  }
2081  }
2082  }
2083  else if (strat->P.p1 == NULL && strat->minim > 0)
2084  {
2085  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2086  }
2087 
2088 #ifdef KDEBUG
2089  memset(&(strat->P), 0, sizeof(strat->P));
2090 #endif /* KDEBUG */
2091  kTest_TS(strat);
2092  }
2093 #ifdef KDEBUG
2094  if (TEST_OPT_DEBUG) messageSets(strat);
2095 #endif /* KDEBUG */
2096 
2097  if (TEST_OPT_SB_1)
2098  {
2099  if(!rField_is_Ring(currRing))
2100  {
2101  int k=1;
2102  int j;
2103  while(k<=strat->sl)
2104  {
2105  j=0;
2106  loop
2107  {
2108  if (j>=k) break;
2109  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2110  j++;
2111  }
2112  k++;
2113  }
2114  }
2115  }
2116  /* complete reduction of the standard basis--------- */
2117  if (TEST_OPT_REDSB)
2118  {
2119  completeReduce(strat);
2120 #ifdef HAVE_TAIL_RING
2121  if (strat->completeReduce_retry)
2122  {
2123  // completeReduce needed larger exponents, retry
2124  // to reduce with S (instead of T)
2125  // and in currRing (instead of strat->tailRing)
2126  cleanT(strat);strat->tailRing=currRing;
2127  int i;
2128  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2129  completeReduce(strat);
2130  }
2131 #endif
2132  }
2133  else if (TEST_OPT_PROT) PrintLn();
2134  if(nCoeff_is_Ring_Z(currRing->cf))
2135  finalReduceByMon(strat);
2137  {
2138  for(int i = 0;i<=strat->sl;i++)
2139  {
2140  if(!nGreaterZero(pGetCoeff(strat->S[i])))
2141  {
2142  strat->S[i] = pNeg(strat->S[i]);
2143  }
2144  }
2145  }
2146  /* release temp data-------------------------------- */
2147  exitBuchMora(strat);
2148 // if (TEST_OPT_WEIGHTM)
2149 // {
2150 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2151 // if (ecartWeights)
2152 // {
2153 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2154 // ecartWeights=NULL;
2155 // }
2156 // }
2157  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
2158  SI_RESTORE_OPT1(save);
2159  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2160 
2161  idTest(strat->Shdl);
2162 
2163  return (strat->Shdl);
2164 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:376
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9814
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7810
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7851
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:9987
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:350
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
char noClearS
Definition: kutil.h:401
#define TRUE
Definition: auxiliary.h:101
#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:9900
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1116
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
int minim
Definition: kutil.h:356
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:11245
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
BOOLEAN interpt
Definition: kutil.h:370
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:48
BOOLEAN homog
Definition: kutil.h:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:654
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9645
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:403
#define messageSets(s)
Definition: kutil.h:538
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:637
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9663
ideal M
Definition: kutil.h:301
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
polyset S
Definition: kutil.h:302
#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:10697
#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:323
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:324
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4899
ring tailRing
Definition: kutil.h:341
#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:10508
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10296
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:1141
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:82
int sl
Definition: kutil.h:346
BOOLEAN use_buckets
Definition: kutil.h:382
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:11080
ideal Shdl
Definition: kutil.h:299
int BOOLEAN
Definition: auxiliary.h:88
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:10063
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11692
#define idTest(id)
Definition: ideals.h:49

§ bbaShift()

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

Definition at line 3677 of file kstd2.cc.

3678 {
3679  int red_result = 1;
3680  int olddeg,reduc;
3681  int hilbeledeg=1,hilbcount=0,minimcnt=0;
3682  BOOLEAN withT = TRUE; // very important for shifts
3683 
3684  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
3686  initBuchMoraPosRing(strat);
3687  else
3688  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
3689  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
3690  initBbaShift(strat); /* DONE */
3691  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3692  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
3693  updateSShift(strat,uptodeg,lV); /* initializes T */
3694 
3695  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
3696  reduc = olddeg = 0;
3697  strat->lV=lV;
3698 
3699 #ifndef NO_BUCKETS
3700  if (!TEST_OPT_NOT_BUCKETS)
3701  strat->use_buckets = 1;
3702 #endif
3703 
3704  // redtailBBa against T for inhomogenous input
3705  // if (!TEST_OPT_OLDSTD)
3706  // withT = ! strat->homog;
3707 
3708  // strat->posInT = posInT_pLength;
3709  kTest_TS(strat);
3710 
3711 #ifdef HAVE_TAIL_RING
3712  kStratInitChangeTailRing(strat);
3713 #endif
3714 
3715  /* compute------------------------------------------------------- */
3716  while (strat->Ll >= 0)
3717  {
3718 #ifdef KDEBUG
3719  if (TEST_OPT_DEBUG) messageSets(strat);
3720 #endif
3721  if (strat->Ll== 0) strat->interpt=TRUE;
3722  if (TEST_OPT_DEGBOUND
3723  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3724  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
3725  {
3726  /*
3727  *stops computation if
3728  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
3729  *a predefined number Kstd1_deg
3730  */
3731  while ((strat->Ll >= 0)
3732  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
3733  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3734  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
3735  )
3736  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
3737  if (strat->Ll<0) break;
3738  else strat->noClearS=TRUE;
3739  }
3740  /* picks the last element from the lazyset L */
3741  strat->P = strat->L[strat->Ll];
3742  strat->Ll--;
3743 
3744  if (pNext(strat->P.p) == strat->tail)
3745  {
3746  // deletes the short spoly
3747  pLmFree(strat->P.p);
3748  strat->P.p = NULL;
3749  poly m1 = NULL, m2 = NULL;
3750 
3751  // check that spoly creation is ok
3752  while (strat->tailRing != currRing &&
3753  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3754  {
3755  assume(m1 == NULL && m2 == NULL);
3756  // if not, change to a ring where exponents are at least
3757  // large enough
3758  kStratChangeTailRing(strat);
3759  }
3760  // create the real one
3761  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3762  strat->tailRing, m1, m2, strat->R);
3763  }
3764  else if (strat->P.p1 == NULL)
3765  {
3766  if (strat->minim > 0)
3767  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3768  // for input polys, prepare reduction
3769  strat->P.PrepareRed(strat->use_buckets);
3770  }
3771 
3772  poly qq;
3773 
3774  /* here in the nonhomog case we shrink the new spoly */
3775 
3776  if ( ! strat->homog)
3777  {
3778  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3779  /* in the nonhomog case we have to shrink the polynomial */
3780  assume(strat->P.t_p!=NULL);
3781  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
3782  if (qq != NULL)
3783  {
3784  /* we're here if Shrink is nonzero */
3785  // strat->P.p = NULL;
3786  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
3787  strat->P.p = NULL; // is not set by Delete
3788  strat->P.t_p = qq;
3789  strat->P.GetP(strat->lmBin);
3790  // update sev and length
3791  strat->initEcart(&(strat->P));
3792  strat->P.sev = pGetShortExpVector(strat->P.p);
3793 // strat->P.FDeg = strat->P.pFDeg();
3794 // strat->P.length = strat->P.pLDeg();
3795 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
3796  }
3797  else
3798  {
3799  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3800 #ifdef KDEBUG
3801  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
3802 #endif
3803  // strat->P.Delete(); // cause error
3804  strat->P.p = NULL;
3805  strat->P.t_p = NULL;
3806  // strat->P.p = NULL; // or delete strat->P.p ?
3807  }
3808  }
3809  /* end shrinking poly in the nonhomog case */
3810 
3811  if (strat->P.p == NULL && strat->P.t_p == NULL)
3812  {
3813  red_result = 0;
3814  }
3815  else
3816  {
3817  if (TEST_OPT_PROT)
3818  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3819  &olddeg,&reduc,strat, red_result);
3820 
3821  /* reduction of the element chosen from L */
3822  red_result = strat->red(&strat->P,strat);
3823  }
3824 
3825  // reduction to non-zero new poly
3826  if (red_result == 1)
3827  {
3828  /* statistic */
3829  if (TEST_OPT_PROT) PrintS("s");
3830 
3831  // get the polynomial (canonicalize bucket, make sure P.p is set)
3832  strat->P.GetP(strat->lmBin);
3833 
3834  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3835 
3836  // reduce the tail and normalize poly
3838  {
3839  strat->P.pCleardenom();
3841  {
3842  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3843  strat->P.pCleardenom();
3844  }
3845  }
3846  else
3847  {
3848  strat->P.pNorm();
3850  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3851  }
3852 
3853  // here we must shrink again! and optionally reduce again
3854  // or build shrink into redtailBba!
3855 
3856 #ifdef KDEBUG
3857  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3858 #endif
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  /* here in the nonhomog case we shrink the reduced poly AGAIN */
3882 
3883  if ( ! strat->homog)
3884  {
3885  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3886  /* assume strat->P.t_p != NULL */
3887  /* in the nonhomog case we have to shrink the polynomial */
3888  assume(strat->P.t_p!=NULL); // poly qq defined above
3889  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
3890  if (qq != NULL)
3891  {
3892  /* we're here if Shrink is nonzero */
3893  // strat->P.p = NULL;
3894  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
3895  strat->P.p = NULL; // is not set by Delete
3896  strat->P.t_p = qq;
3897  strat->P.GetP(strat->lmBin);
3898  // update sev and length
3899  strat->initEcart(&(strat->P));
3900  strat->P.sev = pGetShortExpVector(strat->P.p);
3901  }
3902  else
3903  {
3904  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3905 #ifdef PDEBUG
3906  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
3907 #endif
3908  // strat->P.Delete(); // cause error
3909  strat->P.p = NULL;
3910  strat->P.t_p = NULL;
3911  // strat->P.p = NULL; // or delete strat->P.p ?
3912  goto red_shrink2zero;
3913  }
3914  }
3915  /* end shrinking poly AGAIN in the nonhomog case */
3916 
3917 
3918  // enter into S, L, and T
3919  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3920  // enterT(strat->P, strat); // this was here before Shift stuff
3921  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
3922  // the default value for atT = -1 as in bba
3923  /* strat->P.GetP(); */
3924  // because shifts are counted with .p structure // done before, but ?
3925  enterTShift(strat->P,strat,-1,uptodeg, lV);
3926  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3927  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3928  // posInS only depends on the leading term
3929  strat->enterS(strat->P, pos, strat, strat->tl);
3930 
3931  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3932 // Print("[%d]",hilbeledeg);
3933  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
3934  }
3935  else
3936  {
3937  red_shrink2zero:
3938  if (strat->P.p1 == NULL && strat->minim > 0)
3939  {
3940  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3941  }
3942  }
3943 #ifdef KDEBUG
3944  memset(&(strat->P), 0, sizeof(strat->P));
3945 #endif
3946  kTest_TS(strat);
3947  }
3948 #ifdef KDEBUG
3949  if (TEST_OPT_DEBUG) messageSets(strat);
3950 #endif
3951  /* complete reduction of the standard basis--------- */
3952  /* shift case: look for elt's in S such that they are divisible by elt in T */
3953  // if (TEST_OPT_SB_1)
3954  if (TEST_OPT_REDSB)
3955  {
3956  int k=0;
3957  int j=-1;
3958  while(k<=strat->sl)
3959  {
3960 // loop
3961 // {
3962 // if (j>=k) break;
3963 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3964 // j++;
3965 // }
3966  LObject Ln (strat->S[k],currRing, strat->tailRing);
3967  Ln.SetShortExpVector();
3968  j = kFindDivisibleByInT(strat, &Ln, j+1);
3969  if (j<0) { k++; j=-1;}
3970  else
3971  {
3972  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
3973  {
3974  j = kFindDivisibleByInT(strat, &Ln, j+1);
3975  if (j<0) { k++; j=-1;}
3976  else
3977  {
3978  deleteInS(k,strat);
3979  }
3980  }
3981  else
3982  {
3983  deleteInS(k,strat);
3984  }
3985  }
3986  }
3987  }
3988 
3989  if (TEST_OPT_REDSB)
3990  { completeReduce(strat, TRUE); //shift: withT = TRUE
3991  if (strat->completeReduce_retry)
3992  {
3993  // completeReduce needed larger exponents, retry
3994  // to reduce with S (instead of T)
3995  // and in currRing (instead of strat->tailRing)
3996  cleanT(strat);strat->tailRing=currRing;
3997  int i;
3998  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3999  completeReduce(strat, TRUE);
4000  }
4001  }
4002  else if (TEST_OPT_PROT) PrintLn();
4003 
4004  /* release temp data-------------------------------- */
4005  exitBuchMora(strat);
4006 // if (TEST_OPT_WEIGHTM)
4007 // {
4008 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
4009 // if (ecartWeights)
4010 // {
4011 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
4012 // ecartWeights=NULL;
4013 // }
4014 // }
4015  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
4016  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
4017  return (strat->Shdl);
4018 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:376
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9814
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7810
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7851
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#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:401
#define TRUE
Definition: auxiliary.h:101
#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:12491
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:9900
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1116
int minim
Definition: kutil.h:356
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:11245
#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:11952
BOOLEAN interpt
Definition: kutil.h:370
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:12596
int lV
Definition: kutil.h:367
BOOLEAN homog
Definition: kutil.h:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:654
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9645
#define assume(x)
Definition: mod2.h:403
#define messageSets(s)
Definition: kutil.h:538
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:637
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9663
ideal M
Definition: kutil.h:301
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:11980
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10697
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:4182
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:323
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:341
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:10508
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10296
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:342
BOOLEAN use_buckets
Definition: kutil.h:382
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:88
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10063

§ 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 = 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 = 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:1208

§ 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:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
void 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:378
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:377
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:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:376
LSet L
Definition: kutil.h:323
#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:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3204
int BOOLEAN
Definition: auxiliary.h:88
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:331
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3204
int BOOLEAN
Definition: auxiliary.h:88

§ 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:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
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:332
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3227
LSet L
Definition: kutil.h:323
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pNext(p)
Definition: monomials.h: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 != NULL)
567  {
568  p_LmFree(strat->T[j].max, 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:348
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:302
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:341
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
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 1141 of file kInline.h.

1143 {
1144  assume(p_sev == pGetShortExpVector(p));
1145  if (strat->noClearS) return;
1146  #ifdef HAVE_RINGS
1148  {
1149  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1150  return;
1151  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing))
1152  return;
1153  }
1154  else
1155  #endif
1156  {
1157  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1158  }
1159  deleteInS((*at),strat);
1160  (*at)--;
1161  (*k)--;
1162 }
return P p
Definition: myNF.cc:203
char noClearS
Definition: kutil.h:401
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:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevS
Definition: kutil.h:318

§ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 10508 of file kutil.cc.

10509 {
10510  int i;
10511  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10512  LObject L;
10513 
10514 #ifdef KDEBUG
10515  // need to set this: during tailreductions of T[i], T[i].max is out of
10516  // sync
10517  sloppy_max = TRUE;
10518 #endif
10519 
10520  strat->noTailReduction = FALSE;
10521  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10522  if (TEST_OPT_PROT)
10523  {
10524  PrintLn();
10525 // if (timerv) writeTime("standard base computed:");
10526  }
10527  if (TEST_OPT_PROT)
10528  {
10529  Print("(S:%d)",strat->sl);mflush();
10530  }
10531  for (i=strat->sl; i>=low; i--)
10532  {
10533  int end_pos=strat->sl;
10534  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10535  if (strat->ak==0) end_pos=i-1;
10536  TObject* T_j = strat->s_2_t(i);
10537  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10538  {
10539  L = *T_j;
10540  #ifdef KDEBUG
10541  if (TEST_OPT_DEBUG)
10542  {
10543  Print("test S[%d]:",i);
10544  p_wrp(L.p,currRing,strat->tailRing);
10545  PrintLn();
10546  }
10547  #endif
10549  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10550  else
10551  strat->S[i] = redtail(&L, strat->sl, strat);
10552  #ifdef KDEBUG
10553  if (TEST_OPT_DEBUG)
10554  {
10555  Print("to (tailR) S[%d]:",i);
10556  p_wrp(strat->S[i],currRing,strat->tailRing);
10557  PrintLn();
10558  }
10559  #endif
10560 
10561  if (strat->redTailChange && strat->tailRing != currRing)
10562  {
10563  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
10564  if (pNext(T_j->p) != NULL)
10565  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10566  else
10567  T_j->max = NULL;
10568  }
10570  T_j->pCleardenom();
10571  }
10572  else
10573  {
10574  assume(currRing == strat->tailRing);
10575  #ifdef KDEBUG
10576  if (TEST_OPT_DEBUG)
10577  {
10578  Print("test S[%d]:",i);
10579  p_wrp(strat->S[i],currRing,strat->tailRing);
10580  PrintLn();
10581  }
10582  #endif
10584  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10585  else
10586  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10588  {
10589  if (TEST_OPT_CONTENTSB)
10590  {
10591  number n;
10592  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10593  if (!nIsOne(n))
10594  {
10596  denom->n=nInvers(n);
10597  denom->next=DENOMINATOR_LIST;
10598  DENOMINATOR_LIST=denom;
10599  }
10600  nDelete(&n);
10601  }
10602  else
10603  {
10604  //pContent(strat->S[i]);
10605  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10606  }
10607  }
10608  #ifdef KDEBUG
10609  if (TEST_OPT_DEBUG)
10610  {
10611  Print("to (-tailR) S[%d]:",i);
10612  p_wrp(strat->S[i],currRing,strat->tailRing);
10613  PrintLn();
10614  }
10615  #endif
10616  }
10617  if (TEST_OPT_PROT)
10618  PrintS("-");
10619  }
10620  if (TEST_OPT_PROT) PrintLn();
10621 #ifdef KDEBUG
10622  sloppy_max = FALSE;
10623 #endif
10624 }
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:97
BOOLEAN noTailReduction
Definition: kutil.h:377
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
int ak
Definition: kutil.h:351
#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:2844
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:317
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#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:341
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:346
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:2716
char redTailChange
Definition: kutil.h:398
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:1138

§ 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:3556
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:341
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 = NULL;
282  }
283  else if (fromNext)
284  L->max = 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:657
P bucket
Definition: myNF.cc:79
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
BOOLEAN kHEdgeFound
Definition: kutil.h:375
BOOLEAN LDegLast
Definition: kutil.h:384
#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:1138

§ 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:332
#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:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
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:320
polyset sig
Definition: kutil.h:304
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
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:280
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h: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:349
#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:276
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:901
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:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
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:358
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:97
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:278
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
#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:276
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:901
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:282
LObject P
Definition: kutil.h:298
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:323
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
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:346
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:280
#define pSetm(p)
Definition: polys.h:253
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
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:101
#define pLcm(a, b, m)
Definition: polys.h:278
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:824
int Bmax
Definition: kutil.h:350
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:378
#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:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:376
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
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:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:394
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 12059 of file kutil.cc.

12060 {
12061  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12062 
12065 
12066  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12067  /* that is create the pairs (f, s \dot g) */
12068 
12069  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
12070 
12071  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12072  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12073 
12074  /* determine how many elements we have to insert for a given s[i] */
12075  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12076  /* hence, a total number of elt's to add is: */
12077  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12078  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12079 
12080 #ifdef KDEBUG
12081  if (TEST_OPT_DEBUG)
12082  {
12083  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
12084  }
12085 #endif
12086 
12087  assume(i<=strat->sl); // from OnePair
12088 
12089  /* these vars hold for all shifts of s[i] */
12090  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12091 
12092  int qfromQ;
12093  if (strat->fromQ != NULL)
12094  {
12095  qfromQ = strat->fromQ[i];
12096  }
12097  else
12098  {
12099  qfromQ = -1;
12100  }
12101 
12102  int j;
12103 
12104  poly q/*, s*/;
12105 
12106  // for the 0th shift: insert the orig. pair
12107  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12108 
12109  for (j=1; j<= toInsert; j++)
12110  {
12111  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12112  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12113  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12114  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12115  // pNext(q) = s; // in tailRing
12116  /* here we need to call enterOnePair with two polys ... */
12117 
12118 #ifdef KDEBUG
12119  //if (TEST_OPT_DEBUG)
12120  //{
12121  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
12122  //}
12123 #endif
12124  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12125  }
12126 }
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:12197
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:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
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:341
#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:280
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2308
#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:340
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
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:331
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:101
#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:283
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1939
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:824
int Bmax
Definition: kutil.h:350
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:378
#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:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:376
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
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:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:394
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 12134 of file kutil.cc.

12135 {
12136 
12137  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12138  /* for true self pairs qq ==p */
12139  /* we test both qq and p */
12141  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12144 
12145  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12146 
12147  // int j = 0;
12148  int j = 1;
12149 
12150  /* for such self pairs start with 1, not with 0 */
12151  if (qq == p) j=1;
12152 
12153  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12154  /* that is create the pairs (f, s \dot g) */
12155 
12156  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12157 
12158 #ifdef KDEBUG
12159  //if (TEST_OPT_DEBUG)
12160  //{
12161  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12162  //}
12163 #endif
12164 
12165  poly q;
12166 
12167  /* these vars hold for all shifts of s[i] */
12168  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12169  int qfromQ = 0; // strat->fromQ[i];
12170 
12171  for (; j<= toInsert; j++)
12172  {
12173  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12174  /* we increase shifts by one; must delete q there*/
12175  // q = qq; q = pMoveCurrTail2poly(q,strat);
12176  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12177  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12178  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12179  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12180  // pNext(q) = s; // in tailRing
12181  /* here we need to call enterOnePair with two polys ... */
12182 #ifdef KDEBUG
12183  //if (TEST_OPT_DEBUG)
12184  //{
12185  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12186  //}
12187 #endif
12188  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12189  }
12190 }
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:12197
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:341
#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 12197 of file kutil.cc.

12198 {
12199 
12200  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12201 
12202  /* check this Formats: */
12204  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12207 
12208 #ifdef KDEBUG
12209 // if (TEST_OPT_DEBUG)
12210 // {
12211 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12212 // wrp(q); // wrp(pHead(q));
12213 // PrintS(", p = ");
12214 // wrp(p); //wrp(pHead(p));
12215 // PrintLn();
12216 // }
12217 #endif
12218 
12219  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12220 
12221  int qfromQ = qisFromQ;
12222 
12223  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12224 
12225  int l,j,compare;
12226  LObject Lp;
12227  Lp.i_r = -1;
12228 
12229 #ifdef KDEBUG
12230  Lp.ecart=0; Lp.length=0;
12231 #endif
12232  /*- computes the lcm(s[i],p) -*/
12233  Lp.lcm = pInit();
12234 
12235  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
12236  pSetm(Lp.lcm);
12237 
12238  /* apply the V criterion */
12239  if (!isInV(Lp.lcm, lV))
12240  {
12241 #ifdef KDEBUG
12242  if (TEST_OPT_DEBUG)
12243  {
12244  PrintS("V crit applied to q = ");
12245  wrp(q); // wrp(pHead(q));
12246  PrintS(", p = ");
12247  wrp(p); //wrp(pHead(p));
12248  PrintLn();
12249  }
12250 #endif
12251  pLmFree(Lp.lcm);
12252  Lp.lcm=NULL;
12253  /* + counter for applying the V criterion */
12254  strat->cv++;
12255  return;
12256  }
12257 
12258  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12259  {
12260  if((!((ecartq>0)&&(ecart>0)))
12261  && pHasNotCF(p,q))
12262  {
12263  /*
12264  *the product criterion has applied for (s,p),
12265  *i.e. lcm(s,p)=product of the leading terms of s and p.
12266  *Suppose (s,r) is in L and the leading term
12267  *of p divides lcm(s,r)
12268  *(==> the leading term of p divides the leading term of r)
12269  *but the leading term of s does not divide the leading term of r
12270  *(notice that this condition is automatically satisfied if r is still
12271  *in S), then (s,r) can be cancelled.
12272  *This should be done here because the
12273  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12274  *
12275  *Moreover, skipping (s,r) holds also for the noncommutative case.
12276  */
12277  strat->cp++;
12278  pLmFree(Lp.lcm);
12279  Lp.lcm=NULL;
12280  return;
12281  }
12282  else
12283  Lp.ecart = si_max(ecart,ecartq);
12284  if (strat->fromT && (ecartq>ecart))
12285  {
12286  pLmFree(Lp.lcm);
12287  Lp.lcm=NULL;
12288  return;
12289  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12290  }
12291  /*
12292  *the set B collects the pairs of type (S[j],p)
12293  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12294  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12295  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12296  */
12297  {
12298  j = strat->Bl;
12299  loop
12300  {
12301  if (j < 0) break;
12302  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12303  if ((compare==1)
12304  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12305  {
12306  strat->c3++;
12307  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12308  {
12309  pLmFree(Lp.lcm);
12310  return;
12311  }
12312  break;
12313  }
12314  else
12315  if ((compare ==-1)
12316  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12317  {
12318  deleteInL(strat->B,&strat->Bl,j,strat);
12319  strat->c3++;
12320  }
12321  j--;
12322  }
12323  }
12324  }
12325  else /*sugarcrit*/
12326  {
12327  if (ALLOW_PROD_CRIT(strat))
12328  {
12329  // if currRing->nc_type!=quasi (or skew)
12330  // TODO: enable productCrit for super commutative algebras...
12331  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12332  pHasNotCF(p,q))
12333  {
12334  /*
12335  *the product criterion has applied for (s,p),
12336  *i.e. lcm(s,p)=product of the leading terms of s and p.
12337  *Suppose (s,r) is in L and the leading term
12338  *of p devides lcm(s,r)
12339  *(==> the leading term of p devides the leading term of r)
12340  *but the leading term of s does not devide the leading term of r
12341  *(notice that tis condition is automatically satisfied if r is still
12342  *in S), then (s,r) can be canceled.
12343  *This should be done here because the
12344  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12345  */
12346  strat->cp++;
12347  pLmFree(Lp.lcm);
12348  Lp.lcm=NULL;
12349  return;
12350  }
12351  if (strat->fromT && (ecartq>ecart))
12352  {
12353  pLmFree(Lp.lcm);
12354  Lp.lcm=NULL;
12355  return;
12356  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12357  }
12358  /*
12359  *the set B collects the pairs of type (S[j],p)
12360  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12361  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12362  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12363  */
12364  for(j = strat->Bl;j>=0;j--)
12365  {
12366  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12367  if (compare==1)
12368  {
12369  strat->c3++;
12370  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12371  {
12372  pLmFree(Lp.lcm);
12373  return;
12374  }
12375  break;
12376  }
12377  else
12378  if (compare ==-1)
12379  {
12380  deleteInL(strat->B,&strat->Bl,j,strat);
12381  strat->c3++;
12382  }
12383  }
12384  }
12385  }
12386  /*
12387  *the pair (S[i],p) enters B if the spoly != 0
12388  */
12389  /*- compute the short s-polynomial -*/
12390  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12391  pNorm(p);
12392  if ((q==NULL) || (p==NULL))
12393  return;
12394  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12395  Lp.p=NULL;
12396  else
12397  {
12398 // if ( rIsPluralRing(currRing) )
12399 // {
12400 // if(pHasNotCF(p, q))
12401 // {
12402 // if(ncRingType(currRing) == nc_lie)
12403 // {
12404 // // generalized prod-crit for lie-type
12405 // strat->cp++;
12406 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12407 // }
12408 // else
12409 // if( ALLOW_PROD_CRIT(strat) )
12410 // {
12411 // // product criterion for homogeneous case in SCA
12412 // strat->cp++;
12413 // Lp.p = NULL;
12414 // }
12415 // else
12416 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12417 // }
12418 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12419 // }
12420 // else
12421 // {
12422 
12423  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12424  /* p is already in this form, so convert q */
12425  // q = pMove2CurrTail(q, strat);
12426  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12427  // }
12428  }
12429  if (Lp.p == NULL)
12430  {
12431  /*- the case that the s-poly is 0 -*/
12432  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12433 // if (strat->pairtest==NULL) initPairtest(strat);
12434 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12435 // strat->pairtest[strat->sl+1] = TRUE;
12436  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12437  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12438  /*
12439  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12440  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12441  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12442  *term of p devides the lcm(s,r)
12443  *(this canceling should be done here because
12444  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12445  *the first case is handeled in chainCrit
12446  */
12447  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12448  }
12449  else
12450  {
12451  /*- the pair (S[i],p) enters B -*/
12452  /* both of them should have their LM in currRing and TAIL in tailring */
12453  Lp.p1 = q; // already in the needed form
12454  Lp.p2 = p; // already in the needed form
12455 
12456  if ( !rIsPluralRing(currRing) )
12457  pNext(Lp.p) = strat->tail;
12458 
12459  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12460  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12461  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12462  {
12463  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12464  Lp.i_r2 = atR;
12465  }
12466  else
12467  {
12468  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12469  Lp.i_r1 = -1;
12470  Lp.i_r2 = -1;
12471  }
12472  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12473 
12475  {
12476  if (!rIsPluralRing(currRing))
12477  nDelete(&(Lp.p->coef));
12478  }
12479 
12480  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12481  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12482  }
12483 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#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:345
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:368
int Bl
Definition: kutil.h:350
#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:283
#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:824
int Bmax
Definition: kutil.h:350
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:378
#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:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
void PrintS(const char *s)
Definition: reporter.cc:284
int isInV(poly p, int lV)
Definition: shiftgb.cc:241
poly tail
Definition: kutil.h:332
BOOLEAN sugarCrit
Definition: kutil.h:376
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
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:394
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:280
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:349
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
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:101
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:9364
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:901
#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:302
#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:323
#define nIsZero(n)
Definition: numbers.h:19
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
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:1003
TSet T
Definition: kutil.h:322
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:304
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:358
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
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:278
#define pNeg(p)
Definition: polys.h:181
int tl
Definition: kutil.h:348
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:101
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:276
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:901
#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:282
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h: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:323
#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:349
ring tailRing
Definition: kutil.h:341
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:1003
int sl
Definition: kutil.h:346
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:352
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:378
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:1141
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 12491 of file kutil.cc.

12492 {
12493  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12494  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12495  int j=pos;
12496 
12498  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12499  if ( (!strat->fromT)
12500  && ((strat->syzComp==0)
12501  ||(pGetComp(h)<=strat->syzComp)))
12502  {
12503  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12504  unsigned long h_sev = pGetShortExpVector(h);
12505  loop
12506  {
12507  if (j > k) break;
12508  clearS(h,h_sev, &j,&k,strat);
12509  j++;
12510  }
12511  //Print("end clearS sl=%d\n",strat->sl);
12512  }
12513  // PrintS("end enterpairs\n");
12514 }
int syzComp
Definition: kutil.h:352
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:12523
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:378
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:1141
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:352
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:378
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:1141
static Poly * h
Definition: janet.cc:978

§ enterSBba()

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

Definition at line 9124 of file kutil.cc.

9125 {
9126  strat->news = TRUE;
9127  /*- puts p to the standardbasis s at position at -*/
9128  if (strat->sl == IDELEMS(strat->Shdl)-1)
9129  {
9130  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9131  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9132  (IDELEMS(strat->Shdl)+setmaxTinc)
9133  *sizeof(unsigned long));
9134  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9135  IDELEMS(strat->Shdl)*sizeof(int),
9136  (IDELEMS(strat->Shdl)+setmaxTinc)
9137  *sizeof(int));
9138  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9139  IDELEMS(strat->Shdl)*sizeof(int),
9140  (IDELEMS(strat->Shdl)+setmaxTinc)
9141  *sizeof(int));
9142  if (strat->lenS!=NULL)
9143  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9144  IDELEMS(strat->Shdl)*sizeof(int),
9145  (IDELEMS(strat->Shdl)+setmaxTinc)
9146  *sizeof(int));
9147  if (strat->lenSw!=NULL)
9148  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9149  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9150  (IDELEMS(strat->Shdl)+setmaxTinc)
9151  *sizeof(wlen_type));
9152  if (strat->fromQ!=NULL)
9153  {
9154  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9155  IDELEMS(strat->Shdl)*sizeof(int),
9156  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9157  }
9158  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9159  IDELEMS(strat->Shdl)+=setmaxTinc;
9160  strat->Shdl->m=strat->S;
9161  }
9162  if (atS <= strat->sl)
9163  {
9164 #ifdef ENTER_USE_MEMMOVE
9165  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9166  (strat->sl - atS + 1)*sizeof(poly));
9167  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9168  (strat->sl - atS + 1)*sizeof(int));
9169  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9170  (strat->sl - atS + 1)*sizeof(unsigned long));
9171  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9172  (strat->sl - atS + 1)*sizeof(int));
9173  if (strat->lenS!=NULL)
9174  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9175  (strat->sl - atS + 1)*sizeof(int));
9176  if (strat->lenSw!=NULL)
9177  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9178  (strat->sl - atS + 1)*sizeof(wlen_type));
9179 #else
9180  for (i=strat->sl+1; i>=atS+1; i--)
9181  {
9182  strat->S[i] = strat->S[i-1];
9183  strat->ecartS[i] = strat->ecartS[i-1];
9184  strat->sevS[i] = strat->sevS[i-1];
9185  strat->S_2_R[i] = strat->S_2_R[i-1];
9186  }
9187  if (strat->lenS!=NULL)
9188  for (i=strat->sl+1; i>=atS+1; i--)
9189  strat->lenS[i] = strat->lenS[i-1];
9190  if (strat->lenSw!=NULL)
9191  for (i=strat->sl+1; i>=atS+1; i--)
9192  strat->lenSw[i] = strat->lenSw[i-1];
9193 #endif
9194  }
9195  if (strat->fromQ!=NULL)
9196  {
9197 #ifdef ENTER_USE_MEMMOVE
9198  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9199  (strat->sl - atS + 1)*sizeof(int));
9200 #else
9201  for (i=strat->sl+1; i>=atS+1; i--)
9202  {
9203  strat->fromQ[i] = strat->fromQ[i-1];
9204  }
9205 #endif
9206  strat->fromQ[atS]=0;
9207  }
9208 
9209  /*- save result -*/
9210  strat->S[atS] = p.p;
9211  if (strat->honey) strat->ecartS[atS] = p.ecart;
9212  if (p.sev == 0)
9213  p.sev = pGetShortExpVector(p.p);
9214  else
9215  assume(p.sev == pGetShortExpVector(p.p));
9216  strat->sevS[atS] = p.sev;
9217  strat->ecartS[atS] = p.ecart;
9218  strat->S_2_R[atS] = atR;
9219  strat->sl++;
9220 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:376
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:399
#define TRUE
Definition: auxiliary.h:101
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3556
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299

§ entersets()

void entersets ( LObject  h)

§ enterSSba()

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

Definition at line 9226 of file kutil.cc.

9227 {
9228  strat->news = TRUE;
9229  /*- puts p to the standardbasis s at position at -*/
9230  if (strat->sl == IDELEMS(strat->Shdl)-1)
9231  {
9232  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9233  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9234  (IDELEMS(strat->Shdl)+setmaxTinc)
9235  *sizeof(unsigned long));
9236  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9237  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9238  (IDELEMS(strat->Shdl)+setmaxTinc)
9239  *sizeof(unsigned long));
9240  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9241  IDELEMS(strat->Shdl)*sizeof(int),
9242  (IDELEMS(strat->Shdl)+setmaxTinc)
9243  *sizeof(int));
9244  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9245  IDELEMS(strat->Shdl)*sizeof(int),
9246  (IDELEMS(strat->Shdl)+setmaxTinc)
9247  *sizeof(int));
9248  if (strat->lenS!=NULL)
9249  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9250  IDELEMS(strat->Shdl)*sizeof(int),
9251  (IDELEMS(strat->Shdl)+setmaxTinc)
9252  *sizeof(int));
9253  if (strat->lenSw!=NULL)
9254  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9255  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9256  (IDELEMS(strat->Shdl)+setmaxTinc)
9257  *sizeof(wlen_type));
9258  if (strat->fromQ!=NULL)
9259  {
9260  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9261  IDELEMS(strat->Shdl)*sizeof(int),
9262  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9263  }
9264  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9265  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
9266  IDELEMS(strat->Shdl)+=setmaxTinc;
9267  strat->Shdl->m=strat->S;
9268  }
9269  // in a signature-based algorithm the following situation will never
9270  // appear due to the fact that the critical pairs are already sorted
9271  // by increasing signature.
9272  // True. However, in the case of integers we need to put the element
9273  // that caused the signature drop on the first position
9274  if (atS <= strat->sl)
9275  {
9276 #ifdef ENTER_USE_MEMMOVE
9277  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9278  (strat->sl - atS + 1)*sizeof(poly));
9279  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9280  (strat->sl - atS + 1)*sizeof(poly));
9281  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9282  (strat->sl - atS + 1)*sizeof(unsigned long));
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  strat->sig[i] = strat->sig[i-1];
9303  strat->sevSig[i] = strat->sevSig[i-1];
9304  }
9305  if (strat->lenS!=NULL)
9306  for (i=strat->sl+1; i>=atS+1; i--)
9307  strat->lenS[i] = strat->lenS[i-1];
9308  if (strat->lenSw!=NULL)
9309  for (i=strat->sl+1; i>=atS+1; i--)
9310  strat->lenSw[i] = strat->lenSw[i-1];
9311 #endif
9312  }
9313  if (strat->fromQ!=NULL)
9314  {
9315 #ifdef ENTER_USE_MEMMOVE
9316  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9317  (strat->sl - atS + 1)*sizeof(int));
9318 #else
9319  for (i=strat->sl+1; i>=atS+1; i--)
9320  {
9321  strat->fromQ[i] = strat->fromQ[i-1];
9322  }
9323 #endif
9324  strat->fromQ[atS]=0;
9325  }
9326 
9327  /*- save result -*/
9328  strat->S[atS] = p.p;
9329  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9330  if (strat->honey) strat->ecartS[atS] = p.ecart;
9331  if (p.sev == 0)
9332  p.sev = pGetShortExpVector(p.p);
9333  else
9334  assume(p.sev == pGetShortExpVector(p.p));
9335  strat->sevS[atS] = p.sev;
9336  // during the interreduction process of a signature-based algorithm we do not
9337  // compute the signature at this point, but when the whole interreduction
9338  // process finishes, i.e. f5c terminates!
9339  if (p.sig != NULL)
9340  {
9341  if (p.sevSig == 0)
9342  p.sevSig = pGetShortExpVector(p.sig);
9343  else
9344  assume(p.sevSig == pGetShortExpVector(p.sig));
9345  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9346  }
9347  strat->ecartS[atS] = p.ecart;
9348  strat->S_2_R[atS] = atR;
9349  strat->sl++;
9350 #ifdef DEBUGF5
9351  int k;
9352  Print("--- LIST S: %d ---\n",strat->sl);
9353  for(k=0;k<=strat->sl;k++)
9354  {
9355  pWrite(strat->sig[k]);
9356  }
9357  PrintS("--- LIST S END ---\n");
9358 #endif
9359 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:376
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:399
#define TRUE
Definition: auxiliary.h:101
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:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3556
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299

§ enterSyz()

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

Definition at line 9561 of file kutil.cc.

9562 {
9563  #ifdef ADIDEBUG
9564  printf("\n Entersyz:\n");pWrite(p.sig);
9565  #endif
9566  int i;
9567  strat->newt = TRUE;
9568  if (strat->syzl == strat->syzmax-1)
9569  {
9570  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9571  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9572  (strat->syzmax)*sizeof(unsigned long),
9573  ((strat->syzmax)+setmaxTinc)
9574  *sizeof(unsigned long));
9575  strat->syzmax += setmaxTinc;
9576  }
9577  if (atT < strat->syzl)
9578  {
9579 #ifdef ENTER_USE_MEMMOVE
9580  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9581  (strat->syzl-atT+1)*sizeof(poly));
9582  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9583  (strat->syzl-atT+1)*sizeof(unsigned long));
9584 #endif
9585  for (i=strat->syzl; i>=atT+1; i--)
9586  {
9587 #ifndef ENTER_USE_MEMMOVE
9588  strat->syz[i] = strat->syz[i-1];
9589  strat->sevSyz[i] = strat->sevSyz[i-1];
9590 #endif
9591  }
9592  }
9593  //i = strat->syzl;
9594  i = atT;
9595  //Makes sure the syz saves just the signature
9596  #ifdef HAVE_RINGS
9598  pNext(p.sig) = NULL;
9599  #endif
9600  strat->syz[atT] = p.sig;
9601  strat->sevSyz[atT] = p.sevSig;
9602  strat->syzl++;
9603 #if F5DEBUG
9604  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9605  pWrite(strat->syz[atT]);
9606 #endif
9607  // recheck pairs in strat->L with new rule and delete correspondingly
9608  int cc = strat->Ll;
9609  while (cc>-1)
9610  {
9611  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9612  //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);
9613  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9614  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9615  #ifdef HAVE_RINGS
9616  &&((!rField_is_Ring(currRing))
9617  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9618  #endif
9619  )
9620  {
9621  //printf("\nYES!\n");
9622  #ifdef ADIDEBUG
9623  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9624  #endif
9625  deleteInL(strat->L,&strat->Ll,cc,strat);
9626  }
9627  cc--;
9628  }
9629 //#if 1
9630 #ifdef DEBUGF5
9631  PrintS("--- Syzygies ---\n");
9632  Print("syzl %d\n",strat->syzl);
9633  Print("syzmax %d\n",strat->syzmax);
9634  PrintS("--------------------------------\n");
9635  for(i=0;i<=strat->syzl-1;i++)
9636  {
9637  Print("%d - ",i);
9638  pWrite(strat->syz[i]);
9639  }
9640  PrintS("--------------------------------\n");
9641 #endif
9642 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:400
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
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:323
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:3556
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
polyrec * poly
Definition: hilb.h:10
int syzl
Definition: kutil.h:347

§ enterT()

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

Definition at line 9364 of file kutil.cc.

9365 {
9366  int i;
9367 
9368  pp_Test(p.p, currRing, p.tailRing);
9369  assume(strat->tailRing == p.tailRing);
9370  // redMoraNF complains about this -- but, we don't really
9371  // neeed this so far
9372  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9373  assume(p.FDeg == p.pFDeg());
9374  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9375 
9376 #ifdef KDEBUG
9377  // do not put an LObject twice into T:
9378  for(i=strat->tl;i>=0;i--)
9379  {
9380  if (p.p==strat->T[i].p)
9381  {
9382  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9383  return;
9384  }
9385  }
9386 #endif
9387 
9388 #ifdef HAVE_TAIL_RING
9389  if (currRing!=strat->tailRing)
9390  {
9391  p.t_p=p.GetLmTailRing();
9392  }
9393 #endif
9394  strat->newt = TRUE;
9395  if (atT < 0)
9396  atT = strat->posInT(strat->T, strat->tl, p);
9397  if (strat->tl == strat->tmax-1)
9398  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9399  if (atT <= strat->tl)
9400  {
9401 #ifdef ENTER_USE_MEMMOVE
9402  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9403  (strat->tl-atT+1)*sizeof(TObject));
9404  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9405  (strat->tl-atT+1)*sizeof(unsigned long));
9406 #endif
9407  for (i=strat->tl+1; i>=atT+1; i--)
9408  {
9409 #ifndef ENTER_USE_MEMMOVE
9410  strat->T[i] = strat->T[i-1];
9411  strat->sevT[i] = strat->sevT[i-1];
9412 #endif
9413  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9414  }
9415  }
9416 
9417  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9418  {
9420  (strat->tailRing != NULL ?
9421  strat->tailRing : currRing),
9422  strat->tailBin);
9423  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9424  }
9425  strat->T[atT] = (TObject) p;
9426  #ifdef ADIDEBUG
9427  printf("\nenterT: add in position %i\n",atT);
9428  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9429  #endif
9430  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9431 
9432  if (strat->tailRing != currRing && pNext(p.p) != NULL)
9433  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9434  else
9435  strat->T[atT].max = NULL;
9436 
9437  strat->tl++;
9438  strat->R[strat->tl] = &(strat->T[atT]);
9439  strat->T[atT].i_r = strat->tl;
9440  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9441  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9442  kTest_T(&(strat->T[atT]));
9443 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
char newt
Definition: kutil.h:400
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static int pLength(poly a)
Definition: p_polys.h:189
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:338
int tmax
Definition: kutil.h:348
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:322
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
#define kTest_T(T)
Definition: kutil.h:655
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1138

§ enterT_strong()

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

Definition at line 9449 of file kutil.cc.

9450 {
9452  int i;
9453 
9454  pp_Test(p.p, currRing, p.tailRing);
9455  assume(strat->tailRing == p.tailRing);
9456  // redMoraNF complains about this -- but, we don't really
9457  // neeed this so far
9458  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9459  assume(p.FDeg == p.pFDeg());
9460  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9461 
9462 #ifdef KDEBUG
9463  // do not put an LObject twice into T:
9464  for(i=strat->tl;i>=0;i--)
9465  {
9466  if (p.p==strat->T[i].p)
9467  {
9468  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9469  return;
9470  }
9471  }
9472 #endif
9473 
9474 #ifdef HAVE_TAIL_RING
9475  if (currRing!=strat->tailRing)
9476  {
9477  p.t_p=p.GetLmTailRing();
9478  }
9479 #endif
9480  strat->newt = TRUE;
9481  if (atT < 0)
9482  atT = strat->posInT(strat->T, strat->tl, p);
9483  if (strat->tl == strat->tmax-1)
9484  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9485  if (atT <= strat->tl)
9486  {
9487 #ifdef ENTER_USE_MEMMOVE
9488  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9489  (strat->tl-atT+1)*sizeof(TObject));
9490  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9491  (strat->tl-atT+1)*sizeof(unsigned long));
9492 #endif
9493  for (i=strat->tl+1; i>=atT+1; i--)
9494  {
9495 #ifndef ENTER_USE_MEMMOVE
9496  strat->T[i] = strat->T[i-1];
9497  strat->sevT[i] = strat->sevT[i-1];
9498 #endif
9499  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9500  }
9501  }
9502 
9503  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9504  {
9506  (strat->tailRing != NULL ?
9507  strat->tailRing : currRing),
9508  strat->tailBin);
9509  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9510  }
9511  strat->T[atT] = (TObject) p;
9512  #ifdef ADIDEBUG
9513  printf("\nenterT_strong: add in position %i\n",atT);
9514  pWrite(p.p);
9515  #endif
9516  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9517 
9518  if (strat->tailRing != currRing && pNext(p.p) != NULL)
9519  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9520  else
9521  strat->T[atT].max = NULL;
9522 
9523  strat->tl++;
9524  strat->R[strat->tl] = &(strat->T[atT]);
9525  strat->T[atT].i_r = strat->tl;
9526  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9527  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9528  #if 1
9530  && !n_IsUnit(p.p->coef, currRing->cf))
9531  {
9532  #ifdef ADIDEBUG
9533  printf("\nDas ist p:\n");pWrite(p.p);
9534  #endif
9535  for(i=strat->tl;i>=0;i--)
9536  {
9537  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9538  {
9539  #ifdef ADIDEBUG
9540  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9541  #endif
9542  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9543  }
9544  }
9545  }
9546  /*
9547  printf("\nThis is T:\n");
9548  for(i=strat->tl;i>=0;i--)
9549  {
9550  pWrite(strat->T[i].p);
9551  }
9552  //getchar();*/
9553  #endif
9554  kTest_T(&(strat->T[atT]));
9555 }
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:400
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
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:277
static int pLength(poly a)
Definition: p_polys.h:189
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:338
int tmax
Definition: kutil.h:348
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:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:322
#define kTest_T(T)
Definition: kutil.h:655
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1138

§ enterTShift()

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

Definition at line 12596 of file kutil.cc.

12597 {
12598  /* determine how many elements we have to insert */
12599  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12600  /* hence, a total number of elt's to add is: */
12601  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12602 
12603  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12604 
12605 #ifdef PDEBUG
12606  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12607 #endif
12608  int i;
12609 
12610  if (atT < 0)
12611  atT = strat->posInT(strat->T, strat->tl, p);
12612 
12613  /* can call enterT in a sequence, e.g. */
12614 
12615  /* shift0 = it's our model for further shifts */
12616  enterT(p,strat,atT);
12617  LObject qq;
12618  for (i=1; i<=toInsert; i++) // toIns - 1?
12619  {
12620  qq = p; //qq.Copy();
12621  qq.p = NULL;
12622  qq.max = NULL;
12623  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12624  qq.GetP();
12625  // update q.sev
12626  qq.sev = pGetShortExpVector(qq.p);
12627  /* enter it into T, first el't is with the shift 0 */
12628  // compute the position for qq
12629  atT = strat->posInT(strat->T, strat->tl, qq);
12630  enterT(qq,strat,atT);
12631  }
12632 /* Q: what to do with this one in the orig enterT ? */
12633 /* strat->R[strat->tl] = &(strat->T[atT]); */
12634 /* Solution: it is done by enterT each time separately */
12635 }
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:348
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
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:9364
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:341
TSet T
Definition: kutil.h:322

§ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10063 of file kutil.cc.

10064 {
10065  /*- release temp data -*/
10066  cleanT(strat);
10067  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10068  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10069  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10070  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10071  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10072  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10073  /*- set L: should be empty -*/
10074  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10075  /*- set B: should be empty -*/
10076  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10077  pLmDelete(&strat->tail);
10078  strat->syzComp=0;
10079 }
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#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:321
void * ADDRESS
Definition: auxiliary.h:118
int Bmax
Definition: kutil.h:350
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
unsigned long * sevS
Definition: kutil.h:318
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59

§ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10256 of file kutil.cc.

10257 {
10258  /*- release temp data -*/
10260  cleanTSbaRing(strat);
10261  else
10262  cleanT(strat);
10263  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10264  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10265  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10266  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10267  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10268  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10269  if(strat->syzmax>0)
10270  {
10271  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10272  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10273  if (strat->sbaOrder == 1)
10274  {
10275  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10276  }
10277  }
10278  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10279  /*- set L: should be empty -*/
10280  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10281  /*- set B: should be empty -*/
10282  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10283  /*- set sig: no need for the signatures anymore -*/
10284  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10285  pLmDelete(&strat->tail);
10286  strat->syzComp=0;
10287 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int syzComp
Definition: kutil.h:352
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#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:321
void * ADDRESS
Definition: auxiliary.h:118
int Bmax
Definition: kutil.h:350
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:312
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
int syzidxmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59
intset syzIdx
Definition: kutil.h:309

§ 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 3356 of file kstd2.cc.

3359 {
3360  int Ll_old, red_result = 1;
3361  int pos = 0;
3362  hilbeledeg=1;
3363  hilbcount=0;
3364  minimcnt=0;
3365  srmax = 0; // strat->sl is 0 at this point
3366  reduc = olddeg = lrmax = 0;
3367  // we cannot use strat->T anymore
3368  //cleanT(strat);
3369  //strat->tl = -1;
3370  Ll_old = strat->Ll;
3371  while (strat->tl >= 0)
3372  {
3373  if(!strat->T[strat->tl].is_redundant)
3374  {
3375  LObject h;
3376  h.p = strat->T[strat->tl].p;
3377  h.tailRing = strat->T[strat->tl].tailRing;
3378  h.t_p = strat->T[strat->tl].t_p;
3379  if (h.p!=NULL)
3380  {
3381  if (currRing->OrdSgn==-1)
3382  {
3383  cancelunit(&h);
3384  deleteHC(&h, strat);
3385  }
3386  if (h.p!=NULL)
3387  {
3389  {
3390  //pContent(h.p);
3391  h.pCleardenom(); // also does a pContent
3392  }
3393  else
3394  {
3395  h.pNorm();
3396  }
3397  strat->initEcart(&h);
3399  pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
3400  else
3401  pos = strat->Ll+1;
3402  h.sev = pGetShortExpVector(h.p);
3403  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
3404  }
3405  }
3406  }
3407  strat->tl--;
3408  }
3409  strat->sl = -1;
3410 #if 0
3411 //#ifdef HAVE_TAIL_RING
3412  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
3413  kStratInitChangeTailRing(strat);
3414 #endif
3415  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
3416  //strat->sl = -1;
3417  /* picks the last element from the lazyset L */
3418  while (strat->Ll>Ll_old)
3419  {
3420  strat->P = strat->L[strat->Ll];
3421  strat->Ll--;
3422 //#if 1
3423 #ifdef DEBUGF5
3424  PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3425  PrintS("-------------------------------------------------\n");
3426  pWrite(pHead(strat->P.p));
3427  pWrite(pHead(strat->P.p1));
3428  pWrite(pHead(strat->P.p2));
3429  printf("%d\n",strat->tl);
3430  PrintS("-------------------------------------------------\n");
3431 #endif
3432  if (pNext(strat->P.p) == strat->tail)
3433  {
3434  // deletes the short spoly
3435  if (rField_is_Ring(currRing))
3436  pLmDelete(strat->P.p);
3437  else
3438  pLmFree(strat->P.p);
3439 
3440  // TODO: needs some masking
3441  // TODO: masking needs to vanish once the signature
3442  // sutff is completely implemented
3443  strat->P.p = NULL;
3444  poly m1 = NULL, m2 = NULL;
3445 
3446  // check that spoly creation is ok
3447  while (strat->tailRing != currRing &&
3448  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3449  {
3450  assume(m1 == NULL && m2 == NULL);
3451  // if not, change to a ring where exponents are at least
3452  // large enough
3453  if (!kStratChangeTailRing(strat))
3454  {
3455  WerrorS("OVERFLOW...");
3456  break;
3457  }
3458  }
3459  // create the real one
3460  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3461  strat->tailRing, m1, m2, strat->R);
3462  }
3463  else if (strat->P.p1 == NULL)
3464  {
3465  if (strat->minim > 0)
3466  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3467  // for input polys, prepare reduction
3468  if(!rField_is_Ring(currRing))
3469  strat->P.PrepareRed(strat->use_buckets);
3470  }
3471 
3472  if (strat->P.p == NULL && strat->P.t_p == NULL)
3473  {
3474  red_result = 0;
3475  }
3476  else
3477  {
3478  if (TEST_OPT_PROT)
3479  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3480  &olddeg,&reduc,strat, red_result);
3481 
3482 #ifdef DEBUGF5
3483  PrintS("Poly before red: ");
3484  pWrite(strat->P.p);
3485 #endif
3486  /* complete reduction of the element chosen from L */
3487  red_result = strat->red2(&strat->P,strat);
3488  if (errorreported) break;
3489  }
3490 
3491  if (strat->overflow)
3492  {
3493  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
3494  }
3495 
3496  // reduction to non-zero new poly
3497  if (red_result == 1)
3498  {
3499  // get the polynomial (canonicalize bucket, make sure P.p is set)
3500  strat->P.GetP(strat->lmBin);
3501  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
3502  // but now, for entering S, T, we reset it
3503  // in the inhomogeneous case: FDeg == pFDeg
3504  if (strat->homog) strat->initEcart(&(strat->P));
3505 
3506  /* statistic */
3507  if (TEST_OPT_PROT) PrintS("s");
3508  int pos;
3509  #if 1
3510  if(!rField_is_Ring(currRing))
3511  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3512  else
3513  pos = posInSMonFirst(strat,strat->sl,strat->P.p,strat->P.ecart);
3514  #else
3515  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3516  #endif
3517  // reduce the tail and normalize poly
3518  // in the ring case we cannot expect LC(f) = 1,
3519  // therefore we call pContent instead of pNorm
3520 #if F5CTAILRED
3521  BOOLEAN withT = TRUE;
3523  {
3524  strat->P.pCleardenom();
3526  {
3527  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3528  strat->P.pCleardenom();
3529  }
3530  }
3531  else
3532  {
3533  strat->P.pNorm();
3535  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3536  }
3537 #endif
3538 #ifdef KDEBUG
3539  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3540 #endif /* KDEBUG */
3541 
3542  // min_std stuff
3543  if ((strat->P.p1==NULL) && (strat->minim>0))
3544  {
3545  if (strat->minim==1)
3546  {
3547  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3548  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3549  }
3550  else
3551  {
3552  strat->M->m[minimcnt]=strat->P.p2;
3553  strat->P.p2=NULL;
3554  }
3555  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3556  pNext(strat->M->m[minimcnt])
3557  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3558  strat->tailRing, currRing,
3559  currRing->PolyBin);
3560  minimcnt++;
3561  }
3562 
3563  // enter into S, L, and T
3564  // here we need to recompute new signatures, but those are trivial ones
3565  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3566  {
3567  enterT(strat->P, strat);
3568  // posInS only depends on the leading term
3569  strat->enterS(strat->P, pos, strat, strat->tl);
3570 //#if 1
3571 #ifdef DEBUGF5
3572  PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
3573  pWrite(pHead(strat->S[strat->sl]));
3574  pWrite(strat->sig[strat->sl]);
3575 #endif
3576  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3577  }
3578  // Print("[%d]",hilbeledeg);
3579  if (strat->P.lcm!=NULL)
3580 #ifdef HAVE_RINGS
3581  pLmDelete(strat->P.lcm);
3582 #else
3583  pLmFree(strat->P.lcm);
3584 #endif
3585  if (strat->sl>srmax) srmax = strat->sl;
3586  }
3587  else
3588  {
3589  // adds signature of the zero reduction to
3590  // strat->syz. This is the leading term of
3591  // syzygy and can be used in syzCriterion()
3592  // the signature is added if and only if the
3593  // pair was not detected by the rewritten criterion in strat->red = redSig
3594  if (strat->P.p1 == NULL && strat->minim > 0)
3595  {
3596  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3597  }
3598  }
3599 
3600 #ifdef KDEBUG
3601  memset(&(strat->P), 0, sizeof(strat->P));
3602 #endif /* KDEBUG */
3603  }
3604  int cc = 0;
3605  while (cc<strat->tl+1)
3606  {
3607  strat->T[cc].sig = pOne();
3608  p_SetComp(strat->T[cc].sig,cc+1,currRing);
3609  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
3610  strat->sig[cc] = strat->T[cc].sig;
3611  strat->sevSig[cc] = strat->T[cc].sevSig;
3612  strat->T[cc].is_sigsafe = TRUE;
3613  cc++;
3614  }
3615  strat->max_lower_index = strat->tl;
3616  // set current signature index of upcoming iteration step
3617  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
3618  // the corresponding syzygy rules correctly
3619  strat->currIdx = cc+1;
3620  for (int cd=strat->Ll; cd>=0; cd--)
3621  {
3622  p_SetComp(strat->L[cd].sig,cc+1,currRing);
3623  cc++;
3624  }
3625  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
3626  strat->Shdl->m[cc] = NULL;
3627  #if 0
3628  printf("\nAfter f5c sorting\n");
3629  for(int i=0;i<=strat->sl;i++)
3630  pWrite(pHead(strat->S[i]));
3631  getchar();
3632  #endif
3633 //#if 1
3634 #if DEBUGF5
3635  PrintS("------------------- STRAT S ---------------------\n");
3636  cc = 0;
3637  while (cc<strat->tl+1)
3638  {
3639  pWrite(pHead(strat->S[cc]));
3640  pWrite(strat->sig[cc]);
3641  printf("- - - - - -\n");
3642  cc++;
3643  }
3644  PrintS("-------------------------------------------------\n");
3645  PrintS("------------------- STRAT T ---------------------\n");
3646  cc = 0;
3647  while (cc<strat->tl+1)
3648  {
3649  pWrite(pHead(strat->T[cc].p));
3650  pWrite(strat->T[cc].sig);
3651  printf("- - - - - -\n");
3652  cc++;
3653  }
3654  PrintS("-------------------------------------------------\n");
3655  PrintS("------------------- STRAT L ---------------------\n");
3656  cc = 0;
3657  while (cc<strat->Ll+1)
3658  {
3659  pWrite(pHead(strat->L[cc].p));
3660  pWrite(pHead(strat->L[cc].p1));
3661  pWrite(pHead(strat->L[cc].p2));
3662  pWrite(strat->L[cc].sig);
3663  printf("- - - - - -\n");
3664  cc++;
3665  }
3666  PrintS("-------------------------------------------------\n");
3667  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
3668 #endif
3669 
3670 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:376
void PrintLn()
Definition: reporter.cc:310
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7810
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:349
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:101
#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:1116
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:356
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:11245
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:637
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define pOne()
Definition: polys.h:298
TObject ** R
Definition: kutil.h:338
#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:10697
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:323
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:349
ring tailRing
Definition: kutil.h:341
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:346
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88

§ 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:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
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:360
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h: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:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int sl
Definition: kutil.h:346

§ finalReduceByMon()

void finalReduceByMon ( kStrategy  strat)

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

Definition at line 11080 of file kutil.cc.

11081 {
11082  if(!nCoeff_is_Ring_Z(currRing->cf))
11083  return;
11084  poly p,pp;
11085  for(int j = 0; j<=strat->sl; j++)
11086  {
11087  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11088  {
11089  for(int i = 0; i<=strat->sl; i++)
11090  {
11091  if((i != j) && (strat->S[i] != NULL))
11092  {
11093  p = strat->S[i];
11094  if(pLmDivisibleBy(strat->S[j], p))
11095  {
11096  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11097  p_SetCoeff(p,dummy,currRing);
11098  }
11099  pp = pNext(p);
11100  if((pp == NULL) && (nIsZero(p->coef)))
11101  {
11102  deleteInS(i, strat);
11103  }
11104  else
11105  {
11106  while(pp != NULL)
11107  {
11108  if(pLmDivisibleBy(strat->S[j], pp))
11109  {
11110  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11111  p_SetCoeff(pp,dummy,currRing);
11112  if(nIsZero(pp->coef))
11113  {
11114  pLmDelete(&pNext(p));
11115  pp = pNext(p);
11116  }
11117  else
11118  {
11119  p = pp;
11120  pp = pNext(p);
11121  }
11122  }
11123  else
11124  {
11125  p = pp;
11126  pp = pNext(p);
11127  }
11128  }
11129  }
11130  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11131  {
11132  if(pNext(strat->S[i]) == NULL)
11133  strat->S[i]=NULL;
11134  else
11135  strat->S[i]=pNext(strat->S[i]);
11136  }
11137  }
11138  }
11139  //idPrint(strat->Shdl);
11140  }
11141  }
11142  //idSkipZeroes(strat->Shdl);
11143 }
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:302
#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:346
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 4021 of file kstd2.cc.

4022 {
4023  /* todo main call */
4024 
4025  /* assume: ring is prepared, ideal is copied into shifted ring */
4026  /* uptodeg and lVblock are correct - test them! */
4027 
4028  /* check whether the ideal is in V */
4029 
4030 // if (0)
4031  if (! ideal_isInV(I,lVblock) )
4032  {
4033  WerrorS("The input ideal contains incorrectly encoded elements! ");
4034  return(NULL);
4035  }
4036 
4037  // kStrategy strat = new skStrategy;
4038  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
4039  /* at the moment:
4040 - no quotient (check)
4041 - no *w, no *hilb
4042  */
4043  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
4044  int newIdeal, intvec *vw) */
4045  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
4046  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
4047  idSkipZeroes(RS);
4048  return(RS);
4049 }
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:97
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define TRUE
Definition: auxiliary.h:101
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h: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:375
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:376
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:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
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:276
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:371
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:282
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:351
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9124

§ initBbaShift()

void initBbaShift ( kStrategy  strat)

Definition at line 4182 of file kstd2.cc.

4183 {
4184  /* setting global variables ------------------- */
4185  strat->enterS = enterSBba; /* remains as is, we change enterT! */
4186 
4187  strat->red = redFirstShift; /* no redHomog ! */
4188 
4189  if (currRing->pLexOrder && strat->honey)
4190  strat->initEcart = initEcartNormal;
4191  else
4192  strat->initEcart = initEcartBBA;
4193  if (strat->honey)
4195  else
4197 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
4198 // {
4199 // //interred machen Aenderung
4200 // pFDegOld=currRing->pFDeg;
4201 // pLDegOld=pLDeg;
4202 // //h=ggetid("ecart");
4203 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
4204 // //{
4205 // // ecartWeights=iv2array(IDINTVEC(h));
4206 // //}
4207 // //else
4208 // {
4209 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
4210 // /*uses automatic computation of the ecartWeights to set them*/
4211 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
4212 // }
4213 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
4214 // if (TEST_OPT_PROT)
4215 // {
4216 // for(int i=1; i<=rVar(currRing); i++)
4217 // Print(" %d",ecartWeights[i]);
4218 // PrintLn();
4219 // mflush();
4220 // }
4221 // }
4222 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1249
BOOLEAN honey
Definition: kutil.h:376
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:4055
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:282
void initEcartNormal(TObject *h)
Definition: kutil.cc:1234
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9124

§ initBuchMora()

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

Definition at line 9987 of file kutil.cc.

9988 {
9989  strat->interpt = BTEST1(OPT_INTERRUPT);
9990  strat->kHEdge=NULL;
9992  /*- creating temp data structures------------------- -*/
9993  strat->cp = 0;
9994  strat->c3 = 0;
9995  strat->tail = pInit();
9996  /*- set s -*/
9997  strat->sl = -1;
9998  /*- set L -*/
9999  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10000  strat->Ll = -1;
10001  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10002  /*- set B -*/
10003  strat->Bmax = setmaxL;
10004  strat->Bl = -1;
10005  strat->B = initL();
10006  /*- set T -*/
10007  strat->tl = -1;
10008  strat->tmax = setmaxT;
10009  strat->T = initT();
10010  strat->R = initR();
10011  strat->sevT = initsevT();
10012  /*- init local data struct.---------------------------------------- -*/
10013  strat->P.ecart=0;
10014  strat->P.length=0;
10015  strat->P.pLength=0;
10017  {
10018  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10019  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10020  }
10022  {
10023  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10024  }
10025  else
10026  {
10027  if(TEST_OPT_SB_1)
10028  {
10029  int i;
10030  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10031  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10032  {
10033  P->m[i-strat->newIdeal] = F->m[i];
10034  F->m[i] = NULL;
10035  }
10036  initSSpecial(F,Q,P,strat);
10037  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10038  {
10039  F->m[i] = P->m[i-strat->newIdeal];
10040  P->m[i-strat->newIdeal] = NULL;
10041  }
10042  idDelete(&P);
10043  }
10044  else
10045  {
10046  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10047  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10048  }
10049  }
10050  strat->fromT = FALSE;
10052  if ((!TEST_OPT_SB_1)
10053  || (rField_is_Ring(currRing))
10054  )
10055  {
10056  updateS(TRUE,strat);
10057  }
10058  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10059  strat->fromQ=NULL;
10060  assume(kTest_TS(strat));
10061 }
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:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8024
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:101
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:370
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:378
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8430
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:375
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
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:8895
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:420
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

§ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9663 of file kutil.cc.

9664 {
9666  strat->chainCrit=chainCritNormal;
9667  if (TEST_OPT_SB_1)
9668  strat->chainCrit=chainCritOpt_1;
9669 #ifdef HAVE_RINGS
9670  if (rField_is_Ring(currRing))
9671  {
9673  strat->chainCrit=chainCritRing;
9674  }
9675 #endif
9676 #ifdef HAVE_RATGRING
9677  if (rIsRatGRing(currRing))
9678  {
9679  strat->chainCrit=chainCritPart;
9680  /* enterOnePairNormal get rational part in it */
9681  }
9682 #endif
9683  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9684  && (!rIsPluralRing(currRing)))
9686 
9687  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9688  strat->Gebauer = strat->homog || strat->sugarCrit;
9689  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9690  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9691  strat->pairtest = NULL;
9692  /* alway use tailreduction, except:
9693  * - in local rings, - in lex order case, -in ring over extensions */
9695  //if(rHasMixedOrdering(currRing)==2)
9696  //{
9697  // strat->noTailReduction =TRUE;
9698  //}
9699 
9700 #ifdef HAVE_PLURAL
9701  // and r is plural_ring
9702  // hence this holds for r a rational_plural_ring
9703  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9704  { //or it has non-quasi-comm type... later
9705  strat->sugarCrit = FALSE;
9706  strat->Gebauer = FALSE;
9707  strat->honey = FALSE;
9708  }
9709 #endif
9710 
9711  // Coefficient ring?
9712  if (rField_is_Ring(currRing))
9713  {
9714  strat->sugarCrit = FALSE;
9715  strat->Gebauer = FALSE ;
9716  strat->honey = FALSE;
9717  }
9718  #ifdef KDEBUG
9719  if (TEST_OPT_DEBUG)
9720  {
9721  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9722  else PrintS("ideal/module is not homogeneous\n");
9723  }
9724  #endif
9725 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:376
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
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:331
BOOLEAN z2homog
Definition: kutil.h:373
#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:286
BOOLEAN homog
Definition: kutil.h:371
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:377
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:376
#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:287
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 9814 of file kutil.cc.

9815 {
9817  {
9818  if (strat->honey)
9819  {
9820  strat->posInL = posInL15;
9821  // ok -- here is the deal: from my experiments for Singular-2-0
9822  // I conclude that that posInT_EcartpLength is the best of
9823  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9824  // see the table at the end of this file
9825  if (TEST_OPT_OLDSTD)
9826  strat->posInT = posInT15;
9827  else
9828  strat->posInT = posInT_EcartpLength;
9829  }
9830  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9831  {
9832  strat->posInL = posInL11;
9833  strat->posInT = posInT11;
9834  }
9835  else if (TEST_OPT_INTSTRATEGY)
9836  {
9837  strat->posInL = posInL11;
9838  strat->posInT = posInT11;
9839  }
9840  else
9841  {
9842  strat->posInL = posInL0;
9843  strat->posInT = posInT0;
9844  }
9845  //if (strat->minim>0) strat->posInL =posInLSpecial;
9846  if (strat->homog)
9847  {
9848  strat->posInL = posInL110;
9849  strat->posInT = posInT110;
9850  }
9851  }
9852  else
9853  {
9854  if (strat->homog)
9855  {
9856  strat->posInL = posInL11;
9857  strat->posInT = posInT11;
9858  }
9859  else
9860  {
9861  if ((currRing->order[0]==ringorder_c)
9862  ||(currRing->order[0]==ringorder_C))
9863  {
9864  strat->posInL = posInL17_c;
9865  strat->posInT = posInT17_c;
9866  }
9867  else
9868  {
9869  strat->posInL = posInL17;
9870  strat->posInT = posInT17;
9871  }
9872  }
9873  }
9874  if (strat->minim>0) strat->posInL =posInLSpecial;
9875  // for further tests only
9876  if ((BTEST1(11)) || (BTEST1(12)))
9877  strat->posInL = posInL11;
9878  else if ((BTEST1(13)) || (BTEST1(14)))
9879  strat->posInL = posInL13;
9880  else if ((BTEST1(15)) || (BTEST1(16)))
9881  strat->posInL = posInL15;
9882  else if ((BTEST1(17)) || (BTEST1(18)))
9883  strat->posInL = posInL17;
9884  if (BTEST1(11))
9885  strat->posInT = posInT11;
9886  else if (BTEST1(13))
9887  strat->posInT = posInT13;
9888  else if (BTEST1(15))
9889  strat->posInT = posInT15;
9890  else if ((BTEST1(17)))
9891  strat->posInT = posInT17;
9892  else if ((BTEST1(19)))
9893  strat->posInT = posInT19;
9894  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
9895  strat->posInT = posInT1;
9897 }
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:280
BOOLEAN honey
Definition: kutil.h:376
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:388
#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:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
int minim
Definition: kutil.h:356
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:9798
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:371
#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 9900 of file kutil.cc.

9901 {
9903  {
9904  if (strat->honey)
9905  {
9906  strat->posInL = posInL15Ring;
9907  // ok -- here is the deal: from my experiments for Singular-2-0
9908  // I conclude that that posInT_EcartpLength is the best of
9909  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9910  // see the table at the end of this file
9911  if (TEST_OPT_OLDSTD)
9912  strat->posInT = posInT15Ring;
9913  else
9914  strat->posInT = posInT_EcartpLength;
9915  }
9916  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9917  {
9918  strat->posInL = posInL11Ring;
9919  strat->posInT = posInT11;
9920  }
9921  else if (TEST_OPT_INTSTRATEGY)
9922  {
9923  strat->posInL = posInL11Ring;
9924  strat->posInT = posInT11;
9925  }
9926  else
9927  {
9928  strat->posInL = posInL0Ring;
9929  strat->posInT = posInT0;
9930  }
9931  //if (strat->minim>0) strat->posInL =posInLSpecial;
9932  if (strat->homog)
9933  {
9934  strat->posInL = posInL110Ring;
9935  strat->posInT = posInT110Ring;
9936  }
9937  }
9938  else
9939  {
9940  if (strat->homog)
9941  {
9942  //printf("\nHere 3\n");
9943  strat->posInL = posInL11Ring;
9944  strat->posInT = posInT11Ring;
9945  }
9946  else
9947  {
9948  if ((currRing->order[0]==ringorder_c)
9949  ||(currRing->order[0]==ringorder_C))
9950  {
9951  strat->posInL = posInL17_cRing;
9952  strat->posInT = posInT17_cRing;
9953  }
9954  else
9955  {
9956  strat->posInL = posInL11Ringls;
9957  strat->posInT = posInT17Ring;
9958  }
9959  }
9960  }
9961  if (strat->minim>0) strat->posInL =posInLSpecial;
9962  // for further tests only
9963  if ((BTEST1(11)) || (BTEST1(12)))
9964  strat->posInL = posInL11Ring;
9965  else if ((BTEST1(13)) || (BTEST1(14)))
9966  strat->posInL = posInL13;
9967  else if ((BTEST1(15)) || (BTEST1(16)))
9968  strat->posInL = posInL15Ring;
9969  else if ((BTEST1(17)) || (BTEST1(18)))
9970  strat->posInL = posInL17Ring;
9971  if (BTEST1(11))
9972  strat->posInT = posInT11Ring;
9973  else if (BTEST1(13))
9974  strat->posInT = posInT13;
9975  else if (BTEST1(15))
9976  strat->posInT = posInT15Ring;
9977  else if ((BTEST1(17)))
9978  strat->posInT = posInT17Ring;
9979  else if ((BTEST1(19)))
9980  strat->posInT = posInT19;
9981  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
9982  strat->posInT = posInT1;
9984 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:376
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:388
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:277
int minim
Definition: kutil.h:356
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:9798
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:371
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 11980 of file kutil.cc.

11981 {
11982  strat->interpt = BTEST1(OPT_INTERRUPT);
11983  strat->kHEdge=NULL;
11985  /*- creating temp data structures------------------- -*/
11986  strat->cp = 0;
11987  strat->c3 = 0;
11988  strat->cv = 0;
11989  strat->tail = pInit();
11990  /*- set s -*/
11991  strat->sl = -1;
11992  /*- set L -*/
11993  strat->Lmax = setmaxL;
11994  strat->Ll = -1;
11995  strat->L = initL();
11996  /*- set B -*/
11997  strat->Bmax = setmaxL;
11998  strat->Bl = -1;
11999  strat->B = initL();
12000  /*- set T -*/
12001  strat->tl = -1;
12002  strat->tmax = setmaxT;
12003  strat->T = initT();
12004  strat->R = initR();
12005  strat->sevT = initsevT();
12006  /*- init local data struct.---------------------------------------- -*/
12007  strat->P.ecart=0;
12008  strat->P.length=0;
12010  {
12011  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12012  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12013  }
12015  {
12016  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12017  }
12018  {
12019  if(TEST_OPT_SB_1)
12020  {
12021  int i;
12022  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12023  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12024  {
12025  P->m[i-strat->newIdeal] = F->m[i];
12026  F->m[i] = NULL;
12027  }
12028  initSSpecial(F,Q,P,strat);
12029  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12030  {
12031  F->m[i] = P->m[i-strat->newIdeal];
12032  P->m[i-strat->newIdeal] = NULL;
12033  }
12034  idDelete(&P);
12035  }
12036  else
12037  {
12038  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12039  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12040  }
12041  }
12042  strat->fromT = FALSE;
12043  if (!TEST_OPT_SB_1)
12044  {
12045  /* the only change: we do not fill the set T*/
12046  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12047  }
12048  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12049  strat->fromQ=NULL;
12050  /* more changes: fill the set T with all the shifts of elts of S*/
12051  /* is done by other procedure */
12052 }
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:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:368
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8024
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:370
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:378
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8430
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:375
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
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:8895
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:420
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#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 int 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 int 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:123

§ initenterpairsShift()

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

Definition at line 12523 of file kutil.cc.

12524 {
12525  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12526  // atR = -1;
12527  if ((strat->syzComp==0)
12528  || (pGetComp(h)<=strat->syzComp))
12529  {
12530  int j;
12531  BOOLEAN new_pair=FALSE;
12532 
12533  if (pGetComp(h)==0)
12534  {
12535  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12536  if ((isFromQ)&&(strat->fromQ!=NULL))
12537  {
12538  for (j=0; j<=k; j++)
12539  {
12540  if (!strat->fromQ[j])
12541  {
12542  new_pair=TRUE;
12543  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12544  // other side pairs:
12545  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12546  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12547  }
12548  }
12549  }
12550  else
12551  {
12552  new_pair=TRUE;
12553  for (j=0; j<=k; j++)
12554  {
12555  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12556  // other side pairs
12557  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12558  }
12559  /* HERE we put (h, s*h) pairs */
12560  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
12561  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12562  }
12563  }
12564  else
12565  {
12566  for (j=0; j<=k; j++)
12567  {
12568  if ((pGetComp(h)==pGetComp(strat->S[j]))
12569  || (pGetComp(strat->S[j])==0))
12570  {
12571  new_pair=TRUE;
12572  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
12573  // other side pairs
12574  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12575  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12576  }
12577  }
12578  /* HERE we put (h, s*h) pairs */
12579  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12580  }
12581 
12582  if (new_pair)
12583  {
12584  strat->chainCrit(h,ecart,strat);
12585  }
12586 
12587  }
12588 }
int syzComp
Definition: kutil.h:352
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
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:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12059
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12134

§ initHilbCrit()

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

Definition at line 9645 of file kutil.cc.

9646 {
9647 
9648  //if the ordering is local, then hilb criterion
9649  //can be used also if the ideal is not homogenous
9651  {
9653  *hilb=NULL;
9654  else
9655  return;
9656  }
9657  if (strat->homog!=isHomog)
9658  {
9659  *hilb=NULL;
9660  }
9661 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
#define FALSE
Definition: auxiliary.h:97
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:371
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 420 of file kutil.h.

421 { 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 7928 of file kutil.cc.

7929 {
7930  int i,pos;
7931 
7932  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7933  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7934  strat->ecartS=initec(i);
7935  strat->sevS=initsevS(i);
7936  strat->S_2_R=initS_2_R(i);
7937  strat->fromQ=NULL;
7938  strat->Shdl=idInit(i,F->rank);
7939  strat->S=strat->Shdl->m;
7940  /*- put polys into S -*/
7941  if (Q!=NULL)
7942  {
7943  strat->fromQ=initec(i);
7944  memset(strat->fromQ,0,i*sizeof(int));
7945  for (i=0; i<IDELEMS(Q); i++)
7946  {
7947  if (Q->m[i]!=NULL)
7948  {
7949  LObject h;
7950  h.p = pCopy(Q->m[i]);
7952  {
7953  //pContent(h.p);
7954  h.pCleardenom(); // also does a pContent
7955  }
7956  else
7957  {
7958  h.pNorm();
7959  }
7961  {
7962  deleteHC(&h, strat);
7963  }
7964  if (h.p!=NULL)
7965  {
7966  strat->initEcart(&h);
7967  if (strat->sl==-1)
7968  pos =0;
7969  else
7970  {
7971  pos = posInS(strat,strat->sl,h.p,h.ecart);
7972  }
7973  h.sev = pGetShortExpVector(h.p);
7974  strat->enterS(h,pos,strat,-1);
7975  strat->fromQ[pos]=1;
7976  }
7977  }
7978  }
7979  }
7980  for (i=0; i<IDELEMS(F); i++)
7981  {
7982  if (F->m[i]!=NULL)
7983  {
7984  LObject h;
7985  h.p = pCopy(F->m[i]);
7987  {
7988  cancelunit(&h); /*- tries to cancel a unit -*/
7989  deleteHC(&h, strat);
7990  }
7991  if (h.p!=NULL)
7992  // do not rely on the input being a SB!
7993  {
7995  {
7996  //pContent(h.p);
7997  h.pCleardenom(); // also does a pContent
7998  }
7999  else
8000  {
8001  h.pNorm();
8002  }
8003  strat->initEcart(&h);
8004  if (strat->sl==-1)
8005  pos =0;
8006  else
8007  pos = posInS(strat,strat->sl,h.p,h.ecart);
8008  h.sev = pGetShortExpVector(h.p);
8009  strat->enterS(h,pos,strat,-1);
8010  }
8011  }
8012  }
8013  /*- test, if a unit is in F -*/
8014  if ((strat->sl>=0)
8015 #ifdef HAVE_RINGS
8016  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8017 #endif
8018  && pIsConstant(strat->S[0]))
8019  {
8020  while (strat->sl>0) deleteInS(strat->sl,strat);
8021  }
8022 }
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:340
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:276
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:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp 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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
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:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
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:376
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9226
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:283
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:697
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:536
int currIdx
Definition: kutil.h:313
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
pFDegProc pOrigFDeg
Definition: kutil.h:292
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:293
BOOLEAN homog
Definition: kutil.h:371
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:282
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:3509
#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:351
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:275

§ initSbaBuchMora()

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

Definition at line 10183 of file kutil.cc.

10184 {
10185  strat->interpt = BTEST1(OPT_INTERRUPT);
10186  strat->kHEdge=NULL;
10188  /*- creating temp data structures------------------- -*/
10189  strat->cp = 0;
10190  strat->c3 = 0;
10191  strat->tail = pInit();
10192  /*- set s -*/
10193  strat->sl = -1;
10194  /*- set ps -*/
10195  strat->syzl = -1;
10196  /*- set L -*/
10197  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10198  strat->Ll = -1;
10199  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10200  /*- set B -*/
10201  strat->Bmax = setmaxL;
10202  strat->Bl = -1;
10203  strat->B = initL();
10204  /*- set T -*/
10205  strat->tl = -1;
10206  strat->tmax = setmaxT;
10207  strat->T = initT();
10208  strat->R = initR();
10209  strat->sevT = initsevT();
10210  /*- init local data struct.---------------------------------------- -*/
10211  strat->P.ecart=0;
10212  strat->P.length=0;
10214  {
10215  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10216  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10217  }
10219  {
10220  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10221  }
10222  else
10223  {
10224  if(TEST_OPT_SB_1)
10225  {
10226  int i;
10227  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10228  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10229  {
10230  P->m[i-strat->newIdeal] = F->m[i];
10231  F->m[i] = NULL;
10232  }
10233  initSSpecialSba(F,Q,P,strat);
10234  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10235  {
10236  F->m[i] = P->m[i-strat->newIdeal];
10237  P->m[i-strat->newIdeal] = NULL;
10238  }
10239  idDelete(&P);
10240  }
10241  else
10242  {
10243  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10244  }
10245  }
10246  strat->fromT = FALSE;
10247  if (!TEST_OPT_SB_1)
10248  {
10249  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10250  }
10251  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10252  //strat->fromQ=NULL;
10253  assume(kTest_TS(strat));
10254 }
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:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int c3
Definition: kutil.h:345
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:101
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8575
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8123
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:370
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:378
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:403
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:375
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
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:8895
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:420
int newIdeal
Definition: kutil.h:355
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:347

§ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9727 of file kutil.cc.

9728 {
9729  //strat->enterOnePair=enterOnePairNormal;
9731  //strat->chainCrit=chainCritNormal;
9732  strat->chainCrit = chainCritSig;
9733  /******************************************
9734  * rewCrit1 and rewCrit2 are already set in
9735  * kSba() in kstd1.cc
9736  *****************************************/
9737  //strat->rewCrit1 = faugereRewCriterion;
9738  if (strat->sbaOrder == 1)
9739  {
9740  strat->syzCrit = syzCriterionInc;
9741  }
9742  else
9743  {
9744  strat->syzCrit = syzCriterion;
9745  }
9746 #ifdef HAVE_RINGS
9747  if (rField_is_Ring(currRing))
9748  {
9750  strat->chainCrit=chainCritRing;
9751  }
9752 #endif
9753 #ifdef HAVE_RATGRING
9754  if (rIsRatGRing(currRing))
9755  {
9756  strat->chainCrit=chainCritPart;
9757  /* enterOnePairNormal get rational part in it */
9758  }
9759 #endif
9760 
9761  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9762  strat->Gebauer = strat->homog || strat->sugarCrit;
9763  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9764  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9765  strat->pairtest = NULL;
9766  /* alway use tailreduction, except:
9767  * - in local rings, - in lex order case, -in ring over extensions */
9770 
9771 #ifdef HAVE_PLURAL
9772  // and r is plural_ring
9773  // hence this holds for r a rational_plural_ring
9774  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9775  { //or it has non-quasi-comm type... later
9776  strat->sugarCrit = FALSE;
9777  strat->Gebauer = FALSE;
9778  strat->honey = FALSE;
9779  }
9780 #endif
9781 
9782  // Coefficient ring?
9783  if (rField_is_Ring(currRing))
9784  {
9785  strat->sugarCrit = FALSE;
9786  strat->Gebauer = FALSE ;
9787  strat->honey = FALSE;
9788  }
9789  #ifdef KDEBUG
9790  if (TEST_OPT_DEBUG)
9791  {
9792  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9793  else PrintS("ideal/module is not homogeneous\n");
9794  }
9795  #endif
9796 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:376
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:373
#define TRUE
Definition: auxiliary.h:101
#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:288
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:286
BOOLEAN homog
Definition: kutil.h:371
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:377
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
unsigned sbaOrder
Definition: kutil.h:312
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:376
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:287
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 10081 of file kutil.cc.

10082 {
10084  {
10085  if (strat->honey)
10086  {
10087  strat->posInL = posInL15;
10088  // ok -- here is the deal: from my experiments for Singular-2-0
10089  // I conclude that that posInT_EcartpLength is the best of
10090  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10091  // see the table at the end of this file
10092  if (TEST_OPT_OLDSTD)
10093  strat->posInT = posInT15;
10094  else
10095  strat->posInT = posInT_EcartpLength;
10096  }
10097  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10098  {
10099  strat->posInL = posInL11;
10100  strat->posInT = posInT11;
10101  }
10102  else if (TEST_OPT_INTSTRATEGY)
10103  {
10104  strat->posInL = posInL11;
10105  strat->posInT = posInT11;
10106  }
10107  else
10108  {
10109  strat->posInL = posInL0;
10110  strat->posInT = posInT0;
10111  }
10112  //if (strat->minim>0) strat->posInL =posInLSpecial;
10113  if (strat->homog)
10114  {
10115  strat->posInL = posInL110;
10116  strat->posInT = posInT110;
10117  }
10118  }
10119  else
10120  {
10121  if (strat->homog)
10122  {
10123  strat->posInL = posInL11;
10124  strat->posInT = posInT11;
10125  }
10126  else
10127  {
10128  if ((currRing->order[0]==ringorder_c)
10129  ||(currRing->order[0]==ringorder_C))
10130  {
10131  strat->posInL = posInL17_c;
10132  strat->posInT = posInT17_c;
10133  }
10134  else
10135  {
10136  strat->posInL = posInL17;
10137  strat->posInT = posInT17;
10138  }
10139  }
10140  }
10141  if (strat->minim>0) strat->posInL =posInLSpecial;
10142  // for further tests only
10143  if ((BTEST1(11)) || (BTEST1(12)))
10144  strat->posInL = posInL11;
10145  else if ((BTEST1(13)) || (BTEST1(14)))
10146  strat->posInL = posInL13;
10147  else if ((BTEST1(15)) || (BTEST1(16)))
10148  strat->posInL = posInL15;
10149  else if ((BTEST1(17)) || (BTEST1(18)))
10150  strat->posInL = posInL17;
10151  if (BTEST1(11))
10152  strat->posInT = posInT11;
10153  else if (BTEST1(13))
10154  strat->posInT = posInT13;
10155  else if (BTEST1(15))
10156  strat->posInT = posInT15;
10157  else if ((BTEST1(17)))
10158  strat->posInT = posInT17;
10159  else if ((BTEST1(19)))
10160  strat->posInT = posInT19;
10161  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10162  strat->posInT = posInT1;
10163  if (rField_is_Ring(currRing))
10164  {
10165  strat->posInL = posInL11Ring;
10166  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10167  strat->posInL = posInL11Ringls;
10168  strat->posInT = posInT11;
10169  }
10170  strat->posInLDependsOnLength = FALSE;
10171  strat->posInLSba = posInLSig;
10172  //strat->posInL = posInLSig;
10173  strat->posInL = posInLF5C;
10174  /*
10175  if (rField_is_Ring(currRing))
10176  {
10177  strat->posInLSba = posInLSigRing;
10178  strat->posInL = posInL11Ring;
10179  }*/
10180  //strat->posInT = posInTSig;
10181 }
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:280
BOOLEAN honey
Definition: kutil.h:376
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:97
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:388
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:101
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:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
int minim
Definition: kutil.h:356
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:371
#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 8024 of file kutil.cc.

8025 {
8026  int i,pos;
8027 
8028  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8029  else i=setmaxT;
8030  strat->ecartS=initec(i);
8031  strat->sevS=initsevS(i);
8032  strat->S_2_R=initS_2_R(i);
8033  strat->fromQ=NULL;
8034  strat->Shdl=idInit(i,F->rank);
8035  strat->S=strat->Shdl->m;
8036  /*- put polys into S -*/
8037  if (Q!=NULL)
8038  {
8039  strat->fromQ=initec(i);
8040  memset(strat->fromQ,0,i*sizeof(int));
8041  for (i=0; i<IDELEMS(Q); i++)
8042  {
8043  if (Q->m[i]!=NULL)
8044  {
8045  LObject h;
8046  h.p = pCopy(Q->m[i]);
8048  {
8049  deleteHC(&h,strat);
8050  }
8052  {
8053  //pContent(h.p);
8054  h.pCleardenom(); // also does a pContent
8055  }
8056  else
8057  {
8058  h.pNorm();
8059  }
8060  if (h.p!=NULL)
8061  {
8062  strat->initEcart(&h);
8063  if (strat->sl==-1)
8064  pos =0;
8065  else
8066  {
8067  pos = posInS(strat,strat->sl,h.p,h.ecart);
8068  }
8069  h.sev = pGetShortExpVector(h.p);
8070  strat->enterS(h,pos,strat,-1);
8071  strat->fromQ[pos]=1;
8072  }
8073  }
8074  }
8075  }
8076  for (i=0; i<IDELEMS(F); i++)
8077  {
8078  if (F->m[i]!=NULL)
8079  {
8080  LObject h;
8081  h.p = pCopy(F->m[i]);
8082  if (h.p!=NULL)
8083  {
8085  {
8086  cancelunit(&h); /*- tries to cancel a unit -*/
8087  deleteHC(&h, strat);
8088  }
8089  if (h.p!=NULL)
8090  {
8092  {
8093  //pContent(h.p);
8094  h.pCleardenom(); // also does a pContent
8095  }
8096  else
8097  {
8098  h.pNorm();
8099  }
8100  strat->initEcart(&h);
8101  if (strat->Ll==-1)
8102  pos =0;
8103  else
8104  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8105  h.sev = pGetShortExpVector(h.p);
8106  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8107  }
8108  }
8109  }
8110  }
8111  /*- test, if a unit is in F -*/
8112 
8113  if ((strat->Ll>=0)
8114 #ifdef HAVE_RINGS
8115  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8116 #endif
8117  && pIsConstant(strat->L[strat->Ll].p))
8118  {
8119  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8120  }
8121 }
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:280
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h: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:349
int * S_2_R
Definition: kutil.h:340
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:276
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:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp 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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
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:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
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 8123 of file kutil.cc.

8124 {
8125  int i,pos;
8126  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8127  else i=setmaxT;
8128  strat->ecartS = initec(i);
8129  strat->sevS = initsevS(i);
8130  strat->sevSig = initsevS(i);
8131  strat->S_2_R = initS_2_R(i);
8132  strat->fromQ = NULL;
8133  strat->Shdl = idInit(i,F->rank);
8134  strat->S = strat->Shdl->m;
8135  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8136  if (strat->sbaOrder != 1)
8137  {
8138  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8139  strat->sevSyz = initsevS(i);
8140  strat->syzmax = i;
8141  strat->syzl = 0;
8142  }
8143  /*- put polys into S -*/
8144  if (Q!=NULL)
8145  {
8146  strat->fromQ=initec(i);
8147  memset(strat->fromQ,0,i*sizeof(int));
8148  for (i=0; i<IDELEMS(Q); i++)
8149  {
8150  if (Q->m[i]!=NULL)
8151  {
8152  LObject h;
8153  h.p = pCopy(Q->m[i]);
8155  {
8156  deleteHC(&h,strat);
8157  }
8159  {
8160  //pContent(h.p);
8161  h.pCleardenom(); // also does a pContent
8162  }
8163  else
8164  {
8165  h.pNorm();
8166  }
8167  if (h.p!=NULL)
8168  {
8169  strat->initEcart(&h);
8170  if (strat->sl==-1)
8171  pos =0;
8172  else
8173  {
8174  pos = posInS(strat,strat->sl,h.p,h.ecart);
8175  }
8176  h.sev = pGetShortExpVector(h.p);
8177  strat->enterS(h,pos,strat,-1);
8178  strat->fromQ[pos]=1;
8179  }
8180  }
8181  }
8182  }
8183  for (i=0; i<IDELEMS(F); i++)
8184  {
8185  if (F->m[i]!=NULL)
8186  {
8187  LObject h;
8188  h.p = pCopy(F->m[i]);
8189  h.sig = pOne();
8190  //h.sig = pInit();
8191  //p_SetCoeff(h.sig,nInit(1),currRing);
8192  p_SetComp(h.sig,i+1,currRing);
8193  // if we are working with the Schreyer order we generate it
8194  // by multiplying the initial signatures with the leading monomial
8195  // of the corresponding initial polynomials generating the ideal
8196  // => we can keep the underlying monomial order and get a Schreyer
8197  // order without any bigger overhead
8198  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8199  {
8200  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8201  }
8202  h.sevSig = pGetShortExpVector(h.sig);
8203 #ifdef DEBUGF5
8204  pWrite(h.p);
8205  pWrite(h.sig);
8206 #endif
8207  if (h.p!=NULL)
8208  {
8210  {
8211  cancelunit(&h); /*- tries to cancel a unit -*/
8212  deleteHC(&h, strat);
8213  }
8214  if (h.p!=NULL)
8215  {
8217  {
8218  //pContent(h.p);
8219  h.pCleardenom(); // also does a pContent
8220  }
8221  else
8222  {
8223  h.pNorm();
8224  }
8225  strat->initEcart(&h);
8226  if (strat->Ll==-1)
8227  pos =0;
8228  else
8229  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8230  h.sev = pGetShortExpVector(h.p);
8231  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8232  }
8233  }
8234  /*
8235  if (strat->sbaOrder != 1)
8236  {
8237  for(j=0;j<i;j++)
8238  {
8239  strat->syz[ctr] = pCopy(F->m[j]);
8240  p_SetCompP(strat->syz[ctr],i+1,currRing);
8241  // add LM(F->m[i]) to the signature to get a Schreyer order
8242  // without changing the underlying polynomial ring at all
8243  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8244  // since p_Add_q() destroys all input
8245  // data we need to recreate help
8246  // each time
8247  poly help = pCopy(F->m[i]);
8248  p_SetCompP(help,j+1,currRing);
8249  pWrite(strat->syz[ctr]);
8250  pWrite(help);
8251  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8252  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8253  printf("%d. SYZ ",ctr);
8254  pWrite(strat->syz[ctr]);
8255  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8256  ctr++;
8257  }
8258  strat->syzl = ps;
8259  }
8260  */
8261  }
8262  }
8263  /*- test, if a unit is in F -*/
8264 
8265  if ((strat->Ll>=0)
8266 #ifdef HAVE_RINGS
8267  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8268 #endif
8269  && pIsConstant(strat->L[strat->Ll].p))
8270  {
8271  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8272  }
8273 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
int syzmax
Definition: kutil.h:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
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:276
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:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
unsigned sbaOrder
Definition: kutil.h:312
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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
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:318
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:347
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8275 of file kutil.cc.

8276 {
8277  if( strat->S[0] )
8278  {
8279  if( strat->S[1] && !rField_is_Ring(currRing))
8280  {
8281  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8282  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8283  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8284  }
8285  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8286  /************************************************************
8287  * computing the length of the syzygy array needed
8288  ***********************************************************/
8289  for(i=1; i<=strat->sl; i++)
8290  {
8291  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8292  {
8293  ps += i;
8294  }
8295  }
8296  ps += strat->sl+1;
8297  //comp = pGetComp (strat->P.sig);
8298  comp = strat->currIdx;
8299  strat->syzIdx = initec(comp);
8300  strat->sevSyz = initsevS(ps);
8301  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8302  strat->syzmax = ps;
8303  strat->syzl = 0;
8304  strat->syzidxmax = comp;
8305 #if defined(DEBUGF5) || defined(DEBUGF51)
8306  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8307 #endif
8308  i = 1;
8309  j = 0;
8310  /************************************************************
8311  * generating the leading terms of the principal syzygies
8312  ***********************************************************/
8313  while (i <= strat->sl)
8314  {
8315  /**********************************************************
8316  * principal syzygies start with component index 2
8317  * the array syzIdx starts with index 0
8318  * => the rules for a signature with component comp start
8319  * at strat->syz[strat->syzIdx[comp-2]] !
8320  *********************************************************/
8321  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8322  {
8323  comp = pGetComp(strat->sig[i]);
8324  comp_old = pGetComp(strat->sig[i-1]);
8325  diff = comp - comp_old - 1;
8326  // diff should be zero, but sometimes also the initial generating
8327  // elements of the input ideal reduce to zero. then there is an
8328  // index-gap between the signatures. for these inbetween signatures we
8329  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8330  // in the following.
8331  // doing this, we keep the relation "j = comp - 2" alive, which makes
8332  // jumps way easier when checking criteria
8333  while (diff>0)
8334  {
8335  strat->syzIdx[j] = 0;
8336  diff--;
8337  j++;
8338  }
8339  strat->syzIdx[j] = ctr;
8340  j++;
8341  LObject Q;
8342  int pos;
8343  for (k = 0; k<i; k++)
8344  {
8345  Q.sig = pOne();
8347  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8348  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8349  p_SetCompP (Q.sig, comp, currRing);
8350  poly q = p_One(currRing);
8352  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8353  p_ExpVectorCopy(q,strat->S[i],currRing);
8354  q = p_Neg (q, currRing);
8355  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8356  Q.sig = p_Add_q (Q.sig, q, currRing);
8357  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8358  pos = posInSyz(strat, Q.sig);
8359  enterSyz(Q, strat, pos);
8360  ctr++;
8361  }
8362  }
8363  i++;
8364  }
8365  /**************************************************************
8366  * add syzygies for upcoming first element of new iteration step
8367  **************************************************************/
8368  comp = strat->currIdx;
8369  comp_old = pGetComp(strat->sig[i-1]);
8370  diff = comp - comp_old - 1;
8371  // diff should be zero, but sometimes also the initial generating
8372  // elements of the input ideal reduce to zero. then there is an
8373  // index-gap between the signatures. for these inbetween signatures we
8374  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8375  // in the following.
8376  // doing this, we keep the relation "j = comp - 2" alive, which makes
8377  // jumps way easier when checking criteria
8378  while (diff>0)
8379  {
8380  strat->syzIdx[j] = 0;
8381  diff--;
8382  j++;
8383  }
8384  strat->syzIdx[j] = ctr;
8385  LObject Q;
8386  int pos;
8387  for (k = 0; k<strat->sl+1; k++)
8388  {
8389  Q.sig = pOne();
8391  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8392  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8393  p_SetCompP (Q.sig, comp, currRing);
8394  poly q = p_One(currRing);
8396  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8397  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8398  q = p_Neg (q, currRing);
8399  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8400  Q.sig = p_Add_q (Q.sig, q, currRing);
8401  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8402  pos = posInSyz(strat, Q.sig);
8403  enterSyz(Q, strat, pos);
8404  ctr++;
8405  }
8406 //#if 1
8407 #ifdef DEBUGF5
8408  PrintS("Principal syzygies:\n");
8409  Print("syzl %d\n",strat->syzl);
8410  Print("syzmax %d\n",strat->syzmax);
8411  Print("ps %d\n",ps);
8412  PrintS("--------------------------------\n");
8413  for(i=0;i<=strat->syzl-1;i++)
8414  {
8415  Print("%d - ",i);
8416  pWrite(strat->syz[i]);
8417  }
8418  for(i=0;i<strat->currIdx;i++)
8419  {
8420  Print("%d - %d\n",i,strat->syzIdx[i]);
8421  }
8422  PrintS("--------------------------------\n");
8423 #endif
8424  }
8425 }
polyset sig
Definition: kutil.h:304
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
#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:313
#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:1313
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:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4589
LSet L
Definition: kutil.h:323
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:347
#define nCopy(n)
Definition: numbers.h:15
unsigned long * sevSyz
Definition: kutil.h:319
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
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:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9561
intset syzIdx
Definition: kutil.h:309

§ 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 960 of file kInline.h.

962 {
963  p_LmCheckPolyRing(p1, p_r);
964  p_LmCheckPolyRing(p2, p_r);
965 
966  int i;
967  long x;
968  m1 = p_Init(m_r);
969  m2 = p_Init(m_r);
970 
971  for (i = p_r->N; i; i--)
972  {
973  x = p_GetExpDiff(p1, p2, i, p_r);
974  if (x > 0)
975  {
976  if (x > (long) m_r->bitmask) goto false_return;
977  p_SetExp(m2,i,x, m_r);
978  p_SetExp(m1,i,0, m_r);
979  }
980  else
981  {
982  if (-x > (long) m_r->bitmask) goto false_return;
983  p_SetExp(m1,i,-x, m_r);
984  p_SetExp(m2,i,0, m_r);
985  }
986  }
987 
988  p_Setm(m1, m_r);
989  p_Setm(m2, m_r);
990  return TRUE;
991 
992  false_return:
993  p_LmFree(m1, m_r);
994  p_LmFree(m2, m_r);
995  m1 = m2 = NULL;
996  return FALSE;
997 }
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
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 1003 of file kInline.h.

1005 {
1006  p_LmCheckPolyRing(p1, leadRing);
1007  p_LmCheckPolyRing(p2, leadRing);
1008 
1009  int i;
1010  int x;
1011  int e1;
1012  int e2;
1013  int s;
1014  m1 = p_Init(tailRing);
1015  m2 = p_Init(tailRing);
1016  lcm = p_Init(leadRing);
1017 
1018  for (i = leadRing->N; i>=0; i--)
1019  {
1020  e1 = p_GetExp(p1,i,leadRing);
1021  e2 = p_GetExp(p2,i,leadRing);
1022  x = e1 - e2;
1023  if (x > 0)
1024  {
1025  p_SetExp(m2,i,x, tailRing);
1026  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1027  s = e1;
1028  }
1029  else if (x<0)
1030  {
1031  p_SetExp(m1,i,-x, tailRing);
1032  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1033  s = e2;
1034  }
1035  else
1036  s = e1; // e1==e2
1037  p_SetExp(lcm,i,s, leadRing);
1038  }
1039 
1040  p_Setm(m1, tailRing);
1041  p_Setm(m2, tailRing);
1042  p_Setm(lcm, leadRing);
1043 }
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 901 of file kInline.h.

902 {
903 
904  poly np = p_LmInit(p, currRing, tailRing, tailBin);
905  pNext(np) = pNext(p);
906  pSetCoeff0(np, pGetCoeff(p));
907  return np;
908 }
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 933 of file kInline.h.

934 {
935  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
936 }
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:901

§ k_LmInit_tailRing_2_currRing() [1/2]

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

Definition at line 910 of file kInline.h.

911 {
912  poly np = p_LmInit(p, tailRing, currRing, lmBin);
913  pNext(np) = pNext(p);
914  pSetCoeff0(np, pGetCoeff(p));
915  return np;
916 }
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 938 of file kInline.h.

939 {
940  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
941 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:910
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 919 of file kInline.h.

920 {
922  p_LmFree(p, currRing);
923  return np;
924 }
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:901
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 943 of file kInline.h.

944 {
946 }
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:919

§ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

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

Definition at line 926 of file kInline.h.

927 {
929  p_LmFree(p, tailRing);
930  return np;
931 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:910
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 948 of file kInline.h.

949 {
951 }
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:926

§ kCheckSpolyCreation()

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

Definition at line 10697 of file kutil.cc.

10698 {
10699  if (strat->overflow) return FALSE;
10700  assume(L->p1 != NULL && L->p2 != NULL);
10701  // shift changes: from 0 to -1
10702  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10703  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10704  assume(strat->tailRing != currRing);
10705 
10706  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10707  return FALSE;
10708  // shift changes: extra case inserted
10709  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10710  {
10711  return TRUE;
10712  }
10713  poly p1_max = (strat->R[L->i_r1])->max;
10714  poly p2_max = (strat->R[L->i_r2])->max;
10715 
10716  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10717  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10718  {
10719  p_LmFree(m1, strat->tailRing);
10720  p_LmFree(m2, strat->tailRing);
10721  m1 = NULL;
10722  m2 = NULL;
10723  return FALSE;
10724  }
10725  return TRUE;
10726 }
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:960
#define FALSE
Definition: auxiliary.h:97
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
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
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:403
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
polyrec * poly
Definition: hilb.h:10

§ kCheckStrongCreation()

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

Definition at line 10735 of file kutil.cc.

10736 {
10737  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10738  //assume(strat->tailRing != currRing);
10739 
10740  poly p1_max = (strat->R[atR])->max;
10741  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
10742 
10743  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10744  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10745  {
10746  return FALSE;
10747  }
10748  return TRUE;
10749 }
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:403
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
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:1443
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:1297
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 11692 of file kutil.cc.

11693 {
11694  PrintS("red: ");
11695  if (strat->red==redFirst) PrintS("redFirst\n");
11696  else if (strat->red==redHoney) PrintS("redHoney\n");
11697  else if (strat->red==redEcart) PrintS("redEcart\n");
11698  else if (strat->red==redHomog) PrintS("redHomog\n");
11699  else Print("%p\n",(void*)strat->red);
11700  PrintS("posInT: ");
11701  if (strat->posInT==posInT0) PrintS("posInT0\n");
11702  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11703  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11704  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11705  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11706  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11707  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11708  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11709  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11710  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11711  #ifdef HAVE_RINGS
11712  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11713  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11714  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11715  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11716  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11717  #endif
11718 #ifdef HAVE_MORE_POS_IN_T
11719  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11720  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11721  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11722 #endif
11723  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11724  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11725  else Print("%p\n",(void*)strat->posInT);
11726  PrintS("posInL: ");
11727  if (strat->posInL==posInL0) PrintS("posInL0\n");
11728  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11729  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11730  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11731  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11732  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11733  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11734  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11735  #ifdef HAVE_RINGS
11736  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11737  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11738  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11739  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11740  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11741  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11742  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11743  #endif
11744  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11745  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11746  else Print("%p\n",(void*)strat->posInL);
11747  PrintS("enterS: ");
11748  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11749  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11750  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11751  else Print("%p\n",(void*)strat->enterS);
11752  PrintS("initEcart: ");
11753  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11754  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11755  else Print("%p\n",(void*)strat->initEcart);
11756  PrintS("initEcartPair: ");
11757  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11758  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11759  else Print("%p\n",(void*)strat->initEcartPair);
11760  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11761  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11762  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11763  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11764  PrintS("chainCrit: ");
11765  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11766  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11767  else Print("%p\n",(void*)strat->chainCrit);
11768  Print("posInLDependsOnLength=%d\n",
11769  strat->posInLDependsOnLength);
11770  PrintS(showOption());PrintLn();
11771  PrintS("LDeg: ");
11772  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11773  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11774  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11775  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11776  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11777  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11778  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11779  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11780  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11781  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11782  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11783  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11784  else Print("? (%lx)", (long)currRing->pLDeg);
11785  PrintS(" / ");
11786  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11787  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11788  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11789  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11790  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11791  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11792  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11793  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11794  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11795  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11796  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11797  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11798  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11799  PrintLn();
11800  PrintS("currRing->pFDeg: ");
11801  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11802  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11803  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11804  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11805  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11806  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11807  else Print("? (%lx)", (long)currRing->pFDeg);
11808  PrintLn();
11809  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11810  if(TEST_OPT_DEGBOUND)
11811  Print(" degBound: %d\n", Kstd1_deg);
11812 
11813  if( ecartWeights != NULL )
11814  {
11815  PrintS("ecartWeights: ");
11816  for (int i = rVar(currRing); i > 0; i--)
11817  Print("%hd ", ecartWeights[i]);
11818  PrintLn();
11820  }
11821 
11822 #ifndef SING_NDEBUG
11824 #endif
11825 }
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:11658
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5481
BOOLEAN honey
Definition: kutil.h:376
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:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:841
#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:1005
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:877
BOOLEAN noTailReduction
Definition: kutil.h:377
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:388
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:770
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:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:717
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:910
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:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:536
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc: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:941
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:587
BOOLEAN homog
Definition: kutil.h:371
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:377
#define assume(x)
Definition: mod2.h:403
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:596
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:739
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
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:4033
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:376
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:11567
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:811
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:975
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
ring tailRing
Definition: kutil.h:341
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:1038
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:1068
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:613
BOOLEAN use_buckets
Definition: kutil.h:382
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:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11621
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:351
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:9124

§ 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))
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))
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:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h: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:302
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:4589
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:318
int sl
Definition: kutil.h:346
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))
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))
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))
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))
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:340
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:348
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h: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:302
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:4589
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
unsigned long * sevS
Definition: kutil.h:318
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(p_GetCoeff(p,r), p_GetCoeff(T[j].p,r), r))
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(p_GetCoeff(p,r), p_GetCoeff(T[j].p,r), r))
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))
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))
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:348
unsigned long * sevT
Definition: kutil.h:321
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h: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:4589
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define p_GetCoeff(p, r)
Definition: monomials.h:57
TSet T
Definition: kutil.h:322
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))
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))
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:302
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:4589
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
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:1443
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:1297
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 3204 of file kstd2.cc.

3205 {
3206  assume(q!=NULL);
3207  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3208 
3209 // lazy_reduce flags: can be combined by |
3210 //#define KSTD_NF_LAZY 1
3211  // do only a reduction of the leading term
3212 //#define KSTD_NF_NONORM 4
3213  // only global: avoid normalization, return a multiply of NF
3214  poly p;
3215 
3216  //if ((idIs0(F))&&(Q==NULL))
3217  // return pCopy(q); /*F=0*/
3218  //strat->ak = idRankFreeModule(F);
3219  /*- creating temp data structures------------------- -*/
3220  BITSET save1;
3221  SI_SAVE_OPT1(save1);
3223  initBuchMoraCrit(strat);
3224  strat->initEcart = initEcartBBA;
3225  strat->enterS = enterSBba;
3226 #ifndef NO_BUCKETS
3228 #endif
3229  /*- set S -*/
3230  strat->sl = -1;
3231  /*- init local data struct.---------------------------------------- -*/
3232  /*Shdl=*/initS(F,Q,strat);
3233  /*- compute------------------------------------------------------- -*/
3234  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3235  //{
3236  // for (i=strat->sl;i>=0;i--)
3237  // pNorm(strat->S[i]);
3238  //}
3239  kTest(strat);
3240  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3241  if (BVERBOSE(23)) kDebugPrint(strat);
3242  int max_ind;
3243  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3244  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3245  {
3246  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3247  if (rField_is_Ring(currRing))
3248  {
3249  p = redtailBba_Z(p,max_ind,strat);
3250  }
3251  else
3252  {
3254  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3255  }
3256  }
3257  /*- release temp data------------------------------- -*/
3258  assume(strat->L==NULL); /* strat->L unused */
3259  assume(strat->B==NULL); /* strat->B unused */
3260  omFree(strat->sevS);
3261  omFree(strat->ecartS);
3262  assume(strat->T==NULL);//omfree(strat->T);
3263  assume(strat->sevT==NULL);//omfree(strat->sevT);
3264  assume(strat->R==NULL);//omfree(strat->R);
3265  omfree(strat->S_2_R);
3266  omfree(strat->fromQ);
3267  idDelete(&strat->Shdl);
3268  SI_RESTORE_OPT1(save1);
3269  if (TEST_OPT_PROT) PrintLn();
3270  return p;
3271 }
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:1123
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:653
unsigned long * sevT
Definition: kutil.h:321
#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:1116
#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:276
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:7928
#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:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9663
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:338
#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:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
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:11692
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:9124
#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 3273 of file kstd2.cc.

3274 {
3275  assume(!idIs0(q));
3276  assume(!(idIs0(F)&&(Q==NULL)));
3277 // lazy_reduce flags: can be combined by |
3278 //#define KSTD_NF_LAZY 1
3279  // do only a reduction of the leading term
3280 //#define KSTD_NF_NONORM 4
3281  // only global: avoid normalization, return a multiply of NF
3282  poly p;
3283  int i;
3284  ideal res;
3285  int max_ind;
3286 
3287  //if (idIs0(q))
3288  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3289  //if ((idIs0(F))&&(Q==NULL))
3290  // return idCopy(q); /*F=0*/
3291  //strat->ak = idRankFreeModule(F);
3292  /*- creating temp data structures------------------- -*/
3293  BITSET save1;
3294  SI_SAVE_OPT1(save1);
3296  initBuchMoraCrit(strat);
3297  strat->initEcart = initEcartBBA;
3298  strat->enterS = enterSBba;
3299  /*- set S -*/
3300  strat->sl = -1;
3301 #ifndef NO_BUCKETS
3303 #endif
3304  /*- init local data struct.---------------------------------------- -*/
3305  /*Shdl=*/initS(F,Q,strat);
3306  /*- compute------------------------------------------------------- -*/
3307  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3309  for (i=IDELEMS(q)-1; i>=0; i--)
3310  {
3311  if (q->m[i]!=NULL)
3312  {
3313  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3314  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3315  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3316  {
3317  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3318  if (rField_is_Ring(currRing))
3319  {
3320  p = redtailBba_Z(p,max_ind,strat);
3321  }
3322  else
3323  {
3324  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3325  }
3326  }
3327  res->m[i]=p;
3328  }
3329  //else
3330  // res->m[i]=NULL;
3331  }
3332  /*- release temp data------------------------------- -*/
3333  assume(strat->L==NULL); /* strat->L unused */
3334  assume(strat->B==NULL); /* strat->B unused */
3335  omFree(strat->sevS);
3336  omFree(strat->ecartS);
3337  assume(strat->T==NULL);//omfree(strat->T);
3338  assume(strat->sevT==NULL);//omfree(strat->sevT);
3339  assume(strat->R==NULL);//omfree(strat->R);
3340  omfree(strat->S_2_R);
3341  omfree(strat->fromQ);
3342  idDelete(&strat->Shdl);
3343  SI_RESTORE_OPT1(save1);
3344  if (TEST_OPT_PROT) PrintLn();
3345  return res;
3346 }
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:1123
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
unsigned long * sevT
Definition: kutil.h:321
#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:1116
#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:276
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:7928
#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:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9663
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:338
#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:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
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:9124
#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 824 of file kspoly.cc.

825 {
826  poly a1 = pNext(p1), a2 = pNext(p2);
827  long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
828  long c;
829  poly m1,m2;
830  number t1 = NULL,t2 = NULL;
831  int cm,i;
832  BOOLEAN equal;
833 
834 #ifdef HAVE_RINGS
836  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
837  if (is_Ring)
838  {
839  ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
840  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
841  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
842  while (a1 != NULL && nIsZero(t2))
843  {
844  pIter(a1);
845  nDelete(&t2);
846  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
847  }
848  while (a2 != NULL && nIsZero(t1))
849  {
850  pIter(a2);
851  nDelete(&t1);
852  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
853  }
854  }
855 #endif
856 
857  if (a1==NULL)
858  {
859  if(a2!=NULL)
860  {
861  m2=p_Init(currRing);
862 x2:
863  for (i = (currRing->N); i; i--)
864  {
865  c = p_GetExpDiff(p1, p2,i, currRing);
866  if (c>0)
867  {
868  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
869  }
870  else
871  {
872  p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
873  }
874  }
875  if ((c1==c2)||(c2!=0))
876  {
878  }
879  else
880  {
881  p_SetComp(m2,c1,currRing);
882  }
883  p_Setm(m2, currRing);
884 #ifdef HAVE_RINGS
885  if (is_Ring)
886  {
887  nDelete(&lc1);
888  nDelete(&lc2);
889  nDelete(&t2);
890  pSetCoeff0(m2, t1);
891  }
892  else
893 #endif
894  nNew(&(pGetCoeff(m2)));
895  return m2;
896  }
897  else
898  {
899 #ifdef HAVE_RINGS
900  if (is_Ring)
901  {
902  nDelete(&lc1);
903  nDelete(&lc2);
904  nDelete(&t1);
905  nDelete(&t2);
906  }
907 #endif
908  return NULL;
909  }
910  }
911  if (a2==NULL)
912  {
913  m1=p_Init(currRing);
914 x1:
915  for (i = (currRing->N); i; i--)
916  {
917  c = p_GetExpDiff(p2, p1,i,currRing);
918  if (c>0)
919  {
920  p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
921  }
922  else
923  {
924  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
925  }
926  }
927  if ((c1==c2)||(c1!=0))
928  {
930  }
931  else
932  {
933  p_SetComp(m1,c2,currRing);
934  }
935  p_Setm(m1, currRing);
936 #ifdef HAVE_RINGS
937  if (is_Ring)
938  {
939  pSetCoeff0(m1, t2);
940  nDelete(&lc1);
941  nDelete(&lc2);
942  nDelete(&t1);
943  }
944  else
945 #endif
946  nNew(&(pGetCoeff(m1)));
947  return m1;
948  }
949  m1 = p_Init(currRing);
950  m2 = p_Init(currRing);
951  loop
952  {
953  for (i = (currRing->N); i; i--)
954  {
955  c = p_GetExpDiff(p1, p2,i,currRing);
956  if (c > 0)
957  {
958  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
959  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
960  }
961  else
962  {
963  p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
964  p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
965  }
966  }
967  if(c1==c2)
968  {
971  }
972  else
973  {
974  if(c1!=0)
975  {
977  p_SetComp(m2,c1, currRing);
978  }
979  else
980  {
982  p_SetComp(m1,c2, currRing);
983  }
984  }
985  p_Setm(m1,currRing);
986  p_Setm(m2,currRing);
987  cm = p_LmCmp(m1, m2,currRing);
988  if (cm!=0)
989  {
990  if(cm==1)
991  {
992  p_LmFree(m2,currRing);
993 #ifdef HAVE_RINGS
994  if (is_Ring)
995  {
996  pSetCoeff0(m1, t2);
997  nDelete(&lc1);
998  nDelete(&lc2);
999  nDelete(&t1);
1000  }
1001  else
1002 #endif
1003  nNew(&(pGetCoeff(m1)));
1004  return m1;
1005  }
1006  else
1007  {
1008  p_LmFree(m1,currRing);
1009 #ifdef HAVE_RINGS
1010  if (is_Ring)
1011  {
1012  pSetCoeff0(m2, t1);
1013  nDelete(&lc1);
1014  nDelete(&lc2);
1015  nDelete(&t2);
1016  }
1017  else
1018 #endif
1019  nNew(&(pGetCoeff(m2)));
1020  return m2;
1021  }
1022  }
1023 #ifdef HAVE_RINGS
1024  if (is_Ring)
1025  {
1026  equal = nEqual(t1,t2);
1027  }
1028  else
1029 #endif
1030  {
1031  t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
1032  t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
1033  equal = nEqual(t1,t2);
1034  nDelete(&t2);
1035  nDelete(&t1);
1036  }
1037  if (!equal)
1038  {
1039  p_LmFree(m2,currRing);
1040 #ifdef HAVE_RINGS
1041  if (is_Ring)
1042  {
1043  pSetCoeff0(m1, nSub(t1, t2));
1044  nDelete(&lc1);
1045  nDelete(&lc2);
1046  nDelete(&t1);
1047  nDelete(&t2);
1048  }
1049  else
1050 #endif
1051  nNew(&(pGetCoeff(m1)));
1052  return m1;
1053  }
1054  pIter(a1);
1055  pIter(a2);
1056 #ifdef HAVE_RINGS
1057  if (is_Ring)
1058  {
1059  if (a2 != NULL)
1060  {
1061  nDelete(&t1);
1062  t1 = nMult(pGetCoeff(a2),lc1);
1063  }
1064  if (a1 != NULL)
1065  {
1066  nDelete(&t2);
1067  t2 = nMult(pGetCoeff(a1),lc2);
1068  }
1069  while ((a1 != NULL) && nIsZero(t2))
1070  {
1071  pIter(a1);
1072  if (a1 != NULL)
1073  {
1074  nDelete(&t2);
1075  t2 = nMult(pGetCoeff(a1),lc2);
1076  }
1077  }
1078  while ((a2 != NULL) && nIsZero(t1))
1079  {
1080  pIter(a2);
1081  if (a2 != NULL)
1082  {
1083  nDelete(&t1);
1084  t1 = nMult(pGetCoeff(a2),lc1);
1085  }
1086  }
1087  }
1088 #endif
1089  if (a2==NULL)
1090  {
1091  p_LmFree(m2,currRing);
1092  if (a1==NULL)
1093  {
1094 #ifdef HAVE_RINGS
1095  if (is_Ring)
1096  {
1097  nDelete(&lc1);
1098  nDelete(&lc2);
1099  nDelete(&t1);
1100  nDelete(&t2);
1101  }
1102 #endif
1103  p_LmFree(m1,currRing);
1104  return NULL;
1105  }
1106  goto x1;
1107  }
1108  if (a1==NULL)
1109  {
1110  p_LmFree(m1,currRing);
1111  goto x2;
1112  }
1113  }
1114 }
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:88
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 637 of file kspoly.cc.

640 {
641 #ifdef KDEBUG
642  create_count++;
643 #endif
644  kTest_L(Pair);
645  poly p1 = Pair->p1;
646  poly p2 = Pair->p2;
647  Pair->tailRing = tailRing;
648 
649  assume(p1 != NULL);
650  assume(p2 != NULL);
651  assume(tailRing != NULL);
652 
653  poly a1 = pNext(p1), a2 = pNext(p2);
654  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
655  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
656  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
657 
658  int l1=0, l2=0;
659 
660  if (p_GetComp(p1, currRing)!=p_GetComp(p2, currRing))
661  {
662  if (p_GetComp(p1, currRing)==0)
663  {
664  co=1;
666  }
667  else
668  {
669  co=2;
671  }
672  }
673 
674  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
675  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
676  if (m1 == NULL)
677  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
678 
679  pSetCoeff0(m1, lc2);
680  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
681 
682  if (R != NULL)
683  {
684  if (Pair->i_r1 == -1)
685  {
686  l1 = pLength(p1) - 1;
687  }
688  else
689  {
690  l1 = (R[Pair->i_r1])->GetpLength() - 1;
691  }
692  if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
693  {
694  l2 = pLength(p2) - 1;
695  }
696  else
697  {
698  l2 = (R[Pair->i_r2])->GetpLength() - 1;
699  }
700  }
701 
702  // get m2 * a2
703  if (spNoether != NULL)
704  {
705  l2 = -1;
706  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
707  assume(l2 == pLength(a2));
708  }
709  else
710  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
711 #ifdef HAVE_RINGS
712  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
713 #endif
714 
715  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
716 
717  // get m2*a2 - m1*a1
718  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
719 
720  // Clean-up time
721  Pair->LmDeleteAndIter();
722  p_LmDelete(m1, tailRing);
723 
724  if (co != 0)
725  {
726  if (co==1)
727  {
728  p_SetCompP(p1,0, currRing, tailRing);
729  }
730  else
731  {
732  p_SetCompP(p2,0, currRing, tailRing);
733  }
734  }
735 
736  // the following is commented out: shrinking
737 #ifdef HAVE_SHIFTBBA_NONEXISTENT
738  if (currRing->isLPring)
739  {
740  // assume? h->p in currRing
741  Pair->GetP();
742  poly qq = p_Shrink(Pair->p, currRing->isLPring, currRing);
743  Pair->Clear(); // does the right things
744  Pair->p = qq;
745  Pair->t_p = NULL;
746  Pair->SetShortExpVector();
747  }
748 #endif
749 
750 }
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:960
#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
static int pLength(poly a)
Definition: p_polys.h:189
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:657
#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 1098 of file kInline.h.

1099 {
1100  LObject L(r);
1101  L.p1 = p1;
1102  L.p2 = p2;
1103 
1104  ksCreateSpoly(&L, spNoether);
1105  return L.GetLmCurrRing();
1106 }
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:637
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

§ ksOldSpolyRed()

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

Definition at line 1078 of file kInline.h.

1079 {
1080  LObject L(p2);
1081  TObject T(p1);
1082 
1083  ksReducePoly(&L, &T, spNoether);
1084 
1085  return L.GetLmCurrRing();
1086 }
class sLObject LObject
Definition: kutil.h:60
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
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 1088 of file kInline.h.

1089 {
1090  LObject L(p_Copy(p2, currRing));
1091  TObject T(p1);
1092 
1093  ksReducePoly(&L, &T, spNoether);
1094 
1095  return L.GetLmCurrRing();
1096 }
class sLObject LObject
Definition: kutil.h:60
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
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 1108 of file kInline.h.

1109 {
1110  LObject L(q, currRing, r);
1111  TObject T(p1, currRing, r);
1112 
1113  ksReducePolyTail(&L, &T, q2, spNoether);
1114 }
class sLObject LObject
Definition: kutil.h:60
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
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 40 of file kspoly.cc.

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

§ ksReducePolySig()

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

Definition at line 178 of file kspoly.cc.

184 {
185 #ifdef KDEBUG
186  red_count++;
187 #ifdef TEST_OPT_DEBUG_RED
188  if (TEST_OPT_DEBUG)
189  {
190  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
191  PW->wrp();
192  }
193 #endif
194 #endif
195  int ret = 0;
196  ring tailRing = PR->tailRing;
197  kTest_L(PR);
198  kTest_T(PW);
199 
200  // signature-based stuff:
201  // checking for sig-safeness first
202  // NOTE: This has to be done in the current ring
203  //
204  /**********************************************
205  *
206  * TODO:
207  * --------------------------------------------
208  * if strat->sbaOrder == 1
209  * Since we are subdividing lower index and
210  * current index reductions it is enough to
211  * look at the polynomial part of the signature
212  * for a check. This should speed-up checking
213  * a lot!
214  * if !strat->sbaOrder == 0
215  * We are not subdividing lower and current index
216  * due to the fact that we are using the induced
217  * Schreyer order
218  *
219  * nevertheless, this different behaviour is
220  * taken care of by is_sigsafe
221  * => one reduction procedure can be used for
222  * both, the incremental and the non-incremental
223  * attempt!
224  * --------------------------------------------
225  *
226  *********************************************/
227  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
228  if (!PW->is_sigsafe)
229  {
230  poly sigMult = pCopy(PW->sig); // copy signature of reducer
231 //#if 1
232 #ifdef DEBUGF5
233  printf("IN KSREDUCEPOLYSIG: \n");
234  pWrite(pHead(f1));
235  pWrite(pHead(f2));
236  pWrite(sigMult);
237  printf("--------------\n");
238 #endif
239  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
240 //#if 1
241 #ifdef DEBUGF5
242  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
243  pWrite(pHead(f1));
244  pWrite(pHead(f2));
245  pWrite(sigMult);
246  pWrite(PR->sig);
247  printf("--------------\n");
248 #endif
249  int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
250  // now we can delete the copied polynomial data used for checking for
251  // sig-safeness of the reduction step
252 //#if 1
253 #ifdef DEBUGF5
254  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
255 
256 #endif
257  //pDelete(&f1);
258  pDelete(&sigMult);
259  // go on with the computations only if the signature of p2 is greater than the
260  // signature of fm*p1
261  if(sigSafe != 1)
262  {
263  PR->is_redundant = TRUE;
264  return 3;
265  }
266  //PW->is_sigsafe = TRUE;
267  }
268  PR->is_redundant = FALSE;
269  poly p1 = PR->GetLmTailRing(); // p2 | p1
270  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
271  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
272  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
273  p_CheckPolyRing(p1, tailRing);
274  p_CheckPolyRing(p2, tailRing);
275 
276  pAssume1(p2 != NULL && p1 != NULL &&
277  p_DivisibleBy(p2, p1, tailRing));
278 
279  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
280  (p_GetComp(p2, tailRing) == 0 &&
281  p_MaxComp(pNext(p2),tailRing) == 0));
282 
283 #ifdef HAVE_PLURAL
284  if (rIsPluralRing(currRing))
285  {
286  // for the time being: we know currRing==strat->tailRing
287  // no exp-bound checking needed
288  // (only needed if exp-bound(tailring)<exp-b(currRing))
289  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
290  else
291  {
292  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
293  assume(_p != NULL);
294  nc_PolyPolyRed(_p, p2, coef, currRing);
295  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
296  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
297  }
298  return 0;
299  }
300 #endif
301 
302  if (t2==NULL) // Divisor is just one term, therefore it will
303  { // just cancel the leading term
304  PR->LmDeleteAndIter();
305  if (coef != NULL) *coef = n_Init(1, tailRing);
306  return 0;
307  }
308 
309  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
310 
311  if (tailRing != currRing)
312  {
313  // check that reduction does not violate exp bound
314  while (PW->max != NULL && !p_LmExpVectorAddIsOk(lm, PW->max, tailRing))
315  {
316  // undo changes of lm
317  p_ExpVectorAdd(lm, p2, tailRing);
318  if (strat == NULL) return 2;
319  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
320  tailRing = strat->tailRing;
321  p1 = PR->GetLmTailRing();
322  p2 = PW->GetLmTailRing();
323  t2 = pNext(p2);
324  lm = p1;
325  p_ExpVectorSub(lm, p2, tailRing);
326  ret = 1;
327  }
328  }
329 
330  // take care of coef buisness
331  if (! n_IsOne(pGetCoeff(p2), tailRing))
332  {
333  number bn = pGetCoeff(lm);
334  number an = pGetCoeff(p2);
335  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
336  p_SetCoeff(lm, bn, tailRing);
337  if ((ct == 0) || (ct == 2))
338  PR->Tail_Mult_nn(an);
339  if (coef != NULL) *coef = an;
340  else n_Delete(&an, tailRing);
341  }
342  else
343  {
344  if (coef != NULL) *coef = n_Init(1, tailRing);
345  }
346 
347 
348  // and finally,
349  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
350  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
351  PR->LmDeleteAndIter();
352 
353  // the following is commented out: shrinking
354 #ifdef HAVE_SHIFTBBA_NONEXISTENT
355  if ( (currRing->isLPring) && (!strat->homog) )
356  {
357  // assume? h->p in currRing
358  PR->GetP();
359  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
360  PR->Clear(); // does the right things
361  PR->p = qq;
362  PR->t_p = NULL;
363  PR->SetShortExpVector();
364  }
365 #endif
366 
367 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
368  if (TEST_OPT_DEBUG)
369  {
370  Print(" to: "); PR->wrp(); Print("\n");
371  }
372 #endif
373  return ret;
374 }
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:2295
#define FALSE
Definition: auxiliary.h:97
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:101
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
static int pLength(poly a)
Definition: p_polys.h:189
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:371
#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:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
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
#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:341
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:655
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1379
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ ksReducePolySigRing()

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

Definition at line 376 of file kspoly.cc.

382 {
383 #ifdef ADIDEBUG
384 printf("\nksReducePolySig\n");
385 pWrite(PR->p);pWrite(PR->sig);
386 pWrite(PW->p);pWrite(PW->sig);
387 #endif
388 #ifdef KDEBUG
389  red_count++;
390 #ifdef TEST_OPT_DEBUG_RED
391  if (TEST_OPT_DEBUG)
392  {
393  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
394  PW->wrp();
395  }
396 #endif
397 #endif
398  int ret = 0;
399  ring tailRing = PR->tailRing;
400  kTest_L(PR);
401  kTest_T(PW);
402 
403  // signature-based stuff:
404  // checking for sig-safeness first
405  // NOTE: This has to be done in the current ring
406  //
407  /**********************************************
408  *
409  * TODO:
410  * --------------------------------------------
411  * if strat->sbaOrder == 1
412  * Since we are subdividing lower index and
413  * current index reductions it is enough to
414  * look at the polynomial part of the signature
415  * for a check. This should speed-up checking
416  * a lot!
417  * if !strat->sbaOrder == 0
418  * We are not subdividing lower and current index
419  * due to the fact that we are using the induced
420  * Schreyer order
421  *
422  * nevertheless, this different behaviour is
423  * taken care of by is_sigsafe
424  * => one reduction procedure can be used for
425  * both, the incremental and the non-incremental
426  * attempt!
427  * --------------------------------------------
428  *
429  *********************************************/
430  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
431  if (!PW->is_sigsafe)
432  {
433  poly sigMult = pCopy(PW->sig); // copy signature of reducer
434 //#if 1
435 #ifdef DEBUGF5
436  printf("IN KSREDUCEPOLYSIG: \n");
437  pWrite(pHead(f1));
438  pWrite(pHead(f2));
439  pWrite(sigMult);
440  printf("--------------\n");
441 #endif
442  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
443  //I have also to set the leading coeficient for sigMult (in the case of rings)
445  {
446  pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
447  if(nIsZero(pGetCoeff(sigMult)))
448  {
449  sigMult = NULL;
450  }
451  }
452 //#if 1
453 #ifdef DEBUGF5
454  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
455  pWrite(pHead(f1));
456  pWrite(pHead(f2));
457  pWrite(sigMult);
458  pWrite(PR->sig);
459  printf("--------------\n");
460 #endif
461  int sigSafe;
463  sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
464  // now we can delete the copied polynomial data used for checking for
465  // sig-safeness of the reduction step
466 //#if 1
467 #ifdef DEBUGF5
468  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
469 
470 #endif
472  {
473  // Set the sig
474  poly origsig = pCopy(PR->sig);
475  if(sigMult != NULL)
476  PR->sig = pHead(pSub(PR->sig, sigMult));
477  //The sigs have the same lm, have to substract
478  //It may happen that now the signature is 0 (drop)
479  if(PR->sig == NULL)
480  {
481  #ifdef ADIDEBUG
482  printf("\nPossible sigdrop in ksreducepolysig (lost signature)\n");
483  #endif
484  strat->sigdrop=TRUE;
485  }
486  else
487  {
488  if(pLtCmp(PR->sig,origsig) == 1)
489  {
490  // do not allow this reduction - it will increase it's signature
491  // and the partially standard basis is just till the old sig, not the new one
492  PR->is_redundant = TRUE;
493  pDelete(&PR->sig);
494  PR->sig = origsig;
495  strat->blockred++;
496  return 3;
497  }
498  if(pLtCmp(PR->sig,origsig) == -1)
499  {
500  #ifdef ADIDEBUG
501  printf("\nSigdrop in ksreducepolysig from * to *\n");pWrite(origsig);pWrite(PR->sig);
502  #endif
503  strat->sigdrop=TRUE;
504  }
505  }
506  pDelete(&origsig);
507  }
508  //pDelete(&f1);
509  // go on with the computations only if the signature of p2 is greater than the
510  // signature of fm*p1
511  if(sigSafe != 1 && !rField_is_Ring(currRing))
512  {
513  PR->is_redundant = TRUE;
514  return 3;
515  }
516  //PW->is_sigsafe = TRUE;
517  }
518  PR->is_redundant = FALSE;
519  poly p1 = PR->GetLmTailRing(); // p2 | p1
520  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
521  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
522  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
523  p_CheckPolyRing(p1, tailRing);
524  p_CheckPolyRing(p2, tailRing);
525 
526  pAssume1(p2 != NULL && p1 != NULL &&
527  p_DivisibleBy(p2, p1, tailRing));
528 
529  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
530  (p_GetComp(p2, tailRing) == 0 &&
531  p_MaxComp(pNext(p2),tailRing) == 0));
532 
533 #ifdef HAVE_PLURAL
534  if (rIsPluralRing(currRing))
535  {
536  // for the time being: we know currRing==strat->tailRing
537  // no exp-bound checking needed
538  // (only needed if exp-bound(tailring)<exp-b(currRing))
539  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
540  else
541  {
542  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
543  assume(_p != NULL);
544  nc_PolyPolyRed(_p, p2, coef, currRing);
545  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
546  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
547  }
548  return 0;
549  }
550 #endif
551 
552  if (t2==NULL) // Divisor is just one term, therefore it will
553  { // just cancel the leading term
554  PR->LmDeleteAndIter();
555  if (coef != NULL) *coef = n_Init(1, tailRing);
556  return 0;
557  }
558 
559  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
560 
561  if (tailRing != currRing)
562  {
563  // check that reduction does not violate exp bound
564  while (PW->max != NULL && !p_LmExpVectorAddIsOk(lm, PW->max, tailRing))
565  {
566  // undo changes of lm
567  p_ExpVectorAdd(lm, p2, tailRing);
568  if (strat == NULL) return 2;
569  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
570  tailRing = strat->tailRing;
571  p1 = PR->GetLmTailRing();
572  p2 = PW->GetLmTailRing();
573  t2 = pNext(p2);
574  lm = p1;
575  p_ExpVectorSub(lm, p2, tailRing);
576  ret = 1;
577  }
578  }
579  // take care of coef buisness
581  {
582  p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
583  if (coef != NULL) *coef = n_Init(1, tailRing);
584  }
585  else
586  {
587  if (! n_IsOne(pGetCoeff(p2), tailRing))
588  {
589  number bn = pGetCoeff(lm);
590  number an = pGetCoeff(p2);
591  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
592  p_SetCoeff(lm, bn, tailRing);
593  if (((ct == 0) || (ct == 2)))
594  PR->Tail_Mult_nn(an);
595  if (coef != NULL) *coef = an;
596  else n_Delete(&an, tailRing);
597  }
598  else
599  {
600  if (coef != NULL) *coef = n_Init(1, tailRing);
601  }
602  }
603 
604  // and finally,
605  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
606  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
607  PR->LmDeleteAndIter();
608 
609  // the following is commented out: shrinking
610 #ifdef HAVE_SHIFTBBA_NONEXISTENT
611  if ( (currRing->isLPring) && (!strat->homog) )
612  {
613  // assume? h->p in currRing
614  PR->GetP();
615  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
616  PR->Clear(); // does the right things
617  PR->p = qq;
618  PR->t_p = NULL;
619  PR->SetShortExpVector();
620  }
621 #endif
622 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
623  if (TEST_OPT_DEBUG)
624  {
625  Print(" to: "); PR->wrp(); Print("\n");
626  }
627 #endif
628  return ret;
629 }
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:2295
bool sigdrop
Definition: kutil.h:358
#define FALSE
Definition: auxiliary.h:97
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:101
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
static int pLength(poly a)
Definition: p_polys.h:189
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:371
#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:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
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
#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:341
int blockred
Definition: kutil.h:363
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:655
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1379
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ ksReducePolyTail() [1/2]

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

Definition at line 752 of file kspoly.cc.

753 {
754  BOOLEAN ret;
755  number coef;
756  poly Lp = PR->GetLmCurrRing();
757  poly Save = PW->GetLmCurrRing();
758 
759  kTest_L(PR);
760  kTest_T(PW);
761  pAssume(pIsMonomOf(Lp, Current));
762 
763  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
764  assume(PR->bucket == NULL);
765 
766  LObject Red(pNext(Current), PR->tailRing);
767  TObject With(PW, Lp == Save);
768 
769  pAssume(!pHaveCommonMonoms(Red.p, With.p));
770  ret = ksReducePoly(&Red, &With, spNoether, &coef);
771 
772  if (!ret)
773  {
774  if (! n_IsOne(coef, currRing))
775  {
776  pNext(Current) = NULL;
777  if (Current == PR->p && PR->t_p != NULL)
778  pNext(PR->t_p) = NULL;
779  PR->Mult_nn(coef);
780  }
781 
782  n_Delete(&coef, currRing);
783  pNext(Current) = Red.GetLmTailRing();
784  if (Current == PR->p && PR->t_p != NULL)
785  pNext(PR->t_p) = pNext(Current);
786  }
787 
788  if (Lp == Save)
789  With.Delete();
790 
791  // the following is commented out: shrinking
792 #ifdef HAVE_SHIFTBBA_NONEXISTENT
793  if (currRing->isLPring)
794  {
795  // assume? h->p in currRing
796  PR->GetP();
797  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
798  PR->Clear(); // does the right things
799  PR->p = qq;
800  PR->t_p = NULL;
801  PR->SetShortExpVector();
802  }
803 #endif
804 
805  return ret;
806 }
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:40
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:657
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define kTest_T(T)
Definition: kutil.h:655
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:88
class sTObject TObject
Definition: kutil.h:59

§ ksReducePolyTail() [2/2]

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

Definition at line 1051 of file kInline.h.

1052 {
1053  BOOLEAN ret;
1054  number coef;
1055 
1056  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1057  Red->HeadNormalize();
1058  ret = ksReducePoly(Red, PW, NULL, &coef);
1059 
1060  if (!ret)
1061  {
1062  if (! n_IsOne(coef, currRing->cf))
1063  {
1064  PR->Mult_nn(coef);
1065  // HANNES: mark for Normalize
1066  }
1067  n_Delete(&coef, currRing->cf);
1068  }
1069  return ret;
1070 }
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:40
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:88

§ kStratChangeTailRing()

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

Definition at line 11146 of file kutil.cc.

11147 {
11148  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11149  /* initial setup or extending */
11150 
11151  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11152  if (expbound >= currRing->bitmask) return FALSE;
11153  strat->overflow=FALSE;
11154  ring new_tailRing = rModifyRing(currRing,
11155  // Hmmm .. the condition pFDeg == p_Deg
11156  // might be too strong
11157  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11158  (strat->ak==0), // omit_comp if the input is an ideal
11159  expbound); // exp_limit
11160 
11161  if (new_tailRing == currRing) return TRUE;
11162 
11163  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11164  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11165 
11166  if (currRing->pFDeg != currRing->pFDegOrig)
11167  {
11168  new_tailRing->pFDeg = currRing->pFDeg;
11169  new_tailRing->pLDeg = currRing->pLDeg;
11170  }
11171 
11172  if (TEST_OPT_PROT)
11173  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11174  kTest_TS(strat);
11175  assume(new_tailRing != strat->tailRing);
11176  pShallowCopyDeleteProc p_shallow_copy_delete
11177  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11178 
11179  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11180 
11181  int i;
11182  for (i=0; i<=strat->tl; i++)
11183  {
11184  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11185  p_shallow_copy_delete);
11186  }
11187  for (i=0; i<=strat->Ll; i++)
11188  {
11189  assume(strat->L[i].p != NULL);
11190  if (pNext(strat->L[i].p) != strat->tail)
11191  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11192  }
11193  if ((strat->P.t_p != NULL) ||
11194  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11195  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11196 
11197  if ((L != NULL) && (L->tailRing != new_tailRing))
11198  {
11199  if (L->i_r < 0)
11200  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11201  else
11202  {
11203  assume(L->i_r <= strat->tl);
11204  TObject* t_l = strat->R[L->i_r];
11205  assume(t_l != NULL);
11206  L->tailRing = new_tailRing;
11207  L->p = t_l->p;
11208  L->t_p = t_l->t_p;
11209  L->max = t_l->max;
11210  }
11211  }
11212 
11213  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11214  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11215 
11216  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11217  if (strat->tailRing != currRing)
11218  rKillModifiedRing(strat->tailRing);
11219 
11220  strat->tailRing = new_tailRing;
11221  strat->tailBin = new_tailBin;
11222  strat->p_shallow_copy_delete
11223  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11224 
11225  if (strat->kHEdge != NULL)
11226  {
11227  if (strat->t_kHEdge != NULL)
11228  p_LmFree(strat->t_kHEdge, strat->tailRing);
11229  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11230  }
11231 
11232  if (strat->kNoether != NULL)
11233  {
11234  if (strat->t_kNoether != NULL)
11235  p_LmFree(strat->t_kNoether, strat->tailRing);
11237  new_tailRing);
11238  }
11239  kTest_TS(strat);
11240  if (TEST_OPT_PROT)
11241  PrintS("]");
11242  return TRUE;
11243 }
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:325
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2597
#define TRUE
Definition: auxiliary.h:101
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
int ak
Definition: kutil.h:351
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:587
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:901
BOOLEAN homog
Definition: kutil.h:371
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:403
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:327
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
omBin tailBin
Definition: kutil.h:343
char overflow
Definition: kutil.h:403
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2963
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:59

§ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11245 of file kutil.cc.

11246 {
11247  unsigned long l = 0;
11248  int i;
11249  long e;
11250 
11251  assume(strat->tailRing == currRing);
11252 
11253  for (i=0; i<= strat->Ll; i++)
11254  {
11255  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11256  }
11257  for (i=0; i<=strat->tl; i++)
11258  {
11259  // Hmm ... this we could do in one Step
11260  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11261  }
11262  if (rField_is_Ring(currRing))
11263  {
11264  l *= 2;
11265  }
11266  e = p_GetMaxExp(l, currRing);
11267  if (e <= 1) e = 2;
11268 
11269  kStratChangeTailRing(strat, NULL, NULL, e);
11270 }
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:1175
int Ll
Definition: kutil.h:349
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:348
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:11146
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
int l
Definition: cfEzgcd.cc:94

§ message()

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

Definition at line 7810 of file kutil.cc.

7811 {
7812  if (i != *olddeg)
7813  {
7814  Print("%d",i);
7815  *olddeg = i;
7816  }
7817  if (TEST_OPT_OLDSTD)
7818  {
7819  if (strat->Ll != *reduc)
7820  {
7821  if (strat->Ll != *reduc-1)
7822  Print("(%d)",strat->Ll+1);
7823  else
7824  PrintS("-");
7825  *reduc = strat->Ll;
7826  }
7827  else
7828  PrintS(".");
7829  mflush();
7830  }
7831  else
7832  {
7833  if (red_result == 0)
7834  PrintS("-");
7835  else if (red_result < 0)
7836  PrintS(".");
7837  if ((red_result > 0) || ((strat->Ll % 100)==99))
7838  {
7839  if (strat->Ll != *reduc && strat->Ll > 0)
7840  {
7841  Print("(%d)",strat->Ll+1);
7842  *reduc = strat->Ll;
7843  }
7844  }
7845  }
7846 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:349
#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 7851 of file kutil.cc.

7852 {
7853  //PrintS("\nUsage/Allocation of temporary storage:\n");
7854  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7855  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7856  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7857  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7858  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7859  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7860  /*mflush();*/
7861 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:345
int cv
Definition: kutil.h:368
int cp
Definition: kutil.h:345

§ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7863 of file kutil.cc.

7864 {
7865  //PrintS("\nUsage/Allocation of temporary storage:\n");
7866  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7867  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7868  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
7869  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7870  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7871  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7872  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7873  /*mflush();*/
7874 }
#define Print
Definition: emacs.cc:83
int cv
Definition: kutil.h:368
int nrsyzcrit
Definition: kutil.h:359
int nrrewcrit
Definition: kutil.h:360

§ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10631 of file kutil.cc.

10632 {
10633  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10634  return FALSE;
10635  int i,j;
10636  poly newNoether;
10637 
10638 #if 0
10639  if (currRing->weight_all_1)
10640  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10641  else
10642  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10643 #else
10644  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10645 #endif
10646  if (strat->kHEdge==NULL) return FALSE;
10647  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10648  if (strat->tailRing != currRing)
10649  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10650  /* compare old and new noether*/
10651  newNoether = pLmInit(strat->kHEdge);
10652  j = p_FDeg(newNoether,currRing);
10653  for (i=1; i<=(currRing->N); i++)
10654  {
10655  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10656  }
10657  pSetm(newNoether);
10658  if (j < strat->HCord) /*- statistics -*/
10659  {
10660  if (TEST_OPT_PROT)
10661  {
10662  Print("H(%d)",j);
10663  mflush();
10664  }
10665  strat->HCord=j;
10666  #ifdef KDEBUG
10667  if (TEST_OPT_DEBUG)
10668  {
10669  Print("H(%d):",j);
10670  wrp(strat->kHEdge);
10671  PrintLn();
10672  }
10673  #endif
10674  }
10675  if (pCmp(strat->kNoether,newNoether)!=1)
10676  {
10677  pDelete(&strat->kNoether);
10678  strat->kNoether=newNoether;
10679  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10680  if (strat->tailRing != currRing)
10681  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10682 
10683  return TRUE;
10684  }
10685  if (rField_is_Ring(currRing))
10686  pLmDelete(newNoether);
10687  else
10688  pLmFree(newNoether);
10689  return FALSE;
10690 }
#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:325
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:97
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:326
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc: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:101
int ak
Definition: kutil.h:351
#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:353
#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:901
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:327
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
#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:299

§ pairs()

void pairs ( )

§ pCopyL2p()

poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 11859 of file kutil.cc.

11860 {
11861  /* restores a poly in currRing from LObject */
11862  LObject h = H;
11863  h.Copy();
11864  poly p;
11865  if (h.p == NULL)
11866  {
11867  if (h.t_p != NULL)
11868  {
11869  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11870  return(p);
11871  }
11872  else
11873  {
11874  /* h.tp == NULL -> the object is NULL */
11875  return(NULL);
11876  }
11877  }
11878  /* we're here if h.p != NULL */
11879  if (h.t_p == NULL)
11880  {
11881  /* then h.p is the whole poly in currRing */
11882  p = h.p;
11883  return(p);
11884  }
11885  /* we're here if h.p != NULL and h.t_p != NULL */
11886  // clean h.p, get poly from t_p
11887  pNext(h.p)=NULL;
11888  pLmDelete(&h.p);
11889  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
11890  /* dest. ring: */ currRing);
11891  // no need to clean h: we re-used the polys
11892  return(p);
11893 }
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:341
#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 11828 of file kutil.cc.

11829 {
11830  /* assume: p is completely in currRing */
11831  /* produces an object with LM in curring
11832  and TAIL in tailring */
11833  if (pNext(p)!=NULL)
11834  {
11835  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11836  }
11837  return(p);
11838 }
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:341
#define pNext(p)
Definition: monomials.h:43

§ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 11842 of file kutil.cc.

11843 {
11844  /* assume: p has LM in curring and TAIL in tailring */
11845  /* convert it to complete currRing */
11846 
11847  /* check that LM is in currRing */
11849 
11850  if (pNext(p)!=NULL)
11851  {
11852  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11853  }
11854  return(p);
11855 }
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:341
#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:587
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:354
int j
Definition: myNF.cc:70
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
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:349

§ 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:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h: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:587
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:302
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:748
intset ecartS
Definition: kutil.h:305
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:587
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#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:303
int syzl
Definition: kutil.h:347

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

11568 {
11569 
11570  if (length==-1) return 0;
11571 
11572  int o = p.ecart;
11573  int op=p.GetpFDeg();
11574  int ol = p.GetpLength();
11575 
11576  if (set[length].ecart < o)
11577  return length+1;
11578  if (set[length].ecart == o)
11579  {
11580  int oo=set[length].GetpFDeg();
11581  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11582  return length+1;
11583  }
11584 
11585  int i;
11586  int an = 0;
11587  int en= length;
11588  loop
11589  {
11590  if (an >= en-1)
11591  {
11592  if (set[an].ecart > o)
11593  return an;
11594  if (set[an].ecart == o)
11595  {
11596  int oo=set[an].GetpFDeg();
11597  if((oo > op)
11598  || ((oo==op) && (set[an].pLength > ol)))
11599  return an;
11600  }
11601  return en;
11602  }
11603  i=(an+en) / 2;
11604  if (set[i].ecart > o)
11605  en=i;
11606  else if (set[i].ecart == o)
11607  {
11608  int oo=set[i].GetpFDeg();
11609  if ((oo > op)
11610  || ((oo == op) && (set[i].pLength > ol)))
11611  en=i;
11612  else
11613  an=i;
11614  }
11615  else
11616  an=i;
11617  }
11618 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ 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
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ posInT_FDegpLength()

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

Definition at line 11621 of file kutil.cc.

11622 {
11623 
11624  if (length==-1) return 0;
11625 
11626  int op=p.GetpFDeg();
11627  int ol = p.GetpLength();
11628 
11629  int oo=set[length].GetpFDeg();
11630  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11631  return length+1;
11632 
11633  int i;
11634  int an = 0;
11635  int en= length;
11636  loop
11637  {
11638  if (an >= en-1)
11639  {
11640  int oo=set[an].GetpFDeg();
11641  if((oo > op)
11642  || ((oo==op) && (set[an].pLength > ol)))
11643  return an;
11644  return en;
11645  }
11646  i=(an+en) / 2;
11647  int oo=set[i].GetpFDeg();
11648  if ((oo > op)
11649  || ((oo == op) && (set[i].pLength > ol)))
11650  en=i;
11651  else
11652  an=i;
11653  }
11654 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ posInT_pLength()

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

Definition at line 11658 of file kutil.cc.

11659 {
11660  int ol = p.GetpLength();
11661  if (length==-1)
11662  return 0;
11663  if (set[length].length<p.length)
11664  return length+1;
11665 
11666  int i;
11667  int an = 0;
11668  int en= length;
11669 
11670  loop
11671  {
11672  if (an >= en-1)
11673  {
11674  if (set[an].pLength>ol) return an;
11675  return en;
11676  }
11677  i=(an+en) / 2;
11678  if (set[i].pLength>ol) en=i;
11679  else an=i;
11680  }
11681 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

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

10927 {
10928  if(!nCoeff_is_Ring_Z(currRing->cf))
10929  return;
10930  poly pH = h->GetP();
10931  poly p,pp;
10932  p = pH;
10933  bool deleted = FALSE, ok = FALSE;
10934  for(int i = 0; i<=strat->sl; i++)
10935  {
10936  p = pH;
10937  if(pNext(strat->S[i]) == NULL)
10938  {
10939  //pWrite(p);
10940  //pWrite(strat->S[i]);
10941  while(ok == FALSE && p != NULL)
10942  {
10943  if(pLmDivisibleBy(strat->S[i], p))
10944  {
10945  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
10946  p_SetCoeff(p,dummy,currRing);
10947  }
10948  if(nIsZero(p->coef))
10949  {
10950  pLmDelete(&p);
10951  h->p = p;
10952  deleted = TRUE;
10953  }
10954  else
10955  {
10956  ok = TRUE;
10957  }
10958  }
10959  pp = pNext(p);
10960  while(pp != NULL)
10961  {
10962  if(pLmDivisibleBy(strat->S[i], pp))
10963  {
10964  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
10965  p_SetCoeff(pp,dummy,currRing);
10966  if(nIsZero(pp->coef))
10967  {
10968  pLmDelete(&pNext(p));
10969  pp = pNext(p);
10970  deleted = TRUE;
10971  }
10972  else
10973  {
10974  p = pp;
10975  pp = pNext(p);
10976  }
10977  }
10978  else
10979  {
10980  p = pp;
10981  pp = pNext(p);
10982  }
10983  }
10984  }
10985  }
10986  h->SetLmCurrRing();
10987  if(deleted)
10988  strat->initEcart(h);
10989 }
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:97
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:101
#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:276
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:302
#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:346
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 10991 of file kutil.cc.

10992 {
10993  if(!nCoeff_is_Ring_Z(currRing->cf))
10994  return;
10995  poly hSig = h->sig;
10996  poly pH = h->GetP();
10997  poly p,pp;
10998  p = pH;
10999  bool deleted = FALSE, ok = FALSE;
11000  for(int i = 0; i<=strat->sl; i++)
11001  {
11002  p = pH;
11003  if(pNext(strat->S[i]) == NULL)
11004  {
11005  while(ok == FALSE && p!=NULL)
11006  {
11007  if(pLmDivisibleBy(strat->S[i], p))
11008  {
11009  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11010  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11011  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11012  {
11013  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11014  p_SetCoeff(p,dummy,currRing);
11015  }
11016  pDelete(&sigMult);
11017  }
11018  if(nIsZero(p->coef))
11019  {
11020  pLmDelete(&p);
11021  h->p = p;
11022  deleted = TRUE;
11023  }
11024  else
11025  {
11026  ok = TRUE;
11027  }
11028  }
11029  if(p == NULL)
11030  return;
11031  pp = pNext(p);
11032  while(pp != NULL)
11033  {
11034  if(pLmDivisibleBy(strat->S[i], pp))
11035  {
11036  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11037  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11038  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11039  {
11040  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11041  p_SetCoeff(pp,dummy,currRing);
11042  if(nIsZero(pp->coef))
11043  {
11044  pLmDelete(&pNext(p));
11045  pp = pNext(p);
11046  deleted = TRUE;
11047  }
11048  else
11049  {
11050  p = pp;
11051  pp = pNext(p);
11052  }
11053  }
11054  else
11055  {
11056  p = pp;
11057  pp = pNext(p);
11058  }
11059  pDelete(&sigMult);
11060  }
11061  else
11062  {
11063  p = pp;
11064  pp = pNext(p);
11065  }
11066  }
11067  }
11068  }
11069  h->SetLmCurrRing();
11070  if(deleted)
11071  strat->initEcart(h);
11072 
11073 }
polyset sig
Definition: kutil.h:304
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:632
#define FALSE
Definition: auxiliary.h:97
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:101
#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:276
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:302
#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:346
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 10758 of file kutil.cc.

10759 {
10761  if(!nCoeff_is_Ring_Z(currRing->cf))
10762  return NULL;
10763  ideal F = idCopy(Forig);
10764  idSkipZeroes(F);
10765  poly pmon;
10766  ring origR = currRing;
10767  ideal monred = idInit(1,1);
10768  for(int i=0; i<idElem(F); i++)
10769  {
10770  if(pNext(F->m[i]) == NULL)
10771  idInsertPoly(monred, pCopy(F->m[i]));
10772  }
10773  int posconst = idPosConstant(F);
10774  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10775  {
10776  idDelete(&F);
10777  idDelete(&monred);
10778  return NULL;
10779  }
10780  int idelemQ = 0;
10781  if(Q!=NULL)
10782  {
10783  idelemQ = IDELEMS(Q);
10784  for(int i=0; i<idelemQ; i++)
10785  {
10786  if(pNext(Q->m[i]) == NULL)
10787  idInsertPoly(monred, pCopy(Q->m[i]));
10788  }
10789  idSkipZeroes(monred);
10790  posconst = idPosConstant(monred);
10791  //the constant, if found, will be from Q
10792  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10793  {
10794  pmon = pCopy(monred->m[posconst]);
10795  idDelete(&F);
10796  idDelete(&monred);
10797  return pmon;
10798  }
10799  }
10800  ring QQ_ring = rCopy0(currRing,FALSE);
10801  nKillChar(QQ_ring->cf);
10802  QQ_ring->cf = nInitChar(n_Q, NULL);
10803  rComplete(QQ_ring,1);
10804  QQ_ring = rAssure_c_dp(QQ_ring);
10805  rChangeCurrRing(QQ_ring);
10806  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10807  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10808  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10809  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10810  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10811  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10812  ideal one = kStd(II, NULL, isNotHomog, NULL);
10813  idSkipZeroes(one);
10814  if(idIsConstant(one))
10815  {
10816  //one should be <1>
10817  for(int i = IDELEMS(II)-1; i>=0; i--)
10818  if(II->m[i] != NULL)
10819  II->m[i+1] = II->m[i];
10820  II->m[0] = pOne();
10821  ideal syz = idSyzygies(II, isNotHomog, NULL);
10822  poly integer = NULL;
10823  for(int i = IDELEMS(syz)-1;i>=0; i--)
10824  {
10825  if(pGetComp(syz->m[i]) == 1)
10826  {
10827  pSetComp(syz->m[i],0);
10828  if(pIsConstant(pHead(syz->m[i])))
10829  {
10830  integer = pHead(syz->m[i]);
10831  break;
10832  }
10833  }
10834  }
10835  rChangeCurrRing(origR);
10836  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10837  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10838  idDelete(&monred);
10839  idDelete(&F);
10840  id_Delete(&II,QQ_ring);
10841  id_Delete(&one,QQ_ring);
10842  id_Delete(&syz,QQ_ring);
10843  p_Delete(&integer,QQ_ring);
10844  rDelete(QQ_ring);
10845  return pmon;
10846  }
10847  else
10848  {
10849  if(idIs0(monred))
10850  {
10851  poly mindegmon = NULL;
10852  for(int i = 0; i<IDELEMS(one); i++)
10853  {
10854  if(pNext(one->m[i]) == NULL)
10855  {
10856  if(mindegmon == NULL)
10857  mindegmon = pCopy(one->m[i]);
10858  else
10859  {
10860  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10861  mindegmon = pCopy(one->m[i]);
10862  }
10863  }
10864  }
10865  if(mindegmon != NULL)
10866  {
10867  for(int i = IDELEMS(II)-1; i>=0; i--)
10868  if(II->m[i] != NULL)
10869  II->m[i+1] = II->m[i];
10870  II->m[0] = pCopy(mindegmon);
10871  ideal syz = idSyzygies(II, isNotHomog, NULL);
10872  bool found = FALSE;
10873  for(int i = IDELEMS(syz)-1;i>=0; i--)
10874  {
10875  if(pGetComp(syz->m[i]) == 1)
10876  {
10877  pSetComp(syz->m[i],0);
10878  if(pIsConstant(pHead(syz->m[i])))
10879  {
10880  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10881  found = TRUE;
10882  break;
10883  }
10884  }
10885  }
10886  id_Delete(&syz,QQ_ring);
10887  if (found == FALSE)
10888  {
10889  rChangeCurrRing(origR);
10890  idDelete(&monred);
10891  idDelete(&F);
10892  id_Delete(&II,QQ_ring);
10893  id_Delete(&one,QQ_ring);
10894  rDelete(QQ_ring);
10895  return NULL;
10896  }
10897  rChangeCurrRing(origR);
10898  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10899  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
10900  idDelete(&monred);
10901  idDelete(&F);
10902  id_Delete(&II,QQ_ring);
10903  id_Delete(&one,QQ_ring);
10904  id_Delete(&syz,QQ_ring);
10905  rDelete(QQ_ring);
10906  return pmon;
10907  }
10908  }
10909  }
10910  rChangeCurrRing(origR);
10911  idDelete(&monred);
10912  idDelete(&F);
10913  id_Delete(&II,QQ_ring);
10914  id_Delete(&one,QQ_ring);
10915  rDelete(QQ_ring);
10916  return NULL;
10917 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:39
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define FALSE
Definition: auxiliary.h:97
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:101
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4893
#define pGetComp(p)
Component.
Definition: polys.h:37
bool found
Definition: facFactorize.cc:56
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:47
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
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:3435
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:62
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:490
#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:329
#define idIsConstant(I)
Definition: ideals.h:42

§ redFirstShift()

int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 4055 of file kstd2.cc.

4056 {
4057  if (h->IsNull()) return 0;
4058 
4059  int at, reddeg,d;
4060  int pass = 0;
4061  int j = 0;
4062 
4063  if (! strat->homog)
4064  {
4065  d = h->GetpFDeg() + h->ecart;
4066  reddeg = strat->LazyDegree+d;
4067  }
4068  h->SetShortExpVector();
4069  loop
4070  {
4071  j = kFindDivisibleByInT(strat, h);
4072  if (j < 0)
4073  {
4074  h->SetDegStuffReturnLDeg(strat->LDegLast);
4075  return 1;
4076  }
4077 
4078  if (!TEST_OPT_INTSTRATEGY)
4079  strat->T[j].pNorm();
4080 #ifdef KDEBUG
4081  if (TEST_OPT_DEBUG)
4082  {
4083  PrintS("reduce ");
4084  h->wrp();
4085  PrintS(" with ");
4086  strat->T[j].wrp();
4087  }
4088 #endif
4089  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
4090  if (!h->IsNull())
4091  {
4092  poly qq=p_Shrink(h->GetTP(),strat->lV,strat->tailRing);
4093  h->p=NULL;
4094  h->t_p=qq;
4095  if (qq!=NULL) h->GetP(strat->lmBin);
4096  }
4097 
4098 #ifdef KDEBUG
4099  if (TEST_OPT_DEBUG)
4100  {
4101  PrintS(" to ");
4102  wrp(h->p);
4103  PrintLn();
4104  }
4105 #endif
4106  if (h->IsNull())
4107  {
4108  if (h->lcm!=NULL) pLmFree(h->lcm);
4109  h->Clear();
4110  return 0;
4111  }
4112  h->SetShortExpVector();
4113 
4114 #if 0
4115  if ((strat->syzComp!=0) && !strat->honey)
4116  {
4117  if ((strat->syzComp>0) &&
4118  (h->Comp() > strat->syzComp))
4119  {
4120  assume(h->MinComp() > strat->syzComp);
4121 #ifdef KDEBUG
4122  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
4123 #endif
4124  if (strat->homog)
4125  h->SetDegStuffReturnLDeg(strat->LDegLast);
4126  return -2;
4127  }
4128  }
4129 #endif
4130  if (!strat->homog)
4131  {
4132  if (!TEST_OPT_OLDSTD && strat->honey)
4133  {
4134  h->SetpFDeg();
4135  if (strat->T[j].ecart <= h->ecart)
4136  h->ecart = d - h->GetpFDeg();
4137  else
4138  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
4139 
4140  d = h->GetpFDeg() + h->ecart;
4141  }
4142  else
4143  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
4144  /*- try to reduce the s-polynomial -*/
4145  pass++;
4146  /*
4147  *test whether the polynomial should go to the lazyset L
4148  *-if the degree jumps
4149  *-if the number of pre-defined reductions jumps
4150  */
4151  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
4152  && ((d >= reddeg) || (pass > strat->LazyPass)))
4153  {
4154  h->SetLmCurrRing();
4155  if (strat->posInLDependsOnLength)
4156  h->SetLength(strat->length_pLength);
4157  at = strat->posInL(strat->L,strat->Ll,h,strat);
4158  if (at <= strat->Ll)
4159  {
4160  //int dummy=strat->sl;
4161  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
4162  //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
4163  if (kFindDivisibleByInT(strat, h) < 0)
4164  return 1;
4165  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
4166 #ifdef KDEBUG
4167  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
4168 #endif
4169  h->Clear();
4170  return -1;
4171  }
4172  }
4173  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
4174  {
4175  reddeg = d+1;
4176  Print(".%d",d);mflush();
4177  }
4178  }
4179  }
4180 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:376
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
BOOLEAN length_pLength
Definition: kutil.h:386
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
#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:367
BOOLEAN homog
Definition: kutil.h:371
#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:323
BOOLEAN LDegLast
Definition: kutil.h:384
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
TSet T
Definition: kutil.h:322
omBin lmBin
Definition: kutil.h:342
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:351
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:351

§ 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:280
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int tl
Definition: kutil.h:348
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
unsigned long * sevT
Definition: kutil.h:321
#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 int pLength(poly a)
Definition: p_polys.h:189
BOOLEAN fromT
Definition: kutil.h:378
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
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:88
int LazyPass
Definition: kutil.h:351
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:280
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
#define p_GetComp(p, r)
Definition: monomials.h:72
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
unsigned long * sevT
Definition: kutil.h:321
#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 int pLength(poly a)
Definition: p_polys.h:189
#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:378
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
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
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:351
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:280
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:349
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
unsigned long * sevT
Definition: kutil.h:321
#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 int pLength(poly a)
Definition: p_polys.h:189
#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
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:88
int LazyPass
Definition: kutil.h:351
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:326
#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
static int pLength(poly a)
Definition: p_polys.h:189
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
polyset S
Definition: kutil.h:302
#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:346
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:88
#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))
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:280
BOOLEAN honey
Definition: kutil.h:376
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:386
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
#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:388
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:101
unsigned long * sevT
Definition: kutil.h:321
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:378
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:323
BOOLEAN LDegLast
Definition: kutil.h:384
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:10926
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
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:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:351

§ 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:280
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:386
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:101
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
#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:323
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:10926
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:88
int LazyPass
Definition: kutil.h:351
#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:280
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
unsigned long * sevT
Definition: kutil.h:321
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 int pLength(poly a)
Definition: p_polys.h:189
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:178
BOOLEAN fromT
Definition: kutil.h:378
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
#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:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:88
int LazyPass
Definition: kutil.h:351
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:280
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:358
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition: kutil.cc:10991
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
Definition: kutil.cc:1645
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
unsigned long * sevT
Definition: kutil.h:321
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
static int pLength(poly a)
Definition: p_polys.h:189
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:378
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
#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:323
#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:349
ring tailRing
Definition: kutil.h:341
#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:346
TSet T
Definition: kutil.h:322
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:351
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:376

§ 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:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define TRUE
Definition: auxiliary.h:101
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
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:375
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4589
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#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:88
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:398
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 1116 of file kInline.h.

1117 {
1118  LObject L(p, currRing, strat->tailRing);
1119  return redtailBba(&L, pos, strat,FALSE, normalize);
1120 }
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:97
return P p
Definition: myNF.cc:203
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1116
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:341

§ 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:352
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:101
#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:402
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:657
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
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:398
class sTObject TObject
Definition: kutil.h:59

§ redtailBba() [3/3]

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

Definition at line 1130 of file kInline.h.

1131 {
1132  LObject L;
1133  L = *T;
1134  poly p = redtailBba(&L, pos, strat, FALSE);
1135  *T = L;
1136  //kTest_T(T);
1137  assume( p == T->p);
1138  return p;
1139 }
class sLObject LObject
Definition: kutil.h:60
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1116
#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 1123 of file kInline.h.

1124 {
1125  LObject L(p, currRing, strat->tailRing);
1126  return redtailBba_Z(&L, pos, strat);
1127 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1123
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:341

§ redtailBba_Z() [2/2]

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

Definition at line 7692 of file kutil.cc.

7694 {
7695  strat->redTailChange=FALSE;
7696  if (strat->noTailReduction) return L->GetLmCurrRing();
7697  poly h, p;
7698  p = h = L->GetLmTailRing();
7699  if ((h==NULL) || (pNext(h)==NULL))
7700  return L->GetLmCurrRing();
7701 
7702  TObject* With;
7703  // placeholder in case strat->tl < 0
7704  TObject With_s(strat->tailRing);
7705 
7706  LObject Ln(pNext(h), strat->tailRing);
7707  Ln.pLength = L->GetpLength() - 1;
7708 
7709  pNext(h) = NULL;
7710  if (L->p != NULL) pNext(L->p) = NULL;
7711  L->pLength = 1;
7712 
7713  Ln.PrepareRed(strat->use_buckets);
7714 
7715  int cnt=REDTAIL_CANONICALIZE;
7716  while(!Ln.IsNull())
7717  {
7718  loop
7719  {
7720  Ln.SetShortExpVector();
7721  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7722  if (With == NULL) break;
7723  cnt--;
7724  if (cnt==0)
7725  {
7727  /*poly tmp=*/Ln.CanonicalizeP();
7728  }
7729  // we are in Z, do not call pNorm
7730  strat->redTailChange=TRUE;
7731  // test divisibility of coefs:
7732  poly p_Ln=Ln.GetLmCurrRing();
7733  poly p_With=With->GetLmCurrRing();
7734  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7735  if (!nIsZero(z))
7736  {
7737  // subtract z*Ln, add z.Ln to L
7738  poly m=pHead(p_Ln);
7739  pSetCoeff(m,z);
7740  poly mm=pHead(m);
7741  pNext(h) = m;
7742  pIter(h);
7743  L->pLength++;
7744  mm=pNeg(mm);
7745  if (Ln.bucket!=NULL)
7746  {
7747  int dummy=1;
7748  kBucket_Add_q(Ln.bucket,mm,&dummy);
7749  }
7750  else
7751  {
7752  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7753  Ln.GetP();
7754  if (Ln.p!=NULL)
7755  {
7756  Ln.p=pAdd(Ln.p,mm);
7757  if (Ln.t_p!=NULL)
7758  {
7759  pNext(Ln.t_p)=NULL;
7760  p_LmDelete(Ln.t_p,strat->tailRing);
7761  }
7762  }
7763  }
7764  }
7765  else
7766  nDelete(&z);
7767 
7768  if (ksReducePolyTail(L, With, &Ln))
7769  {
7770  // reducing the tail would violate the exp bound
7771  // set a flag and hope for a retry (in bba)
7772  strat->completeReduce_retry=TRUE;
7773  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7774  do
7775  {
7776  pNext(h) = Ln.LmExtractAndIter();
7777  pIter(h);
7778  L->pLength++;
7779  } while (!Ln.IsNull());
7780  goto all_done;
7781  }
7782  if (Ln.IsNull()) goto all_done;
7783  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  }
7799 
7800  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7801  //L->Normalize(); // HANNES: should have a test
7802  kTest_L(L);
7803  return L->GetLmCurrRing();
7804 }
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:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define pNeg(p)
Definition: polys.h:181
#define TRUE
Definition: auxiliary.h:101
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:402
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:657
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc: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:341
#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:382
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:398
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

§ redtailBbaShift()

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

Definition at line 12639 of file kutil.cc.

12640 {
12641  /* for the shift case need to run it with withT = TRUE */
12642  strat->redTailChange=FALSE;
12643  if (strat->noTailReduction) return L->GetLmCurrRing();
12644  poly h, p;
12645  p = h = L->GetLmTailRing();
12646  if ((h==NULL) || (pNext(h)==NULL))
12647  return L->GetLmCurrRing();
12648 
12649  TObject* With;
12650  // placeholder in case strat->tl < 0
12651  TObject With_s(strat->tailRing);
12652 
12653  LObject Ln(pNext(h), strat->tailRing);
12654  Ln.pLength = L->GetpLength() - 1;
12655 
12656  pNext(h) = NULL;
12657  if (L->p != NULL) pNext(L->p) = NULL;
12658  L->pLength = 1;
12659 
12660  Ln.PrepareRed(strat->use_buckets);
12661 
12662  while(!Ln.IsNull())
12663  {
12664  loop
12665  {
12666  Ln.SetShortExpVector();
12667  if (withT)
12668  {
12669  int j;
12670  j = kFindDivisibleByInT(strat, &Ln);
12671  if (j < 0) break;
12672  With = &(strat->T[j]);
12673  }
12674  else
12675  {
12676  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12677  if (With == NULL) break;
12678  }
12679  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12680  {
12681  With->pNorm();
12682  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12683  }
12684  strat->redTailChange=TRUE;
12685  if (ksReducePolyTail(L, With, &Ln))
12686  {
12687  // reducing the tail would violate the exp bound
12688  // set a flag and hope for a retry (in bba)
12689  strat->completeReduce_retry=TRUE;
12690  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12691  do
12692  {
12693  pNext(h) = Ln.LmExtractAndIter();
12694  pIter(h);
12695  L->pLength++;
12696  } while (!Ln.IsNull());
12697  goto all_done;
12698  }
12699  if (Ln.IsNull()) goto all_done;
12700  if (! withT) With_s.Init(currRing);
12701  }
12702  pNext(h) = Ln.LmExtractAndIter();
12703  pIter(h);
12704  L->pLength++;
12705  }
12706 
12707  all_done:
12708  Ln.Delete();
12709  if (L->p != NULL) pNext(L->p) = pNext(p);
12710 
12711  if (strat->redTailChange)
12712  {
12713  L->length = 0;
12714  }
12715  L->Normalize(); // HANNES: should have a test
12716  kTest_L(L);
12717  return L->GetLmCurrRing();
12718 }
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:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define TRUE
Definition: auxiliary.h:101
#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:402
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define kTest_L(T)
Definition: kutil.h:657
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
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:398
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:358
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
#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
static int pLength(poly a)
Definition: p_polys.h:189
char completeReduce_retry
Definition: kutil.h:402
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
Definition: kstd2.cc:197
#define kTest_L(T)
Definition: kutil.h:657
#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:341
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
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:398
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:340
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#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:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10

§ sba()

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

Definition at line 2166 of file kstd2.cc.

2167 {
2168  // ring order stuff:
2169  // in sba we have (until now) two possibilities:
2170  // 1. an incremental computation w.r.t. (C,monomial order)
2171  // 2. a (possibly non-incremental) computation w.r.t. the
2172  // induced Schreyer order.
2173  // The corresponding orders are computed in sbaRing(), depending
2174  // on the flag strat->sbaOrder
2175 #if SBA_PRINT_ZERO_REDUCTIONS
2176  long zeroreductions = 0;
2177 #endif
2178 #if SBA_PRINT_PRODUCT_CRITERION
2179  long product_criterion = 0;
2180 #endif
2181 #if SBA_PRINT_SIZE_G
2182  int size_g = 0;
2183  int size_g_non_red = 0;
2184 #endif
2185 #if SBA_PRINT_SIZE_SYZ
2186  long size_syz = 0;
2187 #endif
2188  // global variable
2189 #if SBA_PRINT_REDUCTION_STEPS
2190  sba_reduction_steps = 0;
2191  sba_interreduction_steps = 0;
2192 #endif
2193 #if SBA_PRINT_OPERATIONS
2194  sba_operations = 0;
2195  sba_interreduction_operations = 0;
2196 #endif
2197 
2198  ideal F1 = F0;
2199  ring sRing, currRingOld;
2200  currRingOld = currRing;
2201  if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
2202  {
2203  sRing = sbaRing(strat);
2204  if (sRing!=currRingOld)
2205  {
2206  rChangeCurrRing (sRing);
2207  F1 = idrMoveR (F0, currRingOld, currRing);
2208  }
2209  }
2210  ideal F;
2211  // sort ideal F
2212  //Put the SigDrop element on the correct position (think of sbaEnterS)
2213  //We also sort them
2214  if(rField_is_Ring(currRing) && strat->sigdrop)
2215  {
2216  #if 1
2217  F = idInit(IDELEMS(F1),F1->rank);
2218  for (int i=0; i<IDELEMS(F1);++i)
2219  F->m[i] = F1->m[i];
2220  if(strat->sbaEnterS >= 0)
2221  {
2222  poly dummy;
2223  dummy = pCopy(F->m[0]); //the sigdrop element
2224  for(int i = 0;i<strat->sbaEnterS;i++)
2225  F->m[i] = F->m[i+1];
2226  F->m[strat->sbaEnterS] = dummy;
2227  }
2228  #else
2229  F = idInit(1,F1->rank);
2230  //printf("\nBefore the initial block sorting:\n");idPrint(F1);
2231  F->m[0] = F1->m[0];
2232  int pos;
2233  if(strat->sbaEnterS >= 0)
2234  {
2235  for(int i=1;i<=strat->sbaEnterS;i++)
2236  {
2237  pos = posInIdealMonFirst(F,F1->m[i],1,strat->sbaEnterS);
2238  idInsertPolyOnPos(F,F1->m[i],pos);
2239  }
2240  for(int i=strat->sbaEnterS+1;i<IDELEMS(F1);i++)
2241  {
2242  pos = posInIdealMonFirst(F,F1->m[i],strat->sbaEnterS+1,IDELEMS(F));
2243  idInsertPolyOnPos(F,F1->m[i],pos);
2244  }
2245  poly dummy;
2246  dummy = pCopy(F->m[0]); //the sigdrop element
2247  for(int i = 0;i<strat->sbaEnterS;i++)
2248  F->m[i] = F->m[i+1];
2249  F->m[strat->sbaEnterS] = dummy;
2250  }
2251  else
2252  {
2253  for(int i=1;i<IDELEMS(F1);i++)
2254  {
2255  pos = posInIdealMonFirst(F,F1->m[i],1,IDELEMS(F));
2256  idInsertPolyOnPos(F,F1->m[i],pos);
2257  }
2258  }
2259  #endif
2260  //printf("\nAfter the initial block sorting:\n");idPrint(F);getchar();
2261  }
2262  else
2263  {
2264  F = idInit(IDELEMS(F1),F1->rank);
2265  intvec *sort = idSort(F1);
2266  for (int i=0; i<sort->length();++i)
2267  F->m[i] = F1->m[(*sort)[i]-1];
2269  {
2270  // put the monomials after the sbaEnterS polynomials
2271  //printf("\nThis is the ideal before sorting (sbaEnterS = %i)\n",strat->sbaEnterS);idPrint(F);
2272  int nrmon = 0;
2273  for(int i = IDELEMS(F)-1,j;i>strat->sbaEnterS+nrmon+1 ;i--)
2274  {
2275  //pWrite(F->m[i]);
2276  if(F->m[i] != NULL && pNext(F->m[i]) == NULL)
2277  {
2278  poly mon = F->m[i];
2279  for(j = i;j>strat->sbaEnterS+nrmon+1;j--)
2280  {
2281  F->m[j] = F->m[j-1];
2282  }
2283  F->m[j] = mon;
2284  nrmon++;
2285  }
2286  //idPrint(F);
2287  }
2288  }
2289  }
2290  //printf("\nThis is the ideal after sorting\n");idPrint(F);getchar();
2292  strat->sigdrop = FALSE;
2293  strat->nrsyzcrit = 0;
2294  strat->nrrewcrit = 0;
2296  F = kInterRed(F,NULL);
2297 #endif
2298 #if F5DEBUG
2299  printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2300  rWrite (currRing);
2301  printf("ordSgn = %d\n",currRing->OrdSgn);
2302  printf("\n");
2303 #endif
2304  int srmax,lrmax, red_result = 1;
2305  int olddeg,reduc;
2306  int hilbeledeg=1,hilbcount=0,minimcnt=0;
2307  LObject L;
2308  BOOLEAN withT = TRUE;
2309  strat->max_lower_index = 0;
2310  //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
2311  initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
2312  initSbaPos(strat);
2313  initHilbCrit(F,Q,&hilb,strat);
2314  initSba(F,strat);
2315  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2316  /*Shdl=*/initSbaBuchMora(F, Q,strat);
2317  idTest(strat->Shdl);
2318  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2319  srmax = strat->sl;
2320  reduc = olddeg = lrmax = 0;
2321 #ifndef NO_BUCKETS
2322  if (!TEST_OPT_NOT_BUCKETS)
2323  strat->use_buckets = 1;
2324 #endif
2325 
2326  // redtailBBa against T for inhomogenous input
2327  // if (!TEST_OPT_OLDSTD)
2328  // withT = ! strat->homog;
2329 
2330  // strat->posInT = posInT_pLength;
2331  kTest_TS(strat);
2332 
2333 #ifdef HAVE_TAIL_RING
2334  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2335  kStratInitChangeTailRing(strat);
2336 #endif
2337  if (BVERBOSE(23))
2338  {
2339  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
2340  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
2341  kDebugPrint(strat);
2342  }
2343  // We add the elements directly in S from the previous loop
2344  if(rField_is_Ring(currRing) && strat->sbaEnterS >= 0)
2345  {
2346  for(int i = 0;i<strat->sbaEnterS;i++)
2347  {
2348  //Update: now the element is at the corect place
2349  //i+1 because on the 0 position is the sigdrop element
2350  enterT(strat->L[strat->Ll-(i)],strat);
2351  strat->enterS(strat->L[strat->Ll-(i)], strat->sl+1, strat, strat->tl);
2352  }
2353  strat->Ll = strat->Ll - strat->sbaEnterS;
2354  strat->sbaEnterS = -1;
2355  }
2356  kTest_TS(strat);
2357 #ifdef KDEBUG
2358  //kDebugPrint(strat);
2359 #endif
2360  /* compute------------------------------------------------------- */
2361  while (strat->Ll >= 0)
2362  {
2363  #ifdef ADIDEBUG
2364  printf("\n ------------------------NEW LOOP\n");
2365  printf("\nShdl = \n");
2366  #if 0
2367  idPrint(strat->Shdl);
2368  #else
2369  for(int ii = 0; ii<=strat->sl;ii++)
2370  {
2371  printf("\nS[%i]: ",ii);p_Write(strat->S[ii],strat->tailRing);
2372  printf("sig: ");pWrite(strat->sig[ii]);
2373  }
2374  #endif
2375  #if 0
2376  for(int iii = 0; iii< strat->syzl; iii++)
2377  {
2378  printf("\nsyz[%i]:\n",iii);
2379  p_Write(strat->syz[iii], currRing);
2380  }
2381  #endif
2382  #if 0
2383  for(int iii = 0; iii<= strat->tl; iii++)
2384  {
2385  printf("\nT[%i]:\n",iii);
2386  p_Write(strat->T[iii].p, currRing);
2387  }
2388  #endif
2389  printf("\n list L\n");
2390  int iii;
2391  #if 0
2392  for(iii = 0; iii<= strat->Ll; iii++)
2393  {
2394  printf("\nL[%i]:\n",iii);
2395  p_Write(strat->L[iii].p, currRing);
2396  p_Write(strat->L[iii].p1, currRing);
2397  p_Write(strat->L[iii].p2, currRing);
2398  p_Write(strat->L[iii].sig, currRing);
2399  }
2400  #else
2401  {
2402  printf("L[%i]:",strat->Ll);
2403  p_Write(strat->L[strat->Ll].p, strat->tailRing);
2404  p_Write(strat->L[strat->Ll].p1, strat->tailRing);
2405  p_Write(strat->L[strat->Ll].p2, strat->tailRing);
2406  p_Write(strat->L[strat->Ll].sig, currRing);
2407  }
2408  #endif
2409  //getchar();
2410  #endif
2411  if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
2412  #ifdef KDEBUG
2413  if (TEST_OPT_DEBUG) messageSets(strat);
2414  #endif
2415  if (strat->Ll== 0) strat->interpt=TRUE;
2416  /*
2417  if (TEST_OPT_DEGBOUND
2418  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2419  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2420  {
2421 
2422  //stops computation if
2423  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2424  //a predefined number Kstd1_deg
2425  while ((strat->Ll >= 0)
2426  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2427  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2428  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2429  )
2430  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2431  if (strat->Ll<0) break;
2432  else strat->noClearS=TRUE;
2433  }
2434  */
2435  if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
2436  {
2437  strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
2438 #if F5C
2439  // 1. interreduction of the current standard basis
2440  // 2. generation of new principal syzygy rules for syzCriterion
2441  f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2442  lrmax, reduc, Q, w, hilb );
2443 #endif
2444  // initialize new syzygy rules for the next iteration step
2445  initSyzRules(strat);
2446  }
2447  /*********************************************************************
2448  * interrreduction step is done, we can go on with the next iteration
2449  * step of the signature-based algorithm
2450  ********************************************************************/
2451  /* picks the last element from the lazyset L */
2452  strat->P = strat->L[strat->Ll];
2453  strat->Ll--;
2454 
2456  strat->sbaEnterS = pGetComp(strat->P.sig) - 1;
2457 
2458  #ifdef ADIDEBUG
2459  printf("\n-------------------------\nThis is the current element P\n");
2460  p_Write(strat->P.p,strat->tailRing);
2461  p_Write(strat->P.p1,strat->tailRing);
2462  p_Write(strat->P.p2,strat->tailRing);
2463  p_Write(strat->P.sig,currRing);
2464  #endif
2465  /* reduction of the element chosen from L */
2466  if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) {
2467  //#if 1
2468 #ifdef DEBUGF5
2469  PrintS("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2470  PrintS("-------------------------------------------------\n");
2471  pWrite(strat->P.sig);
2472  pWrite(pHead(strat->P.p));
2473  pWrite(pHead(strat->P.p1));
2474  pWrite(pHead(strat->P.p2));
2475  PrintS("-------------------------------------------------\n");
2476 #endif
2477  if (pNext(strat->P.p) == strat->tail)
2478  {
2479  // deletes the short spoly
2480  /*
2481  if (rField_is_Ring(currRing))
2482  pLmDelete(strat->P.p);
2483  else
2484  pLmFree(strat->P.p);
2485 */
2486  // TODO: needs some masking
2487  // TODO: masking needs to vanish once the signature
2488  // sutff is completely implemented
2489  strat->P.p = NULL;
2490  poly m1 = NULL, m2 = NULL;
2491 
2492  // check that spoly creation is ok
2493  while (strat->tailRing != currRing &&
2494  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2495  {
2496  assume(m1 == NULL && m2 == NULL);
2497  // if not, change to a ring where exponents are at least
2498  // large enough
2499  if (!kStratChangeTailRing(strat))
2500  {
2501  WerrorS("OVERFLOW...");
2502  break;
2503  }
2504  }
2505  // create the real one
2506  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2507  strat->tailRing, m1, m2, strat->R);
2508 
2509  }
2510  else if (strat->P.p1 == NULL)
2511  {
2512  if (strat->minim > 0)
2513  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2514  // for input polys, prepare reduction
2515  if(!rField_is_Ring(currRing))
2516  strat->P.PrepareRed(strat->use_buckets);
2517  }
2518  if (strat->P.p == NULL && strat->P.t_p == NULL)
2519  {
2520  red_result = 0;
2521  }
2522  else
2523  {
2524  //#if 1
2525 #ifdef DEBUGF5
2526  PrintS("Poly before red: ");
2527  pWrite(pHead(strat->P.p));
2528  pWrite(strat->P.sig);
2529 #endif
2530 #if SBA_PRODUCT_CRITERION
2531  if (strat->P.prod_crit) {
2532 #if SBA_PRINT_PRODUCT_CRITERION
2533  product_criterion++;
2534 #endif
2535  int pos = posInSyz(strat, strat->P.sig);
2536  enterSyz(strat->P, strat, pos);
2537  if (strat->P.lcm!=NULL)
2538  pLmFree(strat->P.lcm);
2539  red_result = 2;
2540  } else {
2541  red_result = strat->red(&strat->P,strat);
2542  }
2543 #else
2544  red_result = strat->red(&strat->P,strat);
2545 #endif
2546  }
2547  } else {
2548  /*
2549  if (strat->P.lcm != NULL)
2550  pLmFree(strat->P.lcm);
2551  */
2552  red_result = 2;
2553  }
2555  {
2556  if(strat->P.sig!= NULL && !nGreaterZero(pGetCoeff(strat->P.sig)))
2557  {
2558  strat->P.p = pNeg(strat->P.p);
2559  strat->P.sig = pNeg(strat->P.sig);
2560  }
2561  strat->P.pLength = pLength(strat->P.p);
2562  if(strat->P.sig != NULL)
2563  strat->P.sevSig = pGetShortExpVector(strat->P.sig);
2564  if(strat->P.p != NULL)
2565  strat->P.sev = pGetShortExpVector(strat->P.p);
2566  }
2567  #ifdef ADIDEBUG
2568  printf("\nAfter reduce (redresult=%i): \n",red_result);pWrite(strat->P.p);pWrite(strat->P.sig);
2569  #endif
2570  //sigdrop case
2571  if(rField_is_Ring(currRing) && strat->sigdrop)
2572  {
2573  //First reduce it as much as one can
2574  #ifdef ADIDEBUG
2575  printf("\nSigdrop in the reduce. Trying redring\n");
2576  #endif
2577  red_result = redRing(&strat->P,strat);
2578  if(red_result == 0)
2579  {
2580  #ifdef ADIDEBUG
2581  printf("\nSigdrop cancelled since redRing reduced to 0\n");
2582  #endif
2583  strat->sigdrop = FALSE;
2584  pDelete(&strat->P.sig);
2585  strat->P.sig = NULL;
2586  }
2587  else
2588  {
2589  #ifdef ADIDEBUG
2590  printf("\nStill Sigdrop - redRing reduced to:\n");pWrite(strat->P.p);
2591  #endif
2592  strat->enterS(strat->P, 0, strat, strat->tl);
2593  if (TEST_OPT_PROT)
2594  PrintS("-");
2595  break;
2596  }
2597  }
2598  if(rField_is_Ring(currRing) && strat->blockred > strat->blockredmax)
2599  {
2600  #ifdef ADIDEBUG
2601  printf("\nToo many blocked reductions\n");
2602  #endif
2603  strat->sigdrop = TRUE;
2604  break;
2605  }
2606 
2607  if (errorreported) break;
2608 
2609 //#if 1
2610 #ifdef DEBUGF5
2611  if (red_result != 0) {
2612  PrintS("Poly after red: ");
2613  pWrite(pHead(strat->P.p));
2614  pWrite(strat->P.GetLmCurrRing());
2615  pWrite(strat->P.sig);
2616  printf("%d\n",red_result);
2617  }
2618 #endif
2619  if (TEST_OPT_PROT)
2620  {
2621  if(strat->P.p != NULL)
2622  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2623  &olddeg,&reduc,strat, red_result);
2624  else
2625  message((strat->honey ? strat->P.ecart : 0),
2626  &olddeg,&reduc,strat, red_result);
2627  }
2628 
2629  if (strat->overflow)
2630  {
2631  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2632  }
2633  // reduction to non-zero new poly
2634  if (red_result == 1)
2635  {
2636  // get the polynomial (canonicalize bucket, make sure P.p is set)
2637  strat->P.GetP(strat->lmBin);
2638 
2639  // sig-safe computations may lead to wrong FDeg computation, thus we need
2640  // to recompute it to make sure everything is alright
2641  (strat->P).FDeg = (strat->P).pFDeg();
2642  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2643  // but now, for entering S, T, we reset it
2644  // in the inhomogeneous case: FDeg == pFDeg
2645  if (strat->homog) strat->initEcart(&(strat->P));
2646 
2647  /* statistic */
2648  if (TEST_OPT_PROT) PrintS("s");
2649 
2650  //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2651  // in F5E we know that the last reduced element is already the
2652  // the one with highest signature
2653  int pos = strat->sl+1;
2654 
2655  // reduce the tail and normalize poly
2656  // in the ring case we cannot expect LC(f) = 1,
2657  // therefore we call pContent instead of pNorm
2658  #ifdef HAVE_RINGS
2659  poly beforetailred;
2661  beforetailred = pCopy(strat->P.sig);
2662  #endif
2663 #if SBA_TAIL_RED
2665  {
2667  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2668  }
2669  else
2670  {
2671  if (strat->sbaOrder != 2) {
2673  {
2674  strat->P.pCleardenom();
2676  {
2677  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2678  strat->P.pCleardenom();
2679  }
2680  }
2681  else
2682  {
2683  strat->P.pNorm();
2685  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2686  }
2687  }
2688  }
2689  // It may happen that we have lost the sig in redtailsba
2690  // It cannot reduce to 0 since here we are doing just tail reduction.
2691  // Best case scenerio: remains the leading term
2692  if(rField_is_Ring(currRing) && strat->sigdrop)
2693  {
2694  #ifdef ADIDEBUG
2695  printf("\n Still sigdrop after redtailSba - it reduced to \n");pWrite(strat->P.p);
2696  #endif
2697  strat->enterS(strat->P, 0, strat, strat->tl);
2698  break;
2699  }
2700 #endif
2702  {
2703  if(strat->P.sig == NULL || pLtCmp(beforetailred,strat->P.sig) == 1)
2704  {
2705  #ifdef ADIDEBUG
2706  printf("\nSigDrop after TAILred\n");pWrite(beforetailred);pWrite(strat->P.sig);
2707  #endif
2708  strat->sigdrop = TRUE;
2709  //Reduce it as much as you can
2710  red_result = redRing(&strat->P,strat);
2711  if(red_result == 0)
2712  {
2713  //It reduced to 0, cancel the sigdrop
2714  #ifdef ADIDEBUG
2715  printf("\nReduced to 0 via redRing. Cancel sigdrop\n");
2716  #endif
2717  strat->sigdrop = FALSE;
2718  p_Delete(&strat->P.sig,currRing);strat->P.sig = NULL;
2719  }
2720  else
2721  {
2722  #ifdef ADIDEBUG
2723  printf("\nReduced to this via redRing.SIGDROP\n");pWrite(strat->P.p);
2724  #endif
2725  strat->enterS(strat->P, 0, strat, strat->tl);
2726  break;
2727  }
2728  }
2729  p_Delete(&beforetailred,currRing);
2730  // strat->P.p = NULL may appear if we had a sigdrop above and reduced to 0 via redRing
2731  if(strat->P.p == NULL)
2732  goto case_when_red_result_changed;
2733  }
2734  #ifdef ADIDEBUG
2735  printf("\nNach redTailSba: \n");
2736  p_Write(strat->P.p,strat->tailRing);p_Write(strat->P.sig,currRing);
2737  #endif
2738  // remove sigsafe label since it is no longer valid for the next element to
2739  // be reduced
2740  if (strat->sbaOrder == 1)
2741  {
2742  for (int jj = 0; jj<strat->tl+1; jj++)
2743  {
2744  if (pGetComp(strat->T[jj].sig) == strat->currIdx)
2745  {
2746  strat->T[jj].is_sigsafe = FALSE;
2747  }
2748  }
2749  }
2750  else
2751  {
2752  for (int jj = 0; jj<strat->tl+1; jj++)
2753  {
2754  strat->T[jj].is_sigsafe = FALSE;
2755  }
2756  }
2757 #ifdef KDEBUG
2758  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2759 #endif /* KDEBUG */
2760 
2761  // min_std stuff
2762  if ((strat->P.p1==NULL) && (strat->minim>0))
2763  {
2764  if (strat->minim==1)
2765  {
2766  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2767  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2768  }
2769  else
2770  {
2771  strat->M->m[minimcnt]=strat->P.p2;
2772  strat->P.p2=NULL;
2773  }
2774  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2775  pNext(strat->M->m[minimcnt])
2776  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2777  strat->tailRing, currRing,
2778  currRing->PolyBin);
2779  minimcnt++;
2780  }
2781 
2782  // enter into S, L, and T
2783  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2784  enterT(strat->P, strat);
2785  strat->T[strat->tl].is_sigsafe = FALSE;
2786  /*
2787  printf("hier\n");
2788  pWrite(strat->P.GetLmCurrRing());
2789  pWrite(strat->P.sig);
2790  */
2791  if (rField_is_Ring(currRing))
2792  superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2793  else
2794  enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2795  #ifdef ADIDEBUG
2796  printf("\nThis element is added to S\n");
2797  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);
2798  //getchar();
2799  #endif
2800  if(rField_is_Ring(currRing) && strat->sigdrop)
2801  break;
2803  strat->P.sevSig = p_GetShortExpVector(strat->P.sig,currRing);
2804  strat->enterS(strat->P, pos, strat, strat->tl);
2805  if(strat->sbaOrder != 1)
2806  {
2807  BOOLEAN overwrite = FALSE;
2808  for (int tk=0; tk<strat->sl+1; tk++)
2809  {
2810  if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
2811  {
2812  //printf("TK %d / %d\n",tk,strat->sl);
2813  overwrite = FALSE;
2814  break;
2815  }
2816  }
2817  //printf("OVERWRITE %d\n",overwrite);
2818  if (overwrite)
2819  {
2820  int cmp = pGetComp(strat->P.sig);
2821  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2822  pGetExpV (strat->P.p,vv);
2823  pSetExpV (strat->P.sig, vv);
2824  pSetComp (strat->P.sig,cmp);
2825 
2826  strat->P.sevSig = pGetShortExpVector (strat->P.sig);
2827  int i;
2828  LObject Q;
2829  for(int ps=0;ps<strat->sl+1;ps++)
2830  {
2831 
2832  strat->newt = TRUE;
2833  if (strat->syzl == strat->syzmax)
2834  {
2835  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
2836  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
2837  (strat->syzmax)*sizeof(unsigned long),
2838  ((strat->syzmax)+setmaxTinc)
2839  *sizeof(unsigned long));
2840  strat->syzmax += setmaxTinc;
2841  }
2842  Q.sig = pCopy(strat->P.sig);
2843  // add LM(F->m[i]) to the signature to get a Schreyer order
2844  // without changing the underlying polynomial ring at all
2845  if (strat->sbaOrder == 0)
2846  p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
2847  // since p_Add_q() destroys all input
2848  // data we need to recreate help
2849  // each time
2850  // ----------------------------------------------------------
2851  // in the Schreyer order we always know that the multiplied
2852  // module monomial strat->P.sig gives the leading monomial of
2853  // the corresponding principal syzygy
2854  // => we do not need to compute the "real" syzygy completely
2855  poly help = p_Copy(strat->sig[ps],currRing);
2856  p_ExpVectorAdd (help,strat->P.p,currRing);
2857  Q.sig = p_Add_q(Q.sig,help,currRing);
2858  //printf("%d. SYZ ",i+1);
2859  //pWrite(strat->syz[i]);
2860  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
2861  i = posInSyz(strat, Q.sig);
2862  enterSyz(Q, strat, i);
2863  }
2864  }
2865  }
2866  // deg - idx - lp/rp
2867  // => we need to add syzygies with indices > pGetComp(strat->P.sig)
2868  if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
2869  {
2870  int cmp = pGetComp(strat->P.sig);
2871  int max_cmp = IDELEMS(F);
2872  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2873  pGetExpV (strat->P.p,vv);
2874  LObject Q;
2875  int pos;
2876  int idx = p_GetComp(strat->P.sig,currRing);
2877  //printf("++ -- adding syzygies -- ++\n");
2878  // if new element is the first one in this index
2879  if (strat->currIdx < idx) {
2880  for (int i=0; i<strat->sl; ++i) {
2881  Q.sig = p_Copy(strat->P.sig,currRing);
2882  p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
2883  poly help = p_Copy(strat->sig[i],currRing);
2884  p_ExpVectorAdd(help,strat->P.p,currRing);
2885  Q.sig = p_Add_q(Q.sig,help,currRing);
2886  //pWrite(Q.sig);
2887  pos = posInSyz(strat, Q.sig);
2888  enterSyz(Q, strat, pos);
2889  }
2890  strat->currIdx = idx;
2891  } else {
2892  // if the element is not the first one in the given index we build all
2893  // possible syzygies with elements of higher index
2894  for (int i=cmp+1; i<=max_cmp; ++i) {
2895  pos = -1;
2896  for (int j=0; j<strat->sl; ++j) {
2897  if (p_GetComp(strat->sig[j],currRing) == i) {
2898  pos = j;
2899  break;
2900  }
2901  }
2902  if (pos != -1) {
2903  Q.sig = p_One(currRing);
2904  p_SetExpV(Q.sig, vv, currRing);
2905  // F->m[i-1] corresponds to index i
2906  p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
2907  p_SetComp(Q.sig, i, currRing);
2908  poly help = p_Copy(strat->P.sig,currRing);
2909  p_ExpVectorAdd(help,strat->S[pos],currRing);
2910  Q.sig = p_Add_q(Q.sig,help,currRing);
2911  if (strat->sbaOrder == 0) {
2912  if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn) {
2913  pos = posInSyz(strat, Q.sig);
2914  enterSyz(Q, strat, pos);
2915  }
2916  } else {
2917  pos = posInSyz(strat, Q.sig);
2918  enterSyz(Q, strat, pos);
2919  }
2920  }
2921  }
2922  //printf("++ -- done adding syzygies -- ++\n");
2923  }
2924  }
2925 //#if 1
2926 #if DEBUGF50
2927  printf("---------------------------\n");
2928  Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
2929  PrintS("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
2930  PrintS("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
2931 #endif
2932  /*
2933  if (newrules)
2934  {
2935  newrules = FALSE;
2936  }
2937  */
2938 #if 0
2939  int pl=pLength(strat->P.p);
2940  if (pl==1)
2941  {
2942  //if (TEST_OPT_PROT)
2943  //PrintS("<1>");
2944  }
2945  else if (pl==2)
2946  {
2947  //if (TEST_OPT_PROT)
2948  //PrintS("<2>");
2949  }
2950 #endif
2951  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2952 // Print("[%d]",hilbeledeg);
2953  if (strat->P.lcm!=NULL)
2954 #ifdef HAVE_RINGS
2955  pLmDelete(strat->P.lcm);
2956 #else
2957  pLmFree(strat->P.lcm);
2958 #endif
2959  if (strat->sl>srmax) srmax = strat->sl;
2960  }
2961  else
2962  {
2963  case_when_red_result_changed:
2964  // adds signature of the zero reduction to
2965  // strat->syz. This is the leading term of
2966  // syzygy and can be used in syzCriterion()
2967  // the signature is added if and only if the
2968  // pair was not detected by the rewritten criterion in strat->red = redSig
2969  if (red_result!=2) {
2970 #if SBA_PRINT_ZERO_REDUCTIONS
2971  zeroreductions++;
2972 #endif
2973  if(rField_is_Ring(currRing) && strat->P.p == NULL && strat->P.sig == NULL)
2974  {
2975  //Catch the case when p = 0, sig = 0
2976  }
2977  else
2978  {
2979  int pos = posInSyz(strat, strat->P.sig);
2980  enterSyz(strat->P, strat, pos);
2981  //#if 1
2982  #ifdef DEBUGF5
2983  Print("ADDING STUFF TO SYZ : ");
2984  //pWrite(strat->P.p);
2985  pWrite(strat->P.sig);
2986  #endif
2987  }
2988  }
2989  if (strat->P.p1 == NULL && strat->minim > 0)
2990  {
2991  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2992  }
2993  }
2994 
2995 #ifdef KDEBUG
2996  memset(&(strat->P), 0, sizeof(strat->P));
2997 #endif /* KDEBUG */
2998  kTest_TS(strat);
2999  }
3000  #if 0
3001  if(strat->sigdrop)
3002  printf("\nSigDrop!\n");
3003  else
3004  printf("\nEnded with no SigDrop\n");
3005  #endif
3006 // Clean strat->P for the next sba call
3007  if(rField_is_Ring(currRing) && strat->sigdrop)
3008  {
3009  //This is used to know how many elements can we directly add to S in the next run
3010  if(strat->P.sig != NULL)
3011  strat->sbaEnterS = pGetComp(strat->P.sig)-1;
3012  //else we already set it at the beggining of the loop
3013  #ifdef KDEBUG
3014  memset(&(strat->P), 0, sizeof(strat->P));
3015  #endif /* KDEBUG */
3016  }
3017 #ifdef KDEBUG
3018  if (TEST_OPT_DEBUG) messageSets(strat);
3019 #endif /* KDEBUG */
3020 
3021  if (TEST_OPT_SB_1)
3022  {
3023  if(!rField_is_Ring(currRing))
3024  {
3025  int k=1;
3026  int j;
3027  while(k<=strat->sl)
3028  {
3029  j=0;
3030  loop
3031  {
3032  if (j>=k) break;
3033  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3034  j++;
3035  }
3036  k++;
3037  }
3038  }
3039  }
3040  /* complete reduction of the standard basis--------- */
3041  if (TEST_OPT_REDSB)
3042  {
3043  completeReduce(strat);
3044 #ifdef HAVE_TAIL_RING
3045  if (strat->completeReduce_retry)
3046  {
3047  // completeReduce needed larger exponents, retry
3048  // to reduce with S (instead of T)
3049  // and in currRing (instead of strat->tailRing)
3050  cleanT(strat);strat->tailRing=currRing;
3051  int i;
3052  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3053  completeReduce(strat);
3054  }
3055 #endif
3056  }
3057  else if (TEST_OPT_PROT) PrintLn();
3058 
3059 #if SBA_PRINT_SIZE_SYZ
3060  // that is correct, syzl is counting one too far
3061  size_syz = strat->syzl;
3062 #endif
3063 // if (TEST_OPT_WEIGHTM)
3064 // {
3065 // pRestoreDegProcs(pFDegOld, pLDegOld);
3066 // if (ecartWeights)
3067 // {
3068 // omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
3069 // ecartWeights=NULL;
3070 // }
3071 // }
3072  if (TEST_OPT_PROT) messageStatSBA(hilbcount,strat);
3073  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3074 #if SBA_PRINT_SIZE_G
3075  size_g_non_red = IDELEMS(strat->Shdl);
3076 #endif
3077  if(!rField_is_Ring(currRing))
3078  exitSba(strat);
3079  // I have to add the initial input polynomials which where not used (p1 and p2 = NULL)
3080  #ifdef HAVE_RINGS
3081  int k;
3083  {
3084  //for(k = strat->sl;k>=0;k--)
3085  // {printf("\nS[%i] = %p\n",k,strat->Shdl->m[k]);pWrite(strat->Shdl->m[k]);}
3086  k = strat->Ll;
3087  #if 1
3088  // 1 - adds just the unused ones, 0 - adds everthing
3089  for(;k>=0 && (strat->L[k].p1 != NULL || strat->L[k].p2 != NULL);k--)
3090  {
3091  //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);
3092  deleteInL(strat->L,&strat->Ll,k,strat);
3093  }
3094  #endif
3095  //for(int kk = strat->sl;kk>=0;kk--)
3096  // {printf("\nS[%i] = %p\n",kk,strat->Shdl->m[kk]);pWrite(strat->Shdl->m[kk]);}
3097  //idPrint(strat->Shdl);
3098  //printf("\nk = %i\n",k);
3099  for(;k>=0 && strat->L[k].p1 == NULL && strat->L[k].p2 == NULL;k--)
3100  {
3101  //printf("\nAdded k = %i\n",k);
3102  strat->enterS(strat->L[k], strat->sl+1, strat, strat->tl);
3103  //printf("\nThis elements was added from L on pos %i\n",strat->sl);pWrite(strat->S[strat->sl]);pWrite(strat->sig[strat->sl]);
3104  }
3105  }
3106  // 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
3107  #if 0
3108  if(strat->sigdrop && rField_is_Ring(currRing))
3109  {
3110  for(k=strat->sl;k>=0;k--)
3111  {
3112  printf("\nsig[%i] = ",i);pWrite(strat->sig[k]);
3113  if(strat->sig[k] == NULL)
3114  strat->sig[k] = pCopy(strat->sig[k-1]);
3115  }
3116  }
3117  #endif
3118  #endif
3119  //Never do this - you will damage S
3120  //idSkipZeroes(strat->Shdl);
3121  //idPrint(strat->Shdl);
3122 
3123  if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
3124  {
3125  rChangeCurrRing (currRingOld);
3126  F0 = idrMoveR (F1, sRing, currRing);
3127  strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
3128  rChangeCurrRing (sRing);
3130  exitSba(strat);
3131  rChangeCurrRing (currRingOld);
3132  if(strat->tailRing == sRing)
3133  strat->tailRing = currRing;
3134  rDelete (sRing);
3135  }
3136  if(rField_is_Ring(currRing) && !strat->sigdrop)
3137  id_DelDiv(strat->Shdl, currRing);
3138  if(!rField_is_Ring(currRing))
3139  id_DelDiv(strat->Shdl, currRing);
3140  idSkipZeroes(strat->Shdl);
3141  idTest(strat->Shdl);
3142 
3143 #if SBA_PRINT_SIZE_G
3144  size_g = IDELEMS(strat->Shdl);
3145 #endif
3146 #ifdef DEBUGF5
3147  printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
3148  int oo = 0;
3149  while (oo<IDELEMS(strat->Shdl))
3150  {
3151  printf(" %d. ",oo+1);
3152  pWrite(pHead(strat->Shdl->m[oo]));
3153  oo++;
3154  }
3155 #endif
3156 #if SBA_PRINT_ZERO_REDUCTIONS
3157  printf("----------------------------------------------------------\n");
3158  printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3159  zeroreductions = 0;
3160 #endif
3161 #if SBA_PRINT_REDUCTION_STEPS
3162  printf("----------------------------------------------------------\n");
3163  printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3164 #endif
3165 #if SBA_PRINT_OPERATIONS
3166  printf("OPERATIONS: %ld\n",sba_operations);
3167 #endif
3168 #if SBA_PRINT_REDUCTION_STEPS
3169  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3170  printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3171 #endif
3172 #if SBA_PRINT_OPERATIONS
3173  printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3174 #endif
3175 #if SBA_PRINT_REDUCTION_STEPS
3176  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3177  printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3178  sba_interreduction_steps = 0;
3179  sba_reduction_steps = 0;
3180 #endif
3181 #if SBA_PRINT_OPERATIONS
3182  printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3183  sba_interreduction_operations = 0;
3184  sba_operations = 0;
3185 #endif
3186 #if SBA_PRINT_SIZE_G
3187  printf("----------------------------------------------------------\n");
3188  printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3189  size_g = 0;
3190  size_g_non_red = 0;
3191 #endif
3192 #if SBA_PRINT_SIZE_SYZ
3193  printf("SIZE OF SYZ: %ld\n",size_syz);
3194  printf("----------------------------------------------------------\n");
3195  size_syz = 0;
3196 #endif
3197 #if SBA_PRINT_PRODUCT_CRITERION
3198  printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3199  product_criterion = 0;
3200 #endif
3201  return (strat->Shdl);
3202 }
polyset sig
Definition: kutil.h:304
#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:280
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:10081
BOOLEAN honey
Definition: kutil.h:376
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:7810
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:358
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Definition: kutil.cc:5291
#define FALSE
Definition: auxiliary.h:97
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:361
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:290
void initSba(ideal F, kStrategy strat)
Definition: kstd1.cc:1479
#define pNeg(p)
Definition: polys.h:181
void initSyzRules(kStrategy strat)
Definition: kutil.cc:8275
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
#define TEST_OPT_REDSB
Definition: options.h:99
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:11272
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:10183
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:171
#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:274
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int currIdx
Definition: kutil.h:313
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
static int pLength(poly a)
Definition: p_polys.h:189
int minim
Definition: kutil.h:356
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:11245
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
BOOLEAN interpt
Definition: kutil.h:370
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:364
#define idPrint(id)
Definition: ideals.h:48
int nrsyzcrit
Definition: kutil.h:359
int nrrewcrit
Definition: kutil.h:360
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:14
#define kTest_TS(A)
Definition: kutil.h:654
poly p_One(const ring r)
Definition: p_polys.cc:1313
int max_lower_index
Definition: kutil.h:314
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9645
#define assume(x)
Definition: mod2.h:403
#define messageSets(s)
Definition: kutil.h:538
#define pSetExpV(p, e)
Definition: polys.h:97
void messageStatSBA(int hilbcount, kStrategy strat)
Definition: kutil.cc:7863
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:637
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3436
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:11146
LObject P
Definition: kutil.h:298
ideal M
Definition: kutil.h:301
unsigned sbaOrder
Definition: kutil.h:312
void exitSba(kStrategy strat)
Definition: kutil.cc:10256
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
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:3356
TObject ** R
Definition: kutil.h:338
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define 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:10697
#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:4589
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
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:3556
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:341
#define TEST_OPT_SB_1
Definition: options.h:113
int blockred
Definition: kutil.h:363
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:9727
#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:10508
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10296
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:1141
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:82
polyset syz
Definition: kutil.h:303
int sl
Definition: kutil.h:346
void sort(CFArray &A, int l=0)
quick sort A
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
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:299
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kstd2.cc:1162
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
int syzl
Definition: kutil.h:347
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11692
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9561
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:49

§ 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:304
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:97
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:101
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:276
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:901
#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:302
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:697
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
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:1003
int sl
Definition: kutil.h:346
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 11272 of file kutil.cc.

11273 {
11274  int n = rBlocks(r); // Including trailing zero!
11275  // if sbaOrder == 1 => use (C,monomial order from r)
11276  if (strat->sbaOrder == 1)
11277  {
11278  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11279  {
11280  return r;
11281  }
11282  ring res = rCopy0(r, TRUE, FALSE);
11283  res->order = (int *)omAlloc0((n+1)*sizeof(int));
11284  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11285  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11286  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11287  res->wvhdl = wvhdl;
11288  for (int i=1; i<n; i++)
11289  {
11290  res->order[i] = r->order[i-1];
11291  res->block0[i] = r->block0[i-1];
11292  res->block1[i] = r->block1[i-1];
11293  res->wvhdl[i] = r->wvhdl[i-1];
11294  }
11295 
11296  // new 1st block
11297  res->order[0] = ringorder_C; // Prefix
11298  // removes useless secondary component order if defined in old ring
11299  for (int i=rBlocks(res); i>0; --i)
11300  {
11301  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11302  {
11303  res->order[i] = 0;
11304  }
11305  }
11306  rComplete(res, 1);
11307 #ifdef HAVE_PLURAL
11308  if (rIsPluralRing(r))
11309  {
11310  if ( nc_rComplete(r, res, false) ) // no qideal!
11311  {
11312 #ifndef SING_NDEBUG
11313  WarnS("error in nc_rComplete");
11314 #endif
11315  // cleanup?
11316 
11317  // rDelete(res);
11318  // return r;
11319 
11320  // just go on..
11321  }
11322  }
11323 #endif
11324  strat->tailRing = res;
11325  return (res);
11326  }
11327  // if sbaOrder == 3 => degree - position - ring order
11328  if (strat->sbaOrder == 3)
11329  {
11330  ring res = rCopy0(r, TRUE, FALSE);
11331  res->order = (int *)omAlloc0((n+2)*sizeof(int));
11332  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11333  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11334  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11335  res->wvhdl = wvhdl;
11336  for (int i=2; i<n+2; i++)
11337  {
11338  res->order[i] = r->order[i-2];
11339  res->block0[i] = r->block0[i-2];
11340  res->block1[i] = r->block1[i-2];
11341  res->wvhdl[i] = r->wvhdl[i-2];
11342  }
11343 
11344  // new 1st block
11345  res->order[0] = ringorder_a; // Prefix
11346  res->block0[0] = 1;
11347  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11348  for (int i=0; i<res->N; ++i)
11349  res->wvhdl[0][i] = 1;
11350  res->block1[0] = si_min(res->N, rVar(res));
11351  // new 2nd block
11352  res->order[1] = ringorder_C; // Prefix
11353  res->wvhdl[1] = NULL;
11354  // removes useless secondary component order if defined in old ring
11355  for (int i=rBlocks(res); i>1; --i)
11356  {
11357  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11358  {
11359  res->order[i] = 0;
11360  }
11361  }
11362  rComplete(res, 1);
11363 #ifdef HAVE_PLURAL
11364  if (rIsPluralRing(r))
11365  {
11366  if ( nc_rComplete(r, res, false) ) // no qideal!
11367  {
11368 #ifndef SING_NDEBUG
11369  WarnS("error in nc_rComplete");
11370 #endif
11371  // cleanup?
11372 
11373  // rDelete(res);
11374  // return r;
11375 
11376  // just go on..
11377  }
11378  }
11379 #endif
11380  strat->tailRing = res;
11381  return (res);
11382  }
11383 
11384  // not sbaOrder == 1 => use Schreyer order
11385  // this is done by a trick when initializing the signatures
11386  // in initSLSba():
11387  // Instead of using the signature 1e_i for F->m[i], we start
11388  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11389  // Schreyer order w.r.t. the underlying monomial order.
11390  // => we do not need to change the underlying polynomial ring at all!
11391 
11392  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11393 
11394  /*
11395  else
11396  {
11397  ring res = rCopy0(r, FALSE, FALSE);
11398  // Create 2 more blocks for prefix/suffix:
11399  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11400  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11401  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11402  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11403 
11404  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11405  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11406 
11407  // new 1st block
11408  int j = 0;
11409  res->order[j] = ringorder_IS; // Prefix
11410  res->block0[j] = res->block1[j] = 0;
11411  // wvhdl[j] = NULL;
11412  j++;
11413 
11414  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11415  {
11416  res->order [j] = r->order [i];
11417  res->block0[j] = r->block0[i];
11418  res->block1[j] = r->block1[i];
11419 
11420  if (r->wvhdl[i] != NULL)
11421  {
11422  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11423  } // else wvhdl[j] = NULL;
11424  }
11425 
11426  // new last block
11427  res->order [j] = ringorder_IS; // Suffix
11428  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11429  // wvhdl[j] = NULL;
11430  j++;
11431 
11432  // res->order [j] = 0; // The End!
11433  res->wvhdl = wvhdl;
11434 
11435  // j == the last zero block now!
11436  assume(j == (n+1));
11437  assume(res->order[0]==ringorder_IS);
11438  assume(res->order[j-1]==ringorder_IS);
11439  assume(res->order[j]==0);
11440 
11441  if (complete)
11442  {
11443  rComplete(res, 1);
11444 
11445 #ifdef HAVE_PLURAL
11446  if (rIsPluralRing(r))
11447  {
11448  if ( nc_rComplete(r, res, false) ) // no qideal!
11449  {
11450  }
11451  }
11452  assume(rIsPluralRing(r) == rIsPluralRing(res));
11453 #endif
11454 
11455 
11456 #ifdef HAVE_PLURAL
11457  ring old_ring = r;
11458 
11459 #endif
11460 
11461  if (r->qideal!=NULL)
11462  {
11463  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11464 
11465  assume(idRankFreeModule(res->qideal, res) == 0);
11466 
11467 #ifdef HAVE_PLURAL
11468  if( rIsPluralRing(res) )
11469  if( nc_SetupQuotient(res, r, true) )
11470  {
11471  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11472  }
11473 
11474 #endif
11475  assume(idRankFreeModule(res->qideal, res) == 0);
11476  }
11477 
11478 #ifdef HAVE_PLURAL
11479  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11480  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11481  assume(rIsSCA(res) == rIsSCA(old_ring));
11482  assume(ncRingType(res) == ncRingType(old_ring));
11483 #endif
11484  }
11485  strat->tailRing = res;
11486  return res;
11487  }
11488  */
11489 
11490  assume(FALSE);
11491  return(NULL);
11492 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:124
#define FALSE
Definition: auxiliary.h:97
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5527
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
#define TRUE
Definition: auxiliary.h:101
#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:3435
#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:312
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#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:358
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) && 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:97
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
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:359
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

§ syzCriterionInc()

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

Definition at line 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) && 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:97
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
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:313
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:359
static int max(int a, int b)
Definition: fast_mult.cc:264
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
intset syzIdx
Definition: kutil.h:309

§ twoPow()

long twoPow ( long  arg)

Definition at line 4224 of file kutil.cc.

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

§ updateResult()

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

Definition at line 10296 of file kutil.cc.

10297 {
10298  int l;
10299  if (strat->ak>0)
10300  {
10301  for (l=IDELEMS(r)-1;l>=0;l--)
10302  {
10303  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10304  {
10305  pDelete(&r->m[l]); // and set it to NULL
10306  }
10307  }
10308  int q;
10309  poly p;
10310  if(!rField_is_Ring(currRing))
10311  {
10312  for (l=IDELEMS(r)-1;l>=0;l--)
10313  {
10314  if ((r->m[l]!=NULL)
10315  //&& (strat->syzComp>0)
10316  //&& (pGetComp(r->m[l])<=strat->syzComp)
10317  )
10318  {
10319  for(q=IDELEMS(Q)-1; q>=0;q--)
10320  {
10321  if ((Q->m[q]!=NULL)
10322  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10323  {
10324  if (TEST_OPT_REDSB)
10325  {
10326  p=r->m[l];
10327  r->m[l]=kNF(Q,NULL,p);
10328  pDelete(&p);
10329  }
10330  else
10331  {
10332  pDelete(&r->m[l]); // and set it to NULL
10333  }
10334  break;
10335  }
10336  }
10337  }
10338  }
10339  }
10340  #ifdef HAVE_RINGS
10341  else
10342  {
10343  for (l=IDELEMS(r)-1;l>=0;l--)
10344  {
10345  if ((r->m[l]!=NULL)
10346  //&& (strat->syzComp>0)
10347  //&& (pGetComp(r->m[l])<=strat->syzComp)
10348  )
10349  {
10350  for(q=IDELEMS(Q)-1; q>=0;q--)
10351  {
10352  if ((Q->m[q]!=NULL)
10353  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10354  {
10355  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
10356  {
10357  if (TEST_OPT_REDSB)
10358  {
10359  p=r->m[l];
10360  r->m[l]=kNF(Q,NULL,p);
10361  pDelete(&p);
10362  }
10363  else
10364  {
10365  pDelete(&r->m[l]); // and set it to NULL
10366  }
10367  break;
10368  }
10369  }
10370  }
10371  }
10372  }
10373  }
10374  #endif
10375  }
10376  else
10377  {
10378  int q;
10379  poly p;
10380  BOOLEAN reduction_found=FALSE;
10381  if (!rField_is_Ring(currRing))
10382  {
10383  for (l=IDELEMS(r)-1;l>=0;l--)
10384  {
10385  if (r->m[l]!=NULL)
10386  {
10387  for(q=IDELEMS(Q)-1; q>=0;q--)
10388  {
10389  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10390  {
10391  if (TEST_OPT_REDSB)
10392  {
10393  p=r->m[l];
10394  r->m[l]=kNF(Q,NULL,p);
10395  pDelete(&p);
10396  reduction_found=TRUE;
10397  }
10398  else
10399  {
10400  pDelete(&r->m[l]); // and set it to NULL
10401  }
10402  break;
10403  }
10404  }
10405  }
10406  }
10407  }
10408  #ifdef HAVE_RINGS
10409  //Also need divisibility of the leading coefficients
10410  else
10411  {
10412  for (l=IDELEMS(r)-1;l>=0;l--)
10413  {
10414  if (r->m[l]!=NULL)
10415  {
10416  for(q=IDELEMS(Q)-1; q>=0;q--)
10417  {
10418  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
10419  {
10420  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10421  {
10422  if (TEST_OPT_REDSB)
10423  {
10424  p=r->m[l];
10425  r->m[l]=kNF(Q,NULL,p);
10426  pDelete(&p);
10427  reduction_found=TRUE;
10428  }
10429  else
10430  {
10431  pDelete(&r->m[l]); // and set it to NULL
10432  }
10433  break;
10434  }
10435  }
10436  }
10437  }
10438  }
10439  }
10440  #endif
10441  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10442  {
10443  #ifdef HAVE_RINGS
10445  {
10446  for (l=IDELEMS(r)-1;l>=0;l--)
10447  {
10448  if (r->m[l]!=NULL)
10449  {
10450  for(q=IDELEMS(r)-1;q>=0;q--)
10451  {
10452  if ((l!=q)
10453  && (r->m[q]!=NULL)
10454  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10455  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
10456  )
10457  {
10458  //If they are equal then take the one with the smallest length
10459  if(pLmDivisibleBy(r->m[q],r->m[l])
10460  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing)
10461  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10462  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10463  {
10464  pDelete(&r->m[l]);
10465  break;
10466  }
10467  else
10468  pDelete(&r->m[q]);
10469  }
10470  }
10471  }
10472  }
10473  }
10474  else
10475  #endif
10476  {
10477  for (l=IDELEMS(r)-1;l>=0;l--)
10478  {
10479  if (r->m[l]!=NULL)
10480  {
10481  for(q=IDELEMS(r)-1;q>=0;q--)
10482  {
10483  if ((l!=q)
10484  && (r->m[q]!=NULL)
10485  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10486  )
10487  {
10488  //If they are equal then take the one with the smallest length
10489  if(pLmDivisibleBy(r->m[q],r->m[l])
10490  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10491  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10492  {
10493  pDelete(&r->m[l]);
10494  break;
10495  }
10496  else
10497  pDelete(&r->m[q]);
10498  }
10499  }
10500  }
10501  }
10502  }
10503  }
10504  }
10505  idSkipZeroes(r);
10506 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
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
#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:88
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

§ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 8895 of file kutil.cc.

8896 {
8897  LObject h;
8898  int i, suc=0;
8899  poly redSi=NULL;
8900  BOOLEAN change,any_change;
8901 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
8902 // for (i=0; i<=(strat->sl); i++)
8903 // {
8904 // Print("s%d:",i);
8905 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
8906 // pWrite(strat->S[i]);
8907 // }
8908 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
8909  any_change=FALSE;
8911  {
8912  while (suc != -1)
8913  {
8914  i=suc+1;
8915  while (i<=strat->sl)
8916  {
8917  change=FALSE;
8919  any_change = FALSE;
8920  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
8921  {
8922  redSi = pHead(strat->S[i]);
8923  strat->S[i] = redBba(strat->S[i],i-1,strat);
8924  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
8925  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
8926  if (pCmp(redSi,strat->S[i])!=0)
8927  {
8928  change=TRUE;
8929  any_change=TRUE;
8930  #ifdef KDEBUG
8931  if (TEST_OPT_DEBUG)
8932  {
8933  PrintS("reduce:");
8934  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
8935  }
8936  #endif
8937  if (TEST_OPT_PROT)
8938  {
8939  if (strat->S[i]==NULL)
8940  PrintS("V");
8941  else
8942  PrintS("v");
8943  mflush();
8944  }
8945  }
8946  pLmDelete(&redSi);
8947  if (strat->S[i]==NULL)
8948  {
8949  deleteInS(i,strat);
8950  i--;
8951  }
8952  else if (change)
8953  {
8955  {
8956  if (TEST_OPT_CONTENTSB)
8957  {
8958  number n;
8959  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8960  if (!nIsOne(n))
8961  {
8963  denom->n=nInvers(n);
8964  denom->next=DENOMINATOR_LIST;
8965  DENOMINATOR_LIST=denom;
8966  }
8967  nDelete(&n);
8968  }
8969  else
8970  {
8971  //pContent(strat->S[i]);
8972  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8973  }
8974  }
8975  else
8976  {
8977  pNorm(strat->S[i]);
8978  }
8979  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
8980  }
8981  }
8982  i++;
8983  }
8984  if (any_change) reorderS(&suc,strat);
8985  else break;
8986  }
8987  if (toT)
8988  {
8989  for (i=0; i<=strat->sl; i++)
8990  {
8991  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
8992  {
8993  h.p = redtailBba(strat->S[i],i-1,strat);
8995  {
8996  h.pCleardenom();// also does a pContent
8997  }
8998  }
8999  else
9000  {
9001  h.p = strat->S[i];
9002  }
9003  strat->initEcart(&h);
9004  if (strat->honey)
9005  {
9006  strat->ecartS[i] = h.ecart;
9007  }
9008  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9009  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9010  h.sev = strat->sevS[i];
9011  /*puts the elements of S also to T*/
9012  strat->initEcart(&h);
9013  enterT(h,strat);
9014  strat->S_2_R[i] = strat->tl;
9015  }
9016  }
9017  }
9018  else
9019  {
9020  while (suc != -1)
9021  {
9022  i=suc;
9023  while (i<=strat->sl)
9024  {
9025  change=FALSE;
9026  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9027  {
9028  redSi=pHead((strat->S)[i]);
9029  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9030  if ((strat->S)[i]==NULL)
9031  {
9032  deleteInS(i,strat);
9033  i--;
9034  }
9035  else if (pCmp((strat->S)[i],redSi)!=0)
9036  {
9037  any_change=TRUE;
9038  h.p = strat->S[i];
9039  strat->initEcart(&h);
9040  strat->ecartS[i] = h.ecart;
9042  {
9043  if (TEST_OPT_CONTENTSB)
9044  {
9045  number n;
9046  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9047  if (!nIsOne(n))
9048  {
9050  denom->n=nInvers(n);
9051  denom->next=DENOMINATOR_LIST;
9052  DENOMINATOR_LIST=denom;
9053  }
9054  nDelete(&n);
9055  }
9056  else
9057  {
9058  //pContent(strat->S[i]);
9059  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9060  }
9061  }
9062  else
9063  {
9064  pNorm(strat->S[i]); // == h.p
9065  }
9066  h.sev = pGetShortExpVector(h.p);
9067  strat->sevS[i] = h.sev;
9068  }
9069  pLmDelete(&redSi);
9070  kTest(strat);
9071  }
9072  i++;
9073  }
9074 #ifdef KDEBUG
9075  kTest(strat);
9076 #endif
9077  if (any_change) reorderS(&suc,strat);
9078  else { suc=-1; break; }
9079  if (h.p!=NULL)
9080  {
9081  if (!strat->kHEdgeFound)
9082  {
9083  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9084  }
9085  if (strat->kHEdgeFound)
9086  newHEdge(strat);
9087  }
9088  }
9089  for (i=0; i<=strat->sl; i++)
9090  {
9091  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9092  {
9093  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9094  strat->initEcart(&h);
9095  strat->ecartS[i] = h.ecart;
9096  h.sev = pGetShortExpVector(h.p);
9097  strat->sevS[i] = h.sev;
9098  }
9099  else
9100  {
9101  h.p = strat->S[i];
9102  h.ecart=strat->ecartS[i];
9103  h.sev = strat->sevS[i];
9104  h.length = h.pLength = pLength(h.p);
9105  }
9106  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9107  cancelunit1(&h,&suc,strat->sl,strat);
9108  h.SetpFDeg();
9109  /*puts the elements of S also to T*/
9110  enterT(h,strat);
9111  strat->S_2_R[i] = strat->tl;
9112  }
9113  if (suc!= -1) updateS(toT,strat);
9114  }
9115 #ifdef KDEBUG
9116  kTest(strat);
9117 #endif
9118 }
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:376
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:97
int * S_2_R
Definition: kutil.h:340
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8738
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5059
#define TEST_OPT_CONTENTSB
Definition: options.h:121
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
#define kTest(A)
Definition: kutil.h:653
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1041
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
static int pLength(poly a)
Definition: p_polys.h:189
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8826
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2844
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#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:375
intset ecartS
Definition: kutil.h:305
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:341
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:8895
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8850
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10631
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:88
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2716

§ updateSShift()

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

Definition at line 11952 of file kutil.cc.

11953 {
11954  /* to use after updateS(toT=FALSE,strat) */
11955  /* fills T with shifted elt's of S */
11956  int i;
11957  LObject h;
11958  int atT = -1; // or figure out smth better
11959  strat->tl = -1; // init
11960  for (i=0; i<=strat->sl; i++)
11961  {
11962  memset(&h,0,sizeof(h));
11963  h.p = strat->S[i]; // lm in currRing, tail in TR
11964  strat->initEcart(&h);
11965  h.sev = strat->sevS[i];
11966  h.t_p = NULL;
11967  h.GetTP(); // creates correct t_p
11968  /*puts the elements of S with their shifts to T*/
11969  // int atT, int uptodeg, int lV)
11970  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
11971  // need a small check for above; we insert >=1 elements
11972  // insert this check into kTest_TS ?
11973  enterTShift(h,strat,atT,uptodeg,lV);
11974  }
11975  /* what about setting strat->tl? */
11976 }
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12596
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
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.