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 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 posInT19 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (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 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 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 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 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 superenterpairs (poly h, 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)
 
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)
 
void message (int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
 
void messageStat (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 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 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 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 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

struct denominator_list_s

Definition at line 67 of file kutil.h.

Data Fields
number n
denominator_list next

Macro Definition Documentation

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

Definition at line 385 of file kutil.h.

#define HAVE_TAIL_RING

Definition at line 25 of file kutil.h.

#define KINLINE

Definition at line 51 of file kutil.h.

#define kTest (   A)    (TRUE)

Definition at line 619 of file kutil.h.

#define kTest_L (   T)    (TRUE)

Definition at line 623 of file kutil.h.

#define kTest_S (   T)    (TRUE)

Definition at line 622 of file kutil.h.

#define kTest_T (   T)    (TRUE)

Definition at line 621 of file kutil.h.

#define kTest_TS (   A)    (TRUE)

Definition at line 620 of file kutil.h.

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

Definition at line 508 of file kutil.h.

#define NO_KINLINE   1

Definition at line 52 of file kutil.h.

#define setmax   16

Definition at line 28 of file kutil.h.

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

Definition at line 29 of file kutil.h.

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

Definition at line 30 of file kutil.h.

#define setmaxT   64

Definition at line 32 of file kutil.h.

#define setmaxTinc   32

Definition at line 33 of file kutil.h.

Typedef Documentation

Definition at line 65 of file kutil.h.

typedef int* intset

Definition at line 55 of file kutil.h.

typedef class sLObject LObject

Definition at line 60 of file kutil.h.

typedef LObject* LSet

Definition at line 62 of file kutil.h.

typedef class sTObject TObject

Definition at line 59 of file kutil.h.

typedef TObject* TSet

Definition at line 61 of file kutil.h.

typedef wlen_type* wlen_set

Definition at line 57 of file kutil.h.

typedef int64 wlen_type

Definition at line 56 of file kutil.h.

Function Documentation

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

Definition at line 5802 of file kutil.cc.

5803 {
5804  poly p1 = pOne();
5805  poly p2 = pOne();
5806  for (int ii=strat->sl; ii>start; ii--)
5807  {
5808  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
5809  {
5810  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
5811  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
5812  if (!(pLmCmp(p1,p2) == 1))
5813  {
5814  pDelete(&p1);
5815  pDelete(&p2);
5816  return TRUE;
5817  }
5818  }
5819  }
5820  pDelete(&p1);
5821  pDelete(&p2);
5822  return FALSE;
5823 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:140
#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:144
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
LObject P
Definition: kutil.h:298
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
#define pDelete(p_ptr)
Definition: polys.h:157
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:1353
polyrec * poly
Definition: hilb.h:10
BOOLEAN arriRewCriterionPre ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int  start 
)

Definition at line 5825 of file kutil.cc.

5826 {
5827  int found = -1;
5828  for (int i=strat->Bl; i>-1; i--) {
5829  if (pLmEqual(strat->B[i].sig,sig)) {
5830  found = i;
5831  break;
5832  }
5833  }
5834  if (found != -1) {
5835  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1) {
5836  deleteInL(strat->B,&strat->Bl,found,strat);
5837  } else {
5838  return TRUE;
5839  }
5840  }
5841  poly p1 = pOne();
5842  poly p2 = pOne();
5843  for (int ii=strat->sl; ii>-1; ii--)
5844  {
5845  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
5846  {
5847  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
5848  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
5849  if (!(pLmCmp(p1,p2) == 1))
5850  {
5851  pDelete(&p1);
5852  pDelete(&p2);
5853  return TRUE;
5854  }
5855  }
5856  }
5857  pDelete(&p1);
5858  pDelete(&p2);
5859  return FALSE;
5860 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:140
#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:144
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
LSet B
Definition: kutil.h:324
#define pDelete(p_ptr)
Definition: polys.h:157
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:1353
polyrec * poly
Definition: hilb.h:10
#define pLmEqual(p1, p2)
Definition: polys.h:111
KINLINE BOOLEAN arriRewDummy ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int  start 
)

Definition at line 1172 of file kInline.h.

1173 {
1174  return FALSE;
1175 }
#define FALSE
Definition: auxiliary.h:140
ideal bba ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1467 of file kstd2.cc.

1468 {
1469  int red_result = 1;
1470  int olddeg,reduc;
1471  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1472  BOOLEAN withT = FALSE;
1473  BITSET save;
1474  SI_SAVE_OPT1(save);
1475 
1476  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1477  initBuchMoraPos(strat);
1478  initHilbCrit(F,Q,&hilb,strat);
1479  initBba(strat);
1480  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1481  /*Shdl=*/initBuchMora(F, Q,strat);
1482  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1483  reduc = olddeg = 0;
1484 
1485 #ifndef NO_BUCKETS
1486  if (!TEST_OPT_NOT_BUCKETS)
1487  strat->use_buckets = 1;
1488 #endif
1489  // redtailBBa against T for inhomogenous input
1490  if (!TEST_OPT_OLDSTD)
1491  withT = ! strat->homog;
1492 
1493  // strat->posInT = posInT_pLength;
1494  kTest_TS(strat);
1495 
1496 #ifdef KDEBUG
1497 #if MYTEST
1498  if (TEST_OPT_DEBUG)
1499  {
1500  PrintS("bba start GB: currRing: ");
1501  // rWrite(currRing);PrintLn();
1503  PrintLn();
1504  }
1505 #endif /* MYTEST */
1506 #endif /* KDEBUG */
1507 
1508 #ifdef HAVE_TAIL_RING
1509  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1510  kStratInitChangeTailRing(strat);
1511 #endif
1512  if (BVERBOSE(23))
1513  {
1514  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1515  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1516  kDebugPrint(strat);
1517  }
1518 
1519 
1520 #ifdef KDEBUG
1521  //kDebugPrint(strat);
1522 #endif
1523  /* compute------------------------------------------------------- */
1524  while (strat->Ll >= 0)
1525  {
1526  #if ADIDEBUG
1527  printf("\n ------------------------NEW LOOP\n");
1528  printf("\nShdl = \n");
1529  #if 0
1530  idPrint(strat->Shdl);
1531  #else
1532  for(int ii = 0; ii<=strat->sl;ii++)
1533  p_Write(strat->S[ii],strat->tailRing);
1534  #endif
1535  printf("\n list L\n");
1536  int iii;
1537  #if 1
1538  for(iii = 0; iii<= strat->Ll; iii++)
1539  {
1540  printf("L[%i]:",iii);
1541  p_Write(strat->L[iii].p, currRing);
1542  p_Write(strat->L[iii].p1, currRing);
1543  p_Write(strat->L[iii].p2, currRing);
1544  }
1545  #else
1546  {
1547  printf("L[%i]:",strat->Ll);
1548  p_Write(strat->L[strat->Ll].p, strat->tailRing);
1549  p_Write(strat->L[strat->Ll].p1, strat->tailRing);
1550  p_Write(strat->L[strat->Ll].p2, strat->tailRing);
1551  }
1552  #endif
1553  #if 1
1554  for(iii = 0; iii<= strat->Bl; iii++)
1555  {
1556  printf("B[%i]:",iii);
1557  p_Write(strat->B[iii].p, /*strat->tailRing*/currRing);
1558  p_Write(strat->B[iii].p1, /*strat->tailRing*/currRing);
1559  p_Write(strat->B[iii].p2, strat->tailRing);
1560  }
1561  #endif
1562  getchar();
1563  #endif
1564  #ifdef KDEBUG
1565  if (TEST_OPT_DEBUG) messageSets(strat);
1566  #endif
1567  if (strat->Ll== 0) strat->interpt=TRUE;
1568  if (TEST_OPT_DEGBOUND
1569  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1570  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1571  {
1572  /*
1573  *stops computation if
1574  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1575  *a predefined number Kstd1_deg
1576  */
1577  while ((strat->Ll >= 0)
1578  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1579  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1580  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1581  )
1582  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1583  if (strat->Ll<0) break;
1584  else strat->noClearS=TRUE;
1585  }
1586  /* picks the last element from the lazyset L */
1587  strat->P = strat->L[strat->Ll];
1588  strat->Ll--;
1589 
1590  if (pNext(strat->P.p) == strat->tail)
1591  {
1592  // deletes the short spoly
1593 #ifdef HAVE_RINGS
1594  if (rField_is_Ring(currRing))
1595  pLmDelete(strat->P.p);
1596  else
1597 #endif
1598  pLmFree(strat->P.p);
1599  strat->P.p = NULL;
1600  poly m1 = NULL, m2 = NULL;
1601 
1602  // check that spoly creation is ok
1603  while (strat->tailRing != currRing &&
1604  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1605  {
1606  assume(m1 == NULL && m2 == NULL);
1607  // if not, change to a ring where exponents are at least
1608  // large enough
1609  if (!kStratChangeTailRing(strat))
1610  {
1611  WerrorS("OVERFLOW...");
1612  break;
1613  }
1614  }
1615  // create the real one
1616  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
1617  strat->tailRing, m1, m2, strat->R);
1618  }
1619  else if (strat->P.p1 == NULL)
1620  {
1621  if (strat->minim > 0)
1622  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
1623  // for input polys, prepare reduction
1624  strat->P.PrepareRed(strat->use_buckets);
1625  }
1626 
1627  if (strat->P.p == NULL && strat->P.t_p == NULL)
1628  {
1629  red_result = 0;
1630  }
1631  else
1632  {
1633  if (TEST_OPT_PROT)
1634  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
1635  &olddeg,&reduc,strat, red_result);
1636 
1637  /* reduction of the element chosen from L */
1638  #if ADIDEBUG
1639  printf("\nBefore \n");pWrite(strat->P.p);
1640  #endif
1641  red_result = strat->red(&strat->P,strat);
1642  #if ADIDEBUG
1643  printf("\nAfter \n");pWrite(strat->P.p);
1644  #endif
1645  if (errorreported) break;
1646  }
1647 
1648  if (strat->overflow)
1649  {
1650  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
1651  }
1652 
1653  // reduction to non-zero new poly
1654  if (red_result == 1)
1655  {
1656  // get the polynomial (canonicalize bucket, make sure P.p is set)
1657  strat->P.GetP(strat->lmBin);
1658  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
1659  // but now, for entering S, T, we reset it
1660  // in the inhomogeneous case: FDeg == pFDeg
1661  if (strat->homog) strat->initEcart(&(strat->P));
1662 
1663  /* statistic */
1664  if (TEST_OPT_PROT) PrintS("s");
1665 
1666  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1667 
1668 #ifdef KDEBUG
1669 #if MYTEST
1670  PrintS("New S: "); p_DebugPrint(strat->P.p, currRing); PrintLn();
1671 #endif /* MYTEST */
1672 #endif /* KDEBUG */
1673 
1674  // reduce the tail and normalize poly
1675  // in the ring case we cannot expect LC(f) = 1,
1676  // therefore we call pContent instead of pNorm
1678  {
1679  strat->P.pCleardenom();
1681  {
1682  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1683  strat->P.pCleardenom();
1684  }
1685  }
1686  else
1687  {
1688  strat->P.pNorm();
1690  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1691  }
1692 
1693 #ifdef KDEBUG
1694  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
1695 #if MYTEST
1696  PrintS("New (reduced) S: "); p_DebugPrint(strat->P.p, currRing); PrintLn();
1697 #endif /* MYTEST */
1698 #endif /* KDEBUG */
1699 
1700  // min_std stuff
1701  if ((strat->P.p1==NULL) && (strat->minim>0))
1702  {
1703  if (strat->minim==1)
1704  {
1705  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
1706  p_Delete(&strat->P.p2, currRing, strat->tailRing);
1707  }
1708  else
1709  {
1710  strat->M->m[minimcnt]=strat->P.p2;
1711  strat->P.p2=NULL;
1712  }
1713  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
1714  pNext(strat->M->m[minimcnt])
1715  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
1716  strat->tailRing, currRing,
1717  currRing->PolyBin);
1718  minimcnt++;
1719  }
1720 
1721  // enter into S, L, and T
1722  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
1723  {
1724  enterT(strat->P, strat);
1725 #ifdef HAVE_RINGS
1726  if (rField_is_Ring(currRing))
1727  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1728  else
1729 #endif
1730  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1731  // posInS only depends on the leading term
1732  #if ADIDEBUG
1733  printf("\nThis element is added to S\n");
1734  p_Write(strat->P.p, strat->tailRing);p_Write(strat->P.p1, strat->tailRing);p_Write(strat->P.p2, strat->tailRing);
1735  #endif
1736  strat->enterS(strat->P, pos, strat, strat->tl);
1737 #if 0
1738  int pl=pLength(strat->P.p);
1739  if (pl==1)
1740  {
1741  //if (TEST_OPT_PROT)
1742  //PrintS("<1>");
1743  }
1744  else if (pl==2)
1745  {
1746  //if (TEST_OPT_PROT)
1747  //PrintS("<2>");
1748  }
1749 #endif
1750  }
1751  if (strat->s_poly!=NULL)
1752  {
1753  if (strat->s_poly(strat))
1754  {
1755  // we are called AFTER enterS, i.e. if we change P
1756  // we have it also to S/T
1757  // and add pairs
1758  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1759  enterT(strat->P, strat);
1760  #ifdef HAVE_RINGS
1761  if (rField_is_Ring(currRing))
1762  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1763  else
1764  #endif
1765  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1766  strat->enterS(strat->P, pos, strat, strat->tl);
1767  }
1768  }
1769  #if ADIDEBUG
1770  for(int iii = 0; iii<=strat->tl;iii++)
1771  {
1772  printf("\nT[%i] = ",iii);pWrite(strat->T[iii].p);
1773  }
1774  #endif
1775 
1776  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1777 // Print("[%d]",hilbeledeg);
1778  if (strat->P.lcm!=NULL)
1779 #ifdef HAVE_RINGS
1780  pLmDelete(strat->P.lcm);
1781 #else
1782  pLmFree(strat->P.lcm);
1783 #endif
1784  }
1785  else if (strat->P.p1 == NULL && strat->minim > 0)
1786  {
1787  p_Delete(&strat->P.p2, currRing, strat->tailRing);
1788  }
1789 
1790 #ifdef KDEBUG
1791  memset(&(strat->P), 0, sizeof(strat->P));
1792 #endif /* KDEBUG */
1793  kTest_TS(strat);
1794  }
1795 #ifdef KDEBUG
1796 #if MYTEST
1797  PrintS("bba finish GB: currRing: "); rWrite(currRing);
1798 #endif /* MYTEST */
1799  if (TEST_OPT_DEBUG) messageSets(strat);
1800 #endif /* KDEBUG */
1801 
1802  if (TEST_OPT_SB_1)
1803  {
1804  #ifdef HAVE_RINGS
1805  if(!rField_is_Ring(currRing))
1806  #endif
1807  {
1808  int k=1;
1809  int j;
1810  while(k<=strat->sl)
1811  {
1812  j=0;
1813  loop
1814  {
1815  if (j>=k) break;
1816  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
1817  j++;
1818  }
1819  k++;
1820  }
1821  }
1822  }
1823  /* complete reduction of the standard basis--------- */
1824  if (TEST_OPT_REDSB)
1825  {
1826  completeReduce(strat);
1827 #ifdef HAVE_TAIL_RING
1828  if (strat->completeReduce_retry)
1829  {
1830  // completeReduce needed larger exponents, retry
1831  // to reduce with S (instead of T)
1832  // and in currRing (instead of strat->tailRing)
1833  cleanT(strat);strat->tailRing=currRing;
1834  int i;
1835  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
1836  completeReduce(strat);
1837  }
1838 #endif
1839  }
1840  else if (TEST_OPT_PROT) PrintLn();
1841  #ifdef HAVE_RINGS
1842  if(nCoeff_is_Ring_Z(currRing->cf))
1843  finalReduceByMon(strat);
1845  {
1846  for(int i = 0;i<=strat->sl;i++)
1847  {
1848  if(!nGreaterZero(pGetCoeff(strat->S[i])))
1849  {
1850  strat->S[i] = pNeg(strat->S[i]);
1851  }
1852  }
1853  }
1854  #endif
1855  /* release temp data-------------------------------- */
1856  exitBuchMora(strat);
1857 // if (TEST_OPT_WEIGHTM)
1858 // {
1859 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
1860 // if (ecartWeights)
1861 // {
1862 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1863 // ecartWeights=NULL;
1864 // }
1865 // }
1866  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
1867  SI_RESTORE_OPT1(save);
1868  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1869 
1870 #ifdef KDEBUG
1871 #if MYTEST
1872  PrintS("bba_end: currRing: "); rWrite(currRing);
1873 #endif /* MYTEST */
1874 #endif /* KDEBUG */
1875  idTest(strat->Shdl);
1876 
1877  return (strat->Shdl);
1878 }
#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
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4240
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:327
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:8240
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:6274
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:6315
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8334
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#define pNeg(p)
Definition: polys.h:169
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3984
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:392
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void pWrite(poly p)
Definition: polys.h:279
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
void initBba(kStrategy strat)
Definition: kstd1.cc:1388
#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:17
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
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:811
void rDebugPrint(ring r)
Definition: ring.cc:4035
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:9460
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
BOOLEAN interpt
Definition: kutil.h:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define idPrint(id)
Definition: ideals.h:59
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:620
int j
Definition: myNF.cc:70
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:8068
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:508
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:379
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8088
ideal M
Definition: kutil.h:301
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
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:8990
#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:850
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:437
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
void cleanT(kStrategy strat)
Definition: kutil.cc:505
LSet B
Definition: kutil.h:324
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3900
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:4197
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:8797
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:8644
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:1145
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:98
int sl
Definition: kutil.h:346
BOOLEAN use_buckets
Definition: kutil.h:373
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:99
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:228
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:9290
ideal Shdl
Definition: kutil.h:299
int BOOLEAN
Definition: auxiliary.h:131
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:8415
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:9903
#define idTest(id)
Definition: ideals.h:60
ideal bbaShift ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 3072 of file kstd2.cc.

3073 {
3074  int red_result = 1;
3075  int olddeg,reduc;
3076  int hilbeledeg=1,hilbcount=0,minimcnt=0;
3077  BOOLEAN withT = TRUE; // very important for shifts
3078 
3079  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
3080  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
3081  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
3082  initBbaShift(strat); /* DONE */
3083  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3084  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
3085  updateSShift(strat,uptodeg,lV); /* initializes T */
3086 
3087  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
3088  reduc = olddeg = 0;
3089  strat->lV=lV;
3090 
3091 #ifndef NO_BUCKETS
3092  if (!TEST_OPT_NOT_BUCKETS)
3093  strat->use_buckets = 1;
3094 #endif
3095 
3096  // redtailBBa against T for inhomogenous input
3097  // if (!TEST_OPT_OLDSTD)
3098  // withT = ! strat->homog;
3099 
3100  // strat->posInT = posInT_pLength;
3101  kTest_TS(strat);
3102 
3103 #ifdef HAVE_TAIL_RING
3104  kStratInitChangeTailRing(strat);
3105 #endif
3106 
3107  /* compute------------------------------------------------------- */
3108  while (strat->Ll >= 0)
3109  {
3110 #ifdef KDEBUG
3111  if (TEST_OPT_DEBUG) messageSets(strat);
3112 #endif
3113  if (strat->Ll== 0) strat->interpt=TRUE;
3114  if (TEST_OPT_DEGBOUND
3115  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3116  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
3117  {
3118  /*
3119  *stops computation if
3120  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
3121  *a predefined number Kstd1_deg
3122  */
3123  while ((strat->Ll >= 0)
3124  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
3125  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3126  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
3127  )
3128  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
3129  if (strat->Ll<0) break;
3130  else strat->noClearS=TRUE;
3131  }
3132  /* picks the last element from the lazyset L */
3133  strat->P = strat->L[strat->Ll];
3134  strat->Ll--;
3135 
3136  if (pNext(strat->P.p) == strat->tail)
3137  {
3138  // deletes the short spoly
3139  pLmFree(strat->P.p);
3140  strat->P.p = NULL;
3141  poly m1 = NULL, m2 = NULL;
3142 
3143  // check that spoly creation is ok
3144  while (strat->tailRing != currRing &&
3145  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3146  {
3147  assume(m1 == NULL && m2 == NULL);
3148  // if not, change to a ring where exponents are at least
3149  // large enough
3150  kStratChangeTailRing(strat);
3151  }
3152  // create the real one
3153  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3154  strat->tailRing, m1, m2, strat->R);
3155  }
3156  else if (strat->P.p1 == NULL)
3157  {
3158  if (strat->minim > 0)
3159  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3160  // for input polys, prepare reduction
3161  strat->P.PrepareRed(strat->use_buckets);
3162  }
3163 
3164  poly qq;
3165 
3166  /* here in the nonhomog case we shrink the new spoly */
3167 
3168  if ( ! strat->homog)
3169  {
3170  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3171  /* in the nonhomog case we have to shrink the polynomial */
3172  assume(strat->P.t_p!=NULL);
3173  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
3174  if (qq != NULL)
3175  {
3176  /* we're here if Shrink is nonzero */
3177  // strat->P.p = NULL;
3178  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
3179  strat->P.p = NULL; // is not set by Delete
3180  strat->P.t_p = qq;
3181  strat->P.GetP(strat->lmBin);
3182  // update sev and length
3183  strat->initEcart(&(strat->P));
3184  strat->P.sev = pGetShortExpVector(strat->P.p);
3185 // strat->P.FDeg = strat->P.pFDeg();
3186 // strat->P.length = strat->P.pLDeg();
3187 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
3188  }
3189  else
3190  {
3191  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3192 #ifdef KDEBUG
3193  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
3194 #endif
3195  // strat->P.Delete(); // cause error
3196  strat->P.p = NULL;
3197  strat->P.t_p = NULL;
3198  // strat->P.p = NULL; // or delete strat->P.p ?
3199  }
3200  }
3201  /* end shrinking poly in the nonhomog case */
3202 
3203  if (strat->P.p == NULL && strat->P.t_p == NULL)
3204  {
3205  red_result = 0;
3206  }
3207  else
3208  {
3209  if (TEST_OPT_PROT)
3210  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3211  &olddeg,&reduc,strat, red_result);
3212 
3213  /* reduction of the element chosen from L */
3214  red_result = strat->red(&strat->P,strat);
3215  }
3216 
3217  // reduction to non-zero new poly
3218  if (red_result == 1)
3219  {
3220  /* statistic */
3221  if (TEST_OPT_PROT) PrintS("s");
3222 
3223  // get the polynomial (canonicalize bucket, make sure P.p is set)
3224  strat->P.GetP(strat->lmBin);
3225 
3226  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3227 
3228  // reduce the tail and normalize poly
3230  {
3231  strat->P.pCleardenom();
3233  {
3234  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3235  strat->P.pCleardenom();
3236  }
3237  }
3238  else
3239  {
3240  strat->P.pNorm();
3242  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3243  }
3244 
3245  // here we must shrink again! and optionally reduce again
3246  // or build shrink into redtailBba!
3247 
3248 #ifdef KDEBUG
3249  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3250 #endif
3251 
3252  // min_std stuff
3253  if ((strat->P.p1==NULL) && (strat->minim>0))
3254  {
3255  if (strat->minim==1)
3256  {
3257  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3258  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3259  }
3260  else
3261  {
3262  strat->M->m[minimcnt]=strat->P.p2;
3263  strat->P.p2=NULL;
3264  }
3265  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3266  pNext(strat->M->m[minimcnt])
3267  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3268  strat->tailRing, currRing,
3269  currRing->PolyBin);
3270  minimcnt++;
3271  }
3272 
3273  /* here in the nonhomog case we shrink the reduced poly AGAIN */
3274 
3275  if ( ! strat->homog)
3276  {
3277  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3278  /* assume strat->P.t_p != NULL */
3279  /* in the nonhomog case we have to shrink the polynomial */
3280  assume(strat->P.t_p!=NULL); // poly qq defined above
3281  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
3282  if (qq != NULL)
3283  {
3284  /* we're here if Shrink is nonzero */
3285  // strat->P.p = NULL;
3286  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
3287  strat->P.p = NULL; // is not set by Delete
3288  strat->P.t_p = qq;
3289  strat->P.GetP(strat->lmBin);
3290  // update sev and length
3291  strat->initEcart(&(strat->P));
3292  strat->P.sev = pGetShortExpVector(strat->P.p);
3293  }
3294  else
3295  {
3296  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3297 #ifdef PDEBUG
3298  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
3299 #endif
3300  // strat->P.Delete(); // cause error
3301  strat->P.p = NULL;
3302  strat->P.t_p = NULL;
3303  // strat->P.p = NULL; // or delete strat->P.p ?
3304  goto red_shrink2zero;
3305  }
3306  }
3307  /* end shrinking poly AGAIN in the nonhomog case */
3308 
3309 
3310  // enter into S, L, and T
3311  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3312  // enterT(strat->P, strat); // this was here before Shift stuff
3313  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
3314  // the default value for atT = -1 as in bba
3315  /* strat->P.GetP(); */
3316  // because shifts are counted with .p structure // done before, but ?
3317  enterTShift(strat->P,strat,-1,uptodeg, lV);
3318  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3319  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3320  // posInS only depends on the leading term
3321  strat->enterS(strat->P, pos, strat, strat->tl);
3322 
3323  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3324 // Print("[%d]",hilbeledeg);
3325  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
3326  }
3327  else
3328  {
3329  red_shrink2zero:
3330  if (strat->P.p1 == NULL && strat->minim > 0)
3331  {
3332  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3333  }
3334  }
3335 #ifdef KDEBUG
3336  memset(&(strat->P), 0, sizeof(strat->P));
3337 #endif
3338  kTest_TS(strat);
3339  }
3340 #ifdef KDEBUG
3341  if (TEST_OPT_DEBUG) messageSets(strat);
3342 #endif
3343  /* complete reduction of the standard basis--------- */
3344  /* shift case: look for elt's in S such that they are divisible by elt in T */
3345  // if (TEST_OPT_SB_1)
3346  if (TEST_OPT_REDSB)
3347  {
3348  int k=0;
3349  int j=-1;
3350  while(k<=strat->sl)
3351  {
3352 // loop
3353 // {
3354 // if (j>=k) break;
3355 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3356 // j++;
3357 // }
3358  LObject Ln (strat->S[k],currRing, strat->tailRing);
3359  Ln.SetShortExpVector();
3360  j = kFindDivisibleByInT(strat, &Ln, j+1);
3361  if (j<0) { k++; j=-1;}
3362  else
3363  {
3364  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
3365  {
3366  j = kFindDivisibleByInT(strat, &Ln, j+1);
3367  if (j<0) { k++; j=-1;}
3368  else
3369  {
3370  deleteInS(k,strat);
3371  }
3372  }
3373  else
3374  {
3375  deleteInS(k,strat);
3376  }
3377  }
3378  }
3379  }
3380 
3381  if (TEST_OPT_REDSB)
3382  { completeReduce(strat, TRUE); //shift: withT = TRUE
3383  if (strat->completeReduce_retry)
3384  {
3385  // completeReduce needed larger exponents, retry
3386  // to reduce with S (instead of T)
3387  // and in currRing (instead of strat->tailRing)
3388  cleanT(strat);strat->tailRing=currRing;
3389  int i;
3390  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3391  completeReduce(strat, TRUE);
3392  }
3393  }
3394  else if (TEST_OPT_PROT) PrintLn();
3395 
3396  /* release temp data-------------------------------- */
3397  exitBuchMora(strat);
3398 // if (TEST_OPT_WEIGHTM)
3399 // {
3400 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
3401 // if (ecartWeights)
3402 // {
3403 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3404 // ecartWeights=NULL;
3405 // }
3406 // }
3407  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
3408  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3409  return (strat->Shdl);
3410 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:327
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:8240
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:6274
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:6315
#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:392
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
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:10692
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int minim
Definition: kutil.h:356
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:9460
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
void updateSShift(kStrategy strat, int uptodeg, int lV)
Definition: kutil.cc:10148
BOOLEAN interpt
Definition: kutil.h:361
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:510
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:12
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:10799
int lV
Definition: kutil.h:358
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:620
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:8068
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:508
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:379
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8088
ideal M
Definition: kutil.h:301
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:10176
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8990
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
void initBbaShift(kStrategy strat)
Definition: kstd2.cc:3574
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
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:505
ring tailRing
Definition: kutil.h:341
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:8797
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:8644
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:373
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:104
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:228
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:8415
void cancelunit ( LObject p,
BOOLEAN  inNF = FALSE 
)

Definition at line 324 of file kutil.cc.

325 {
326  int i;
327  poly h;
328  number lc;
329 
330  if(rHasGlobalOrdering (currRing)) return;
331  if(TEST_OPT_CANCELUNIT) return;
332 
333  ring r = L->tailRing;
334  poly p = L->GetLmTailRing();
335 
336 #ifdef HAVE_RINGS
337  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
338  lc = pGetCoeff(p);
339 #endif
340  #if ADIDEBUG
341  printf("\n cancelunit\n");
342  pWrite(p);
343  #endif
344 #ifdef HAVE_RINGS
345  // Leading coef have to be a unit
346  // example 2x+4x2 should be simplified to 2x*(1+2x)
347  // and 2 is not a unit in Z
348  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
349 #endif
350 
351  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
352 
353 // for(i=r->N;i>0;i--)
354 // {
355 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
356 // }
357  h = pNext(p);
358 
359  loop
360  {
361  if (h==NULL)
362  {
363  p_Delete(&pNext(p), r);
364  if (!inNF)
365  {
366  number eins;
367 #ifdef HAVE_RINGS
368  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
369  eins = nCopy(lc);
370  else
371 #endif
372  eins=nInit(1);
373  if (L->p != NULL)
374  {
375  pSetCoeff(L->p,eins);
376  if (L->t_p != NULL)
377  pSetCoeff0(L->t_p,eins);
378  }
379  else
380  pSetCoeff(L->t_p,eins);
381  /* p and t_p share the same coeff, if both are !=NULL */
382  /* p==NULL==t_p cannot happen here */
383  }
384  L->ecart = 0;
385  L->length = 1;
386  //if (L->pLength > 0)
387  L->pLength = 1;
388  L->max = NULL;
389 
390  if (L->t_p != NULL && pNext(L->t_p) != NULL)
391  p_Delete(&pNext(L->t_p),r);
392  if (L->p != NULL && pNext(L->p) != NULL)
393  pNext(L->p) = NULL;
394 
395  return;
396  }
397  i = 0;
398  loop
399  {
400  i++;
401  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
402  if (i == r->N) break; // does divide, try next monom
403  }
404  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
405  #ifdef HAVE_RINGS
406  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
407  // domains), no zerodivisor test needed CAUTION
408  #if ADIDEBUG
409  pWrite(h);
410  #endif
411  if (rField_is_Ring(r) && !n_DivBy(pGetCoeff(h),lc,r->cf))
412  {
413  #if ADIDEBUG
414  printf("\nDoes not divide\n");
415  #endif
416  return;
417  }
418  #if ADIDEBUG
419  printf("\nDivides. Go On\n");
420  #endif
421  #endif
422  pIter(h);
423  }
424 }
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:279
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:12
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:465
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:771
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#define TEST_OPT_CANCELUNIT
Definition: options.h:122
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1207
void chainCritNormal ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2447 of file kutil.cc.

2448 {
2449  int i,j,l;
2450 
2451  /*
2452  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2453  *In this case all elements in B such
2454  *that their lcm is divisible by the leading term of S[i] can be canceled
2455  */
2456  if (strat->pairtest!=NULL)
2457  {
2458  {
2459  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2460  for (j=0; j<=strat->sl; j++)
2461  {
2462  if (strat->pairtest[j])
2463  {
2464  for (i=strat->Bl; i>=0; i--)
2465  {
2466  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
2467  {
2468  deleteInL(strat->B,&strat->Bl,i,strat);
2469  strat->c3++;
2470  }
2471  }
2472  }
2473  }
2474  }
2475  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2476  strat->pairtest=NULL;
2477  }
2478  if (strat->Gebauer || strat->fromT)
2479  {
2480  if (strat->sugarCrit)
2481  {
2482  /*
2483  *suppose L[j] == (s,r) and p/lcm(s,r)
2484  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2485  *and in case the sugar is o.k. then L[j] can be canceled
2486  */
2487  for (j=strat->Ll; j>=0; j--)
2488  {
2489  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
2490  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2491  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2492  {
2493  if (strat->L[j].p == strat->tail)
2494  {
2495  deleteInL(strat->L,&strat->Ll,j,strat);
2496  strat->c3++;
2497  }
2498  }
2499  }
2500  /*
2501  *this is GEBAUER-MOELLER:
2502  *in B all elements with the same lcm except the "best"
2503  *(i.e. the last one in B with this property) will be canceled
2504  */
2505  j = strat->Bl;
2506  loop /*cannot be changed into a for !!! */
2507  {
2508  if (j <= 0) break;
2509  i = j-1;
2510  loop
2511  {
2512  if (i < 0) break;
2513  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2514  {
2515  strat->c3++;
2516  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
2517  {
2518  deleteInL(strat->B,&strat->Bl,i,strat);
2519  j--;
2520  }
2521  else
2522  {
2523  deleteInL(strat->B,&strat->Bl,j,strat);
2524  break;
2525  }
2526  }
2527  i--;
2528  }
2529  j--;
2530  }
2531  }
2532  else /*sugarCrit*/
2533  {
2534  /*
2535  *suppose L[j] == (s,r) and p/lcm(s,r)
2536  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2537  *and in case the sugar is o.k. then L[j] can be canceled
2538  */
2539  for (j=strat->Ll; j>=0; j--)
2540  {
2541  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2542  {
2543  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2544  {
2545  deleteInL(strat->L,&strat->Ll,j,strat);
2546  strat->c3++;
2547  }
2548  }
2549  }
2550  /*
2551  *this is GEBAUER-MOELLER:
2552  *in B all elements with the same lcm except the "best"
2553  *(i.e. the last one in B with this property) will be canceled
2554  */
2555  j = strat->Bl;
2556  loop /*cannot be changed into a for !!! */
2557  {
2558  if (j <= 0) break;
2559  for(i=j-1; i>=0; i--)
2560  {
2561  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2562  {
2563  strat->c3++;
2564  deleteInL(strat->B,&strat->Bl,i,strat);
2565  j--;
2566  }
2567  }
2568  j--;
2569  }
2570  }
2571  /*
2572  *the elements of B enter L
2573  */
2574  kMergeBintoL(strat);
2575  }
2576  else
2577  {
2578  for (j=strat->Ll; j>=0; j--)
2579  {
2580  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2581  {
2582  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2583  {
2584  deleteInL(strat->L,&strat->Ll,j,strat);
2585  strat->c3++;
2586  }
2587  }
2588  }
2589  /*
2590  *this is our MODIFICATION of GEBAUER-MOELLER:
2591  *First the elements of B enter L,
2592  *then we fix a lcm and the "best" element in L
2593  *(i.e the last in L with this lcm and of type (s,p))
2594  *and cancel all the other elements of type (r,p) with this lcm
2595  *except the case the element (s,r) has also the same lcm
2596  *and is on the worst position with respect to (s,p) and (r,p)
2597  */
2598  /*
2599  *B enters to L/their order with respect to B is permutated for elements
2600  *B[i].p with the same leading term
2601  */
2602  kMergeBintoL(strat);
2603  j = strat->Ll;
2604  loop /*cannot be changed into a for !!! */
2605  {
2606  if (j <= 0)
2607  {
2608  /*now L[0] cannot be canceled any more and the tail can be removed*/
2609  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2610  break;
2611  }
2612  if (strat->L[j].p2 == p)
2613  {
2614  i = j-1;
2615  loop
2616  {
2617  if (i < 0) break;
2618  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2619  {
2620  /*L[i] could be canceled but we search for a better one to cancel*/
2621  strat->c3++;
2622  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2623  && (pNext(strat->L[l].p) == strat->tail)
2624  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2625  && pDivisibleBy(p,strat->L[l].lcm))
2626  {
2627  /*
2628  *"NOT equal(...)" because in case of "equal" the element L[l]
2629  *is "older" and has to be from theoretical point of view behind
2630  *L[i], but we do not want to reorder L
2631  */
2632  strat->L[i].p2 = strat->tail;
2633  /*
2634  *L[l] will be canceled, we cannot cancel L[i] later on,
2635  *so we mark it with "tail"
2636  */
2637  deleteInL(strat->L,&strat->Ll,l,strat);
2638  i--;
2639  }
2640  else
2641  {
2642  deleteInL(strat->L,&strat->Ll,i,strat);
2643  }
2644  j--;
2645  }
2646  i--;
2647  }
2648  }
2649  else if (strat->L[j].p2 == strat->tail)
2650  {
2651  /*now L[j] cannot be canceled any more and the tail can be removed*/
2652  strat->L[j].p2 = p;
2653  }
2654  j--;
2655  }
2656  }
2657 }
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:1049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:581
BOOLEAN Gebauer
Definition: kutil.h:368
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:21
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
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:126
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2401
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 2662 of file kutil.cc.

2663 {
2664  if (strat->pairtest!=NULL)
2665  {
2666  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2667  strat->pairtest=NULL;
2668  }
2669  /*
2670  *the elements of B enter L
2671  */
2672  kMergeBintoL(strat);
2673 }
#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:2401
int BOOLEAN
Definition: auxiliary.h:131
void chainCritSig ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2678 of file kutil.cc.

2679 {
2680  int i,j,l;
2681  kMergeBintoLSba(strat);
2682  j = strat->Ll;
2683  loop /*cannot be changed into a for !!! */
2684  {
2685  if (j <= 0)
2686  {
2687  /*now L[0] cannot be canceled any more and the tail can be removed*/
2688  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2689  break;
2690  }
2691  if (strat->L[j].p2 == p)
2692  {
2693  i = j-1;
2694  loop
2695  {
2696  if (i < 0) break;
2697  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2698  {
2699  /*L[i] could be canceled but we search for a better one to cancel*/
2700  strat->c3++;
2701  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2702  && (pNext(strat->L[l].p) == strat->tail)
2703  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2704  && pDivisibleBy(p,strat->L[l].lcm))
2705  {
2706  /*
2707  *"NOT equal(...)" because in case of "equal" the element L[l]
2708  *is "older" and has to be from theoretical point of view behind
2709  *L[i], but we do not want to reorder L
2710  */
2711  strat->L[i].p2 = strat->tail;
2712  /*
2713  *L[l] will be canceled, we cannot cancel L[i] later on,
2714  *so we mark it with "tail"
2715  */
2716  deleteInL(strat->L,&strat->Ll,l,strat);
2717  i--;
2718  }
2719  else
2720  {
2721  deleteInL(strat->L,&strat->Ll,i,strat);
2722  }
2723  j--;
2724  }
2725  i--;
2726  }
2727  }
2728  else if (strat->L[j].p2 == strat->tail)
2729  {
2730  /*now L[j] cannot be canceled any more and the tail can be removed*/
2731  strat->L[j].p2 = p;
2732  }
2733  j--;
2734  }
2735 }
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:1049
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:581
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:2424
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:126
#define pNext(p)
Definition: monomials.h:43
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void cleanT ( kStrategy  strat)

Definition at line 505 of file kutil.cc.

506 {
507  int i,j;
508  poly p;
509  assume(currRing == strat->tailRing || strat->tailRing != NULL);
510 
511  pShallowCopyDeleteProc p_shallow_copy_delete =
512  (strat->tailRing != currRing ?
514  NULL);
515 
516  for (j=0; j<=strat->tl; j++)
517  {
518  p = strat->T[j].p;
519  strat->T[j].p=NULL;
520  if (strat->T[j].max != NULL)
521  {
522  p_LmFree(strat->T[j].max, strat->tailRing);
523  }
524  i = -1;
525  loop
526  {
527  i++;
528  if (i>strat->sl)
529  {
530  if (strat->T[j].t_p != NULL)
531  {
532  p_Delete(&(strat->T[j].t_p), strat->tailRing);
533  p_LmFree(p, currRing);
534  }
535  else
536  pDelete(&p);
537  break;
538  }
539  if (p == strat->S[i])
540  {
541  if (strat->T[j].t_p != NULL)
542  {
543  assume(p_shallow_copy_delete != NULL);
544  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
545  currRing->PolyBin);
546  p_LmFree(strat->T[j].t_p, strat->tailRing);
547  }
548  break;
549  }
550  }
551  }
552  strat->tl=-1;
553 }
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:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
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:850
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:157
#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
KINLINE void clearS ( poly  p,
unsigned long  p_sev,
int *  at,
int *  k,
kStrategy  strat 
)

Definition at line 1145 of file kInline.h.

1147 {
1148  assume(p_sev == pGetShortExpVector(p));
1149  if (strat->noClearS) return;
1150  #if HAVE_RINGS
1152  {
1153  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1154  return;
1155  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing))
1156  return;
1157  }
1158  else
1159  {
1160  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1161  }
1162  #else
1163  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1164  #endif
1165  deleteInS((*at),strat);
1166  (*at)--;
1167  (*k)--;
1168 }
return P p
Definition: myNF.cc:203
char noClearS
Definition: kutil.h:392
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
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:12
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
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:771
#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:134
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
unsigned long * sevS
Definition: kutil.h:318
void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 8797 of file kutil.cc.

8798 {
8799  int i;
8800  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
8801  LObject L;
8802 
8803 #ifdef KDEBUG
8804  // need to set this: during tailreductions of T[i], T[i].max is out of
8805  // sync
8806  sloppy_max = TRUE;
8807 #endif
8808 
8809  strat->noTailReduction = FALSE;
8810  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
8811  if (TEST_OPT_PROT)
8812  {
8813  PrintLn();
8814 // if (timerv) writeTime("standard base computed:");
8815  }
8816  if (TEST_OPT_PROT)
8817  {
8818  Print("(S:%d)",strat->sl);mflush();
8819  }
8820  for (i=strat->sl; i>=low; i--)
8821  {
8822  int end_pos=strat->sl;
8823  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
8824  if (strat->ak==0) end_pos=i-1;
8825  TObject* T_j = strat->s_2_t(i);
8826  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
8827  {
8828  L = *T_j;
8829  #ifdef KDEBUG
8830  if (TEST_OPT_DEBUG)
8831  {
8832  Print("test S[%d]:",i);
8833  p_wrp(L.p,currRing,strat->tailRing);
8834  PrintLn();
8835  }
8836  #endif
8838  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
8839  else
8840  strat->S[i] = redtail(&L, strat->sl, strat);
8841  #ifdef KDEBUG
8842  if (TEST_OPT_DEBUG)
8843  {
8844  Print("to (tailR) S[%d]:",i);
8845  p_wrp(strat->S[i],currRing,strat->tailRing);
8846  PrintLn();
8847  }
8848  #endif
8849 
8850  if (strat->redTailChange && strat->tailRing != currRing)
8851  {
8852  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
8853  if (pNext(T_j->p) != NULL)
8854  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
8855  else
8856  T_j->max = NULL;
8857  }
8859  T_j->pCleardenom();
8860  }
8861  else
8862  {
8863  assume(currRing == strat->tailRing);
8864  #ifdef KDEBUG
8865  if (TEST_OPT_DEBUG)
8866  {
8867  Print("test S[%d]:",i);
8868  p_wrp(strat->S[i],currRing,strat->tailRing);
8869  PrintLn();
8870  }
8871  #endif
8873  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
8874  else
8875  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
8877  {
8878  if (TEST_OPT_CONTENTSB)
8879  {
8880  number n;
8881  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8882  if (!nIsOne(n))
8883  {
8885  denom->n=nInvers(n);
8886  denom->next=DENOMINATOR_LIST;
8887  DENOMINATOR_LIST=denom;
8888  }
8889  nDelete(&n);
8890  }
8891  else
8892  {
8893  //pContent(strat->S[i]);
8894  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8895  }
8896  }
8897  #ifdef KDEBUG
8898  if (TEST_OPT_DEBUG)
8899  {
8900  Print("to (-tailR) S[%d]:",i);
8901  p_wrp(strat->S[i],currRing,strat->tailRing);
8902  PrintLn();
8903  }
8904  #endif
8905  }
8906  if (TEST_OPT_PROT)
8907  PrintS("-");
8908  }
8909  if (TEST_OPT_PROT) PrintLn();
8910 #ifdef KDEBUG
8911  sloppy_max = FALSE;
8912 #endif
8913 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
void PrintLn()
Definition: reporter.cc:327
#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:140
BOOLEAN noTailReduction
Definition: kutil.h:368
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
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:6047
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
#define mflush()
Definition: reporter.h:55
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2826
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:752
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:2682
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
ideal createG0 ( )

Definition at line 3683 of file kutil.cc.

3684 {
3685  // Initialize
3686  long exp[50]; // The exponent of \hat{X} (basepoint)
3687  long cexp[50]; // The current exponent for iterating over all
3688  long ind[50]; // The power of 2 in the i-th component of exp
3689  long cind[50]; // analog for cexp
3690  long mult[50]; // How to multiply the elements of G
3691  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3692  long habsind = 0; // The abs. index of the coefficient of h
3693  long step[50]; // The last increases
3694  for (int i = 1; i <= currRing->N; i++)
3695  {
3696  exp[i] = 0;
3697  cexp[i] = exp[i];
3698  ind[i] = 0;
3699  step[i] = 500000;
3700  cind[i] = ind[i];
3701  }
3702  long bound = currRing->ch;
3703  step[1] = 500000;
3704 #ifdef OLI_DEBUG
3705  PrintS("-------------\npoly :");
3706 // wrp(p);
3707  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3708  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3709  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3710  Print("bound : %d\n", bound);
3711  Print("cind : %d\n", cabsind);
3712 #endif
3713  if (cabsind == 0)
3714  {
3715  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3716  {
3717  return idInit(1, 1);
3718  }
3719  }
3720  ideal G0 = idInit(1, 1);
3721  // Now the whole simplex
3722  do
3723  {
3724  // Build s-polynomial
3725  // 2**ind-def * mult * g - exp-def * h
3726  poly t_p;
3727  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
3728 #ifdef OLI_DEBUG
3729  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3730  Print("zPoly : ");
3731  wrp(zeroPoly);
3732  Print("\n");
3733 #endif
3734  // Add to ideal
3735  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
3736  IDELEMS(G0) += 1;
3737  G0->m[IDELEMS(G0) - 1] = zeroPoly;
3738  }
3739  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3740  idSkipZeroes(G0);
3741  return G0;
3742 }
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:3554
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:3488
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#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:3540
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
void deleteHC ( poly p,
int *  e,
int *  l,
kStrategy  strat 
)

Definition at line 310 of file kutil.cc.

311 {
312  LObject L(*p, currRing, strat->tailRing);
313 
314  deleteHC(&L, strat);
315  *p = L.p;
316  *e = L.ecart;
317  *l = L.length;
318  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
319 }
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:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
int l
Definition: cfEzgcd.cc:94
void deleteHC ( LObject L,
kStrategy  strat,
BOOLEAN  fromNext = FALSE 
)

Definition at line 235 of file kutil.cc.

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

Definition at line 1049 of file kutil.cc.

1050 {
1051  if (set[j].lcm!=NULL)
1052  {
1053 #ifdef HAVE_RINGS
1054  if (pGetCoeff(set[j].lcm) != NULL)
1055  pLmDelete(set[j].lcm);
1056  else
1057 #endif
1058  pLmFree(set[j].lcm);
1059  }
1060  if (set[j].sig!=NULL)
1061  {
1062 #ifdef HAVE_RINGS
1063  if (pGetCoeff(set[j].sig) != NULL)
1064  pLmDelete(set[j].sig);
1065  else
1066 #endif
1067  pLmFree(set[j].sig);
1068  }
1069  if (set[j].p!=NULL)
1070  {
1071  if (pNext(set[j].p) == strat->tail)
1072  {
1073 #ifdef HAVE_RINGS
1074  if (pGetCoeff(set[j].p) != NULL)
1075  pLmDelete(set[j].p);
1076  else
1077 #endif
1078  pLmFree(set[j].p);
1079  /*- tail belongs to several int spolys -*/
1080  }
1081  else
1082  {
1083  // search p in T, if it is there, do not delete it
1084  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1085  {
1086  // assure that for global orderings kFindInT fails
1087  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1088  set[j].Delete();
1089  }
1090  }
1091  }
1092  if (*length > 0 && j < *length)
1093  {
1094 #ifdef ENTER_USE_MEMMOVE
1095  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1096 #else
1097  int i;
1098  for (i=j; i < (*length); i++)
1099  set[i] = set[i+1];
1100 #endif
1101  }
1102 #ifdef KDEBUG
1103  memset(&(set[*length]),0,sizeof(LObject));
1104 #endif
1105  (*length)--;
1106 }
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:617
#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:12
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:752
#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
void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 942 of file kutil.cc.

943 {
944 #ifdef ENTER_USE_MEMMOVE
945  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
946  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
947  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
948  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
949 #else
950  int j;
951  for (j=i; j<strat->sl; j++)
952  {
953  strat->S[j] = strat->S[j+1];
954  strat->ecartS[j] = strat->ecartS[j+1];
955  strat->sevS[j] = strat->sevS[j+1];
956  strat->S_2_R[j] = strat->S_2_R[j+1];
957  }
958 #endif
959  if (strat->lenS!=NULL)
960  {
961 #ifdef ENTER_USE_MEMMOVE
962  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
963 #else
964  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
965 #endif
966  }
967  if (strat->lenSw!=NULL)
968  {
969 #ifdef ENTER_USE_MEMMOVE
970  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
971 #else
972  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
973 #endif
974  }
975  if (strat->fromQ!=NULL)
976  {
977 #ifdef ENTER_USE_MEMMOVE
978  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
979 #else
980  for (j=i; j<strat->sl; j++)
981  {
982  strat->fromQ[j] = strat->fromQ[j+1];
983  }
984 #endif
985  }
986  strat->S[strat->sl] = NULL;
987  strat->sl--;
988 }
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
void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 994 of file kutil.cc.

995 {
996 #ifdef ENTER_USE_MEMMOVE
997  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
998  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
999  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1000  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1001  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1002  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1003 #else
1004  int j;
1005  for (j=i; j<strat->sl; j++)
1006  {
1007  strat->S[j] = strat->S[j+1];
1008  strat->sig[j] = strat->sig[j+1];
1009  strat->ecartS[j] = strat->ecartS[j+1];
1010  strat->sevS[j] = strat->sevS[j+1];
1011  strat->sevSig[j] = strat->sevSig[j+1];
1012  strat->S_2_R[j] = strat->S_2_R[j+1];
1013  }
1014 #endif
1015  if (strat->lenS!=NULL)
1016  {
1017 #ifdef ENTER_USE_MEMMOVE
1018  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1019 #else
1020  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1021 #endif
1022  }
1023  if (strat->lenSw!=NULL)
1024  {
1025 #ifdef ENTER_USE_MEMMOVE
1026  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1027 #else
1028  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1029 #endif
1030  }
1031  if (strat->fromQ!=NULL)
1032  {
1033 #ifdef ENTER_USE_MEMMOVE
1034  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1035 #else
1036  for (j=i; j<strat->sl; j++)
1037  {
1038  strat->fromQ[j] = strat->fromQ[j+1];
1039  }
1040 #endif
1041  }
1042  strat->S[strat->sl] = NULL;
1043  strat->sl--;
1044 }
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
void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 3780 of file kutil.cc.

3781 {
3782  if (nIsOne(pGetCoeff(h))) return;
3783  number gcd;
3784  bool go = false;
3785  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
3786  {
3787  gcd = n_Ann(pGetCoeff(h),currRing->cf);
3788  go = true;
3789  }
3790  else
3791  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
3792  if (go || !nIsOne(gcd))
3793  {
3794  poly p = h->next;
3795  if (!go)
3796  {
3797  number tmp = gcd;
3798  gcd = n_Ann(gcd,currRing->cf);
3799  nDelete(&tmp);
3800  }
3801  p_Test(p,strat->tailRing);
3802  p = pp_Mult_nn(p, gcd, strat->tailRing);
3803  nDelete(&gcd);
3804 
3805  if (p != NULL)
3806  {
3807  if (TEST_OPT_PROT)
3808  {
3809  PrintS("Z");
3810  }
3811 #ifdef KDEBUG
3812  if (TEST_OPT_DEBUG)
3813  {
3814  PrintS("--- create zero spoly: ");
3815  p_wrp(h,currRing,strat->tailRing);
3816  PrintS(" ---> ");
3817  }
3818 #endif
3819  poly tmp = pInit();
3820  pSetCoeff0(tmp, pGetCoeff(p));
3821  for (int i = 1; i <= rVar(currRing); i++)
3822  {
3823  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
3824  }
3826  {
3827  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
3828  }
3829  p_Setm(tmp, currRing);
3830  p = p_LmFreeAndNext(p, strat->tailRing);
3831  pNext(tmp) = p;
3832  LObject h;
3833  h.Init();
3834  h.p = tmp;
3835  h.tailRing = strat->tailRing;
3836  int posx;
3837  if (h.p!=NULL)
3838  {
3840  {
3841  //pContent(h.p);
3842  h.pCleardenom(); // also does a pContent
3843  }
3844  else
3845  {
3846  h.pNorm();
3847  }
3848  strat->initEcart(&h);
3849  if (strat->Ll==-1)
3850  posx =0;
3851  else
3852  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
3853  h.sev = pGetShortExpVector(h.p);
3854  if (strat->tailRing != currRing)
3855  {
3856  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
3857  }
3858 #ifdef KDEBUG
3859  if (TEST_OPT_DEBUG)
3860  {
3861  p_wrp(tmp,currRing,strat->tailRing);
3862  PrintLn();
3863  }
3864 #endif
3865  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
3866  }
3867  }
3868  }
3869  nDelete(&gcd);
3870 }
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:685
void PrintLn()
Definition: reporter.cc:327
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:236
#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:927
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#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:1111
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:700
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:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
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:465
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
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:771
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:699
#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:436
#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
void enterL ( LSet set,
int *  length,
int *  LSetmax,
LObject  p,
int  at 
)

Definition at line 1111 of file kutil.cc.

1112 {
1113  // this should be corrected
1114  assume(p.FDeg == p.pFDeg());
1115 
1116  if ((*length)>=0)
1117  {
1118  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1119  if (at <= (*length))
1120 #ifdef ENTER_USE_MEMMOVE
1121  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1122 #else
1123  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1124 #endif
1125  }
1126  else at = 0;
1127  (*set)[at] = p;
1128  (*length)++;
1129 }
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:405
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:562
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:44
void enterOnePairLift ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)

Definition at line 1837 of file kutil.cc.

1838 {
1839  assume(ALLOW_PROD_CRIT(strat));
1841  assume(strat->syzComp==1);
1842  assume(i<=strat->sl);
1843 
1844  int l,j,compare;
1845  LObject Lp;
1846  Lp.i_r = -1;
1847 
1848 #ifdef KDEBUG
1849  Lp.ecart=0; Lp.length=0;
1850 #endif
1851  /*- computes the lcm(s[i],p) -*/
1852  Lp.lcm = pInit();
1853 
1854  pLcm(p,strat->S[i],Lp.lcm);
1855  pSetm(Lp.lcm);
1856 
1857  if (strat->sugarCrit)
1858  {
1859  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1860  && p_HasNotCF_Lift(p,strat->S[i],currRing))
1861  {
1862  /*
1863  *the product criterion has applied for (s,p),
1864  *i.e. lcm(s,p)=product of the leading terms of s and p.
1865  *Suppose (s,r) is in L and the leading term
1866  *of p divides lcm(s,r)
1867  *(==> the leading term of p divides the leading term of r)
1868  *but the leading term of s does not divide the leading term of r
1869  *(notice that tis condition is automatically satisfied if r is still
1870  *in S), then (s,r) can be cancelled.
1871  *This should be done here because the
1872  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1873  *
1874  *Moreover, skipping (s,r) holds also for the noncommutative case.
1875  */
1876  strat->cp++;
1877  pLmFree(Lp.lcm);
1878  Lp.lcm=NULL;
1879  return;
1880  }
1881  else
1882  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1883  if (strat->fromT && (strat->ecartS[i]>ecart))
1884  {
1885  pLmFree(Lp.lcm);
1886  Lp.lcm=NULL;
1887  return;
1888  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1889  }
1890  /*
1891  *the set B collects the pairs of type (S[j],p)
1892  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1893  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1894  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1895  */
1896  {
1897  j = strat->Bl;
1898  loop
1899  {
1900  if (j < 0) break;
1901  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1902  if ((compare==1)
1903  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1904  {
1905  strat->c3++;
1906  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1907  {
1908  pLmFree(Lp.lcm);
1909  return;
1910  }
1911  break;
1912  }
1913  else
1914  if ((compare ==-1)
1915  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1916  {
1917  deleteInL(strat->B,&strat->Bl,j,strat);
1918  strat->c3++;
1919  }
1920  j--;
1921  }
1922  }
1923  }
1924  else /*sugarcrit*/
1925  {
1926  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1927  p_HasNotCF_Lift(p,strat->S[i],currRing))
1928  {
1929  /*
1930  *the product criterion has applied for (s,p),
1931  *i.e. lcm(s,p)=product of the leading terms of s and p.
1932  *Suppose (s,r) is in L and the leading term
1933  *of p devides lcm(s,r)
1934  *(==> the leading term of p devides the leading term of r)
1935  *but the leading term of s does not devide the leading term of r
1936  *(notice that tis condition is automatically satisfied if r is still
1937  *in S), then (s,r) can be canceled.
1938  *This should be done here because the
1939  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1940  */
1941  strat->cp++;
1942  pLmFree(Lp.lcm);
1943  Lp.lcm=NULL;
1944  return;
1945  }
1946  if (strat->fromT && (strat->ecartS[i]>ecart))
1947  {
1948  pLmFree(Lp.lcm);
1949  Lp.lcm=NULL;
1950  return;
1951  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1952  }
1953  /*
1954  *the set B collects the pairs of type (S[j],p)
1955  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1956  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1957  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1958  */
1959  for(j = strat->Bl;j>=0;j--)
1960  {
1961  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1962  if (compare==1)
1963  {
1964  strat->c3++;
1965  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1966  {
1967  pLmFree(Lp.lcm);
1968  return;
1969  }
1970  break;
1971  }
1972  else
1973  if (compare ==-1)
1974  {
1975  deleteInL(strat->B,&strat->Bl,j,strat);
1976  strat->c3++;
1977  }
1978  }
1979  }
1980  /*
1981  *the pair (S[i],p) enters B if the spoly != 0
1982  */
1983  /*- compute the short s-polynomial -*/
1984  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1985  pNorm(p);
1986 
1987  if ((strat->S[i]==NULL) || (p==NULL))
1988  return;
1989 
1990  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1991  Lp.p=NULL;
1992  else
1993  {
1995  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1996  }
1997  if (Lp.p == NULL)
1998  {
1999  /*- the case that the s-poly is 0 -*/
2000  if (strat->pairtest==NULL) initPairtest(strat);
2001  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2002  strat->pairtest[strat->sl+1] = TRUE;
2003  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2004  /*
2005  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2006  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2007  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2008  *term of p devides the lcm(s,r)
2009  *(this canceling should be done here because
2010  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2011  *the first case is handeled in chainCrit
2012  */
2013  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2014  }
2015  else
2016  {
2017  /*- the pair (S[i],p) enters B -*/
2018  Lp.p1 = strat->S[i];
2019  Lp.p2 = p;
2020 
2021  pNext(Lp.p) = strat->tail; // !!!
2022 
2023  if (atR >= 0)
2024  {
2025  Lp.i_r1 = strat->S_2_R[i];
2026  Lp.i_r2 = atR;
2027  }
2028  else
2029  {
2030  Lp.i_r1 = -1;
2031  Lp.i_r2 = -1;
2032  }
2033  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2034 
2036  {
2037  nDelete(&(Lp.p->coef));
2038  }
2039 
2040  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2041  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2042  }
2043 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:241
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:179
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:1820
#define TRUE
Definition: auxiliary.h:144
#define pLcm(a, b, m)
Definition: polys.h:266
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:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
#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:572
#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:334
#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:385
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
int l
Definition: cfEzgcd.cc:94
void enterOnePairManyShifts ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 10260 of file kutil.cc.

10261 {
10262  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
10263 
10266 
10267  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
10268  /* that is create the pairs (f, s \dot g) */
10269 
10270  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
10271 
10272  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
10273  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
10274 
10275  /* determine how many elements we have to insert for a given s[i] */
10276  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
10277  /* hence, a total number of elt's to add is: */
10278  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
10279  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
10280 
10281 #ifdef KDEBUG
10282  if (TEST_OPT_DEBUG)
10283  {
10284  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
10285  }
10286 #endif
10287 
10288  assume(i<=strat->sl); // from OnePair
10289 
10290  /* these vars hold for all shifts of s[i] */
10291  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
10292 
10293  int qfromQ;
10294  if (strat->fromQ != NULL)
10295  {
10296  qfromQ = strat->fromQ[i];
10297  }
10298  else
10299  {
10300  qfromQ = -1;
10301  }
10302 
10303  int j;
10304 
10305  poly q/*, s*/;
10306 
10307  // for the 0th shift: insert the orig. pair
10308  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
10309 
10310  for (j=1; j<= toInsert; j++)
10311  {
10312  // q = pLPshift(strat->S[i],j,uptodeg,lV);
10313  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
10314  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
10315  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
10316  // pNext(q) = s; // in tailRing
10317  /* here we need to call enterOnePair with two polys ... */
10318 
10319 #ifdef KDEBUG
10320  if (TEST_OPT_DEBUG)
10321  {
10322  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
10323  }
10324 #endif
10325  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
10326  }
10327 }
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:10398
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
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:12
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
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
void enterOnePairNormal ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)

Definition at line 1532 of file kutil.cc.

1533 {
1534  assume(i<=strat->sl);
1535 
1536  int l,j,compare;
1537  LObject Lp;
1538  Lp.i_r = -1;
1539 
1540 #ifdef KDEBUG
1541  Lp.ecart=0; Lp.length=0;
1542 #endif
1543  /*- computes the lcm(s[i],p) -*/
1544  Lp.lcm = pInit();
1545 
1546 #ifndef HAVE_RATGRING
1547  pLcm(p,strat->S[i],Lp.lcm);
1548 #elif defined(HAVE_RATGRING)
1549  if (rIsRatGRing(currRing))
1550  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1551  else
1552  pLcm(p,strat->S[i],Lp.lcm);
1553 #endif
1554  pSetm(Lp.lcm);
1555 
1556 
1557  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1558  {
1559  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1560  && pHasNotCF(p,strat->S[i]))
1561  {
1562  /*
1563  *the product criterion has applied for (s,p),
1564  *i.e. lcm(s,p)=product of the leading terms of s and p.
1565  *Suppose (s,r) is in L and the leading term
1566  *of p divides lcm(s,r)
1567  *(==> the leading term of p divides the leading term of r)
1568  *but the leading term of s does not divide the leading term of r
1569  *(notice that tis condition is automatically satisfied if r is still
1570  *in S), then (s,r) can be cancelled.
1571  *This should be done here because the
1572  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1573  *
1574  *Moreover, skipping (s,r) holds also for the noncommutative case.
1575  */
1576  strat->cp++;
1577  pLmFree(Lp.lcm);
1578  Lp.lcm=NULL;
1579  return;
1580  }
1581  else
1582  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1583  if (strat->fromT && (strat->ecartS[i]>ecart))
1584  {
1585  pLmFree(Lp.lcm);
1586  Lp.lcm=NULL;
1587  return;
1588  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1589  }
1590  /*
1591  *the set B collects the pairs of type (S[j],p)
1592  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1593  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1594  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1595  */
1596  {
1597  j = strat->Bl;
1598  loop
1599  {
1600  if (j < 0) break;
1601  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1602  if ((compare==1)
1603  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1604  {
1605  strat->c3++;
1606  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1607  {
1608  pLmFree(Lp.lcm);
1609  return;
1610  }
1611  break;
1612  }
1613  else
1614  if ((compare ==-1)
1615  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1616  {
1617  deleteInL(strat->B,&strat->Bl,j,strat);
1618  strat->c3++;
1619  }
1620  j--;
1621  }
1622  }
1623  }
1624  else /*sugarcrit*/
1625  {
1626  if (ALLOW_PROD_CRIT(strat))
1627  {
1628  // if currRing->nc_type!=quasi (or skew)
1629  // TODO: enable productCrit for super commutative algebras...
1630  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1631  pHasNotCF(p,strat->S[i]))
1632  {
1633  /*
1634  *the product criterion has applied for (s,p),
1635  *i.e. lcm(s,p)=product of the leading terms of s and p.
1636  *Suppose (s,r) is in L and the leading term
1637  *of p devides lcm(s,r)
1638  *(==> the leading term of p devides the leading term of r)
1639  *but the leading term of s does not devide the leading term of r
1640  *(notice that tis condition is automatically satisfied if r is still
1641  *in S), then (s,r) can be canceled.
1642  *This should be done here because the
1643  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1644  */
1645  strat->cp++;
1646  pLmFree(Lp.lcm);
1647  Lp.lcm=NULL;
1648  return;
1649  }
1650  if (strat->fromT && (strat->ecartS[i]>ecart))
1651  {
1652  pLmFree(Lp.lcm);
1653  Lp.lcm=NULL;
1654  return;
1655  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1656  }
1657  /*
1658  *the set B collects the pairs of type (S[j],p)
1659  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1660  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1661  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1662  */
1663  for(j = strat->Bl;j>=0;j--)
1664  {
1665  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1666  if (compare==1)
1667  {
1668  strat->c3++;
1669  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1670  {
1671  pLmFree(Lp.lcm);
1672  return;
1673  }
1674  break;
1675  }
1676  else
1677  if (compare ==-1)
1678  {
1679  deleteInL(strat->B,&strat->Bl,j,strat);
1680  strat->c3++;
1681  }
1682  }
1683  }
1684  }
1685  /*
1686  *the pair (S[i],p) enters B if the spoly != 0
1687  */
1688  /*- compute the short s-polynomial -*/
1689  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1690  pNorm(p);
1691 
1692  if ((strat->S[i]==NULL) || (p==NULL))
1693  return;
1694 
1695  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1696  Lp.p=NULL;
1697  else
1698  {
1699  #ifdef HAVE_PLURAL
1700  if ( rIsPluralRing(currRing) )
1701  {
1702  if(pHasNotCF(p, strat->S[i]))
1703  {
1704  if(ncRingType(currRing) == nc_lie)
1705  {
1706  // generalized prod-crit for lie-type
1707  strat->cp++;
1708  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
1709  }
1710  else
1711  if( ALLOW_PROD_CRIT(strat) )
1712  {
1713  // product criterion for homogeneous case in SCA
1714  strat->cp++;
1715  Lp.p = NULL;
1716  }
1717  else
1718  {
1719  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1720  nc_CreateShortSpoly(strat->S[i], p, currRing);
1721 
1722  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1723  pNext(Lp.p) = strat->tail; // !!!
1724  }
1725  }
1726  else
1727  {
1728  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1729  nc_CreateShortSpoly(strat->S[i], p, currRing);
1730 
1731  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1732  pNext(Lp.p) = strat->tail; // !!!
1733 
1734  }
1735 
1736 
1737 #if MYTEST
1738  if (TEST_OPT_DEBUG)
1739  {
1740  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1741  PrintS("p: "); pWrite(p);
1742  PrintS("SPoly: "); pWrite(Lp.p);
1743  }
1744 #endif
1745 
1746  }
1747  else
1748  #endif
1749  {
1751  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1752 #if MYTEST
1753  if (TEST_OPT_DEBUG)
1754  {
1755  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1756  PrintS("p: "); pWrite(p);
1757  PrintS("commutative SPoly: "); pWrite(Lp.p);
1758  }
1759 #endif
1760 
1761  }
1762  }
1763  if (Lp.p == NULL)
1764  {
1765  /*- the case that the s-poly is 0 -*/
1766  if (strat->pairtest==NULL) initPairtest(strat);
1767  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
1768  strat->pairtest[strat->sl+1] = TRUE;
1769  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
1770  /*
1771  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
1772  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
1773  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
1774  *term of p devides the lcm(s,r)
1775  *(this canceling should be done here because
1776  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
1777  *the first case is handeled in chainCrit
1778  */
1779  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
1780  }
1781  else
1782  {
1783  /*- the pair (S[i],p) enters B -*/
1784  Lp.p1 = strat->S[i];
1785  Lp.p2 = p;
1786 
1787  if (
1789 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
1790  )
1791  {
1792  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1793  pNext(Lp.p) = strat->tail; // !!!
1794  }
1795 
1796  if (atR >= 0)
1797  {
1798  Lp.i_r1 = strat->S_2_R[i];
1799  Lp.i_r2 = atR;
1800  }
1801  else
1802  {
1803  Lp.i_r1 = -1;
1804  Lp.i_r2 = -1;
1805  }
1806  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
1807 
1809  {
1810  if (!rIsPluralRing(currRing))
1811  nDelete(&(Lp.p->coef));
1812  }
1813 
1814  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
1815  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
1816  }
1817 }
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:241
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 int pDivComp(poly p, poly q)
Definition: kutil.cc:179
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:144
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
void pWrite(poly p)
Definition: polys.h:279
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1939
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
BOOLEAN sugarCrit
Definition: kutil.h:367
#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:572
#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:334
#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:385
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void enterOnePairSelfShifts ( poly  qq,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 10335 of file kutil.cc.

10336 {
10337 
10338  /* format: p,qq are in LObject form: lm in CR, tail in TR */
10339  /* for true self pairs qq ==p */
10340  /* we test both qq and p */
10342  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
10345 
10346  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
10347 
10348  // int j = 0;
10349  int j = 1;
10350 
10351  /* for such self pairs start with 1, not with 0 */
10352  if (qq == p) j=1;
10353 
10354  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
10355  /* that is create the pairs (f, s \dot g) */
10356 
10357  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
10358 
10359 #ifdef KDEBUG
10360  if (TEST_OPT_DEBUG)
10361  {
10362  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
10363  }
10364 #endif
10365 
10366  poly q;
10367 
10368  /* these vars hold for all shifts of s[i] */
10369  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
10370  int qfromQ = 0; // strat->fromQ[i];
10371 
10372  for (; j<= toInsert; j++)
10373  {
10374  // q = pLPshift(strat->S[i],j,uptodeg,lV);
10375  /* we increase shifts by one; must delete q there*/
10376  // q = qq; q = pMoveCurrTail2poly(q,strat);
10377  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
10378  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
10379  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
10380  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
10381  // pNext(q) = s; // in tailRing
10382  /* here we need to call enterOnePair with two polys ... */
10383 #ifdef KDEBUG
10384  if (TEST_OPT_DEBUG)
10385  {
10386  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
10387  }
10388 #endif
10389  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
10390  }
10391 }
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:10398
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
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:12
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
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
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 10398 of file kutil.cc.

10399 {
10400 
10401  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
10402 
10403  /* check this Formats: */
10405  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
10408 
10409 #ifdef KDEBUG
10410  if (TEST_OPT_DEBUG)
10411  {
10412 // PrintS("enterOnePairShift(q,p) invoked with q = ");
10413 // wrp(q); // wrp(pHead(q));
10414 // PrintS(", p = ");
10415 // wrp(p); //wrp(pHead(p));
10416 // PrintLn();
10417  }
10418 #endif
10419 
10420  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
10421 
10422  int qfromQ = qisFromQ;
10423 
10424  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
10425 
10426  int l,j,compare;
10427  LObject Lp;
10428  Lp.i_r = -1;
10429 
10430 #ifdef KDEBUG
10431  Lp.ecart=0; Lp.length=0;
10432 #endif
10433  /*- computes the lcm(s[i],p) -*/
10434  Lp.lcm = pInit();
10435 
10436  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
10437  pSetm(Lp.lcm);
10438 
10439  /* apply the V criterion */
10440  if (!isInV(Lp.lcm, lV))
10441  {
10442 #ifdef KDEBUG
10443  if (TEST_OPT_DEBUG)
10444  {
10445  PrintS("V crit applied to q = ");
10446  wrp(q); // wrp(pHead(q));
10447  PrintS(", p = ");
10448  wrp(p); //wrp(pHead(p));
10449  PrintLn();
10450  }
10451 #endif
10452  pLmFree(Lp.lcm);
10453  Lp.lcm=NULL;
10454  /* + counter for applying the V criterion */
10455  strat->cv++;
10456  return;
10457  }
10458 
10459  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
10460  {
10461  if((!((ecartq>0)&&(ecart>0)))
10462  && pHasNotCF(p,q))
10463  {
10464  /*
10465  *the product criterion has applied for (s,p),
10466  *i.e. lcm(s,p)=product of the leading terms of s and p.
10467  *Suppose (s,r) is in L and the leading term
10468  *of p divides lcm(s,r)
10469  *(==> the leading term of p divides the leading term of r)
10470  *but the leading term of s does not divide the leading term of r
10471  *(notice that this condition is automatically satisfied if r is still
10472  *in S), then (s,r) can be cancelled.
10473  *This should be done here because the
10474  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
10475  *
10476  *Moreover, skipping (s,r) holds also for the noncommutative case.
10477  */
10478  strat->cp++;
10479  pLmFree(Lp.lcm);
10480  Lp.lcm=NULL;
10481  return;
10482  }
10483  else
10484  Lp.ecart = si_max(ecart,ecartq);
10485  if (strat->fromT && (ecartq>ecart))
10486  {
10487  pLmFree(Lp.lcm);
10488  Lp.lcm=NULL;
10489  return;
10490  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
10491  }
10492  /*
10493  *the set B collects the pairs of type (S[j],p)
10494  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
10495  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
10496  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
10497  */
10498  {
10499  j = strat->Bl;
10500  loop
10501  {
10502  if (j < 0) break;
10503  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
10504  if ((compare==1)
10505  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
10506  {
10507  strat->c3++;
10508  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
10509  {
10510  pLmFree(Lp.lcm);
10511  return;
10512  }
10513  break;
10514  }
10515  else
10516  if ((compare ==-1)
10517  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
10518  {
10519  deleteInL(strat->B,&strat->Bl,j,strat);
10520  strat->c3++;
10521  }
10522  j--;
10523  }
10524  }
10525  }
10526  else /*sugarcrit*/
10527  {
10528  if (ALLOW_PROD_CRIT(strat))
10529  {
10530  // if currRing->nc_type!=quasi (or skew)
10531  // TODO: enable productCrit for super commutative algebras...
10532  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
10533  pHasNotCF(p,q))
10534  {
10535  /*
10536  *the product criterion has applied for (s,p),
10537  *i.e. lcm(s,p)=product of the leading terms of s and p.
10538  *Suppose (s,r) is in L and the leading term
10539  *of p devides lcm(s,r)
10540  *(==> the leading term of p devides the leading term of r)
10541  *but the leading term of s does not devide the leading term of r
10542  *(notice that tis condition is automatically satisfied if r is still
10543  *in S), then (s,r) can be canceled.
10544  *This should be done here because the
10545  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
10546  */
10547  strat->cp++;
10548  pLmFree(Lp.lcm);
10549  Lp.lcm=NULL;
10550  return;
10551  }
10552  if (strat->fromT && (ecartq>ecart))
10553  {
10554  pLmFree(Lp.lcm);
10555  Lp.lcm=NULL;
10556  return;
10557  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
10558  }
10559  /*
10560  *the set B collects the pairs of type (S[j],p)
10561  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
10562  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
10563  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
10564  */
10565  for(j = strat->Bl;j>=0;j--)
10566  {
10567  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
10568  if (compare==1)
10569  {
10570  strat->c3++;
10571  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
10572  {
10573  pLmFree(Lp.lcm);
10574  return;
10575  }
10576  break;
10577  }
10578  else
10579  if (compare ==-1)
10580  {
10581  deleteInL(strat->B,&strat->Bl,j,strat);
10582  strat->c3++;
10583  }
10584  }
10585  }
10586  }
10587  /*
10588  *the pair (S[i],p) enters B if the spoly != 0
10589  */
10590  /*- compute the short s-polynomial -*/
10591  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
10592  pNorm(p);
10593  if ((q==NULL) || (p==NULL))
10594  return;
10595  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
10596  Lp.p=NULL;
10597  else
10598  {
10599 // if ( rIsPluralRing(currRing) )
10600 // {
10601 // if(pHasNotCF(p, q))
10602 // {
10603 // if(ncRingType(currRing) == nc_lie)
10604 // {
10605 // // generalized prod-crit for lie-type
10606 // strat->cp++;
10607 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
10608 // }
10609 // else
10610 // if( ALLOW_PROD_CRIT(strat) )
10611 // {
10612 // // product criterion for homogeneous case in SCA
10613 // strat->cp++;
10614 // Lp.p = NULL;
10615 // }
10616 // else
10617 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
10618 // }
10619 // else Lp.p = nc_CreateSpoly(q,p,currRing);
10620 // }
10621 // else
10622 // {
10623 
10624  /* ksCreateShortSpoly needs two Lobject-kind presentations */
10625  /* p is already in this form, so convert q */
10626  // q = pMove2CurrTail(q, strat);
10627  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
10628  // }
10629  }
10630  if (Lp.p == NULL)
10631  {
10632  /*- the case that the s-poly is 0 -*/
10633  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
10634 // if (strat->pairtest==NULL) initPairtest(strat);
10635 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
10636 // strat->pairtest[strat->sl+1] = TRUE;
10637  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
10638  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
10639  /*
10640  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
10641  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
10642  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
10643  *term of p devides the lcm(s,r)
10644  *(this canceling should be done here because
10645  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
10646  *the first case is handeled in chainCrit
10647  */
10648  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
10649  }
10650  else
10651  {
10652  /*- the pair (S[i],p) enters B -*/
10653  /* both of them should have their LM in currRing and TAIL in tailring */
10654  Lp.p1 = q; // already in the needed form
10655  Lp.p2 = p; // already in the needed form
10656 
10657  if ( !rIsPluralRing(currRing) )
10658  pNext(Lp.p) = strat->tail;
10659 
10660  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
10661  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
10662  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
10663  {
10664  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
10665  Lp.i_r2 = atR;
10666  }
10667  else
10668  {
10669  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
10670  Lp.i_r1 = -1;
10671  Lp.i_r2 = -1;
10672  }
10673  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
10674 
10676  {
10677  if (!rIsPluralRing(currRing))
10678  nDelete(&(Lp.p->coef));
10679  }
10680 
10681  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
10682  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
10683  }
10684 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:241
void PrintLn()
Definition: reporter.cc:327
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:617
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
int cv
Definition: kutil.h:359
int Bl
Definition: kutil.h:350
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
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:1111
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:566
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
void PrintS(const char *s)
Definition: reporter.cc:294
int isInV(poly p, int lV)
Definition: shiftgb.cc:378
poly tail
Definition: kutil.h:332
BOOLEAN sugarCrit
Definition: kutil.h:367
#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:334
#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:385
void wrp(poly p)
Definition: polys.h:281
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1168
int l
Definition: cfEzgcd.cc:94
void enterOnePairSig ( int  i,
poly  p,
poly  pSig,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)
BOOLEAN enterOneStrongPoly ( int  i,
poly  p,
int  ,
int  ,
kStrategy  strat,
int  atR = -1,
bool  enterTstrong = FALSE 
)

Definition at line 1395 of file kutil.cc.

1396 {
1397  number d, s, t;
1398  assume(atR >= 0);
1399  poly m1, m2, gcd,si;
1400  if(!enterTstrong)
1401  {
1402  assume(i<=strat->sl);
1403  si = strat->S[i];
1404  }
1405  else
1406  {
1407  assume(i<=strat->tl);
1408  si = strat->T[i].p;
1409  }
1410  //printf("\n--------------------------------\n");
1411  //pWrite(p);pWrite(si);
1412  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1413 
1414  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1415  {
1416  nDelete(&d);
1417  nDelete(&s);
1418  nDelete(&t);
1419  return FALSE;
1420  }
1421 
1422  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1423  //p_Test(m1,strat->tailRing);
1424  //p_Test(m2,strat->tailRing);
1425  /*if(!enterTstrong)
1426  {
1427  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1428  {
1429  memset(&(strat->P), 0, sizeof(strat->P));
1430  kStratChangeTailRing(strat);
1431  strat->P = *(strat->R[atR]);
1432  p_LmFree(m1, strat->tailRing);
1433  p_LmFree(m2, strat->tailRing);
1434  p_LmFree(gcd, currRing);
1435  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1436  }
1437  }*/
1438  pSetCoeff0(m1, s);
1439  pSetCoeff0(m2, t);
1440  pSetCoeff0(gcd, d);
1441  p_Test(m1,strat->tailRing);
1442  p_Test(m2,strat->tailRing);
1443  //printf("\n===================================\n");
1444  //pWrite(m1);pWrite(m2);pWrite(gcd);
1445 #ifdef KDEBUG
1446  if (TEST_OPT_DEBUG)
1447  {
1448  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1449  PrintS("m1 = ");
1450  p_wrp(m1, strat->tailRing);
1451  PrintS(" ; m2 = ");
1452  p_wrp(m2, strat->tailRing);
1453  PrintS(" ; gcd = ");
1454  wrp(gcd);
1455  PrintS("\n--- create strong gcd poly: ");
1456  Print("\n p: %d", i);
1457  wrp(p);
1458  Print("\n strat->S[%d]: ", i);
1459  wrp(si);
1460  PrintS(" ---> ");
1461  }
1462 #endif
1463 
1464  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1465  p_LmDelete(m1, strat->tailRing);
1466  p_LmDelete(m2, strat->tailRing);
1467 #ifdef KDEBUG
1468  if (TEST_OPT_DEBUG)
1469  {
1470  wrp(gcd);
1471  PrintLn();
1472  }
1473 #endif
1474 
1475  LObject h;
1476  h.p = gcd;
1477  h.tailRing = strat->tailRing;
1478  int posx;
1479  h.pCleardenom();
1480  strat->initEcart(&h);
1481  h.sev = pGetShortExpVector(h.p);
1482  h.i_r1 = -1;h.i_r2 = -1;
1483  if (currRing!=strat->tailRing)
1484  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1485  if(!enterTstrong)
1486  {
1487  #if 1
1488  h.p1 = p;h.p2 = strat->S[i];
1489  #endif
1490  if (atR >= 0)
1491  {
1492  h.i_r2 = strat->S_2_R[i];
1493  h.i_r1 = atR;
1494  }
1495  else
1496  {
1497  h.i_r1 = -1;
1498  h.i_r2 = -1;
1499  }
1500  if (strat->Ll==-1)
1501  posx =0;
1502  else
1503  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1504  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1505  }
1506  else
1507  {
1508  if(h.IsNull()) return FALSE;
1509  //int red_result;
1510  //reduzieren ist teur!!!
1511  //if(strat->L != NULL)
1512  //red_result = strat->red(&h,strat);
1513  if(!h.IsNull())
1514  {
1515  enterT(h, strat,-1);
1516  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1517  //strat->enterS(h,pos,strat,-1);
1518  }
1519  }
1520  //#if 1
1521  #if ADIDEBUG
1522  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1523  #endif
1524  return TRUE;
1525 }
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:327
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
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:962
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
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:7807
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:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:692
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:1007
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
static Poly * h
Definition: janet.cc:978
void enterpairs ( poly  h,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3984 of file kutil.cc.

3985 {
3986  int j=pos;
3987 
3988 #ifdef HAVE_RINGS
3990 #endif
3991  //#if ADIDEBUG
3992  #if 0
3993  Print("\n Vor initenterpairs: The new pair list L -- after superenterpairs in loop\n");
3994  for(int iii=0;iii<=strat->Ll;iii++)
3995  {
3996  printf("\n L[%d]:\n",iii);
3997  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3998  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3999  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
4000  }
4001  #endif
4002 
4003  initenterpairs(h,k,ecart,0,strat, atR);
4004 
4005  //#if ADIDEBUG
4006  #if 0
4007  Print("\n Nach initenterpairs: The new pair list L -- after superenterpairs in loop \n");
4008  for(int iii=0;iii<=strat->Ll;iii++)
4009  {
4010  printf("\n L[%d]:\n",iii);
4011  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
4012  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
4013  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
4014  }
4015  #endif
4016 
4017  if ( (!strat->fromT)
4018  && ((strat->syzComp==0)
4019  ||(pGetComp(h)<=strat->syzComp)))
4020  {
4021  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4022  unsigned long h_sev = pGetShortExpVector(h);
4023  loop
4024  {
4025  if (j > k) break;
4026  clearS(h,h_sev, &j,&k,strat);
4027  j++;
4028  }
4029  //Print("end clearS sl=%d\n",strat->sl);
4030  }
4031  // PrintS("end enterpairs\n");
4032 }
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3028
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:12
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
ring tailRing
Definition: kutil.h:341
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
static Poly * h
Definition: janet.cc:978
void enterpairsShift ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 10692 of file kutil.cc.

10693 {
10694  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
10695  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
10696  int j=pos;
10697 
10698 #ifdef HAVE_RINGS
10700 #endif
10701  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
10702  if ( (!strat->fromT)
10703  && ((strat->syzComp==0)
10704  ||(pGetComp(h)<=strat->syzComp)))
10705  {
10706  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
10707  unsigned long h_sev = pGetShortExpVector(h);
10708  loop
10709  {
10710  if (j > k) break;
10711  clearS(h,h_sev, &j,&k,strat);
10712  j++;
10713  }
10714  //Print("end clearS sl=%d\n",strat->sl);
10715  }
10716  // PrintS("end enterpairs\n");
10717 }
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:10726
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void enterpairsSig ( poly  h,
poly  hSig,
int  from,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4040 of file kutil.cc.

4041 {
4042 int j=pos;
4043 
4044 #ifdef HAVE_RINGS
4046 #endif
4047 
4048 initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4049 if ( (!strat->fromT)
4050 && ((strat->syzComp==0)
4051  ||(pGetComp(h)<=strat->syzComp)))
4052 {
4053  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4054  unsigned long h_sev = pGetShortExpVector(h);
4055  loop
4056  {
4057  if (j > k) break;
4058  clearS(h,h_sev, &j,&k,strat);
4059  j++;
4060  }
4061  //Print("end clearS sl=%d\n",strat->sl);
4062 }
4063 // PrintS("end enterpairs\n");
4064 }
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:3097
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:12
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void enterSBba ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 7573 of file kutil.cc.

7574 {
7575  strat->news = TRUE;
7576  /*- puts p to the standardbasis s at position at -*/
7577  if (strat->sl == IDELEMS(strat->Shdl)-1)
7578  {
7579  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7580  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7581  (IDELEMS(strat->Shdl)+setmaxTinc)
7582  *sizeof(unsigned long));
7583  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7584  IDELEMS(strat->Shdl)*sizeof(int),
7585  (IDELEMS(strat->Shdl)+setmaxTinc)
7586  *sizeof(int));
7587  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7588  IDELEMS(strat->Shdl)*sizeof(int),
7589  (IDELEMS(strat->Shdl)+setmaxTinc)
7590  *sizeof(int));
7591  if (strat->lenS!=NULL)
7592  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7593  IDELEMS(strat->Shdl)*sizeof(int),
7594  (IDELEMS(strat->Shdl)+setmaxTinc)
7595  *sizeof(int));
7596  if (strat->lenSw!=NULL)
7597  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7598  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7599  (IDELEMS(strat->Shdl)+setmaxTinc)
7600  *sizeof(wlen_type));
7601  if (strat->fromQ!=NULL)
7602  {
7603  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7604  IDELEMS(strat->Shdl)*sizeof(int),
7605  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7606  }
7607  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7608  IDELEMS(strat->Shdl)+=setmaxTinc;
7609  strat->Shdl->m=strat->S;
7610  }
7611  if (atS <= strat->sl)
7612  {
7613 #ifdef ENTER_USE_MEMMOVE
7614 // #if 0
7615  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7616  (strat->sl - atS + 1)*sizeof(poly));
7617  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7618  (strat->sl - atS + 1)*sizeof(int));
7619  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7620  (strat->sl - atS + 1)*sizeof(unsigned long));
7621  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7622  (strat->sl - atS + 1)*sizeof(int));
7623  if (strat->lenS!=NULL)
7624  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7625  (strat->sl - atS + 1)*sizeof(int));
7626  if (strat->lenSw!=NULL)
7627  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7628  (strat->sl - atS + 1)*sizeof(wlen_type));
7629 #else
7630  for (i=strat->sl+1; i>=atS+1; i--)
7631  {
7632  strat->S[i] = strat->S[i-1];
7633  strat->ecartS[i] = strat->ecartS[i-1];
7634  strat->sevS[i] = strat->sevS[i-1];
7635  strat->S_2_R[i] = strat->S_2_R[i-1];
7636  }
7637  if (strat->lenS!=NULL)
7638  for (i=strat->sl+1; i>=atS+1; i--)
7639  strat->lenS[i] = strat->lenS[i-1];
7640  if (strat->lenSw!=NULL)
7641  for (i=strat->sl+1; i>=atS+1; i--)
7642  strat->lenSw[i] = strat->lenSw[i-1];
7643 #endif
7644  }
7645  if (strat->fromQ!=NULL)
7646  {
7647 #ifdef ENTER_USE_MEMMOVE
7648  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7649  (strat->sl - atS + 1)*sizeof(int));
7650 #else
7651  for (i=strat->sl+1; i>=atS+1; i--)
7652  {
7653  strat->fromQ[i] = strat->fromQ[i-1];
7654  }
7655 #endif
7656  strat->fromQ[atS]=0;
7657  }
7658 
7659  /*- save result -*/
7660  strat->S[atS] = p.p;
7661  if (strat->honey) strat->ecartS[atS] = p.ecart;
7662  if (p.sev == 0)
7663  p.sev = pGetShortExpVector(p.p);
7664  else
7665  assume(p.sev == pGetShortExpVector(p.p));
7666  strat->sevS[atS] = p.sev;
7667  strat->ecartS[atS] = p.ecart;
7668  strat->S_2_R[atS] = atR;
7669  strat->sl++;
7670 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:367
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:390
#define TRUE
Definition: auxiliary.h:144
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
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:140
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:3540
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
void entersets ( LObject  h)
void enterSSba ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 7676 of file kutil.cc.

7677 {
7678  strat->news = TRUE;
7679  /*- puts p to the standardbasis s at position at -*/
7680  if (strat->sl == IDELEMS(strat->Shdl)-1)
7681  {
7682  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7683  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7684  (IDELEMS(strat->Shdl)+setmaxTinc)
7685  *sizeof(unsigned long));
7686  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
7687  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7688  (IDELEMS(strat->Shdl)+setmaxTinc)
7689  *sizeof(unsigned long));
7690  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7691  IDELEMS(strat->Shdl)*sizeof(int),
7692  (IDELEMS(strat->Shdl)+setmaxTinc)
7693  *sizeof(int));
7694  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7695  IDELEMS(strat->Shdl)*sizeof(int),
7696  (IDELEMS(strat->Shdl)+setmaxTinc)
7697  *sizeof(int));
7698  if (strat->lenS!=NULL)
7699  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7700  IDELEMS(strat->Shdl)*sizeof(int),
7701  (IDELEMS(strat->Shdl)+setmaxTinc)
7702  *sizeof(int));
7703  if (strat->lenSw!=NULL)
7704  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7705  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7706  (IDELEMS(strat->Shdl)+setmaxTinc)
7707  *sizeof(wlen_type));
7708  if (strat->fromQ!=NULL)
7709  {
7710  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7711  IDELEMS(strat->Shdl)*sizeof(int),
7712  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7713  }
7714  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7715  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
7716  IDELEMS(strat->Shdl)+=setmaxTinc;
7717  strat->Shdl->m=strat->S;
7718  }
7719  // in a signature-based algorithm the following situation will never
7720  // appear due to the fact that the critical pairs are already sorted
7721  // by increasing signature.
7722  if (atS <= strat->sl)
7723  {
7724 #ifdef ENTER_USE_MEMMOVE
7725 // #if 0
7726  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7727  (strat->sl - atS + 1)*sizeof(poly));
7728  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7729  (strat->sl - atS + 1)*sizeof(int));
7730  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7731  (strat->sl - atS + 1)*sizeof(unsigned long));
7732  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7733  (strat->sl - atS + 1)*sizeof(int));
7734  if (strat->lenS!=NULL)
7735  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7736  (strat->sl - atS + 1)*sizeof(int));
7737  if (strat->lenSw!=NULL)
7738  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7739  (strat->sl - atS + 1)*sizeof(wlen_type));
7740 #else
7741  for (i=strat->sl+1; i>=atS+1; i--)
7742  {
7743  strat->S[i] = strat->S[i-1];
7744  strat->ecartS[i] = strat->ecartS[i-1];
7745  strat->sevS[i] = strat->sevS[i-1];
7746  strat->S_2_R[i] = strat->S_2_R[i-1];
7747  }
7748  if (strat->lenS!=NULL)
7749  for (i=strat->sl+1; i>=atS+1; i--)
7750  strat->lenS[i] = strat->lenS[i-1];
7751  if (strat->lenSw!=NULL)
7752  for (i=strat->sl+1; i>=atS+1; i--)
7753  strat->lenSw[i] = strat->lenSw[i-1];
7754 #endif
7755  }
7756  if (strat->fromQ!=NULL)
7757  {
7758 #ifdef ENTER_USE_MEMMOVE
7759  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7760  (strat->sl - atS + 1)*sizeof(int));
7761 #else
7762  for (i=strat->sl+1; i>=atS+1; i--)
7763  {
7764  strat->fromQ[i] = strat->fromQ[i-1];
7765  }
7766 #endif
7767  strat->fromQ[atS]=0;
7768  }
7769 
7770  /*- save result -*/
7771  strat->S[atS] = p.p;
7772  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
7773  if (strat->honey) strat->ecartS[atS] = p.ecart;
7774  if (p.sev == 0)
7775  p.sev = pGetShortExpVector(p.p);
7776  else
7777  assume(p.sev == pGetShortExpVector(p.p));
7778  strat->sevS[atS] = p.sev;
7779  // during the interreduction process of a signature-based algorithm we do not
7780  // compute the signature at this point, but when the whole interreduction
7781  // process finishes, i.e. f5c terminates!
7782  if (p.sig != NULL)
7783  {
7784  if (p.sevSig == 0)
7785  p.sevSig = pGetShortExpVector(p.sig);
7786  else
7787  assume(p.sevSig == pGetShortExpVector(p.sig));
7788  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
7789  }
7790  strat->ecartS[atS] = p.ecart;
7791  strat->S_2_R[atS] = atR;
7792  strat->sl++;
7793 #ifdef DEBUGF5
7794  int k;
7795  Print("--- LIST S: %d ---\n",strat->sl);
7796  for(k=0;k<=strat->sl;k++)
7797  {
7798  pWrite(strat->sig[k]);
7799  }
7800  Print("--- LIST S END ---\n");
7801 #endif
7802 }
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:367
#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:390
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
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:140
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:3540
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
void enterSyz ( LObject p,
kStrategy  strat,
int  atT 
)

Definition at line 8003 of file kutil.cc.

8004 {
8005  int i;
8006  strat->newt = TRUE;
8007  if (strat->syzl == strat->syzmax-1)
8008  {
8009  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
8010  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
8011  (strat->syzmax)*sizeof(unsigned long),
8012  ((strat->syzmax)+setmaxTinc)
8013  *sizeof(unsigned long));
8014  strat->syzmax += setmaxTinc;
8015  }
8016  if (atT < strat->syzl)
8017  {
8018 #ifdef ENTER_USE_MEMMOVE
8019  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
8020  (strat->syzl-atT+1)*sizeof(poly));
8021  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
8022  (strat->syzl-atT+1)*sizeof(unsigned long));
8023 #endif
8024  for (i=strat->syzl; i>=atT+1; i--)
8025  {
8026 #ifndef ENTER_USE_MEMMOVE
8027  strat->syz[i] = strat->syz[i-1];
8028  strat->sevSyz[i] = strat->sevSyz[i-1];
8029 #endif
8030  }
8031  }
8032  //i = strat->syzl;
8033  i = atT;
8034  strat->syz[atT] = p.sig;
8035  strat->sevSyz[atT] = p.sevSig;
8036  strat->syzl++;
8037 #if F5DEBUG
8038  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
8039  pWrite(strat->syz[atT]);
8040 #endif
8041  // recheck pairs in strat->L with new rule and delete correspondingly
8042  int cc = strat->Ll;
8043  while (cc>-1)
8044  {
8045  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
8046  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing))
8047  {
8048  deleteInL(strat->L,&strat->Ll,cc,strat);
8049  }
8050  cc--;
8051  }
8052 //#if 1
8053 #ifdef DEBUGF5
8054  PrintS("--- Syzygies ---\n");
8055  Print("syzl %d\n",strat->syzl);
8056  Print("syzmax %d\n",strat->syzmax);
8057  PrintS("--------------------------------\n");
8058  for(i=0;i<=strat->syzl-1;i++)
8059  {
8060  Print("%d - ",i);
8061  pWrite(strat->syz[i]);
8062  }
8063  PrintS("--------------------------------\n");
8064 #endif
8065 }
#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:391
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:323
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
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
void enterT ( LObject p,
kStrategy  strat,
int  atT = -1 
)

Definition at line 7807 of file kutil.cc.

7808 {
7809  int i;
7810 
7811  pp_Test(p.p, currRing, p.tailRing);
7812  assume(strat->tailRing == p.tailRing);
7813  // redMoraNF complains about this -- but, we don't really
7814  // neeed this so far
7815  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7816  assume(p.FDeg == p.pFDeg());
7817  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7818 
7819 #ifdef KDEBUG
7820  // do not put an LObject twice into T:
7821  for(i=strat->tl;i>=0;i--)
7822  {
7823  if (p.p==strat->T[i].p)
7824  {
7825  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7826  return;
7827  }
7828  }
7829 #endif
7830 
7831 #ifdef HAVE_TAIL_RING
7832  if (currRing!=strat->tailRing)
7833  {
7834  p.t_p=p.GetLmTailRing();
7835  }
7836 #endif
7837  strat->newt = TRUE;
7838  if (atT < 0)
7839  atT = strat->posInT(strat->T, strat->tl, p);
7840  if (strat->tl == strat->tmax-1)
7841  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7842  if (atT <= strat->tl)
7843  {
7844 #ifdef ENTER_USE_MEMMOVE
7845  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7846  (strat->tl-atT+1)*sizeof(TObject));
7847  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7848  (strat->tl-atT+1)*sizeof(unsigned long));
7849 #endif
7850  for (i=strat->tl+1; i>=atT+1; i--)
7851  {
7852 #ifndef ENTER_USE_MEMMOVE
7853  strat->T[i] = strat->T[i-1];
7854  strat->sevT[i] = strat->sevT[i-1];
7855 #endif
7856  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7857  }
7858  }
7859 
7860  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7861  {
7863  (strat->tailRing != NULL ?
7864  strat->tailRing : currRing),
7865  strat->tailBin);
7866  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7867  }
7868  strat->T[atT] = (TObject) p;
7869  #if ADIDEBUG
7870  printf("\nenterT: add in position %i\n",atT);
7871  pWrite(p.p);
7872  #endif
7873  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
7874 
7875  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7876  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7877  else
7878  strat->T[atT].max = NULL;
7879 
7880  strat->tl++;
7881  strat->R[strat->tl] = &(strat->T[atT]);
7882  strat->T[atT].i_r = strat->tl;
7883  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7884  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7885  kTest_T(&(strat->T[atT]));
7886 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
char newt
Definition: kutil.h:391
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:279
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:12
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:484
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#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:876
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
#define kTest_T(T)
Definition: kutil.h:621
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
void enterT_strong ( LObject p,
kStrategy  strat,
int  atT = -1 
)

Definition at line 7891 of file kutil.cc.

7892 {
7893  int i;
7894 
7895  pp_Test(p.p, currRing, p.tailRing);
7896  assume(strat->tailRing == p.tailRing);
7897  // redMoraNF complains about this -- but, we don't really
7898  // neeed this so far
7899  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7900  assume(p.FDeg == p.pFDeg());
7901  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7902 
7903 #ifdef KDEBUG
7904  // do not put an LObject twice into T:
7905  for(i=strat->tl;i>=0;i--)
7906  {
7907  if (p.p==strat->T[i].p)
7908  {
7909  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7910  return;
7911  }
7912  }
7913 #endif
7914 
7915 #ifdef HAVE_TAIL_RING
7916  if (currRing!=strat->tailRing)
7917  {
7918  p.t_p=p.GetLmTailRing();
7919  }
7920 #endif
7921  strat->newt = TRUE;
7922  if (atT < 0)
7923  atT = strat->posInT(strat->T, strat->tl, p);
7924  if (strat->tl == strat->tmax-1)
7925  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7926  if (atT <= strat->tl)
7927  {
7928 #ifdef ENTER_USE_MEMMOVE
7929  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7930  (strat->tl-atT+1)*sizeof(TObject));
7931  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7932  (strat->tl-atT+1)*sizeof(unsigned long));
7933 #endif
7934  for (i=strat->tl+1; i>=atT+1; i--)
7935  {
7936 #ifndef ENTER_USE_MEMMOVE
7937  strat->T[i] = strat->T[i-1];
7938  strat->sevT[i] = strat->sevT[i-1];
7939 #endif
7940  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7941  }
7942  }
7943 
7944  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7945  {
7947  (strat->tailRing != NULL ?
7948  strat->tailRing : currRing),
7949  strat->tailBin);
7950  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7951  }
7952  strat->T[atT] = (TObject) p;
7953  #if ADIDEBUG
7954  printf("\nenterT_strong: add in position %i\n",atT);
7955  pWrite(p.p);
7956  #endif
7957  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
7958 
7959  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7960  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7961  else
7962  strat->T[atT].max = NULL;
7963 
7964  strat->tl++;
7965  strat->R[strat->tl] = &(strat->T[atT]);
7966  strat->T[atT].i_r = strat->tl;
7967  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7968  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7969  #if 1
7970  #ifdef HAVE_RINGS
7972  {
7973  #if ADIDEBUG
7974  printf("\nDas ist p:\n");pWrite(p.p);
7975  #endif
7976  for(i=strat->tl;i>=0;i--)
7977  {
7978  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
7979  {
7980  #if ADIDEBUG
7981  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
7982  #endif
7983  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
7984  }
7985  }
7986  }
7987  /*
7988  printf("\nThis is T:\n");
7989  for(i=strat->tl;i>=0;i--)
7990  {
7991  pWrite(strat->T[i].p);
7992  }
7993  //getchar();*/
7994  #endif
7995  #endif
7996  kTest_T(&(strat->T[atT]));
7997 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:516
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
char newt
Definition: kutil.h:391
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:279
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
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:12
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:484
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#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:876
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:437
#define NULL
Definition: omList.c:10
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1395
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:621
class sTObject TObject
Definition: kutil.h:59
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
void enterTShift ( LObject  p,
kStrategy  strat,
int  atT,
int  uptodeg,
int  lV 
)

Definition at line 10799 of file kutil.cc.

10800 {
10801  /* determine how many elements we have to insert */
10802  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
10803  /* hence, a total number of elt's to add is: */
10804  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
10805 
10806  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
10807 
10808 #ifdef PDEBUG
10809  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
10810 #endif
10811  int i;
10812 
10813  if (atT < 0)
10814  atT = strat->posInT(strat->T, strat->tl, p);
10815 
10816  /* can call enterT in a sequence, e.g. */
10817 
10818  /* shift0 = it's our model for further shifts */
10819  enterT(p,strat,atT);
10820  LObject qq;
10821  for (i=1; i<=toInsert; i++) // toIns - 1?
10822  {
10823  qq = p; //qq.Copy();
10824  qq.p = NULL;
10825  qq.max = NULL;
10826  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
10827  qq.GetP();
10828  // update q.sev
10829  qq.sev = pGetShortExpVector(qq.p);
10830  /* enter it into T, first el't is with the shift 0 */
10831  // compute the position for qq
10832  atT = strat->posInT(strat->T, strat->tl, qq);
10833  enterT(qq,strat,atT);
10834  }
10835 /* Q: what to do with this one in the orig enterT ? */
10836 /* strat->R[strat->tl] = &(strat->T[atT]); */
10837 /* Solution: it is done by enterT each time separately */
10838 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
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:811
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:74
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
void exitBuchMora ( kStrategy  strat)

Definition at line 8415 of file kutil.cc.

8416 {
8417  /*- release temp data -*/
8418  cleanT(strat);
8419  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8420  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8421  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8422  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8423  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8424  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8425  /*- set L: should be empty -*/
8426  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8427  /*- set B: should be empty -*/
8428  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8429  pLmDelete(&strat->tail);
8430  strat->syzComp=0;
8431 }
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:161
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:505
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
void exitSba ( kStrategy  strat)

Definition at line 8610 of file kutil.cc.

8611 {
8612  /*- release temp data -*/
8613  cleanT(strat);
8614  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8615  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8616  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8617  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8618  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8619  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8620  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
8621  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8622  if (strat->sbaOrder == 1)
8623  {
8624  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8625  }
8626  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8627  /*- set L: should be empty -*/
8628  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8629  /*- set B: should be empty -*/
8630  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8631  /*- set sig: no need for the signatures anymore -*/
8632  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
8633  pLmDelete(&strat->tail);
8634  strat->syzComp=0;
8635 }
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
#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:161
int Bmax
Definition: kutil.h:350
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
void cleanT(kStrategy strat)
Definition: kutil.cc:505
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
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 2755 of file kstd2.cc.

2758 {
2759  int Ll_old, red_result = 1;
2760  int pos = 0;
2761  hilbeledeg=1;
2762  hilbcount=0;
2763  minimcnt=0;
2764  srmax = 0; // strat->sl is 0 at this point
2765  reduc = olddeg = lrmax = 0;
2766  // we cannot use strat->T anymore
2767  //cleanT(strat);
2768  //strat->tl = -1;
2769  Ll_old = strat->Ll;
2770  while (strat->tl >= 0)
2771  {
2772  if(!strat->T[strat->tl].is_redundant)
2773  {
2774  LObject h;
2775  h.p = strat->T[strat->tl].p;
2776  h.tailRing = strat->T[strat->tl].tailRing;
2777  h.t_p = strat->T[strat->tl].t_p;
2778  if (h.p!=NULL)
2779  {
2780  if (currRing->OrdSgn==-1)
2781  {
2782  cancelunit(&h);
2783  deleteHC(&h, strat);
2784  }
2785  if (h.p!=NULL)
2786  {
2788  {
2789  //pContent(h.p);
2790  h.pCleardenom(); // also does a pContent
2791  }
2792  else
2793  {
2794  h.pNorm();
2795  }
2796  strat->initEcart(&h);
2797  pos = strat->Ll+1;
2798  h.sev = pGetShortExpVector(h.p);
2799  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
2800  }
2801  }
2802  }
2803  strat->tl--;
2804  }
2805  strat->sl = -1;
2806 #if 0
2807 //#ifdef HAVE_TAIL_RING
2808  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2809  kStratInitChangeTailRing(strat);
2810 #endif
2811  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
2812  //strat->sl = -1;
2813  /* picks the last element from the lazyset L */
2814  while (strat->Ll>Ll_old)
2815  {
2816  strat->P = strat->L[strat->Ll];
2817  strat->Ll--;
2818 //#if 1
2819 #ifdef DEBUGF5
2820  Print("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
2821  Print("-------------------------------------------------\n");
2822  pWrite(pHead(strat->P.p));
2823  pWrite(pHead(strat->P.p1));
2824  pWrite(pHead(strat->P.p2));
2825  printf("%d\n",strat->tl);
2826  Print("-------------------------------------------------\n");
2827 #endif
2828  if (pNext(strat->P.p) == strat->tail)
2829  {
2830  // deletes the short spoly
2831 #ifdef HAVE_RINGS
2832  if (rField_is_Ring(currRing))
2833  pLmDelete(strat->P.p);
2834  else
2835 #endif
2836  pLmFree(strat->P.p);
2837 
2838  // TODO: needs some masking
2839  // TODO: masking needs to vanish once the signature
2840  // sutff is completely implemented
2841  strat->P.p = NULL;
2842  poly m1 = NULL, m2 = NULL;
2843 
2844  // check that spoly creation is ok
2845  while (strat->tailRing != currRing &&
2846  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2847  {
2848  assume(m1 == NULL && m2 == NULL);
2849  // if not, change to a ring where exponents are at least
2850  // large enough
2851  if (!kStratChangeTailRing(strat))
2852  {
2853  WerrorS("OVERFLOW...");
2854  break;
2855  }
2856  }
2857  // create the real one
2858  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2859  strat->tailRing, m1, m2, strat->R);
2860  }
2861  else if (strat->P.p1 == NULL)
2862  {
2863  if (strat->minim > 0)
2864  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2865  // for input polys, prepare reduction
2866  strat->P.PrepareRed(strat->use_buckets);
2867  }
2868 
2869  if (strat->P.p == NULL && strat->P.t_p == NULL)
2870  {
2871  red_result = 0;
2872  }
2873  else
2874  {
2875  if (TEST_OPT_PROT)
2876  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2877  &olddeg,&reduc,strat, red_result);
2878 
2879 #ifdef DEBUGF5
2880  Print("Poly before red: ");
2881  pWrite(strat->P.p);
2882 #endif
2883  /* complete reduction of the element chosen from L */
2884  red_result = strat->red2(&strat->P,strat);
2885  if (errorreported) break;
2886  }
2887 
2888  if (strat->overflow)
2889  {
2890  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
2891  }
2892 
2893  // reduction to non-zero new poly
2894  if (red_result == 1)
2895  {
2896  // get the polynomial (canonicalize bucket, make sure P.p is set)
2897  strat->P.GetP(strat->lmBin);
2898  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2899  // but now, for entering S, T, we reset it
2900  // in the inhomogeneous case: FDeg == pFDeg
2901  if (strat->homog) strat->initEcart(&(strat->P));
2902 
2903  /* statistic */
2904  if (TEST_OPT_PROT) PrintS("s");
2905 
2906  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2907 
2908 #ifdef KDEBUG
2909 #if MYTEST
2910  PrintS("New S: "); pDebugPrint(strat->P.p); PrintLn();
2911 #endif /* MYTEST */
2912 #endif /* KDEBUG */
2913 
2914  // reduce the tail and normalize poly
2915  // in the ring case we cannot expect LC(f) = 1,
2916  // therefore we call pContent instead of pNorm
2917 #if F5CTAILRED
2918  BOOLEAN withT = TRUE;
2920  {
2921  strat->P.pCleardenom();
2923  {
2924  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2925  strat->P.pCleardenom();
2926  }
2927  }
2928  else
2929  {
2930  strat->P.pNorm();
2932  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2933  }
2934 #endif
2935 #ifdef KDEBUG
2936  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2937 #if MYTEST
2938 //#if 1
2939  PrintS("New (reduced) S: "); pDebugPrint(strat->P.p); PrintLn();
2940 #endif /* MYTEST */
2941 #endif /* KDEBUG */
2942 
2943  // min_std stuff
2944  if ((strat->P.p1==NULL) && (strat->minim>0))
2945  {
2946  if (strat->minim==1)
2947  {
2948  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2949  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2950  }
2951  else
2952  {
2953  strat->M->m[minimcnt]=strat->P.p2;
2954  strat->P.p2=NULL;
2955  }
2956  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2957  pNext(strat->M->m[minimcnt])
2958  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2959  strat->tailRing, currRing,
2960  currRing->PolyBin);
2961  minimcnt++;
2962  }
2963 
2964  // enter into S, L, and T
2965  // here we need to recompute new signatures, but those are trivial ones
2966  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2967  {
2968  enterT(strat->P, strat);
2969  // posInS only depends on the leading term
2970  strat->enterS(strat->P, pos, strat, strat->tl);
2971 //#if 1
2972 #ifdef DEBUGF5
2973  Print("ELEMENT ADDED TO GCURR DURING INTERRED: ");
2974  pWrite(pHead(strat->S[strat->sl]));
2975  pWrite(strat->sig[strat->sl]);
2976 #endif
2977  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2978  }
2979  // Print("[%d]",hilbeledeg);
2980  if (strat->P.lcm!=NULL)
2981 #ifdef HAVE_RINGS
2982  pLmDelete(strat->P.lcm);
2983 #else
2984  pLmFree(strat->P.lcm);
2985 #endif
2986  if (strat->sl>srmax) srmax = strat->sl;
2987  }
2988  else
2989  {
2990  // adds signature of the zero reduction to
2991  // strat->syz. This is the leading term of
2992  // syzygy and can be used in syzCriterion()
2993  // the signature is added if and only if the
2994  // pair was not detected by the rewritten criterion in strat->red = redSig
2995  if (strat->P.p1 == NULL && strat->minim > 0)
2996  {
2997  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2998  }
2999  }
3000 
3001 #ifdef KDEBUG
3002  memset(&(strat->P), 0, sizeof(strat->P));
3003 #endif /* KDEBUG */
3004  }
3005  int cc = 0;
3006  while (cc<strat->tl+1)
3007  {
3008  strat->T[cc].sig = pOne();
3009  p_SetComp(strat->T[cc].sig,cc+1,currRing);
3010  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
3011  strat->sig[cc] = strat->T[cc].sig;
3012  strat->sevSig[cc] = strat->T[cc].sevSig;
3013  strat->T[cc].is_sigsafe = TRUE;
3014  cc++;
3015  }
3016  strat->max_lower_index = strat->tl;
3017  // set current signature index of upcoming iteration step
3018  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
3019  // the corresponding syzygy rules correctly
3020  strat->currIdx = cc+1;
3021  for (int cd=strat->Ll; cd>=0; cd--)
3022  {
3023  p_SetComp(strat->L[cd].sig,cc+1,currRing);
3024  cc++;
3025  }
3026  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
3027  strat->Shdl->m[cc] = NULL;
3028 //#if 1
3029 #if DEBUGF5
3030  Print("------------------- STRAT S ---------------------\n");
3031  cc = 0;
3032  while (cc<strat->tl+1)
3033  {
3034  pWrite(pHead(strat->S[cc]));
3035  pWrite(strat->sig[cc]);
3036  printf("- - - - - -\n");
3037  cc++;
3038  }
3039  Print("-------------------------------------------------\n");
3040  Print("------------------- STRAT T ---------------------\n");
3041  cc = 0;
3042  while (cc<strat->tl+1)
3043  {
3044  pWrite(pHead(strat->T[cc].p));
3045  pWrite(strat->T[cc].sig);
3046  printf("- - - - - -\n");
3047  cc++;
3048  }
3049  Print("-------------------------------------------------\n");
3050  Print("------------------- STRAT L ---------------------\n");
3051  cc = 0;
3052  while (cc<strat->Ll+1)
3053  {
3054  pWrite(pHead(strat->L[cc].p));
3055  pWrite(pHead(strat->L[cc].p1));
3056  pWrite(pHead(strat->L[cc].p2));
3057  pWrite(strat->L[cc].sig);
3058  printf("- - - - - -\n");
3059  cc++;
3060  }
3061  Print("-------------------------------------------------\n");
3062  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
3063 #endif
3064 
3065 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:6274
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:236
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:144
#define TEST_OPT_REDSB
Definition: options.h:99
void pWrite(poly p)
Definition: polys.h:279
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
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:1111
#define Q
Definition: sirandom.c:25
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#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:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:9460
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:379
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
LObject P
Definition: kutil.h:298
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define pOne()
Definition: polys.h:286
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:8990
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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:437
#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:4197
#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:373
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN faugereRewCriterion ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int  start 
)

Definition at line 5746 of file kutil.cc.

5747 {
5748  //printf("Faugere Rewritten Criterion\n");
5749 //#if 1
5750 #ifdef DEBUGF5
5751  PrintS("rewritten criterion checks: ");
5752  pWrite(sig);
5753 #endif
5754  for(int k = strat->sl; k>=start; k--)
5755  {
5756 //#if 1
5757 #ifdef DEBUGF5
5758  Print("checking with: ");
5759  pWrite(strat->sig[k]);
5760  pWrite(pHead(strat->S[k]));
5761 #endif
5762  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
5763  {
5764 //#if 1
5765 #ifdef DEBUGF5
5766  PrintS("DELETE!\n");
5767 #endif
5768  return TRUE;
5769  }
5770  //k--;
5771  }
5772 #ifdef DEBUGF5
5773  Print("ALL ELEMENTS OF S\n----------------------------------------\n");
5774  for(int kk = 0; kk<strat->sl+1; kk++)
5775  {
5776  pWrite(pHead(strat->S[kk]));
5777  }
5778  Print("------------------------------\n");
5779 #endif
5780  return FALSE;
5781 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
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:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
void PrintS(const char *s)
Definition: reporter.cc:294
#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
int sl
Definition: kutil.h:346
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 9290 of file kutil.cc.

9291 {
9292  if(!nCoeff_is_Ring_Z(currRing->cf))
9293  return;
9294  poly p,pp;
9295  for(int j = 0; j<=strat->sl; j++)
9296  {
9297  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
9298  {
9299  for(int i = 0; i<=strat->sl; i++)
9300  {
9301  if((i != j) && (strat->S[i] != NULL))
9302  {
9303  p = strat->S[i];
9304  if(pLmDivisibleBy(strat->S[j], p))
9305  {
9306  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
9307  p_SetCoeff(p,dummy,currRing);
9308  }
9309  pp = pNext(p);
9310  if((pp == NULL) && (nIsZero(p->coef)))
9311  {
9312  deleteInS(i, strat);
9313  }
9314  else
9315  {
9316  while(pp != NULL)
9317  {
9318  if(pLmDivisibleBy(strat->S[j], pp))
9319  {
9320  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
9321  p_SetCoeff(pp,dummy,currRing);
9322  if(nIsZero(pp->coef))
9323  {
9324  pLmDelete(&pNext(p));
9325  pp = pNext(p);
9326  }
9327  else
9328  {
9329  p = pp;
9330  pp = pNext(p);
9331  }
9332  }
9333  else
9334  {
9335  p = pp;
9336  pp = pNext(p);
9337  }
9338  }
9339  }
9340  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
9341  {
9342  if(pNext(strat->S[i]) == NULL)
9343  strat->S[i]=NULL;
9344  else
9345  strat->S[i]=pNext(strat->S[i]);
9346  }
9347  }
9348  }
9349  //idPrint(strat->Shdl);
9350  }
9351  }
9352  //idSkipZeroes(strat->Shdl);
9353 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#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:942
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
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:401
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:12
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
BOOLEAN findMinLMPair ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat,
int  start 
)
ideal freegb ( ideal  I,
int  uptodeg,
int  lVblock 
)

Definition at line 3413 of file kstd2.cc.

3414 {
3415  /* todo main call */
3416 
3417  /* assume: ring is prepared, ideal is copied into shifted ring */
3418  /* uptodeg and lVblock are correct - test them! */
3419 
3420  /* check whether the ideal is in V */
3421 
3422 // if (0)
3423  if (! ideal_isInV(I,lVblock) )
3424  {
3425  WerrorS("The input ideal contains incorrectly encoded elements! ");
3426  return(NULL);
3427  }
3428 
3429  // kStrategy strat = new skStrategy;
3430  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
3431  /* at the moment:
3432 - no quotient (check)
3433 - no *w, no *hilb
3434  */
3435  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
3436  int newIdeal, intvec *vw) */
3437  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
3438  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
3439  idSkipZeroes(RS);
3440  return(RS);
3441 }
int ideal_isInV(ideal I, int lV)
Definition: shiftgb.cc:445
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:2562
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:10
void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 436 of file kutil.cc.

437 {
438  int j,/*k,*/p;
439 
440  strat->kHEdgeFound=FALSE;
441  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
442  {
443  return;
444  }
445  if (strat->ak > 1) /*we are in the module case*/
446  {
447  return; // until ....
448  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
449  // return FALSE;
450  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
451  // return FALSE;
452  }
453  // k = 0;
454  p=pIsPurePower(pp);
455  if (p!=0) strat->NotUsedAxis[p] = FALSE;
456  /*- the leading term of pp is a power of the p-th variable -*/
457  for (j=(currRing->N);j>0; j--)
458  {
459  if (strat->NotUsedAxis[j])
460  {
461  return;
462  }
463  }
464  strat->kHEdgeFound=TRUE;
465 }
#define pIsPurePower(p)
Definition: polys.h:219
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define TRUE
Definition: auxiliary.h:144
int ak
Definition: kutil.h:351
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:12
int j
Definition: myNF.cc:70
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
BOOLEAN kHEdgeFound
Definition: kutil.h:366
BOOLEAN homogTest ( polyset  F,
int  Fmax 
)
long ind2 ( long  arg)

Definition at line 3335 of file kutil.cc.

3336 {
3337  long ind = 0;
3338  if (arg <= 0) return 0;
3339  while (arg%2 == 0)
3340  {
3341  arg = arg / 2;
3342  ind++;
3343  }
3344  return ind;
3345 }
long ind_fact_2 ( long  arg)

Definition at line 3347 of file kutil.cc.

3348 {
3349  long ind = 0;
3350  if (arg <= 0) return 0;
3351  if (arg%2 == 1) { arg--; }
3352  while (arg > 0)
3353  {
3354  ind += ind2(arg);
3355  arg = arg - 2;
3356  }
3357  return ind;
3358 }
long ind2(long arg)
Definition: kutil.cc:3335
void initBba ( kStrategy  strat)

Definition at line 1388 of file kstd1.cc.

1389 {
1390  /* setting global variables ------------------- */
1391  strat->enterS = enterSBba;
1392  strat->red = redHoney;
1393  if (strat->honey)
1394  strat->red = redHoney;
1395  else if (currRing->pLexOrder && !strat->homog)
1396  strat->red = redLazy;
1397  else
1398  {
1399  strat->LazyPass *=4;
1400  strat->red = redHomog;
1401  }
1402 #ifdef HAVE_RINGS //TODO Oliver
1403  if (rField_is_Ring(currRing))
1404  {
1405  strat->red = redRing;
1406  }
1407 #endif
1408  if (currRing->pLexOrder && strat->honey)
1409  strat->initEcart = initEcartNormal;
1410  else
1411  strat->initEcart = initEcartBBA;
1412  if (strat->honey)
1414  else
1416 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1417 // {
1418 // //interred machen Aenderung
1419 // strat->pOrigFDeg=pFDeg;
1420 // strat->pOrigLDeg=pLDeg;
1421 // //h=ggetid("ecart");
1422 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1423 // //{
1424 // // ecartWeights=iv2array(IDINTVEC(h));
1425 // //}
1426 // //else
1427 // {
1428 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1429 // /*uses automatic computation of the ecartWeights to set them*/
1430 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1431 // }
1432 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1433 // if (TEST_OPT_PROT)
1434 // {
1435 // for(i=1; i<=(currRing->N); i++)
1436 // Print(" %d",ecartWeights[i]);
1437 // PrintLn();
1438 // mflush();
1439 // }
1440 // }
1441 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1150
BOOLEAN honey
Definition: kutil.h:367
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:409
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:519
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1117
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:12
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:957
BOOLEAN homog
Definition: kutil.h:362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1157
void initEcartBBA(TObject *h)
Definition: kutil.cc:1143
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:437
void initEcartNormal(TObject *h)
Definition: kutil.cc:1135
int LazyPass
Definition: kutil.h:351
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7573
void initBbaShift ( kStrategy  strat)

Definition at line 3574 of file kstd2.cc.

3575 {
3576  /* setting global variables ------------------- */
3577  strat->enterS = enterSBba; /* remains as is, we change enterT! */
3578 
3579  strat->red = redFirstShift; /* no redHomog ! */
3580 
3581  if (currRing->pLexOrder && strat->honey)
3582  strat->initEcart = initEcartNormal;
3583  else
3584  strat->initEcart = initEcartBBA;
3585  if (strat->honey)
3587  else
3589 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
3590 // {
3591 // //interred machen Aenderung
3592 // pFDegOld=currRing->pFDeg;
3593 // pLDegOld=pLDeg;
3594 // //h=ggetid("ecart");
3595 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
3596 // //{
3597 // // ecartWeights=iv2array(IDINTVEC(h));
3598 // //}
3599 // //else
3600 // {
3601 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
3602 // /*uses automatic computation of the ecartWeights to set them*/
3603 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
3604 // }
3605 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
3606 // if (TEST_OPT_PROT)
3607 // {
3608 // for(int i=1; i<=rVar(currRing); i++)
3609 // Print(" %d",ecartWeights[i]);
3610 // PrintLn();
3611 // mflush();
3612 // }
3613 // }
3614 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1150
BOOLEAN honey
Definition: kutil.h:367
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:3447
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:12
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1157
void initEcartBBA(TObject *h)
Definition: kutil.cc:1143
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
void initEcartNormal(TObject *h)
Definition: kutil.cc:1135
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7573
void initBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 8334 of file kutil.cc.

8335 {
8336  strat->interpt = BTEST1(OPT_INTERRUPT);
8337  strat->kHEdge=NULL;
8339  /*- creating temp data structures------------------- -*/
8340  strat->cp = 0;
8341  strat->c3 = 0;
8342  strat->tail = pInit();
8343  /*- set s -*/
8344  strat->sl = -1;
8345  /*- set L -*/
8346  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8347  strat->Ll = -1;
8348  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8349  /*- set B -*/
8350  strat->Bmax = setmaxL;
8351  strat->Bl = -1;
8352  strat->B = initL();
8353  /*- set T -*/
8354  strat->tl = -1;
8355  strat->tmax = setmaxT;
8356  strat->T = initT();
8357  strat->R = initR();
8358  strat->sevT = initsevT();
8359  /*- init local data struct.---------------------------------------- -*/
8360  strat->P.ecart=0;
8361  strat->P.length=0;
8362  strat->P.pLength=0;
8364  {
8365  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8366  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8367  }
8368  #ifdef HAVE_RINGS
8370  {
8371  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8372  }
8373  else
8374  #endif
8375  {
8376  if(TEST_OPT_SB_1)
8377  {
8378  int i;
8379  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8380  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8381  {
8382  P->m[i-strat->newIdeal] = F->m[i];
8383  F->m[i] = NULL;
8384  }
8385  initSSpecial(F,Q,P,strat);
8386  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8387  {
8388  F->m[i] = P->m[i-strat->newIdeal];
8389  P->m[i-strat->newIdeal] = NULL;
8390  }
8391  idDelete(&P);
8392  }
8393 
8394  else
8395  {
8396  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8397  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8398  }
8399  }
8400  strat->fromT = FALSE;
8402  if ((!TEST_OPT_SB_1)
8403  #ifdef HAVE_RINGS
8404  || (rField_is_Ring(currRing))
8405  #endif
8406  )
8407  {
8408  updateS(TRUE,strat);
8409  }
8410  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8411  strat->fromQ=NULL;
8412  assume(kTest_TS(strat));
8413 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
#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:140
BOOLEAN noTailReduction
Definition: kutil.h:368
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:6482
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
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:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6882
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
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:366
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:437
#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:752
#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:7341
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:411
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
void initBuchMoraCrit ( kStrategy  strat)

Definition at line 8088 of file kutil.cc.

8089 {
8091  strat->chainCrit=chainCritNormal;
8092  if (TEST_OPT_SB_1)
8093  strat->chainCrit=chainCritOpt_1;
8094 #ifdef HAVE_RINGS
8095  if (rField_is_Ring(currRing))
8096  {
8098  strat->chainCrit=chainCritRing;
8099  }
8100 #endif
8101 #ifdef HAVE_RATGRING
8102  if (rIsRatGRing(currRing))
8103  {
8104  strat->chainCrit=chainCritPart;
8105  /* enterOnePairNormal get rational part in it */
8106  }
8107 #endif
8108  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
8109  && (!rIsPluralRing(currRing)))
8111 
8112 
8113  strat->sugarCrit = TEST_OPT_SUGARCRIT;
8114  strat->Gebauer = strat->homog || strat->sugarCrit;
8115  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
8116  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
8117  strat->pairtest = NULL;
8118  /* alway use tailreduction, except:
8119  * - in local rings, - in lex order case, -in ring over extensions */
8121  //if(rHasMixedOrdering(currRing)==2)
8122  //{
8123  // strat->noTailReduction =TRUE;
8124  //}
8125 
8126 #ifdef HAVE_PLURAL
8127  // and r is plural_ring
8128  // hence this holds for r a rational_plural_ring
8129  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
8130  { //or it has non-quasi-comm type... later
8131  strat->sugarCrit = FALSE;
8132  strat->Gebauer = FALSE;
8133  strat->honey = FALSE;
8134  }
8135 #endif
8136 
8137 #ifdef HAVE_RINGS
8138  // Coefficient ring?
8139  if (rField_is_Ring(currRing))
8140  {
8141  strat->sugarCrit = FALSE;
8142  strat->Gebauer = FALSE ;
8143  strat->honey = FALSE;
8144  }
8145 #endif
8146  #ifdef KDEBUG
8147  if (TEST_OPT_DEBUG)
8148  {
8149  if (strat->homog) PrintS("ideal/module is homogeneous\n");
8150  else PrintS("ideal/module is not homogeneous\n");
8151  }
8152  #endif
8153 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:367
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2447
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:364
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1532
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
BOOLEAN homog
Definition: kutil.h:362
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3162
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:368
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:367
#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:437
#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:1177
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2662
void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1837
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2737
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
void initBuchMoraPos ( kStrategy  strat)

Definition at line 8240 of file kutil.cc.

8241 {
8243  {
8244  if (strat->honey)
8245  {
8246  strat->posInL = posInL15;
8247  // ok -- here is the deal: from my experiments for Singular-2-0
8248  // I conclude that that posInT_EcartpLength is the best of
8249  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8250  // see the table at the end of this file
8251  if (TEST_OPT_OLDSTD)
8252  strat->posInT = posInT15;
8253  else
8254  strat->posInT = posInT_EcartpLength;
8255  }
8256  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8257  {
8258  strat->posInL = posInL11;
8259  strat->posInT = posInT11;
8260  }
8261  else if (TEST_OPT_INTSTRATEGY)
8262  {
8263  strat->posInL = posInL11;
8264  strat->posInT = posInT11;
8265  }
8266  else
8267  {
8268  strat->posInL = posInL0;
8269  strat->posInT = posInT0;
8270  }
8271  //if (strat->minim>0) strat->posInL =posInLSpecial;
8272  if (strat->homog)
8273  {
8274  strat->posInL = posInL110;
8275  strat->posInT = posInT110;
8276  }
8277  }
8278  else
8279  {
8280  if (strat->homog)
8281  {
8282  strat->posInL = posInL11;
8283  strat->posInT = posInT11;
8284  }
8285  else
8286  {
8287  if ((currRing->order[0]==ringorder_c)
8288  ||(currRing->order[0]==ringorder_C))
8289  {
8290  strat->posInL = posInL17_c;
8291  strat->posInT = posInT17_c;
8292  }
8293  else
8294  {
8295  strat->posInL = posInL17;
8296  strat->posInT = posInT17;
8297  }
8298  }
8299  }
8300  if (strat->minim>0) strat->posInL =posInLSpecial;
8301  // for further tests only
8302  if ((BTEST1(11)) || (BTEST1(12)))
8303  strat->posInL = posInL11;
8304  else if ((BTEST1(13)) || (BTEST1(14)))
8305  strat->posInL = posInL13;
8306  else if ((BTEST1(15)) || (BTEST1(16)))
8307  strat->posInL = posInL15;
8308  else if ((BTEST1(17)) || (BTEST1(18)))
8309  strat->posInL = posInL17;
8310  if (BTEST1(11))
8311  strat->posInT = posInT11;
8312  else if (BTEST1(13))
8313  strat->posInT = posInT13;
8314  else if (BTEST1(15))
8315  strat->posInT = posInT15;
8316  else if ((BTEST1(17)))
8317  strat->posInT = posInT17;
8318  else if ((BTEST1(19)))
8319  strat->posInT = posInT19;
8320  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8321  strat->posInT = posInT1;
8322 #ifdef HAVE_RINGS
8323  if (rField_is_Ring(currRing))
8324  {
8325  strat->posInL = posInL11Ring;
8326  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8327  strat->posInL = posInL11Ringls;
8328  strat->posInT = posInT11;
8329  }
8330 #endif
8332 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5081
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5558
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5227
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4313
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5500
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5465
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4618
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:5419
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4302
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:8228
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4371
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4740
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5139
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4905
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5606
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4676
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4504
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4862
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4805
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4579
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4550
void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 10176 of file kutil.cc.

10177 {
10178  strat->interpt = BTEST1(OPT_INTERRUPT);
10179  strat->kHEdge=NULL;
10181  /*- creating temp data structures------------------- -*/
10182  strat->cp = 0;
10183  strat->c3 = 0;
10184  strat->cv = 0;
10185  strat->tail = pInit();
10186  /*- set s -*/
10187  strat->sl = -1;
10188  /*- set L -*/
10189  strat->Lmax = setmaxL;
10190  strat->Ll = -1;
10191  strat->L = initL();
10192  /*- set B -*/
10193  strat->Bmax = setmaxL;
10194  strat->Bl = -1;
10195  strat->B = initL();
10196  /*- set T -*/
10197  strat->tl = -1;
10198  strat->tmax = setmaxT;
10199  strat->T = initT();
10200  strat->R = initR();
10201  strat->sevT = initsevT();
10202  /*- init local data struct.---------------------------------------- -*/
10203  strat->P.ecart=0;
10204  strat->P.length=0;
10206  {
10207  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10208  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10209  }
10210  #ifdef HAVE_RINGS
10212  {
10213  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10214  }
10215  #endif
10216  {
10217  if(TEST_OPT_SB_1)
10218  {
10219  int i;
10220  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10221  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10222  {
10223  P->m[i-strat->newIdeal] = F->m[i];
10224  F->m[i] = NULL;
10225  }
10226  initSSpecial(F,Q,P,strat);
10227  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10228  {
10229  F->m[i] = P->m[i-strat->newIdeal];
10230  P->m[i-strat->newIdeal] = NULL;
10231  }
10232  idDelete(&P);
10233  }
10234  else
10235  {
10236  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10237  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10238  }
10239  }
10240  strat->fromT = FALSE;
10241  if (!TEST_OPT_SB_1)
10242  {
10243  /* the only change: we do not fill the set T*/
10244  #ifdef HAVE_RINGS
10245  if(!rField_is_Ring(currRing))
10246  #endif
10247  updateS(FALSE,strat);
10248  }
10249  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10250  strat->fromQ=NULL;
10251  /* more changes: fill the set T with all the shifts of elts of S*/
10252  /* is done by other procedure */
10253 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:140
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:359
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:6482
#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:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6882
#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:366
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:437
#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:752
#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:7341
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:411
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
void initEcartBBA ( TObject h)

Definition at line 1143 of file kutil.cc.

1144 {
1145  h->FDeg = h->pFDeg();
1146  (*h).ecart = 0;
1147  h->length=h->pLength=pLength(h->p);
1148 }
static int pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978
void initEcartNormal ( TObject h)

Definition at line 1135 of file kutil.cc.

1136 {
1137  h->FDeg = h->pFDeg();
1138  h->ecart = h->pLDeg() - h->FDeg;
1139  // h->length is set by h->pLDeg
1140  h->length=h->pLength=pLength(h->p);
1141 }
static int pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978
void initEcartPairBba ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1150 of file kutil.cc.

1151 {
1152  Lp->FDeg = Lp->pFDeg();
1153  (*Lp).ecart = 0;
1154  (*Lp).length = 0;
1155 }
void initEcartPairMora ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1157 of file kutil.cc.

1158 {
1159  Lp->FDeg = Lp->pFDeg();
1160  (*Lp).ecart = si_max(ecartF,ecartG);
1161  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1162  (*Lp).length = 0;
1163 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:369
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
void initenterpairsShift ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 10726 of file kutil.cc.

10727 {
10728  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
10729  // atR = -1;
10730  if ((strat->syzComp==0)
10731  || (pGetComp(h)<=strat->syzComp))
10732  {
10733  int j;
10734  BOOLEAN new_pair=FALSE;
10735 
10736  if (pGetComp(h)==0)
10737  {
10738  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
10739  if ((isFromQ)&&(strat->fromQ!=NULL))
10740  {
10741  for (j=0; j<=k; j++)
10742  {
10743  if (!strat->fromQ[j])
10744  {
10745  new_pair=TRUE;
10746  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
10747  // other side pairs:
10748  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
10749  //Print("j:%d, Ll:%d\n",j,strat->Ll);
10750  }
10751  }
10752  }
10753  else
10754  {
10755  new_pair=TRUE;
10756  for (j=0; j<=k; j++)
10757  {
10758  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
10759  // other side pairs
10760  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
10761  }
10762  /* HERE we put (h, s*h) pairs */
10763  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
10764  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
10765  }
10766  }
10767  else
10768  {
10769  for (j=0; j<=k; j++)
10770  {
10771  if ((pGetComp(h)==pGetComp(strat->S[j]))
10772  || (pGetComp(strat->S[j])==0))
10773  {
10774  new_pair=TRUE;
10775  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
10776  // other side pairs
10777  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
10778  //Print("j:%d, Ll:%d\n",j,strat->Ll);
10779  }
10780  }
10781  /* HERE we put (h, s*h) pairs */
10782  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
10783  }
10784 
10785  if (new_pair)
10786  {
10787  strat->chainCrit(h,ecart,strat);
10788  }
10789 
10790  }
10791 }
int syzComp
Definition: kutil.h:352
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
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:131
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:10260
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:10335
void initHilbCrit ( ideal  F,
ideal  Q,
intvec **  hilb,
kStrategy  strat 
)

Definition at line 8068 of file kutil.cc.

8069 {
8070 
8071  //if the ordering is local, then hilb criterion
8072  //can be used also if the ideal is not homogenous
8074  #ifdef HAVE_RINGS
8075  {
8077  *hilb=NULL;
8078  else
8079  return;
8080  }
8081 #endif
8082  if (strat->homog!=isHomog)
8083  {
8084  *hilb=NULL;
8085  }
8086 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
#define FALSE
Definition: auxiliary.h:140
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN homog
Definition: kutil.h:362
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
static LSet initL ( int  nr = setmaxL)
inlinestatic

Definition at line 411 of file kutil.h.

412 { 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
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
void initS ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6379 of file kutil.cc.

6380 {
6381  int i,pos;
6382 
6383  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6384  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6385  strat->ecartS=initec(i);
6386  strat->sevS=initsevS(i);
6387  strat->S_2_R=initS_2_R(i);
6388  strat->fromQ=NULL;
6389  strat->Shdl=idInit(i,F->rank);
6390  strat->S=strat->Shdl->m;
6391  /*- put polys into S -*/
6392  if (Q!=NULL)
6393  {
6394  strat->fromQ=initec(i);
6395  memset(strat->fromQ,0,i*sizeof(int));
6396  for (i=0; i<IDELEMS(Q); i++)
6397  {
6398  if (Q->m[i]!=NULL)
6399  {
6400  LObject h;
6401  h.p = pCopy(Q->m[i]);
6403  {
6404  //pContent(h.p);
6405  h.pCleardenom(); // also does a pContent
6406  }
6407  else
6408  {
6409  h.pNorm();
6410  }
6412  {
6413  deleteHC(&h, strat);
6414  }
6415  if (h.p!=NULL)
6416  {
6417  strat->initEcart(&h);
6418  if (strat->sl==-1)
6419  pos =0;
6420  else
6421  {
6422  pos = posInS(strat,strat->sl,h.p,h.ecart);
6423  }
6424  h.sev = pGetShortExpVector(h.p);
6425  strat->enterS(h,pos,strat,-1);
6426  strat->fromQ[pos]=1;
6427  }
6428  }
6429  }
6430  }
6431  for (i=0; i<IDELEMS(F); i++)
6432  {
6433  if (F->m[i]!=NULL)
6434  {
6435  LObject h;
6436  h.p = pCopy(F->m[i]);
6438  {
6439  /*#ifdef HAVE_RINGS
6440  if (rField_is_Ring(currRing))
6441  {
6442  h.pCleardenom();
6443  }
6444  else
6445  #endif*/
6446  cancelunit(&h); /*- tries to cancel a unit -*/
6447  deleteHC(&h, strat);
6448  }
6449  if (h.p!=NULL)
6450  // do not rely on the input being a SB!
6451  {
6453  {
6454  //pContent(h.p);
6455  h.pCleardenom(); // also does a pContent
6456  }
6457  else
6458  {
6459  h.pNorm();
6460  }
6461  strat->initEcart(&h);
6462  if (strat->sl==-1)
6463  pos =0;
6464  else
6465  pos = posInS(strat,strat->sl,h.p,h.ecart);
6466  h.sev = pGetShortExpVector(h.p);
6467  strat->enterS(h,pos,strat,-1);
6468  }
6469  }
6470  }
6471  /*- test, if a unit is in F -*/
6472  if ((strat->sl>=0)
6473 #ifdef HAVE_RINGS
6474  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
6475 #endif
6476  && pIsConstant(strat->S[0]))
6477  {
6478  while (strat->sl>0) deleteInS(strat->sl,strat);
6479  }
6480 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:516
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
#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:475
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:12
#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:140
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:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
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:4197
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
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:156
void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1443 of file kstd1.cc.

1444 {
1445  int i;
1446  //idhdl h;
1447  /* setting global variables ------------------- */
1448  strat->enterS = enterSSba;
1449  strat->red2 = redHoney;
1450  if (strat->honey)
1451  strat->red2 = redHoney;
1452  else if (currRing->pLexOrder && !strat->homog)
1453  strat->red2 = redLazy;
1454  else
1455  {
1456  strat->LazyPass *=4;
1457  strat->red2 = redHomog;
1458  }
1459 #if defined(HAVE_RINGS)
1460  if (rField_is_Ring(currRing))
1461  {
1463  {strat->red = redRiloc;}
1464  else
1465  {strat->red2 = redRing;}
1466  }
1467 #endif
1468  if (currRing->pLexOrder && strat->honey)
1469  strat->initEcart = initEcartNormal;
1470  else
1471  strat->initEcart = initEcartBBA;
1472  if (strat->honey)
1474  else
1476  //strat->kIdeal = NULL;
1477  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1478  //else strat->kIdeal->rtyp=MODUL_CMD;
1479  //strat->kIdeal->data=(void *)strat->Shdl;
1480  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1481  {
1482  //interred machen Aenderung
1483  strat->pOrigFDeg = currRing->pFDeg;
1484  strat->pOrigLDeg = currRing->pLDeg;
1485  //h=ggetid("ecart");
1486  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1487  //{
1488  // ecartWeights=iv2array(IDINTVEC(h));
1489  //}
1490  //else
1491  {
1492  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1493  /*uses automatic computation of the ecartWeights to set them*/
1495  }
1497  if (TEST_OPT_PROT)
1498  {
1499  for(i=1; i<=(currRing->N); i++)
1500  Print(" %d",ecartWeights[i]);
1501  PrintLn();
1502  mflush();
1503  }
1504  }
1505  // for sig-safe reductions in signature-based
1506  // standard basis computations
1507  strat->red = redSig;
1508  //strat->sbaOrder = 1;
1509  strat->currIdx = 1;
1510 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1150
BOOLEAN honey
Definition: kutil.h:367
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7676
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:409
void PrintLn()
Definition: reporter.cc:327
#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:32
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:678
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:519
int currIdx
Definition: kutil.h:313
#define mflush()
Definition: reporter.h:55
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1117
pFDegProc pOrigFDeg
Definition: kutil.h:292
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:355
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:12
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:957
pLDegProc pOrigLDeg
Definition: kutil.h:293
BOOLEAN homog
Definition: kutil.h:362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1157
void initEcartBBA(TObject *h)
Definition: kutil.cc:1143
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3493
#define TEST_OPT_WEIGHTM
Definition: options.h:115
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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:1135
int LazyPass
Definition: kutil.h:351
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:275
void initSbaBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 8531 of file kutil.cc.

8532 {
8533  strat->interpt = BTEST1(OPT_INTERRUPT);
8534  strat->kHEdge=NULL;
8536  /*- creating temp data structures------------------- -*/
8537  strat->cp = 0;
8538  strat->c3 = 0;
8539  strat->tail = pInit();
8540  /*- set s -*/
8541  strat->sl = -1;
8542  /*- set ps -*/
8543  strat->syzl = -1;
8544  /*- set L -*/
8545  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8546  strat->Ll = -1;
8547  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8548  /*- set B -*/
8549  strat->Bmax = setmaxL;
8550  strat->Bl = -1;
8551  strat->B = initL();
8552  /*- set T -*/
8553  strat->tl = -1;
8554  strat->tmax = setmaxT;
8555  strat->T = initT();
8556  strat->R = initR();
8557  strat->sevT = initsevT();
8558  /*- init local data struct.---------------------------------------- -*/
8559  strat->P.ecart=0;
8560  strat->P.length=0;
8562  {
8563  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8564  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8565  }
8566  #ifdef HAVE_RINGS
8568  {
8569  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8570  }
8571  else
8572  #endif
8573  {
8574  if(TEST_OPT_SB_1)
8575  {
8576  int i;
8577  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8578  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8579  {
8580  P->m[i-strat->newIdeal] = F->m[i];
8581  F->m[i] = NULL;
8582  }
8583  initSSpecialSba(F,Q,P,strat);
8584  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8585  {
8586  F->m[i] = P->m[i-strat->newIdeal];
8587  P->m[i-strat->newIdeal] = NULL;
8588  }
8589  idDelete(&P);
8590  }
8591  else
8592  {
8593  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8594  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8595  }
8596  }
8597  strat->fromT = FALSE;
8598  if (!TEST_OPT_SB_1)
8599  {
8600  #ifdef HAVE_RINGS
8601  if(!rField_is_Ring(currRing))
8602  #endif
8603  updateS(TRUE,strat);
8604  }
8605  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8606  //strat->fromQ=NULL;
8607  assume(kTest_TS(strat));
8608 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:140
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:144
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:7027
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:6581
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
#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:366
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:437
#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:752
#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:7341
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:411
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
void initSbaCrit ( kStrategy  strat)

Definition at line 8155 of file kutil.cc.

8156 {
8157  //strat->enterOnePair=enterOnePairNormal;
8159  //strat->chainCrit=chainCritNormal;
8160  strat->chainCrit = chainCritSig;
8161  /******************************************
8162  * rewCrit1 and rewCrit2 are already set in
8163  * kSba() in kstd1.cc
8164  *****************************************/
8165  //strat->rewCrit1 = faugereRewCriterion;
8166  if (strat->sbaOrder == 1)
8167  {
8168  strat->syzCrit = syzCriterionInc;
8169  }
8170  else
8171  {
8172  strat->syzCrit = syzCriterion;
8173  }
8174 #ifdef HAVE_RINGS
8175  if (rField_is_Ring(currRing))
8176  {
8178  strat->chainCrit=chainCritRing;
8179  }
8180 #endif
8181 #ifdef HAVE_RATGRING
8182  if (rIsRatGRing(currRing))
8183  {
8184  strat->chainCrit=chainCritPart;
8185  /* enterOnePairNormal get rational part in it */
8186  }
8187 #endif
8188 
8189  strat->sugarCrit = TEST_OPT_SUGARCRIT;
8190  strat->Gebauer = strat->homog || strat->sugarCrit;
8191  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
8192  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
8193  strat->pairtest = NULL;
8194  /* alway use tailreduction, except:
8195  * - in local rings, - in lex order case, -in ring over extensions */
8198 
8199 #ifdef HAVE_PLURAL
8200  // and r is plural_ring
8201  // hence this holds for r a rational_plural_ring
8202  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
8203  { //or it has non-quasi-comm type... later
8204  strat->sugarCrit = FALSE;
8205  strat->Gebauer = FALSE;
8206  strat->honey = FALSE;
8207  }
8208 #endif
8209 
8210 #ifdef HAVE_RINGS
8211  // Coefficient ring?
8212  if (rField_is_Ring(currRing))
8213  {
8214  strat->sugarCrit = FALSE;
8215  strat->Gebauer = FALSE ;
8216  strat->honey = FALSE;
8217  }
8218 #endif
8219  #ifdef KDEBUG
8220  if (TEST_OPT_DEBUG)
8221  {
8222  if (strat->homog) PrintS("ideal/module is homogeneous\n");
8223  else PrintS("ideal/module is not homogeneous\n");
8224  }
8225  #endif
8226 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:367
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:364
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:2678
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1532
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:12
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
BOOLEAN homog
Definition: kutil.h:362
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3162
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:368
unsigned sbaOrder
Definition: kutil.h:312
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:367
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5672
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5704
#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:437
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1177
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2737
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
void initSbaPos ( kStrategy  strat)

Definition at line 8433 of file kutil.cc.

8434 {
8436  {
8437  if (strat->honey)
8438  {
8439  strat->posInL = posInL15;
8440  // ok -- here is the deal: from my experiments for Singular-2-0
8441  // I conclude that that posInT_EcartpLength is the best of
8442  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8443  // see the table at the end of this file
8444  if (TEST_OPT_OLDSTD)
8445  strat->posInT = posInT15;
8446  else
8447  strat->posInT = posInT_EcartpLength;
8448  }
8449  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8450  {
8451  strat->posInL = posInL11;
8452  strat->posInT = posInT11;
8453  }
8454  else if (TEST_OPT_INTSTRATEGY)
8455  {
8456  strat->posInL = posInL11;
8457  strat->posInT = posInT11;
8458  }
8459  else
8460  {
8461  strat->posInL = posInL0;
8462  strat->posInT = posInT0;
8463  }
8464  //if (strat->minim>0) strat->posInL =posInLSpecial;
8465  if (strat->homog)
8466  {
8467  strat->posInL = posInL110;
8468  strat->posInT = posInT110;
8469  }
8470  }
8471  else
8472  {
8473  if (strat->homog)
8474  {
8475  strat->posInL = posInL11;
8476  strat->posInT = posInT11;
8477  }
8478  else
8479  {
8480  if ((currRing->order[0]==ringorder_c)
8481  ||(currRing->order[0]==ringorder_C))
8482  {
8483  strat->posInL = posInL17_c;
8484  strat->posInT = posInT17_c;
8485  }
8486  else
8487  {
8488  strat->posInL = posInL17;
8489  strat->posInT = posInT17;
8490  }
8491  }
8492  }
8493  if (strat->minim>0) strat->posInL =posInLSpecial;
8494  // for further tests only
8495  if ((BTEST1(11)) || (BTEST1(12)))
8496  strat->posInL = posInL11;
8497  else if ((BTEST1(13)) || (BTEST1(14)))
8498  strat->posInL = posInL13;
8499  else if ((BTEST1(15)) || (BTEST1(16)))
8500  strat->posInL = posInL15;
8501  else if ((BTEST1(17)) || (BTEST1(18)))
8502  strat->posInL = posInL17;
8503  if (BTEST1(11))
8504  strat->posInT = posInT11;
8505  else if (BTEST1(13))
8506  strat->posInT = posInT13;
8507  else if (BTEST1(15))
8508  strat->posInT = posInT15;
8509  else if ((BTEST1(17)))
8510  strat->posInT = posInT17;
8511  else if ((BTEST1(19)))
8512  strat->posInT = posInT19;
8513  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8514  strat->posInT = posInT1;
8515 #ifdef HAVE_RINGS
8516  if (rField_is_Ring(currRing))
8517  {
8518  strat->posInL = posInL11Ring;
8519  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8520  strat->posInL = posInL11Ringls;
8521  strat->posInT = posInT11;
8522  }
8523 #endif
8524  strat->posInLDependsOnLength = FALSE;
8525  strat->posInLSba = posInLSig;
8526  //strat->posInL = posInLSig;
8527  strat->posInL = posInLF5C;
8528  //strat->posInT = posInTSig;
8529 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5081
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5558
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5227
#define FALSE
Definition: auxiliary.h:140
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4313
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5500
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5465
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
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:144
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:5069
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4618
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:5419
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4302
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4936
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4371
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4740
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5139
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4905
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5606
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4676
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4504
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4862
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4805
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4579
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4550
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
void initSL ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6482 of file kutil.cc.

6483 {
6484  int i,pos;
6485 
6486  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6487  else i=setmaxT;
6488  strat->ecartS=initec(i);
6489  strat->sevS=initsevS(i);
6490  strat->S_2_R=initS_2_R(i);
6491  strat->fromQ=NULL;
6492  strat->Shdl=idInit(i,F->rank);
6493  strat->S=strat->Shdl->m;
6494  /*- put polys into S -*/
6495  if (Q!=NULL)
6496  {
6497  strat->fromQ=initec(i);
6498  memset(strat->fromQ,0,i*sizeof(int));
6499  for (i=0; i<IDELEMS(Q); i++)
6500  {
6501  if (Q->m[i]!=NULL)
6502  {
6503  LObject h;
6504  h.p = pCopy(Q->m[i]);
6506  {
6507  deleteHC(&h,strat);
6508  }
6510  {
6511  //pContent(h.p);
6512  h.pCleardenom(); // also does a pContent
6513  }
6514  else
6515  {
6516  h.pNorm();
6517  }
6518  if (h.p!=NULL)
6519  {
6520  strat->initEcart(&h);
6521  if (strat->sl==-1)
6522  pos =0;
6523  else
6524  {
6525  pos = posInS(strat,strat->sl,h.p,h.ecart);
6526  }
6527  h.sev = pGetShortExpVector(h.p);
6528  strat->enterS(h,pos,strat,-1);
6529  strat->fromQ[pos]=1;
6530  }
6531  }
6532  }
6533  }
6534  for (i=0; i<IDELEMS(F); i++)
6535  {
6536  if (F->m[i]!=NULL)
6537  {
6538  LObject h;
6539  h.p = pCopy(F->m[i]);
6540  if (h.p!=NULL)
6541  {
6543  {
6544  cancelunit(&h); /*- tries to cancel a unit -*/
6545  deleteHC(&h, strat);
6546  }
6547  if (h.p!=NULL)
6548  {
6550  {
6551  //pContent(h.p);
6552  h.pCleardenom(); // also does a pContent
6553  }
6554  else
6555  {
6556  h.pNorm();
6557  }
6558  strat->initEcart(&h);
6559  if (strat->Ll==-1)
6560  pos =0;
6561  else
6562  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
6563  h.sev = pGetShortExpVector(h.p);
6564  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6565  }
6566  }
6567  }
6568  }
6569  /*- test, if a unit is in F -*/
6570 
6571  if ((strat->Ll>=0)
6572 #ifdef HAVE_RINGS
6573  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6574 #endif
6575  && pIsConstant(strat->L[strat->Ll].p))
6576  {
6577  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6578  }
6579 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:516
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
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:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
#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:475
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:12
#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:140
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:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
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:4197
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
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:156
void initSLSba ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6581 of file kutil.cc.

6582 {
6583  int i,pos;
6584  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6585  else i=setmaxT;
6586  strat->ecartS = initec(i);
6587  strat->sevS = initsevS(i);
6588  strat->sevSig = initsevS(i);
6589  strat->S_2_R = initS_2_R(i);
6590  strat->fromQ = NULL;
6591  strat->Shdl = idInit(i,F->rank);
6592  strat->S = strat->Shdl->m;
6593  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
6594  if (strat->sbaOrder != 1)
6595  {
6596  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
6597  strat->sevSyz = initsevS(i);
6598  strat->syzmax = i;
6599  strat->syzl = 0;
6600  }
6601  /*- put polys into S -*/
6602  if (Q!=NULL)
6603  {
6604  strat->fromQ=initec(i);
6605  memset(strat->fromQ,0,i*sizeof(int));
6606  for (i=0; i<IDELEMS(Q); i++)
6607  {
6608  if (Q->m[i]!=NULL)
6609  {
6610  LObject h;
6611  h.p = pCopy(Q->m[i]);
6613  {
6614  deleteHC(&h,strat);
6615  }
6617  {
6618  //pContent(h.p);
6619  h.pCleardenom(); // also does a pContent
6620  }
6621  else
6622  {
6623  h.pNorm();
6624  }
6625  if (h.p!=NULL)
6626  {
6627  strat->initEcart(&h);
6628  if (strat->sl==-1)
6629  pos =0;
6630  else
6631  {
6632  pos = posInS(strat,strat->sl,h.p,h.ecart);
6633  }
6634  h.sev = pGetShortExpVector(h.p);
6635  strat->enterS(h,pos,strat,-1);
6636  strat->fromQ[pos]=1;
6637  }
6638  }
6639  }
6640  }
6641  for (i=0; i<IDELEMS(F); i++)
6642  {
6643  if (F->m[i]!=NULL)
6644  {
6645  LObject h;
6646  h.p = pCopy(F->m[i]);
6647  h.sig = pOne();
6648  //h.sig = pInit();
6649  //p_SetCoeff(h.sig,nInit(1),currRing);
6650  p_SetComp(h.sig,i+1,currRing);
6651  // if we are working with the Schreyer order we generate it
6652  // by multiplying the initial signatures with the leading monomial
6653  // of the corresponding initial polynomials generating the ideal
6654  // => we can keep the underlying monomial order and get a Schreyer
6655  // order without any bigger overhead
6656  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
6657  {
6658  p_ExpVectorAdd (h.sig,F->m[i],currRing);
6659  }
6660  h.sevSig = pGetShortExpVector(h.sig);
6661 #ifdef DEBUGF5
6662  pWrite(h.p);
6663  pWrite(h.sig);
6664 #endif
6665  if (h.p!=NULL)
6666  {
6668  {
6669  cancelunit(&h); /*- tries to cancel a unit -*/
6670  deleteHC(&h, strat);
6671  }
6672  if (h.p!=NULL)
6673  {
6675  {
6676  //pContent(h.p);
6677  h.pCleardenom(); // also does a pContent
6678  }
6679  else
6680  {
6681  h.pNorm();
6682  }
6683  strat->initEcart(&h);
6684  if (strat->Ll==-1)
6685  pos =0;
6686  else
6687  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
6688  h.sev = pGetShortExpVector(h.p);
6689  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6690  }
6691  }
6692  /*
6693  if (strat->sbaOrder != 1)
6694  {
6695  for(j=0;j<i;j++)
6696  {
6697  strat->syz[ctr] = pCopy(F->m[j]);
6698  p_SetCompP(strat->syz[ctr],i+1,currRing);
6699  // add LM(F->m[i]) to the signature to get a Schreyer order
6700  // without changing the underlying polynomial ring at all
6701  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
6702  // since p_Add_q() destroys all input
6703  // data we need to recreate help
6704  // each time
6705  poly help = pCopy(F->m[i]);
6706  p_SetCompP(help,j+1,currRing);
6707  pWrite(strat->syz[ctr]);
6708  pWrite(help);
6709  printf("%d\n",pLmCmp(strat->syz[ctr],help));
6710  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
6711  printf("%d. SYZ ",ctr);
6712  pWrite(strat->syz[ctr]);
6713  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
6714  ctr++;
6715  }
6716  strat->syzl = ps;
6717  }
6718  */
6719  }
6720  }
6721  /*- test, if a unit is in F -*/
6722 
6723  if ((strat->Ll>=0)
6724 #ifdef HAVE_RINGS
6725  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6726 #endif
6727  && pIsConstant(strat->L[strat->Ll].p))
6728  {
6729  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6730  }
6731 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
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:516
int syzmax
Definition: kutil.h:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
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:236
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
void pWrite(poly p)
Definition: polys.h:279
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
#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:475
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1049
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:12
#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:140
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:209
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1339
#define pOne()
Definition: polys.h:286
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:4197
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:470
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:156
void initSyzRules ( kStrategy  strat)

Definition at line 6733 of file kutil.cc.

6734 {
6735  if( strat->S[0] )
6736  {
6737  if( strat->S[1] )
6738  {
6739  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
6740  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
6741  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
6742  }
6743  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
6744  /************************************************************
6745  * computing the length of the syzygy array needed
6746  ***********************************************************/
6747  for(i=1; i<=strat->sl; i++)
6748  {
6749  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6750  {
6751  ps += i;
6752  }
6753  }
6754  ps += strat->sl+1;
6755  //comp = pGetComp (strat->P.sig);
6756  comp = strat->currIdx;
6757  strat->syzIdx = initec(comp);
6758  strat->sevSyz = initsevS(ps);
6759  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
6760  strat->syzmax = ps;
6761  strat->syzl = 0;
6762  strat->syzidxmax = comp;
6763 #if defined(DEBUGF5) || defined(DEBUGF51)
6764  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
6765 #endif
6766  i = 1;
6767  j = 0;
6768  /************************************************************
6769  * generating the leading terms of the principal syzygies
6770  ***********************************************************/
6771  while (i <= strat->sl)
6772  {
6773  /**********************************************************
6774  * principal syzygies start with component index 2
6775  * the array syzIdx starts with index 0
6776  * => the rules for a signature with component comp start
6777  * at strat->syz[strat->syzIdx[comp-2]] !
6778  *********************************************************/
6779  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6780  {
6781  comp = pGetComp(strat->sig[i]);
6782  comp_old = pGetComp(strat->sig[i-1]);
6783  diff = comp - comp_old - 1;
6784  // diff should be zero, but sometimes also the initial generating
6785  // elements of the input ideal reduce to zero. then there is an
6786  // index-gap between the signatures. for these inbetween signatures we
6787  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6788  // in the following.
6789  // doing this, we keep the relation "j = comp - 2" alive, which makes
6790  // jumps way easier when checking criteria
6791  while (diff>0)
6792  {
6793  strat->syzIdx[j] = 0;
6794  diff--;
6795  j++;
6796  }
6797  strat->syzIdx[j] = ctr;
6798  j++;
6799  LObject Q;
6800  int pos;
6801  for (k = 0; k<i; k++)
6802  {
6803  Q.sig = pOne();
6804  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6805  p_SetCompP (Q.sig, comp, currRing);
6806  poly q = p_One(currRing);
6807  p_ExpVectorCopy(q,strat->S[i],currRing);
6808  q = p_Neg (q, currRing);
6809  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6810  Q.sig = p_Add_q (Q.sig, q, currRing);
6811  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6812  pos = posInSyz(strat, Q.sig);
6813  enterSyz(Q, strat, pos);
6814  ctr++;
6815  }
6816  }
6817  i++;
6818  }
6819  /**************************************************************
6820  * add syzygies for upcoming first element of new iteration step
6821  **************************************************************/
6822  comp = strat->currIdx;
6823  comp_old = pGetComp(strat->sig[i-1]);
6824  diff = comp - comp_old - 1;
6825  // diff should be zero, but sometimes also the initial generating
6826  // elements of the input ideal reduce to zero. then there is an
6827  // index-gap between the signatures. for these inbetween signatures we
6828  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6829  // in the following.
6830  // doing this, we keep the relation "j = comp - 2" alive, which makes
6831  // jumps way easier when checking criteria
6832  while (diff>0)
6833  {
6834  strat->syzIdx[j] = 0;
6835  diff--;
6836  j++;
6837  }
6838  strat->syzIdx[j] = ctr;
6839  LObject Q;
6840  int pos;
6841  for (k = 0; k<strat->sl+1; k++)
6842  {
6843  Q.sig = pOne();
6844  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6845  p_SetCompP (Q.sig, comp, currRing);
6846  poly q = p_One(currRing);
6847  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
6848  q = p_Neg (q, currRing);
6849  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6850  Q.sig = p_Add_q (Q.sig, q, currRing);
6851  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6852  pos = posInSyz(strat, Q.sig);
6853  enterSyz(Q, strat, pos);
6854  ctr++;
6855  }
6856 //#if 1
6857 #ifdef DEBUGF5
6858  PrintS("Principal syzygies:\n");
6859  Print("syzl %d\n",strat->syzl);
6860  Print("syzmax %d\n",strat->syzmax);
6861  Print("ps %d\n",ps);
6862  PrintS("--------------------------------\n");
6863  for(i=0;i<=strat->syzl-1;i++)
6864  {
6865  Print("%d - ",i);
6866  pWrite(strat->syz[i]);
6867  }
6868  for(i=0;i<strat->currIdx;i++)
6869  {
6870  Print("%d - %d\n",i,strat->syzIdx[i]);
6871  }
6872  PrintS("--------------------------------\n");
6873 #endif
6874  }
6875 }
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:279
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
#define omAlloc(size)
Definition: omAllocDecl.h:210
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:12
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:243
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1241
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
LSet L
Definition: kutil.h:323
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:5041
int syzidxmax
Definition: kutil.h:347
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int syzl
Definition: kutil.h:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:8003
intset syzIdx
Definition: kutil.h:309
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:12
#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
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 964 of file kInline.h.

966 {
967  p_LmCheckPolyRing(p1, p_r);
968  p_LmCheckPolyRing(p2, p_r);
969 
970  int i;
971  long x;
972  m1 = p_Init(m_r);
973  m2 = p_Init(m_r);
974 
975  for (i = p_r->N; i; i--)
976  {
977  x = p_GetExpDiff(p1, p2, i, p_r);
978  if (x > 0)
979  {
980  if (x > (long) m_r->bitmask) goto false_return;
981  p_SetExp(m2,i,x, m_r);
982  p_SetExp(m1,i,0, m_r);
983  }
984  else
985  {
986  if (-x > (long) m_r->bitmask) goto false_return;
987  p_SetExp(m1,i,-x, m_r);
988  p_SetExp(m2,i,0, m_r);
989  }
990  }
991 
992  p_Setm(m1, m_r);
993  p_Setm(m2, m_r);
994  return TRUE;
995 
996  false_return:
997  p_LmFree(m1, m_r);
998  p_LmFree(m2, m_r);
999  m1 = m2 = NULL;
1000  return FALSE;
1001 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:631
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:484
#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:436
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
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 1007 of file kInline.h.

1009 {
1010  p_LmCheckPolyRing(p1, leadRing);
1011  p_LmCheckPolyRing(p2, leadRing);
1012 
1013  int i;
1014  int x;
1015  int e1;
1016  int e2;
1017  int s;
1018  m1 = p_Init(tailRing);
1019  m2 = p_Init(tailRing);
1020  lcm = p_Init(leadRing);
1021 
1022  for (i = leadRing->N; i>=0; i--)
1023  {
1024  e1 = p_GetExp(p1,i,leadRing);
1025  e2 = p_GetExp(p2,i,leadRing);
1026  x = e1 - e2;
1027  if (x > 0)
1028  {
1029  p_SetExp(m2,i,x, tailRing);
1030  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1031  s = e1;
1032  }
1033  else if (x<0)
1034  {
1035  p_SetExp(m1,i,-x, tailRing);
1036  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1037  s = e2;
1038  }
1039  else
1040  s = e1; // e1==e2
1041  p_SetExp(lcm,i,s, leadRing);
1042  }
1043 
1044  p_Setm(m1, tailRing);
1045  p_Setm(m2, tailRing);
1046  p_Setm(lcm, leadRing);
1047 }
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:465
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:484
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:436
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 905 of file kInline.h.

906 {
907 
908  poly np = p_LmInit(p, currRing, tailRing, tailBin);
909  pNext(np) = pNext(p);
910  pSetCoeff0(np, pGetCoeff(p));
911  return np;
912 }
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:12
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1263
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 937 of file kInline.h.

938 {
939  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
940 }
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:905
KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 914 of file kInline.h.

915 {
916  poly np = p_LmInit(p, tailRing, currRing, lmBin);
917  pNext(np) = pNext(p);
918  pSetCoeff0(np, pGetCoeff(p));
919  return np;
920 }
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:12
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1263
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 942 of file kInline.h.

943 {
944  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
945 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:914
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:12
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 923 of file kInline.h.

924 {
926  p_LmFree(p, currRing);
927  return np;
928 }
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:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 947 of file kInline.h.

948 {
950 }
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:923
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 930 of file kInline.h.

931 {
933  p_LmFree(p, tailRing);
934  return np;
935 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:914
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 952 of file kInline.h.

953 {
955 }
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:12
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:930
BOOLEAN kCheckSpolyCreation ( LObject L,
kStrategy  strat,
poly m1,
poly m2 
)

Definition at line 8990 of file kutil.cc.

8991 {
8992  if (strat->overflow) return FALSE;
8993  assume(L->p1 != NULL && L->p2 != NULL);
8994  // shift changes: from 0 to -1
8995  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
8996  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
8997  assume(strat->tailRing != currRing);
8998 
8999  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
9000  return FALSE;
9001  // shift changes: extra case inserted
9002  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
9003  {
9004  return TRUE;
9005  }
9006  poly p1_max = (strat->R[L->i_r1])->max;
9007  poly p2_max = (strat->R[L->i_r2])->max;
9008 
9009  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
9010  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
9011  {
9012  p_LmFree(m1, strat->tailRing);
9013  p_LmFree(m2, strat->tailRing);
9014  m1 = NULL;
9015  m2 = NULL;
9016  return FALSE;
9017  }
9018  return TRUE;
9019 }
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:964
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1821
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:394
polyrec * poly
Definition: hilb.h:10
BOOLEAN kCheckStrongCreation ( int  atR,
poly  m1,
int  atS,
poly  m2,
kStrategy  strat 
)

Definition at line 9028 of file kutil.cc.

9029 {
9030  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
9031  //assume(strat->tailRing != currRing);
9032 
9033  poly p1_max = (strat->R[atR])->max;
9034  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
9035 
9036  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
9037  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
9038  {
9039  return FALSE;
9040  }
9041  return TRUE;
9042 }
#define FALSE
Definition: auxiliary.h:140
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:1821
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
poly kCreateZeroPoly ( long  exp[],
long  cabsind,
poly t_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 3554 of file kutil.cc.

3555 {
3556 
3557  poly zeroPoly = NULL;
3558 
3559  number tmp1;
3560  poly tmp2, tmp3;
3561 
3562  if (cabsind == -1)
3563  {
3564  cabsind = 0;
3565  for (int i = 1; i <= leadRing->N; i++)
3566  {
3567  cabsind += ind_fact_2(exp[i]);
3568  }
3569 // Print("cabsind: %d\n", cabsind);
3570  }
3571  if (cabsind < leadRing->ch)
3572  {
3573  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
3574  }
3575  else
3576  {
3577  zeroPoly = p_ISet(1, tailRing);
3578  }
3579  for (int i = 1; i <= leadRing->N; i++)
3580  {
3581  for (long j = 1; j <= exp[i]; j++)
3582  {
3583  tmp1 = nInit(j);
3584  tmp2 = p_ISet(1, tailRing);
3585  p_SetExp(tmp2, i, 1, tailRing);
3586  p_Setm(tmp2, tailRing);
3587  if (nIsZero(tmp1))
3588  { // should nowbe obsolet, test ! TODO OLIVER
3589  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
3590  }
3591  else
3592  {
3593  tmp3 = p_NSet(nCopy(tmp1), tailRing);
3594  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
3595  }
3596  }
3597  }
3598  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
3599  for (int i = 1; i <= leadRing->N; i++)
3600  {
3601  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
3602  }
3603  p_Setm(tmp2, leadRing);
3604  *t_p = zeroPoly;
3605  zeroPoly = pNext(zeroPoly);
3606  pNext(*t_p) = NULL;
3607  pNext(tmp2) = zeroPoly;
3608  return tmp2;
3609 }
#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:1448
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:3362
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:465
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:484
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:3347
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:436
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:884
#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:1302
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1025
void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 9903 of file kutil.cc.

9904 {
9905  PrintS("red: ");
9906  if (strat->red==redFirst) PrintS("redFirst\n");
9907  else if (strat->red==redHoney) PrintS("redHoney\n");
9908  else if (strat->red==redEcart) PrintS("redEcart\n");
9909  else if (strat->red==redHomog) PrintS("redHomog\n");
9910  else Print("%p\n",(void*)strat->red);
9911  PrintS("posInT: ");
9912  if (strat->posInT==posInT0) PrintS("posInT0\n");
9913  else if (strat->posInT==posInT1) PrintS("posInT1\n");
9914  else if (strat->posInT==posInT11) PrintS("posInT11\n");
9915  else if (strat->posInT==posInT110) PrintS("posInT110\n");
9916  else if (strat->posInT==posInT13) PrintS("posInT13\n");
9917  else if (strat->posInT==posInT15) PrintS("posInT15\n");
9918  else if (strat->posInT==posInT17) PrintS("posInT17\n");
9919  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
9920  else if (strat->posInT==posInT19) PrintS("posInT19\n");
9921  else if (strat->posInT==posInT2) PrintS("posInT2\n");
9922 #ifdef HAVE_MORE_POS_IN_T
9923  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
9924  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
9925  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
9926 #endif
9927  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
9928  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
9929  else Print("%p\n",(void*)strat->posInT);
9930  PrintS("posInL: ");
9931  if (strat->posInL==posInL0) PrintS("posInL0\n");
9932  else if (strat->posInL==posInL10) PrintS("posInL10\n");
9933  else if (strat->posInL==posInL11) PrintS("posInL11\n");
9934  else if (strat->posInL==posInL110) PrintS("posInL110\n");
9935  else if (strat->posInL==posInL13) PrintS("posInL13\n");
9936  else if (strat->posInL==posInL15) PrintS("posInL15\n");
9937  else if (strat->posInL==posInL17) PrintS("posInL17\n");
9938  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
9939  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
9940  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
9941  else Print("%p\n",(void*)strat->posInL);
9942  PrintS("enterS: ");
9943  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
9944  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
9945  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
9946  else Print("%p\n",(void*)strat->enterS);
9947  PrintS("initEcart: ");
9948  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
9949  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
9950  else Print("%p\n",(void*)strat->initEcart);
9951  PrintS("initEcartPair: ");
9952  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
9953  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
9954  else Print("%p\n",(void*)strat->initEcartPair);
9955  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
9956  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
9957  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
9958  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
9959  PrintS("chainCrit: ");
9960  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
9961  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
9962  else Print("%p\n",(void*)strat->chainCrit);
9963  Print("posInLDependsOnLength=%d\n",
9964  strat->posInLDependsOnLength);
9965  PrintS(showOption());PrintLn();
9966  PrintS("LDeg: ");
9967  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9968  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9969  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
9970  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9971  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9972  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9973  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9974  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9975  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9976  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9977  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9978  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9979  else Print("? (%lx)", (long)currRing->pLDeg);
9980  PrintS(" / ");
9981  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9982  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9983  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
9984  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9985  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9986  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9987  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9988  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9989  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9990  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9991  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9992  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9993  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
9994  PrintLn();
9995  PrintS("currRing->pFDeg: ");
9996  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
9997  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
9998  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
9999  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
10000  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
10001  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
10002  else Print("? (%lx)", (long)currRing->pFDeg);
10003  PrintLn();
10004  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
10005  if(TEST_OPT_DEGBOUND)
10006  Print(" degBound: %d\n", Kstd1_deg);
10007 
10008  if( ecartWeights != NULL )
10009  {
10010  PrintS("ecartWeights: ");
10011  for (int i = rVar(currRing); i > 0; i--)
10012  Print("%hd ", ecartWeights[i]);
10013  PrintLn();
10015  }
10016 
10017 #ifndef SING_NDEBUG
10019 #endif
10020 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1150
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5081
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9869
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:4428
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5558
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
void PrintLn()
Definition: reporter.cc:327
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4341
#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:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
BOOLEAN noTailReduction
Definition: kutil.h:368
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4313
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2447
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5335
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5500
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5465
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
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:727
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4618
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:519
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:5419
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4302
void rDebugPrint(ring r)
Definition: ring.cc:4035
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1117
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:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4371
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4740
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1157
BOOLEAN Gebauer
Definition: kutil.h:368
#define assume(x)
Definition: mod2.h:405
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1143
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2208
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4905
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5606
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4676
BOOLEAN sugarCrit
Definition: kutil.h:367
int Kstd1_deg
Definition: kutil.cc:228
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1378
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9778
#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:810
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:179
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4504
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2662
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1037
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:613
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4862
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
BOOLEAN use_buckets
Definition: kutil.h:373
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4805
void initEcartNormal(TObject *h)
Definition: kutil.cc:1135
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9832
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4579
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1046
int LazyDegree
Definition: kutil.h:351
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4550
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7573
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 202 of file kstd2.cc.

203 {
204  unsigned long not_sev = ~L->sev;
205  poly p = L->GetLmCurrRing();
206  int j = 0;
207 
208  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
209 #if 1
210  int ende;
211  if ((strat->ak>0) || currRing->pLexOrder) ende=strat->sl;
212  else ende=posInS(strat,*max_ind,p,0)+1;
213  if (ende>(*max_ind)) ende=(*max_ind);
214 #else
215  int ende=strat->sl;
216 #endif
217  (*max_ind)=ende;
218  loop
219  {
220  if (j > ende) return -1;
221 #if defined(PDEBUG) || defined(PDIV_DEBUG)
222  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
223  p, not_sev, currRing))
224  {
225 #ifdef HAVE_RINGS
227  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
228  return j;}
229  else
230 #endif
231  return j;
232  }
233 #else
234  if ( !(strat->sevS[j] & not_sev) &&
235  p_LmDivisibleBy(strat->S[j], p, currRing))
236  {
237 #ifdef HAVE_RINGS
239  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
240  return j;}
241  else
242 #endif
243  return j;
244  }
245 #endif
246  j++;
247  }
248 }
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:12
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:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4197
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart = LONG_MAX 
)

Definition at line 5868 of file kutil.cc.

5870 {
5871  int j = 0;
5872  const unsigned long not_sev = ~L->sev;
5873  const unsigned long* sev = strat->sevS;
5874  poly p;
5875  ring r;
5876  L->GetLm(p, r);
5877 
5878  assume(~not_sev == p_GetShortExpVector(p, r));
5879 
5880  if (r == currRing)
5881  {
5882  loop
5883  {
5884  if (j > pos) return NULL;
5885 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5886  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
5887  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5888  {
5889 #ifdef HAVE_RINGS
5890  if(rField_is_Ring(r))
5891  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5892  break;}
5893  else
5894 #endif
5895  break;
5896  }
5897 #else
5898  if (!(sev[j] & not_sev) &&
5899  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
5900  p_LmDivisibleBy(strat->S[j], p, r))
5901  {
5902 #ifdef HAVE_RINGS
5903  if(rField_is_Ring(r))
5904  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5905  break;}
5906  else
5907 #endif
5908  break;
5909  }
5910 
5911 #endif
5912  j++;
5913  }
5914  // if called from NF, T objects do not exist:
5915  if (strat->tl < 0 || strat->S_2_R[j] == -1)
5916  {
5917  T->Set(strat->S[j], r, strat->tailRing);
5918  return T;
5919  }
5920  else
5921  {
5922 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
5923 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
5924 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
5925  return strat->S_2_T(j);
5926  }
5927  }
5928  else
5929  {
5930  TObject* t;
5931  loop
5932  {
5933  if (j > pos) return NULL;
5934  assume(strat->S_2_R[j] != -1);
5935 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5936  t = strat->S_2_T(j);
5937  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
5938  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
5939  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5940  {
5941 #ifdef HAVE_RINGS
5942  if(rField_is_Ring(r))
5943  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5944  return t;}
5945  else
5946 #endif
5947  return t;
5948  }
5949 #else
5950  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5951  {
5952  t = strat->S_2_T(j);
5953  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
5954  if (p_LmDivisibleBy(t->t_p, p, r))
5955  {
5956 #ifdef HAVE_RINGS
5957  if(rField_is_Ring(r))
5958  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5959  return t;}
5960  else
5961 #endif
5962  return t;
5963  }
5964  }
5965 #endif
5966  j++;
5967  }
5968  }
5969 }
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:12
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:405
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:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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
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 104 of file kstd2.cc.

105 {
106  unsigned long not_sev = ~L->sev;
107  int j = start;
108 
109  const TSet T=strat->T;
110  const unsigned long* sevT=strat->sevT;
111  if (L->p!=NULL)
112  {
113  const ring r=currRing;
114  const poly p=L->p;
115 
116  pAssume(~not_sev == p_GetShortExpVector(p, r));
117 
118  loop
119  {
120  if (j > strat->tl) return -1;
121 #if defined(PDEBUG) || defined(PDIV_DEBUG)
122  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
123  {
124 #ifdef HAVE_RINGS
125  if(rField_is_Ring(r))
126  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r))
127  return j;}
128  else {
129  return j;
130  }
131 #else
132  return j;
133 #endif
134 
135  }
136 #else
137  if (!(sevT[j] & not_sev) &&
138  p_LmDivisibleBy(T[j].p, p, r))
139  {
140 #ifdef HAVE_RINGS
141  if(rField_is_Ring(r))
142  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r))
143  return j;}
144  else {
145  return j;
146  }
147 #else
148  return j;
149 #endif
150 
151  }
152 #endif
153  j++;
154  }
155  }
156  else
157  {
158  const poly p=L->t_p;
159  const ring r=strat->tailRing;
160  loop
161  {
162  if (j > strat->tl) return -1;
163 #if defined(PDEBUG) || defined(PDIV_DEBUG)
164  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
165  p, not_sev, r))
166  {
167 #ifdef HAVE_RINGS
168  if(rField_is_Ring(r))
169  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r))
170  return j;}
171  else {
172  return j;
173  }
174 #else
175  return j;
176 #endif
177 
178  }
179 #else
180  if (!(sevT[j] & not_sev) &&
181  p_LmDivisibleBy(T[j].t_p, p, r))
182  {
183 #ifdef HAVE_RINGS
184  if(rField_is_Ring(r))
185  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r))
186  return j;}
187  else {
188  return j;
189  }
190 #else
191  return j;
192 #endif
193 
194  }
195 #endif
196  j++;
197  }
198  }
199 }
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:12
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:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 617 of file kutil.cc.

618 {
619  int i;
620 
621  for (i=0; i<=tlength; i++)
622  {
623  if (T[i].p == p) return i;
624  }
625  return -1;
626 }
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static jList * T
Definition: janet.cc:37
int kFindNextDivisibleByInS ( const kStrategy  strat,
int  start,
int  max_ind,
LObject L 
)

Definition at line 250 of file kstd2.cc.

251 {
252  unsigned long not_sev = ~L->sev;
253  poly p = L->GetLmCurrRing();
254  int j = start;
255 
256  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
257 #if 1
258  int ende=max_ind;
259 #else
260  int ende=strat->sl;
261 #endif
262  loop
263  {
264  if (j > ende) return -1;
265 #if defined(PDEBUG) || defined(PDIV_DEBUG)
266  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
267  p, not_sev, currRing))
268  {
269 #ifdef HAVE_RINGS
271  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
272  return j;}
273  else
274 #endif
275  return j;
276  }
277 #else
278  if ( !(strat->sevS[j] & not_sev) &&
279  p_LmDivisibleBy(strat->S[j], p, currRing))
280  {
281 #ifdef HAVE_RINGS
283  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
284  return j;}
285  else
286 #endif
287  return j;
288  }
289 #endif
290  j++;
291  }
292 }
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:12
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:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
poly kFindZeroPoly ( poly  input_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 295 of file kstd2.cc.

296 {
297  // m = currRing->ch
298 
299  if (input_p == NULL) return NULL;
300 
301  poly p = input_p;
302  poly zeroPoly = NULL;
303  unsigned long a = (unsigned long) pGetCoeff(p);
304 
305  int k_ind2 = 0;
306  int a_ind2 = ind2(a);
307 
308  // unsigned long k = 1;
309  // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
310  for (int i = 1; i <= leadRing->N; i++)
311  {
312  k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
313  }
314 
315  a = (unsigned long) pGetCoeff(p);
316 
317  number tmp1;
318  poly tmp2, tmp3;
319  poly lead_mult = p_ISet(1, tailRing);
320  if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
321  {
322  int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
323  int s_exp;
324  zeroPoly = p_ISet(a, tailRing);
325  for (int i = 1; i <= leadRing->N; i++)
326  {
327  s_exp = p_GetExp(p, i,leadRing);
328  if (s_exp % 2 != 0)
329  {
330  s_exp = s_exp - 1;
331  }
332  while ( (0 < ind2(s_exp)) && (ind2(s_exp) <= too_much) )
333  {
334  too_much = too_much - ind2(s_exp);
335  s_exp = s_exp - 2;
336  }
337  p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
338  for (int j = 1; j <= s_exp; j++)
339  {
340  tmp1 = nInit(j);
341  tmp2 = p_ISet(1, tailRing);
342  p_SetExp(tmp2, i, 1, tailRing);
343  p_Setm(tmp2, tailRing);
344  if (nIsZero(tmp1))
345  { // should nowbe obsolet, test ! TODO OLIVER
346  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
347  }
348  else
349  {
350  tmp3 = p_NSet(nCopy(tmp1), tailRing);
351  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
352  }
353  }
354  }
355  p_Setm(lead_mult, tailRing);
356  zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
357  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
358  for (int i = 1; i <= leadRing->N; i++)
359  {
360  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
361  }
362  p_Setm(tmp2, leadRing);
363  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
364  pNext(tmp2) = zeroPoly;
365  return tmp2;
366  }
367 /* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
368  if (1 == 0 && alpha_k <= a)
369  { // Temporarly disabled, reducing coefficients not compatible with std TODO Oliver
370  zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
371  for (int i = 1; i <= leadRing->N; i++)
372  {
373  for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
374  {
375  tmp1 = nInit(j);
376  tmp2 = p_ISet(1, tailRing);
377  p_SetExp(tmp2, i, 1, tailRing);
378  p_Setm(tmp2, tailRing);
379  if (nIsZero(tmp1))
380  {
381  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
382  }
383  else
384  {
385  tmp3 = p_ISet((unsigned long) tmp1, tailRing);
386  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
387  }
388  }
389  }
390  tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
391  for (int i = 1; i <= leadRing->N; i++)
392  {
393  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
394  }
395  p_Setm(tmp2, leadRing);
396  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
397  pNext(tmp2) = zeroPoly;
398  return tmp2;
399  } */
400  return NULL;
401 }
const poly a
Definition: syzextra.cc:212
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
#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:973
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
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:445
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:465
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:484
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:3347
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:436
long ind2(long arg)
Definition: kutil.cc:3335
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
#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:1302
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1025
void kFreeStrat ( kStrategy  strat)
poly kNF2 ( ideal  F,
ideal  Q,
poly  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 2599 of file kstd2.cc.

2600 {
2601  assume(q!=NULL);
2602  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
2603 
2604 // lazy_reduce flags: can be combined by |
2605 //#define KSTD_NF_LAZY 1
2606  // do only a reduction of the leading term
2607 //#define KSTD_NF_NONORM 4
2608  // only global: avoid normalization, return a multiply of NF
2609  poly p;
2610 
2611  //if ((idIs0(F))&&(Q==NULL))
2612  // return pCopy(q); /*F=0*/
2613  //strat->ak = idRankFreeModule(F);
2614  /*- creating temp data structures------------------- -*/
2615  BITSET save1;
2616  SI_SAVE_OPT1(save1);
2618  initBuchMoraCrit(strat);
2619  strat->initEcart = initEcartBBA;
2620  strat->enterS = enterSBba;
2621 #ifndef NO_BUCKETS
2623 #endif
2624  /*- set S -*/
2625  strat->sl = -1;
2626  /*- init local data struct.---------------------------------------- -*/
2627  /*Shdl=*/initS(F,Q,strat);
2628  /*- compute------------------------------------------------------- -*/
2629  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
2630  //{
2631  // for (i=strat->sl;i>=0;i--)
2632  // pNorm(strat->S[i]);
2633  //}
2634  kTest(strat);
2635  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2636  if (BVERBOSE(23)) kDebugPrint(strat);
2637  int max_ind;
2638  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2639  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2640  {
2641  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2642  #ifdef HAVE_RINGS
2643  if (rField_is_Ring(currRing))
2644  {
2645  p = redtailBba_Z(p,max_ind,strat);
2646  }
2647  else
2648  #endif
2649  {
2651  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2652  }
2653  }
2654  /*- release temp data------------------------------- -*/
2655  assume(strat->L==NULL); /* strat->L unused */
2656  assume(strat->B==NULL); /* strat->B unused */
2657  omFree(strat->sevS);
2658  omFree(strat->ecartS);
2659  assume(strat->T==NULL);//omfree(strat->T);
2660  assume(strat->sevT==NULL);//omfree(strat->sevT);
2661  assume(strat->R==NULL);//omfree(strat->R);
2662  omfree(strat->S_2_R);
2663  omfree(strat->fromQ);
2664  idDelete(&strat->Shdl);
2665  SI_RESTORE_OPT1(save1);
2666  if (TEST_OPT_PROT) PrintLn();
2667  return p;
2668 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:327
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
#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:619
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:17
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1321
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:55
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:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6379
#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:405
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1143
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:8088
void PrintS(const char *s)
Definition: reporter.cc:294
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:437
#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:373
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:9903
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:7573
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
ideal kNF2 ( ideal  F,
ideal  Q,
ideal  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 2670 of file kstd2.cc.

2671 {
2672  assume(!idIs0(q));
2673  assume(!(idIs0(F)&&(Q==NULL)));
2674 // lazy_reduce flags: can be combined by |
2675 //#define KSTD_NF_LAZY 1
2676  // do only a reduction of the leading term
2677 //#define KSTD_NF_NONORM 4
2678  // only global: avoid normalization, return a multiply of NF
2679  poly p;
2680  int i;
2681  ideal res;
2682  int max_ind;
2683 
2684  //if (idIs0(q))
2685  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2686  //if ((idIs0(F))&&(Q==NULL))
2687  // return idCopy(q); /*F=0*/
2688  //strat->ak = idRankFreeModule(F);
2689  /*- creating temp data structures------------------- -*/
2690  BITSET save1;
2691  SI_SAVE_OPT1(save1);
2693  initBuchMoraCrit(strat);
2694  strat->initEcart = initEcartBBA;
2695  strat->enterS = enterSBba;
2696  /*- set S -*/
2697  strat->sl = -1;
2698 #ifndef NO_BUCKETS
2700 #endif
2701  /*- init local data struct.---------------------------------------- -*/
2702  /*Shdl=*/initS(F,Q,strat);
2703  /*- compute------------------------------------------------------- -*/
2704  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
2706  for (i=IDELEMS(q)-1; i>=0; i--)
2707  {
2708  if (q->m[i]!=NULL)
2709  {
2710  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
2711  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2712  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2713  {
2714  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2715  #ifdef HAVE_RINGS
2716  if (rField_is_Ring(currRing))
2717  {
2718  p = redtailBba_Z(p,max_ind,strat);
2719  }
2720  else
2721  #endif
2722  {
2723  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2724  }
2725  }
2726  res->m[i]=p;
2727  }
2728  //else
2729  // res->m[i]=NULL;
2730  }
2731  /*- release temp data------------------------------- -*/
2732  assume(strat->L==NULL); /* strat->L unused */
2733  assume(strat->B==NULL); /* strat->B unused */
2734  omFree(strat->sevS);
2735  omFree(strat->ecartS);
2736  assume(strat->T==NULL);//omfree(strat->T);
2737  assume(strat->sevT==NULL);//omfree(strat->sevT);
2738  assume(strat->R==NULL);//omfree(strat->R);
2739  omfree(strat->S_2_R);
2740  omfree(strat->fromQ);
2741  idDelete(&strat->Shdl);
2742  SI_RESTORE_OPT1(save1);
2743  if (TEST_OPT_PROT) PrintLn();
2744  return res;
2745 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:327
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
#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:17
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1321
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:55
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:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6379
#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:405
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1143
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:8088
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:437
#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:373
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:7573
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
poly ksCreateShortSpoly ( poly  p1,
poly  p2,
ring  tailRing 
)

Definition at line 566 of file kspoly.cc.

567 {
568  poly a1 = pNext(p1), a2 = pNext(p2);
569  long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
570  long c;
571  poly m1,m2;
572  number t1 = NULL,t2 = NULL;
573  int cm,i;
574  BOOLEAN equal;
575 
576 #ifdef HAVE_RINGS
578  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
579  if (is_Ring)
580  {
581  ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
582  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
583  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
584  while (a1 != NULL && nIsZero(t2))
585  {
586  pIter(a1);
587  nDelete(&t2);
588  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
589  }
590  while (a2 != NULL && nIsZero(t1))
591  {
592  pIter(a2);
593  nDelete(&t1);
594  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
595  }
596  }
597 #endif
598 
599  if (a1==NULL)
600  {
601  if(a2!=NULL)
602  {
603  m2=p_Init(currRing);
604 x2:
605  for (i = (currRing->N); i; i--)
606  {
607  c = p_GetExpDiff(p1, p2,i, currRing);
608  if (c>0)
609  {
610  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
611  }
612  else
613  {
614  p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
615  }
616  }
617  if ((c1==c2)||(c2!=0))
618  {
620  }
621  else
622  {
623  p_SetComp(m2,c1,currRing);
624  }
625  p_Setm(m2, currRing);
626 #ifdef HAVE_RINGS
627  if (is_Ring)
628  {
629  nDelete(&lc1);
630  nDelete(&lc2);
631  nDelete(&t2);
632  pSetCoeff0(m2, t1);
633  }
634  else
635 #endif
636  nNew(&(pGetCoeff(m2)));
637  return m2;
638  }
639  else
640  {
641 #ifdef HAVE_RINGS
642  if (is_Ring)
643  {
644  nDelete(&lc1);
645  nDelete(&lc2);
646  nDelete(&t1);
647  nDelete(&t2);
648  }
649 #endif
650  return NULL;
651  }
652  }
653  if (a2==NULL)
654  {
655  m1=p_Init(currRing);
656 x1:
657  for (i = (currRing->N); i; i--)
658  {
659  c = p_GetExpDiff(p2, p1,i,currRing);
660  if (c>0)
661  {
662  p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
663  }
664  else
665  {
666  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
667  }
668  }
669  if ((c1==c2)||(c1!=0))
670  {
672  }
673  else
674  {
675  p_SetComp(m1,c2,currRing);
676  }
677  p_Setm(m1, currRing);
678 #ifdef HAVE_RINGS
679  if (is_Ring)
680  {
681  pSetCoeff0(m1, t2);
682  nDelete(&lc1);
683  nDelete(&lc2);
684  nDelete(&t1);
685  }
686  else
687 #endif
688  nNew(&(pGetCoeff(m1)));
689  return m1;
690  }
691  m1 = p_Init(currRing);
692  m2 = p_Init(currRing);
693  loop
694  {
695  for (i = (currRing->N); i; i--)
696  {
697  c = p_GetExpDiff(p1, p2,i,currRing);
698  if (c > 0)
699  {
700  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
701  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
702  }
703  else
704  {
705  p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
706  p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
707  }
708  }
709  if(c1==c2)
710  {
713  }
714  else
715  {
716  if(c1!=0)
717  {
719  p_SetComp(m2,c1, currRing);
720  }
721  else
722  {
724  p_SetComp(m1,c2, currRing);
725  }
726  }
727  p_Setm(m1,currRing);
728  p_Setm(m2,currRing);
729  cm = p_LmCmp(m1, m2,currRing);
730  if (cm!=0)
731  {
732  if(cm==1)
733  {
734  p_LmFree(m2,currRing);
735 #ifdef HAVE_RINGS
736  if (is_Ring)
737  {
738  pSetCoeff0(m1, t2);
739  nDelete(&lc1);
740  nDelete(&lc2);
741  nDelete(&t1);
742  }
743  else
744 #endif
745  nNew(&(pGetCoeff(m1)));
746  return m1;
747  }
748  else
749  {
750  p_LmFree(m1,currRing);
751 #ifdef HAVE_RINGS
752  if (is_Ring)
753  {
754  pSetCoeff0(m2, t1);
755  nDelete(&lc1);
756  nDelete(&lc2);
757  nDelete(&t2);
758  }
759  else
760 #endif
761  nNew(&(pGetCoeff(m2)));
762  return m2;
763  }
764  }
765 #ifdef HAVE_RINGS
766  if (is_Ring)
767  {
768  equal = nEqual(t1,t2);
769  }
770  else
771 #endif
772  {
773  t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
774  t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
775  equal = nEqual(t1,t2);
776  nDelete(&t2);
777  nDelete(&t1);
778  }
779  if (!equal)
780  {
781  p_LmFree(m2,currRing);
782 #ifdef HAVE_RINGS
783  if (is_Ring)
784  {
785  pSetCoeff0(m1, nSub(t1, t2));
786  nDelete(&lc1);
787  nDelete(&lc2);
788  nDelete(&t1);
789  nDelete(&t2);
790  }
791  else
792 #endif
793  nNew(&(pGetCoeff(m1)));
794  return m1;
795  }
796  pIter(a1);
797  pIter(a2);
798 #ifdef HAVE_RINGS
799  if (is_Ring)
800  {
801  if (a2 != NULL)
802  {
803  nDelete(&t1);
804  t1 = nMult(pGetCoeff(a2),lc1);
805  }
806  if (a1 != NULL)
807  {
808  nDelete(&t2);
809  t2 = nMult(pGetCoeff(a1),lc2);
810  }
811  while ((a1 != NULL) && nIsZero(t2))
812  {
813  pIter(a1);
814  if (a1 != NULL)
815  {
816  nDelete(&t2);
817  t2 = nMult(pGetCoeff(a1),lc2);
818  }
819  }
820  while ((a2 != NULL) && nIsZero(t1))
821  {
822  pIter(a2);
823  if (a2 != NULL)
824  {
825  nDelete(&t1);
826  t1 = nMult(pGetCoeff(a2),lc1);
827  }
828  }
829  }
830 #endif
831  if (a2==NULL)
832  {
833  p_LmFree(m2,currRing);
834  if (a1==NULL)
835  {
836 #ifdef HAVE_RINGS
837  if (is_Ring)
838  {
839  nDelete(&lc1);
840  nDelete(&lc2);
841  nDelete(&t1);
842  nDelete(&t2);
843  }
844 #endif
845  p_LmFree(m1,currRing);
846  return NULL;
847  }
848  goto x1;
849  }
850  if (a1==NULL)
851  {
852  p_LmFree(m1,currRing);
853  goto x2;
854  }
855  }
856 }
loop
Definition: myNF.cc:98
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#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:679
#define pIter(p)
Definition: monomials.h:44
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:631
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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:465
#define nMult(n1, n2)
Definition: numbers.h:17
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
#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:484
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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:436
#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:131
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
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 379 of file kspoly.cc.

382 {
383 #ifdef KDEBUG
384  create_count++;
385 #endif
386  kTest_L(Pair);
387  poly p1 = Pair->p1;
388  poly p2 = Pair->p2;
389  Pair->tailRing = tailRing;
390 
391  assume(p1 != NULL);
392  assume(p2 != NULL);
393  assume(tailRing != NULL);
394 
395  poly a1 = pNext(p1), a2 = pNext(p2);
396  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
397  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
398  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
399 
400  int l1=0, l2=0;
401 
402  if (p_GetComp(p1, currRing)!=p_GetComp(p2, currRing))
403  {
404  if (p_GetComp(p1, currRing)==0)
405  {
406  co=1;
408  }
409  else
410  {
411  co=2;
413  }
414  }
415 
416  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
417  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
418  if (m1 == NULL)
419  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
420 
421  pSetCoeff0(m1, lc2);
422  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
423 
424  if (R != NULL)
425  {
426  if (Pair->i_r1 == -1)
427  {
428  l1 = pLength(p1) - 1;
429  }
430  else
431  {
432  l1 = (R[Pair->i_r1])->GetpLength() - 1;
433  }
434  if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
435  {
436  l2 = pLength(p2) - 1;
437  }
438  else
439  {
440  l2 = (R[Pair->i_r2])->GetpLength() - 1;
441  }
442  }
443 
444  // get m2 * a2
445  if (spNoether != NULL)
446  {
447  l2 = -1;
448  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
449  assume(l2 == pLength(a2));
450  }
451  else
452  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
453 #ifdef HAVE_RINGS
454  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
455 #endif
456 
457  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
458 
459  // get m2*a2 - m1*a1
460  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
461 
462  // Clean-up time
463  Pair->LmDeleteAndIter();
464  p_LmDelete(m1, tailRing);
465 
466  if (co != 0)
467  {
468  if (co==1)
469  {
470  p_SetCompP(p1,0, currRing, tailRing);
471  }
472  else
473  {
474  p_SetCompP(p2,0, currRing, tailRing);
475  }
476  }
477 
478  // the following is commented out: shrinking
479 #ifdef HAVE_SHIFTBBA_NONEXISTENT
480  if (currRing->isLPring)
481  {
482  // assume? h->p in currRing
483  Pair->GetP();
484  poly qq = p_Shrink(Pair->p, currRing->isLPring, currRing);
485  Pair->Clear(); // does the right things
486  Pair->p = qq;
487  Pair->t_p = NULL;
488  Pair->SetShortExpVector();
489  }
490 #endif
491 
492 }
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:964
#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:440
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:510
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:243
#define assume(x)
Definition: mod2.h:405
const ring R
Definition: DebugPrint.cc:36
#define kTest_L(T)
Definition: kutil.h:623
#define NULL
Definition: omList.c:10
int create_count
Definition: kspoly.cc:27
#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:707
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
polyrec * poly
Definition: hilb.h:10
KINLINE poly ksOldCreateSpoly ( poly  p1,
poly  p2,
poly  spNoether = NULL,
ring  r = currRing 
)

Definition at line 1102 of file kInline.h.

1103 {
1104  LObject L(r);
1105  L.p1 = p1;
1106  L.p2 = p2;
1107 
1108  ksCreateSpoly(&L, spNoether);
1109  return L.GetLmCurrRing();
1110 }
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:379
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
KINLINE poly ksOldSpolyRed ( poly  p1,
poly  p2,
poly  spNoether = NULL 
)

Definition at line 1082 of file kInline.h.

1083 {
1084  LObject L(p2);
1085  TObject T(p1);
1086 
1087  ksReducePoly(&L, &T, spNoether);
1088 
1089  return L.GetLmCurrRing();
1090 }
class sLObject LObject
Definition: kutil.h:60
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:59
KINLINE poly ksOldSpolyRedNew ( poly  p1,
poly  p2,
poly  spNoether = NULL 
)

Definition at line 1092 of file kInline.h.

1093 {
1094  LObject L(p_Copy(p2, currRing));
1095  TObject T(p1);
1096 
1097  ksReducePoly(&L, &T, spNoether);
1098 
1099  return L.GetLmCurrRing();
1100 }
class sLObject LObject
Definition: kutil.h:60
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:59
KINLINE void ksOldSpolyTail ( poly  p1,
poly  q,
poly  q2,
poly  spNoether,
ring  r = currRing 
)

Definition at line 1112 of file kInline.h.

1113 {
1114  LObject L(q, currRing, r);
1115  TObject T(p1, currRing, r);
1116 
1117  ksReducePolyTail(&L, &T, q2, spNoether);
1118 }
class sLObject LObject
Definition: kutil.h:60
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:59
int ksReducePoly ( LObject PR,
TObject PW,
poly  spNoether = NULL,
number *  coef = NULL,
kStrategy  strat = NULL 
)

Definition at line 38 of file kspoly.cc.

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

Definition at line 175 of file kspoly.cc.

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

Definition at line 494 of file kspoly.cc.

495 {
496  BOOLEAN ret;
497  number coef;
498  poly Lp = PR->GetLmCurrRing();
499  poly Save = PW->GetLmCurrRing();
500 
501  kTest_L(PR);
502  kTest_T(PW);
503  pAssume(pIsMonomOf(Lp, Current));
504 
505  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
506  assume(PR->bucket == NULL);
507 
508  LObject Red(pNext(Current), PR->tailRing);
509  TObject With(PW, Lp == Save);
510 
511  pAssume(!pHaveCommonMonoms(Red.p, With.p));
512  ret = ksReducePoly(&Red, &With, spNoether, &coef);
513 
514  if (!ret)
515  {
516  if (! n_IsOne(coef, currRing))
517  {
518  pNext(Current) = NULL;
519  if (Current == PR->p && PR->t_p != NULL)
520  pNext(PR->t_p) = NULL;
521  PR->Mult_nn(coef);
522  }
523 
524  n_Delete(&coef, currRing);
525  pNext(Current) = Red.GetLmTailRing();
526  if (Current == PR->p && PR->t_p != NULL)
527  pNext(PR->t_p) = pNext(Current);
528  }
529 
530  if (Lp == Save)
531  With.Delete();
532 
533  // the following is commented out: shrinking
534 #ifdef HAVE_SHIFTBBA_NONEXISTENT
535  if (currRing->isLPring)
536  {
537  // assume? h->p in currRing
538  PR->GetP();
539  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
540  PR->Clear(); // does the right things
541  PR->p = qq;
542  PR->t_p = NULL;
543  PR->SetShortExpVector();
544  }
545 #endif
546 
547  return ret;
548 }
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:469
#define pAssume(cond)
Definition: monomials.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
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:510
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:623
#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:456
#define kTest_T(T)
Definition: kutil.h:621
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
class sTObject TObject
Definition: kutil.h:59
KINLINE int ksReducePolyTail ( LObject PR,
TObject PW,
LObject Red 
)

Definition at line 1055 of file kInline.h.

1056 {
1057  BOOLEAN ret;
1058  number coef;
1059 
1060  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1061  Red->HeadNormalize();
1062  ret = ksReducePoly(Red, PW, NULL, &coef);
1063 
1064  if (!ret)
1065  {
1066  if (! n_IsOne(coef, currRing->cf))
1067  {
1068  PR->Mult_nn(coef);
1069  // HANNES: mark for Normalize
1070  }
1071  n_Delete(&coef, currRing->cf);
1072  }
1073  return ret;
1074 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:469
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN kStratChangeTailRing ( kStrategy  strat,
LObject L = NULL,
TObject T = NULL,
unsigned long  new_expbound = 0 
)

Definition at line 9357 of file kutil.cc.

9358 {
9359  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
9360  /* initial setup or extending */
9361 
9362  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
9363  if (expbound >= currRing->bitmask) return FALSE;
9364  strat->overflow=FALSE;
9365  ring new_tailRing = rModifyRing(currRing,
9366  // Hmmm .. the condition pFDeg == p_Deg
9367  // might be too strong
9368 #ifdef HAVE_RINGS
9369  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver
9370 #else
9371  (strat->homog && currRing->pFDeg == p_Deg), // omit_degree
9372 #endif
9373  (strat->ak==0), // omit_comp if the input is an ideal
9374  expbound); // exp_limit
9375 
9376  if (new_tailRing == currRing) return TRUE;
9377 
9378  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
9379  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
9380 
9381  if (currRing->pFDeg != currRing->pFDegOrig)
9382  {
9383  new_tailRing->pFDeg = currRing->pFDeg;
9384  new_tailRing->pLDeg = currRing->pLDeg;
9385  }
9386 
9387  if (TEST_OPT_PROT)
9388  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
9389  kTest_TS(strat);
9390  assume(new_tailRing != strat->tailRing);
9391  pShallowCopyDeleteProc p_shallow_copy_delete
9392  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
9393 
9394  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
9395 
9396  int i;
9397  for (i=0; i<=strat->tl; i++)
9398  {
9399  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
9400  p_shallow_copy_delete);
9401  }
9402  for (i=0; i<=strat->Ll; i++)
9403  {
9404  assume(strat->L[i].p != NULL);
9405  if (pNext(strat->L[i].p) != strat->tail)
9406  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9407  }
9408  if ((strat->P.t_p != NULL) ||
9409  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
9410  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9411 
9412  if ((L != NULL) && (L->tailRing != new_tailRing))
9413  {
9414  if (L->i_r < 0)
9415  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9416  else
9417  {
9418  assume(L->i_r <= strat->tl);
9419  TObject* t_l = strat->R[L->i_r];
9420  assume(t_l != NULL);
9421  L->tailRing = new_tailRing;
9422  L->p = t_l->p;
9423  L->t_p = t_l->t_p;
9424  L->max = t_l->max;
9425  }
9426  }
9427 
9428  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
9429  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
9430 
9431  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
9432  if (strat->tailRing != currRing)
9433  rKillModifiedRing(strat->tailRing);
9434 
9435  strat->tailRing = new_tailRing;
9436  strat->tailBin = new_tailBin;
9437  strat->p_shallow_copy_delete
9438  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
9439 
9440  if (strat->kHEdge != NULL)
9441  {
9442  if (strat->t_kHEdge != NULL)
9443  p_LmFree(strat->t_kHEdge, strat->tailRing);
9444  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
9445  }
9446 
9447  if (strat->kNoether != NULL)
9448  {
9449  if (strat->t_kNoether != NULL)
9450  p_LmFree(strat->t_kNoether, strat->tailRing);
9452  new_tailRing);
9453  }
9454  kTest_TS(strat);
9455  if (TEST_OPT_PROT)
9456  PrintS("]");
9457  return TRUE;
9458 }
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:140
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:2596
#define TRUE
Definition: auxiliary.h:144
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:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
BOOLEAN homog
Definition: kutil.h:362
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:437
#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:394
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2962
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
void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 9460 of file kutil.cc.

9461 {
9462  unsigned long l = 0;
9463  int i;
9464  long e;
9465 
9466  assume(strat->tailRing == currRing);
9467 
9468  for (i=0; i<= strat->Ll; i++)
9469  {
9470  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
9471  }
9472  for (i=0; i<=strat->tl; i++)
9473  {
9474  // Hmm ... this we could do in one Step
9475  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
9476  }
9477  if (rField_is_Ring(currRing))
9478  {
9479  l *= 2;
9480  }
9481  e = p_GetMaxExp(l, currRing);
9482  if (e <= 1) e = 2;
9483 
9484  kStratChangeTailRing(strat, NULL, NULL, e);
9485 }
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
Definition: p_polys.cc:1174
int Ll
Definition: kutil.h:349
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:743
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:12
#define assume(x)
Definition: mod2.h:405
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
int l
Definition: cfEzgcd.cc:94
void message ( int  i,
int *  reduc,
int *  olddeg,
kStrategy  strat,
int  red_result 
)

Definition at line 6274 of file kutil.cc.

6275 {
6276  if (i != *olddeg)
6277  {
6278  Print("%d",i);
6279  *olddeg = i;
6280  }
6281  if (TEST_OPT_OLDSTD)
6282  {
6283  if (strat->Ll != *reduc)
6284  {
6285  if (strat->Ll != *reduc-1)
6286  Print("(%d)",strat->Ll+1);
6287  else
6288  PrintS("-");
6289  *reduc = strat->Ll;
6290  }
6291  else
6292  PrintS(".");
6293  mflush();
6294  }
6295  else
6296  {
6297  if (red_result == 0)
6298  PrintS("-");
6299  else if (red_result < 0)
6300  PrintS(".");
6301  if ((red_result > 0) || ((strat->Ll % 100)==99))
6302  {
6303  if (strat->Ll != *reduc && strat->Ll > 0)
6304  {
6305  Print("(%d)",strat->Ll+1);
6306  *reduc = strat->Ll;
6307  }
6308  }
6309  }
6310 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:349
#define mflush()
Definition: reporter.h:55
#define TEST_OPT_OLDSTD
Definition: options.h:117
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 6315 of file kutil.cc.

6316 {
6317  //PrintS("\nUsage/Allocation of temporary storage:\n");
6318  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
6319  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
6320  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
6321  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
6322  /* in usual case strat->cv is 0, it gets changed only in shift routines */
6323  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
6324  /*mflush();*/
6325 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:345
int cv
Definition: kutil.h:359
int cp
Definition: kutil.h:345
BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 8920 of file kutil.cc.

8921 {
8922  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
8923  return FALSE;
8924  int i,j;
8925  poly newNoether;
8926 
8927 #if 0
8928  if (currRing->weight_all_1)
8929  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8930  else
8931  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8932 #else
8933  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8934 #endif
8935  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
8936  if (strat->tailRing != currRing)
8937  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
8938  /* compare old and new noether*/
8939  newNoether = pLmInit(strat->kHEdge);
8940  j = p_FDeg(newNoether,currRing);
8941 /* #ifdef HAVE_RINGS
8942  if (!rField_is_Ring(currRing))
8943  #endif */
8944  for (i=1; i<=(currRing->N); i++)
8945  {
8946  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
8947  }
8948  pSetm(newNoether);
8949  if (j < strat->HCord) /*- statistics -*/
8950  {
8951  if (TEST_OPT_PROT)
8952  {
8953  Print("H(%d)",j);
8954  mflush();
8955  }
8956  strat->HCord=j;
8957  #ifdef KDEBUG
8958  if (TEST_OPT_DEBUG)
8959  {
8960  Print("H(%d):",j);
8961  wrp(strat->kHEdge);
8962  PrintLn();
8963  }
8964  #endif
8965  }
8966  if (pCmp(strat->kNoether,newNoether)!=1)
8967  {
8968  pDelete(&strat->kNoether);
8969  strat->kNoether=newNoether;
8970  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
8971  if (strat->tailRing != currRing)
8972  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
8973 
8974  return TRUE;
8975  }
8976  #ifdef HAVE_RINGS
8977  if (rField_is_Ring(currRing))
8978  pLmDelete(newNoether);
8979  else
8980  #endif
8981  pLmFree(newNoether);
8982  return FALSE;
8983 }
#define pSetm(p)
Definition: polys.h:241
int HCord
Definition: kutil.cc:227
void PrintLn()
Definition: reporter.cc:327
#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:140
#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:144
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:679
int HCord
Definition: kutil.h:353
#define mflush()
Definition: reporter.h:55
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#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:905
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:369
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
poly t_kHEdge
Definition: kutil.h:327
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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:157
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:281
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
void pairs ( )
poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 10055 of file kutil.cc.

10056 {
10057  /* restores a poly in currRing from LObject */
10058  LObject h = H;
10059  h.Copy();
10060  poly p;
10061  if (h.p == NULL)
10062  {
10063  if (h.t_p != NULL)
10064  {
10065  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
10066  return(p);
10067  }
10068  else
10069  {
10070  /* h.tp == NULL -> the object is NULL */
10071  return(NULL);
10072  }
10073  }
10074  /* we're here if h.p != NULL */
10075  if (h.t_p == NULL)
10076  {
10077  /* then h.p is the whole poly in currRing */
10078  p = h.p;
10079  return(p);
10080  }
10081  /* we're here if h.p != NULL and h.t_p != NULL */
10082  // clean h.p, get poly from t_p
10083  pNext(h.p)=NULL;
10084  pDelete(&h.p);
10085  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
10086  /* dest. ring: */ currRing);
10087  // no need to clean h: we re-used the polys
10088  return(p);
10089 }
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
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 10024 of file kutil.cc.

10025 {
10026  /* assume: p is completely in currRing */
10027  /* produces an object with LM in curring
10028  and TAIL in tailring */
10029  if (pNext(p)!=NULL)
10030  {
10031  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
10032  }
10033  return(p);
10034 }
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:12
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 10038 of file kutil.cc.

10039 {
10040  /* assume: p has LM in curring and TAIL in tailring */
10041  /* convert it to complete currRing */
10042 
10043  /* check that LM is in currRing */
10045 
10046  if (pNext(p)!=NULL)
10047  {
10048  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
10049  }
10050  return(p);
10051 }
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:12
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
int posInL0 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4905 of file kutil.cc.

4907 {
4908  if (length<0) return 0;
4909 
4910  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
4911  return length+1;
4912 
4913  int i;
4914  int an = 0;
4915  int en= length;
4916  loop
4917  {
4918  if (an >= en-1)
4919  {
4920  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
4921  return an;
4922  }
4923  i=(an+en) / 2;
4924  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
4925  else en=i;
4926  /*aend. fuer lazy == in !=- machen */
4927  }
4928 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInL10 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 1046 of file kstd1.cc.

1047 {
1048  int j,dp,dL;
1049 
1050  if (length<0) return 0;
1051  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1052  {
1053  int op= p->GetpFDeg() +p->ecart;
1054  for (j=length; j>=0; j--)
1055  {
1056  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1057  return j+1;
1058  if (dp < dL)
1059  return j+1;
1060  if ((dp == dL)
1061  && (set[j].GetpFDeg()+set[j].ecart >= op))
1062  return j+1;
1063  }
1064  }
1065  j=length;
1066  loop
1067  {
1068  if (j<0) break;
1069  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1070  j--;
1071  }
1072  return strat->posInLOld(set,j,p,strat);
1073 }
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:998
int posInL11 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5081 of file kutil.cc.

5100 {
5101  if (length<0) return 0;
5102 
5103  int o = p->GetpFDeg();
5104  int op = set[length].GetpFDeg();
5105 
5106  if ((op > o)
5107  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5108  return length+1;
5109  int i;
5110  int an = 0;
5111  int en= length;
5112  loop
5113  {
5114  if (an >= en-1)
5115  {
5116  op = set[an].GetpFDeg();
5117  if ((op > o)
5118  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5119  return en;
5120  return an;
5121  }
5122  i=(an+en) / 2;
5123  op = set[i].GetpFDeg();
5124  if ((op > o)
5125  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5126  an=i;
5127  else
5128  en=i;
5129  }
5130 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInL110 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5419 of file kutil.cc.

5421 {
5422  if (length<0) return 0;
5423 
5424  int o = p->GetpFDeg();
5425  int op = set[length].GetpFDeg();
5426 
5427  if ((op > o)
5428  || ((op == o) && (set[length].length >p->length))
5429  || ((op == o) && (set[length].length <= p->length)
5430  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5431  return length+1;
5432  int i;
5433  int an = 0;
5434  int en= length;
5435  loop
5436  {
5437  if (an >= en-1)
5438  {
5439  op = set[an].GetpFDeg();
5440  if ((op > o)
5441  || ((op == o) && (set[an].length >p->length))
5442  || ((op == o) && (set[an].length <=p->length)
5443  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5444  return en;
5445  return an;
5446  }
5447  i=(an+en) / 2;
5448  op = set[i].GetpFDeg();
5449  if ((op > o)
5450  || ((op == o) && (set[i].length > p->length))
5451  || ((op == o) && (set[i].length <= p->length)
5452  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5453  an=i;
5454  else
5455  en=i;
5456  }
5457 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInL11Ring ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5139 of file kutil.cc.

5141 {
5142  if (length < 0) return 0;
5143  int an,en,i;
5144  an = 0;
5145  en = length+1;
5146  #if 0
5147  printf("\n----------------------\n");
5148  for(i=0;i<=length;i++)
5149  pWrite(set[i].p);
5150  printf("\n----------------------\n");
5151  #endif
5152  loop
5153  {
5154  if (an >= en-1)
5155  {
5156  if(an == en)
5157  return en;
5158  if (pLmCmp(set[an].p, p->p) == 1)
5159  return en;
5160  if (pLmCmp(set[an].p, p->p) == -1)
5161  return an;
5162  if (pLmCmp(set[an].p, p->p) == 0)
5163  {
5164  number lcset,lcp;
5165  lcset = pGetCoeff(set[an].p);
5166  lcp = pGetCoeff(p->p);
5167  if(!nGreaterZero(lcset))
5168  {
5169  set[an].p=p_Neg(set[an].p,currRing);
5170  if (set[an].t_p!=NULL)
5171  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
5172  lcset=pGetCoeff(set[an].p);
5173  }
5174  if(!nGreaterZero(lcp))
5175  {
5176  p->p=p_Neg(p->p,currRing);
5177  if (p->t_p!=NULL)
5178  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5179  lcp=pGetCoeff(p->p);
5180  }
5181  if(nGreater(lcset, lcp))
5182  {
5183  return en;
5184  }
5185  else
5186  {
5187  return an;
5188  }
5189  }
5190  }
5191  i=(an+en) / 2;
5192  if (pLmCmp(set[i].p, p->p) == 1)
5193  an=i;
5194  if (pLmCmp(set[i].p, p->p) == -1)
5195  en=i;
5196  if (pLmCmp(set[i].p, p->p) == 0)
5197  {
5198  number lcset,lcp;
5199  lcset = pGetCoeff(set[i].p);
5200  lcp = pGetCoeff(p->p);
5201  if(!nGreaterZero(lcset))
5202  {
5203  set[i].p=p_Neg(set[i].p,currRing);
5204  if (set[i].t_p!=NULL)
5205  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
5206  lcset=pGetCoeff(set[i].p);
5207  }
5208  if(!nGreaterZero(lcp))
5209  {
5210  p->p=p_Neg(p->p,currRing);
5211  if (p->t_p!=NULL)
5212  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5213  lcp=pGetCoeff(p->p);
5214  }
5215  if(nGreater(lcset, lcp))
5216  {
5217  an = i;
5218  }
5219  else
5220  {
5221  en = i;
5222  }
5223  }
5224  }
5225 }
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
void pWrite(poly p)
Definition: polys.h:279
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:12
#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:1018
#define nGreater(a, b)
Definition: numbers.h:28
int posInL11Ringls ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5227 of file kutil.cc.

5229 {
5230  if (length < 0) return 0;
5231  int an,en,i;
5232  an = 0;
5233  en = length+1;
5234  #if 0
5235  printf("\n----------------------\n");
5236  for(i=0;i<=length;i++)
5237  pWrite(set[i].p);
5238  printf("\n----------------------\n");
5239  #endif
5240  loop
5241  {
5242  if (an >= en-1)
5243  {
5244  if(an == en)
5245  return en;
5246  if (set[an].FDeg > p->FDeg)
5247  return en;
5248  if (set[an].FDeg < p->FDeg)
5249  return an;
5250  if (set[an].FDeg == p->FDeg)
5251  {
5252  number lcset,lcp;
5253  lcset = pGetCoeff(set[an].p);
5254  lcp = pGetCoeff(p->p);
5255  if(!nGreaterZero(lcset))
5256  {
5257  set[an].p=p_Neg(set[an].p,currRing);
5258  if (set[an].t_p!=NULL)
5259  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
5260  lcset=pGetCoeff(set[an].p);
5261  }
5262  if(!nGreaterZero(lcp))
5263  {
5264  p->p=p_Neg(p->p,currRing);
5265  if (p->t_p!=NULL)
5266  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5267  lcp=pGetCoeff(p->p);
5268  }
5269  if(nGreater(lcset, lcp))
5270  {
5271  return en;
5272  }
5273  else
5274  {
5275  return an;
5276  }
5277  }
5278  }
5279  i=(an+en) / 2;
5280  if (set[i].FDeg > p->FDeg)
5281  an=i;
5282  if (set[i].FDeg < p->FDeg)
5283  en=i;
5284  if (set[i].FDeg == p->FDeg)
5285  {
5286  number lcset,lcp;
5287  lcset = pGetCoeff(set[i].p);
5288  lcp = pGetCoeff(p->p);
5289  if(!nGreaterZero(lcset))
5290  {
5291  set[i].p=p_Neg(set[i].p,currRing);
5292  if (set[i].t_p!=NULL)
5293  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
5294  lcset=pGetCoeff(set[i].p);
5295  }
5296  if(!nGreaterZero(lcp))
5297  {
5298  p->p=p_Neg(p->p,currRing);
5299  if (p->t_p!=NULL)
5300  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5301  lcp=pGetCoeff(p->p);
5302  }
5303  if(nGreater(lcset, lcp))
5304  {
5305  an = i;
5306  }
5307  else
5308  {
5309  en = i;
5310  }
5311  }
5312  }
5313 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
void pWrite(poly p)
Definition: polys.h:279
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:12
#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:1018
#define nGreater(a, b)
Definition: numbers.h:28
int posInL13 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5465 of file kutil.cc.

5467 {
5468  if (length<0) return 0;
5469 
5470  int o = p->GetpFDeg();
5471 
5472  if (set[length].GetpFDeg() > o)
5473  return length+1;
5474 
5475  int i;
5476  int an = 0;
5477  int en= length;
5478  loop
5479  {
5480  if (an >= en-1)
5481  {
5482  if (set[an].GetpFDeg() >= o)
5483  return en;
5484  return an;
5485  }
5486  i=(an+en) / 2;
5487  if (set[i].GetpFDeg() >= o)
5488  an=i;
5489  else
5490  en=i;
5491  }
5492 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInL15 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5500 of file kutil.cc.

5520 {
5521  if (length<0) return 0;
5522 
5523  int o = p->GetpFDeg() + p->ecart;
5524  int op = set[length].GetpFDeg() + set[length].ecart;
5525 
5526  if ((op > o)
5527  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5528  return length+1;
5529  int i;
5530  int an = 0;
5531  int en= length;
5532  loop
5533  {
5534  if (an >= en-1)
5535  {
5536  op = set[an].GetpFDeg() + set[an].ecart;
5537  if ((op > o)
5538  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5539  return en;
5540  return an;
5541  }
5542  i=(an+en) / 2;
5543  op = set[i].GetpFDeg() + set[i].ecart;
5544  if ((op > o)
5545  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5546  an=i;
5547  else
5548  en=i;
5549  }
5550 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInL17 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5558 of file kutil.cc.

5560 {
5561  if (length<0) return 0;
5562 
5563  int o = p->GetpFDeg() + p->ecart;
5564 
5565  if ((set[length].GetpFDeg() + set[length].ecart > o)
5566  || ((set[length].GetpFDeg() + set[length].ecart == o)
5567  && (set[length].ecart > p->ecart))
5568  || ((set[length].GetpFDeg() + set[length].ecart == o)
5569  && (set[length].ecart == p->ecart)
5570  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5571  return length+1;
5572  int i;
5573  int an = 0;
5574  int en= length;
5575  loop
5576  {
5577  if (an >= en-1)
5578  {
5579  if ((set[an].GetpFDeg() + set[an].ecart > o)
5580  || ((set[an].GetpFDeg() + set[an].ecart == o)
5581  && (set[an].ecart > p->ecart))
5582  || ((set[an].GetpFDeg() + set[an].ecart == o)
5583  && (set[an].ecart == p->ecart)
5584  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5585  return en;
5586  return an;
5587  }
5588  i=(an+en) / 2;
5589  if ((set[i].GetpFDeg() + set[i].ecart > o)
5590  || ((set[i].GetpFDeg() + set[i].ecart == o)
5591  && (set[i].ecart > p->ecart))
5592  || ((set[i].GetpFDeg() +set[i].ecart == o)
5593  && (set[i].ecart == p->ecart)
5594  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5595  an=i;
5596  else
5597  en=i;
5598  }
5599 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInLF5C ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5069 of file kutil.cc.

5071 {
5072  return strat->Ll+1;
5073 }
int Ll
Definition: kutil.h:349
int posInLRing ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4960 of file kutil.cc.

4962 {
4963  if (length < 0) return 0;
4964  if (set[length].FDeg > p->FDeg)
4965  return length+1;
4966  if (set[length].FDeg == p->FDeg)
4967  if(set[length].GetpLength() > p->GetpLength())
4968  return length+1;
4969  int i;
4970  int an = 0;
4971  int en= length+1;
4972  loop
4973  {
4974  if (an >= en-1)
4975  {
4976  if(an == en)
4977  return en;
4978  if (set[an].FDeg > p->FDeg)
4979  return en;
4980  if(set[an].FDeg == p->FDeg)
4981  {
4982  if(set[an].GetpLength() > p->GetpLength())
4983  {return en;}
4984  else
4985  {
4986  if(set[an].GetpLength() == p->GetpLength())
4987  {
4988  if(nGreater(set[an].p->coef, p->p->coef))
4989  {
4990  return en;
4991  }
4992  else
4993  {
4994  return an;
4995  }
4996  }
4997  else
4998  {
4999  return an;
5000  }
5001  }
5002  }
5003  else
5004  {return an;}
5005  }
5006  i=(an+en) / 2;
5007  if (set[i].FDeg > p->FDeg)
5008  an=i;
5009  else
5010  {
5011  if(set[i].FDeg == p->FDeg)
5012  {
5013  if(set[i].GetpLength() > p->GetpLength())
5014  an=i;
5015  else
5016  {
5017  if(set[i].GetpLength() == p->GetpLength())
5018  {
5019  if(nGreater(set[i].p->coef, p->p->coef))
5020  {
5021  an = i;
5022  }
5023  else
5024  {
5025  en = i;
5026  }
5027  }
5028  else
5029  {
5030  en=i;
5031  }
5032  }
5033  }
5034  else
5035  en=i;
5036  }
5037  }
5038 }
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
int posInLSig ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4936 of file kutil.cc.

4938 {
4939 if (length<0) return 0;
4940 if (pLmCmp(set[length].sig,p->sig)== currRing->OrdSgn)
4941  return length+1;
4942 
4943 int i;
4944 int an = 0;
4945 int en= length;
4946 loop
4947 {
4948  if (an >= en-1)
4949  {
4950  if (pLmCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
4951  return an;
4952  }
4953  i=(an+en) / 2;
4954  if (pLmCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
4955  else en=i;
4956  /*aend. fuer lazy == in !=- machen */
4957 }
4958 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInS ( const kStrategy  strat,
const int  length,
const poly  p,
const int  ecart_p 
)

Definition at line 4197 of file kutil.cc.

4199 {
4200  if(length==-1) return 0;
4201  polyset set=strat->S;
4202  int i;
4203  int an = 0;
4204  int en = length;
4205  int cmp_int = currRing->OrdSgn;
4207 #ifdef HAVE_PLURAL
4208  && (currRing->real_var_start==0)
4209 #endif
4210 #if 0
4211  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
4212 #endif
4213  )
4214  {
4215  int o=p_Deg(p,currRing);
4216  int oo=p_Deg(set[length],currRing);
4217 
4218  if ((oo<o)
4219  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
4220  return length+1;
4221 
4222  loop
4223  {
4224  if (an >= en-1)
4225  {
4226  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
4227  {
4228  return an;
4229  }
4230  return en;
4231  }
4232  i=(an+en) / 2;
4233  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
4234  else an=i;
4235  }
4236  }
4237  else
4238  {
4239 #ifdef HAVE_RINGS
4240  if (rField_is_Ring(currRing))
4241  {
4242  if (pLmCmp(set[length],p)== -cmp_int)
4243  return length+1;
4244  int cmp;
4245  loop
4246  {
4247  if (an >= en-1)
4248  {
4249  cmp = pLmCmp(set[an],p);
4250  if (cmp == cmp_int) return an;
4251  if (cmp == -cmp_int) return en;
4252  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
4253  return an;
4254  }
4255  i = (an+en) / 2;
4256  cmp = pLmCmp(set[i],p);
4257  if (cmp == cmp_int) en = i;
4258  else if (cmp == -cmp_int) an = i;
4259  else
4260  {
4261  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
4262  else en = i;
4263  }
4264  }
4265  }
4266  else
4267 #endif
4268  if (pLmCmp(set[length],p)== -cmp_int)
4269  return length+1;
4270 
4271  loop
4272  {
4273  if (an >= en-1)
4274  {
4275  if (pLmCmp(set[an],p) == cmp_int) return an;
4276  if (pLmCmp(set[an],p) == -cmp_int) return en;
4277  if ((cmp_int!=1)
4278  && ((strat->ecartS[an])>ecart_p))
4279  return an;
4280  return en;
4281  }
4282  i=(an+en) / 2;
4283  if (pLmCmp(set[i],p) == cmp_int) en=i;
4284  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
4285  else
4286  {
4287  if ((cmp_int!=1)
4288  &&((strat->ecartS[i])<ecart_p))
4289  en=i;
4290  else
4291  an=i;
4292  }
4293  }
4294  }
4295 }
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:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:771
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
poly * polyset
Definition: hutil.h:17
int posInSyz ( const kStrategy  strat,
const poly  sig 
)

Definition at line 5041 of file kutil.cc.

5042 {
5043 if (strat->syzl==0) return 0;
5044 if (pLmCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
5045  return strat->syzl;
5046 int i;
5047 int an = 0;
5048 int en= strat->syzl-1;
5049 loop
5050 {
5051  if (an >= en-1)
5052  {
5053  if (pLmCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
5054  return an;
5055  }
5056  i=(an+en) / 2;
5057  if (pLmCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
5058  else en=i;
5059  /*aend. fuer lazy == in !=- machen */
5060 }
5061 }
loop
Definition: myNF.cc:98
#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:12
int i
Definition: cfEzgcd.cc:123
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
int posInT0 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4302 of file kutil.cc.

4303 {
4304  return (length+1);
4305 }
int posInT1 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4313 of file kutil.cc.

4314 {
4315  if (length==-1) return 0;
4316 
4317  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
4318 
4319  int i;
4320  int an = 0;
4321  int en= length;
4322 
4323  loop
4324  {
4325  if (an >= en-1)
4326  {
4327  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
4328  return en;
4329  }
4330  i=(an+en) / 2;
4331  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
4332  else an=i;
4333  }
4334 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInT11 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4371 of file kutil.cc.

4389 {
4390  if (length==-1) return 0;
4391 
4392  int o = p.GetpFDeg();
4393  int op = set[length].GetpFDeg();
4394 
4395  if ((op < o)
4396  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4397  return length+1;
4398 
4399  int i;
4400  int an = 0;
4401  int en= length;
4402 
4403  loop
4404  {
4405  if (an >= en-1)
4406  {
4407  op= set[an].GetpFDeg();
4408  if ((op > o)
4409  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4410  return an;
4411  return en;
4412  }
4413  i=(an+en) / 2;
4414  op = set[i].GetpFDeg();
4415  if (( op > o)
4416  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4417  en=i;
4418  else
4419  an=i;
4420  }
4421 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInT110 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4504 of file kutil.cc.

4505 {
4506  p.GetpLength();
4507  if (length==-1) return 0;
4508 
4509  int o = p.GetpFDeg();
4510  int op = set[length].GetpFDeg();
4511 
4512  if (( op < o)
4513  || (( op == o) && (set[length].length<p.length))
4514  || (( op == o) && (set[length].length == p.length)
4515  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4516  return length+1;
4517 
4518  int i;
4519  int an = 0;
4520  int en= length;
4521  loop
4522  {
4523  if (an >= en-1)
4524  {
4525  op = set[an].GetpFDeg();
4526  if (( op > o)
4527  || (( op == o) && (set[an].length > p.length))
4528  || (( op == o) && (set[an].length == p.length)
4529  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4530  return an;
4531  return en;
4532  }
4533  i=(an+en) / 2;
4534  op = set[i].GetpFDeg();
4535  if (( op > o)
4536  || (( op == o) && (set[i].length > p.length))
4537  || (( op == o) && (set[i].length == p.length)
4538  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4539  en=i;
4540  else
4541  an=i;
4542  }
4543 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInT13 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4550 of file kutil.cc.

4551 {
4552  if (length==-1) return 0;
4553 
4554  int o = p.GetpFDeg();
4555 
4556  if (set[length].GetpFDeg() <= o)
4557  return length+1;
4558 
4559  int i;
4560  int an = 0;
4561  int en= length;
4562  loop
4563  {
4564  if (an >= en-1)
4565  {
4566  if (set[an].GetpFDeg() > o)
4567  return an;
4568  return en;
4569  }
4570  i=(an+en) / 2;
4571  if (set[i].GetpFDeg() > o)
4572  en=i;
4573  else
4574  an=i;
4575  }
4576 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInT15 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4618 of file kutil.cc.

4637 {
4638  if (length==-1) return 0;
4639 
4640  int o = p.GetpFDeg() + p.ecart;
4641  int op = set[length].GetpFDeg()+set[length].ecart;
4642 
4643  if ((op < o)
4644  || ((op == o)
4645  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4646  return length+1;
4647 
4648  int i;
4649  int an = 0;
4650  int en= length;
4651  loop
4652  {
4653  if (an >= en-1)
4654  {
4655  op = set[an].GetpFDeg()+set[an].ecart;
4656  if (( op > o)
4657  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4658  return an;
4659  return en;
4660  }
4661  i=(an+en) / 2;
4662  op = set[i].GetpFDeg()+set[i].ecart;
4663  if (( op > o)
4664  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4665  en=i;
4666  else
4667  an=i;
4668  }
4669 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInT17 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4676 of file kutil.cc.

4697 {
4698  if (length==-1) return 0;
4699 
4700  int o = p.GetpFDeg() + p.ecart;
4701  int op = set[length].GetpFDeg()+set[length].ecart;
4702 
4703  if ((op < o)
4704  || (( op == o) && (set[length].ecart > p.ecart))
4705  || (( op == o) && (set[length].ecart==p.ecart)
4706  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4707  return length+1;
4708 
4709  int i;
4710  int an = 0;
4711  int en= length;
4712  loop
4713  {
4714  if (an >= en-1)
4715  {
4716  op = set[an].GetpFDeg()+set[an].ecart;
4717  if (( op > o)
4718  || (( op == o) && (set[an].ecart < p.ecart))
4719  || (( op == o) && (set[an].ecart==p.ecart)
4720  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4721  return an;
4722  return en;
4723  }
4724  i=(an+en) / 2;
4725  op = set[i].GetpFDeg()+set[i].ecart;
4726  if ((op > o)
4727  || (( op == o) && (set[i].ecart < p.ecart))
4728  || (( op == o) && (set[i].ecart == p.ecart)
4729  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4730  en=i;
4731  else
4732  an=i;
4733  }
4734 }
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:12
int i
Definition: cfEzgcd.cc:123
int posInT19 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4805 of file kutil.cc.

4806 {
4807  p.GetpLength();
4808  if (length==-1) return 0;
4809 
4810  int o = p.ecart;
4811  int op=p.GetpFDeg();
4812 
4813  if (set[length].ecart < o)
4814  return length+1;
4815  if (set[length].ecart == o)
4816  {
4817  int oo=set[length].GetpFDeg();
4818  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
4819  return length+1;
4820  }
4821 
4822  int i;
4823  int an = 0;
4824  int en= length;
4825  loop
4826  {
4827  if (an >= en-1)
4828  {
4829  if (set[an].ecart > o)
4830  return an;
4831  if (set[an].ecart == o)
4832  {
4833  int oo=set[an].GetpFDeg();
4834  if((oo > op)
4835  || ((oo==op) && (set[an].length > p.length)))
4836  return an;
4837  }
4838  return en;
4839  }
4840  i=(an+en) / 2;
4841  if (set[i].ecart > o)
4842  en=i;
4843  else if (set[i].ecart == o)
4844  {
4845  int oo=set[i].GetpFDeg();
4846  if ((oo > op)
4847  || ((oo == op) && (set[i].length > p.length)))
4848  en=i;
4849  else
4850  an=i;
4851  }
4852  else
4853  an=i;
4854  }
4855 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInT2 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4341 of file kutil.cc.

4342 {
4343  p.GetpLength();
4344  if (length==-1)
4345  return 0;
4346  if (set[length].length<p.length)
4347  return length+1;
4348 
4349  int i;
4350  int an = 0;
4351  int en= length;
4352 
4353  loop
4354  {
4355  if (an >= en-1)
4356  {
4357  if (set[an].length>p.length) return an;
4358  return en;
4359  }
4360  i=(an+en) / 2;
4361  if (set[i].length>p.length) en=i;
4362  else an=i;
4363  }
4364 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInT_EcartpLength ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4579 of file kutil.cc.

4580 {
4581  int ol = p.GetpLength();
4582  if (length==-1) return 0;
4583 
4584  int op=p.ecart;
4585 
4586  int oo=set[length].ecart;
4587  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
4588  return length+1;
4589 
4590  int i;
4591  int an = 0;
4592  int en= length;
4593  loop
4594  {
4595  if (an >= en-1)
4596  {
4597  int oo=set[an].ecart;
4598  if((oo > op)
4599  || ((oo==op) && (set[an].pLength > ol)))
4600  return an;
4601  return en;
4602  }
4603  i=(an+en) / 2;
4604  int oo=set[i].ecart;
4605  if ((oo > op)
4606  || ((oo == op) && (set[i].pLength > ol)))
4607  en=i;
4608  else
4609  an=i;
4610  }
4611 }
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
int posInTSig ( const TSet  set,
const int  length,
LObject p 
)
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 9221 of file kutil.cc.

9222 {
9223  if(!nCoeff_is_Ring_Z(currRing->cf))
9224  return;
9225  poly pH = h->GetP();
9226  poly p,pp;
9227  p = pH;
9228  bool deleted = FALSE, ok = FALSE;
9229  for(int i = 0; i<=strat->sl; i++)
9230  {
9231  p = pH;
9232  if(pNext(strat->S[i]) == NULL)
9233  {
9234  //pWrite(p);
9235  //pWrite(strat->S[i]);
9236  while(ok == FALSE)
9237  {
9238  if(pLmDivisibleBy(strat->S[i], p))
9239  {
9240  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
9241  p_SetCoeff(p,dummy,currRing);
9242  }
9243  if(nIsZero(p->coef))
9244  {
9245  pLmDelete(&p);
9246  deleted = TRUE;
9247  }
9248  else
9249  {
9250  ok = TRUE;
9251  }
9252  }
9253  pp = pNext(p);
9254  while(pp != NULL)
9255  {
9256  if(pLmDivisibleBy(strat->S[i], pp))
9257  {
9258  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
9259  p_SetCoeff(pp,dummy,currRing);
9260  if(nIsZero(pp->coef))
9261  {
9262  pLmDelete(&pNext(p));
9263  pp = pNext(p);
9264  deleted = TRUE;
9265  }
9266  else
9267  {
9268  p = pp;
9269  pp = pNext(p);
9270  }
9271  }
9272  else
9273  {
9274  p = pp;
9275  pp = pNext(p);
9276  }
9277  }
9278  }
9279  }
9280  h->SetLmCurrRing();
9281  if(deleted)
9282  strat->initEcart(h);
9283 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
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:12
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
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 9048 of file kutil.cc.

9049 {
9051  if(!nCoeff_is_Ring_Z(currRing->cf))
9052  return NULL;
9053  ideal F = idCopy(FOrig);
9054  idSkipZeroes(F);
9055  poly pmon;
9056  ring origR = currRing;
9057  ideal monred = idInit(1,1);
9058  for(int i=0; i<idElem(F); i++)
9059  {
9060  if(pNext(F->m[i]) == NULL)
9061  idInsertPoly(monred, F->m[i]);
9062  }
9063  int posconst = idPosConstant(F);
9064  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
9065  {
9066  pmon = pCopy(F->m[posconst]);
9067  idDelete(&F);
9068  idDelete(&monred);
9069  return pmon;
9070  }
9071  int idelemQ = 0;
9072  if(Q!=NULL)
9073  {
9074  idelemQ = IDELEMS(Q);
9075  for(int i=0; i<idelemQ; i++)
9076  {
9077  if(pNext(Q->m[i]) == NULL)
9078  idInsertPoly(monred, Q->m[i]);
9079  }
9080  idSkipZeroes(monred);
9081  posconst = idPosConstant(monred);
9082  //the constant, if found, will be from Q
9083  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
9084  {
9085  pmon = pCopy(monred->m[posconst]);
9086  idDelete(&F);
9087  idDelete(&monred);
9088  return pmon;
9089  }
9090  }
9091  ring QQ_ring = rCopy0(currRing,FALSE);
9092  nKillChar(QQ_ring->cf);
9093  QQ_ring->cf = nInitChar(n_Q, NULL);
9094  rComplete(QQ_ring,1);
9095  QQ_ring = rAssure_c_dp(QQ_ring);
9096  rChangeCurrRing(QQ_ring);
9097  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
9098  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
9099  for(int i = 0, j = 0; i<IDELEMS(F); i++)
9100  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
9101  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
9102  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
9103  ideal one = kStd(II, NULL, isNotHomog, NULL);
9104  idSkipZeroes(one);
9105  if(idIsConstant(one))
9106  {
9107  //one should be <1>
9108  for(int i = IDELEMS(II)-1; i>=0; i--)
9109  if(II->m[i] != NULL)
9110  II->m[i+1] = II->m[i];
9111  II->m[0] = pOne();
9112  ideal syz = idSyzygies(II, isNotHomog, NULL);
9113  poly integer = NULL;
9114  for(int i = IDELEMS(syz)-1;i>=0; i--)
9115  {
9116  if(pGetComp(syz->m[i]) == 1)
9117  {
9118  if(pIsConstant(syz->m[i]))
9119  {
9120  integer = pHead(syz->m[i]);
9121  pSetComp(integer, 0);
9122  break;
9123  }
9124  }
9125  }
9126  rChangeCurrRing(origR);
9127  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9128  pmon = prMapR(integer, nMap2, QQ_ring, origR);
9129  idDelete(&F);
9130  idDelete(&monred);
9131  idDelete(&II);
9132  idDelete(&one);
9133  idDelete(&syz);
9134  pDelete(&integer);
9135  rDelete(QQ_ring);
9136  return pmon;
9137  }
9138  else
9139  {
9140  if(idIs0(monred))
9141  {
9142  poly mindegmon = NULL;
9143  for(int i = 0; i<IDELEMS(one); i++)
9144  {
9145  if(pNext(one->m[i]) == NULL)
9146  {
9147  if(mindegmon == NULL)
9148  mindegmon = one->m[i];
9149  else
9150  {
9151  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
9152  mindegmon = one->m[i];
9153  }
9154  }
9155  }
9156  if(mindegmon != NULL)
9157  {
9158  for(int i = IDELEMS(II)-1; i>=0; i--)
9159  if(II->m[i] != NULL)
9160  II->m[i+1] = II->m[i];
9161  II->m[0] = mindegmon;
9162  ideal syz = idSyzygies(II, isNotHomog, NULL);
9163  bool found = FALSE;
9164  for(int i = IDELEMS(syz)-1;i>=0; i--)
9165  {
9166  if(pGetComp(syz->m[i]) == 1)
9167  {
9168  if(pIsConstant(syz->m[i]))
9169  {
9170  pSetCoeff(mindegmon, syz->m[i]->coef);
9171  found = TRUE;
9172  break;
9173  }
9174  }
9175  }
9176  idDelete(&syz);
9177  if (found == FALSE)
9178  {
9179  rChangeCurrRing(origR);
9180  idDelete(&F);
9181  idDelete(&monred);
9182  idDelete(&II);
9183  idDelete(&one);
9184  pDelete(&mindegmon);
9185  pDelete(&pmon);
9186  rDelete(QQ_ring);
9187  return NULL;
9188  }
9189  rChangeCurrRing(origR);
9190  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9191  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
9192  idDelete(&F);
9193  idDelete(&monred);
9194  idDelete(&II);
9195  idDelete(&one);
9196  idDelete(&syz);
9197  pDelete(&mindegmon);
9198  rDelete(QQ_ring);
9199  return pmon;
9200  }
9201  else
9202  rChangeCurrRing(origR);
9203  pDelete(&mindegmon);
9204  }
9205  else
9206  rChangeCurrRing(origR);
9207  }
9208  idDelete(&F);
9209  idDelete(&monred);
9210  idDelete(&II);
9211  idDelete(&one);
9212  pDelete(&pmon);
9213  rDelete(QQ_ring);
9214  return NULL;
9215 }
#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:140
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#define TRUE
Definition: auxiliary.h:144
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:2221
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4895
#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:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3436
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1318
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
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:209
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#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:720
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:73
void rChangeCurrRing(ring r)
Definition: polys.cc:14
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 pDelete(p_ptr)
Definition: polys.h:157
#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:557
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:488
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
#define idIsConstant(I)
Definition: ideals.h:53
int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 3447 of file kstd2.cc.

3448 {
3449  if (h->IsNull()) return 0;
3450 
3451  int at, reddeg,d;
3452  int pass = 0;
3453  int j = 0;
3454 
3455  if (! strat->homog)
3456  {
3457  d = h->GetpFDeg() + h->ecart;
3458  reddeg = strat->LazyDegree+d;
3459  }
3460  h->SetShortExpVector();
3461  loop
3462  {
3463  j = kFindDivisibleByInT(strat, h);
3464  if (j < 0)
3465  {
3466  h->SetDegStuffReturnLDeg(strat->LDegLast);
3467  return 1;
3468  }
3469 
3470  if (!TEST_OPT_INTSTRATEGY)
3471  strat->T[j].pNorm();
3472 #ifdef KDEBUG
3473  if (TEST_OPT_DEBUG)
3474  {
3475  PrintS("reduce ");
3476  h->wrp();
3477  PrintS(" with ");
3478  strat->T[j].wrp();
3479  }
3480 #endif
3481  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
3482  if (!h->IsNull())
3483  {
3484  poly qq=p_Shrink(h->GetTP(),strat->lV,strat->tailRing);
3485  h->p=NULL;
3486  h->t_p=qq;
3487  if (qq!=NULL) h->GetP(strat->lmBin);
3488  }
3489 
3490 #ifdef KDEBUG
3491  if (TEST_OPT_DEBUG)
3492  {
3493  PrintS(" to ");
3494  wrp(h->p);
3495  PrintLn();
3496  }
3497 #endif
3498  if (h->IsNull())
3499  {
3500  if (h->lcm!=NULL) pLmFree(h->lcm);
3501  h->Clear();
3502  return 0;
3503  }
3504  h->SetShortExpVector();
3505 
3506 #if 0
3507  if ((strat->syzComp!=0) && !strat->honey)
3508  {
3509  if ((strat->syzComp>0) &&
3510  (h->Comp() > strat->syzComp))
3511  {
3512  assume(h->MinComp() > strat->syzComp);
3513 #ifdef KDEBUG
3514  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
3515 #endif
3516  if (strat->homog)
3517  h->SetDegStuffReturnLDeg(strat->LDegLast);
3518  return -2;
3519  }
3520  }
3521 #endif
3522  if (!strat->homog)
3523  {
3524  if (!TEST_OPT_OLDSTD && strat->honey)
3525  {
3526  h->SetpFDeg();
3527  if (strat->T[j].ecart <= h->ecart)
3528  h->ecart = d - h->GetpFDeg();
3529  else
3530  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
3531 
3532  d = h->GetpFDeg() + h->ecart;
3533  }
3534  else
3535  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
3536  /*- try to reduce the s-polynomial -*/
3537  pass++;
3538  /*
3539  *test whether the polynomial should go to the lazyset L
3540  *-if the degree jumps
3541  *-if the number of pre-defined reductions jumps
3542  */
3543  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
3544  && ((d >= reddeg) || (pass > strat->LazyPass)))
3545  {
3546  h->SetLmCurrRing();
3547  if (strat->posInLDependsOnLength)
3548  h->SetLength(strat->length_pLength);
3549  at = strat->posInL(strat->L,strat->Ll,h,strat);
3550  if (at <= strat->Ll)
3551  {
3552  //int dummy=strat->sl;
3553  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
3554  //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
3555  if (kFindDivisibleByInT(strat, h) < 0)
3556  return 1;
3557  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
3558 #ifdef KDEBUG
3559  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
3560 #endif
3561  h->Clear();
3562  return -1;
3563  }
3564  }
3565  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
3566  {
3567  reddeg = d+1;
3568  Print(".%d",d);mflush();
3569  }
3570  }
3571  }
3572 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
BOOLEAN length_pLength
Definition: kutil.h:377
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
#define mflush()
Definition: reporter.h:55
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:510
int lV
Definition: kutil.h:358
BOOLEAN homog
Definition: kutil.h:362
#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:405
void PrintS(const char *s)
Definition: reporter.cc:294
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:323
BOOLEAN LDegLast
Definition: kutil.h:375
#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:104
void wrp(poly p)
Definition: polys.h:281
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
int redHomog ( LObject h,
kStrategy  strat 
)

Definition at line 519 of file kstd2.cc.

520 {
521  if (strat->tl<0) return 1;
522  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
523  assume(h->FDeg == h->pFDeg());
524 
525  poly h_p;
526  int i,j,at,pass, ii;
527  unsigned long not_sev;
528  // long reddeg,d;
529 
530  pass = j = 0;
531  // d = reddeg = h->GetpFDeg();
532  h->SetShortExpVector();
533  int li;
534  h_p = h->GetLmTailRing();
535  not_sev = ~ h->sev;
536  loop
537  {
538  j = kFindDivisibleByInT(strat, h);
539  if (j < 0) return 1;
540 
541  li = strat->T[j].pLength;
542  ii = j;
543  /*
544  * the polynomial to reduce with (up to the moment) is;
545  * pi with length li
546  */
547  i = j;
548 #if 1
549  if (TEST_OPT_LENGTH)
550  loop
551  {
552  /*- search the shortest possible with respect to length -*/
553  i++;
554  if (i > strat->tl)
555  break;
556  if (li<=1)
557  break;
558  if ((strat->T[i].pLength < li)
559  &&
560  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
561  h_p, not_sev, strat->tailRing))
562  {
563  /*
564  * the polynomial to reduce with is now;
565  */
566  li = strat->T[i].pLength;
567  ii = i;
568  }
569  }
570 #endif
571 
572  /*
573  * end of search: have to reduce with pi
574  */
575 #ifdef KDEBUG
576  if (TEST_OPT_DEBUG)
577  {
578  PrintS("red:");
579  h->wrp();
580  PrintS(" with ");
581  strat->T[ii].wrp();
582  }
583 #endif
584  assume(strat->fromT == FALSE);
585 
586  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
587 #if SBA_PRINT_REDUCTION_STEPS
588  sba_interreduction_steps++;
589 #endif
590 #if SBA_PRINT_OPERATIONS
591  sba_interreduction_operations += pLength(strat->T[ii].p);
592 #endif
593 
594 #ifdef KDEBUG
595  if (TEST_OPT_DEBUG)
596  {
597  PrintS("\nto ");
598  h->wrp();
599  PrintLn();
600  }
601 #endif
602 
603  h_p = h->GetLmTailRing();
604  if (h_p == NULL)
605  {
606  if (h->lcm!=NULL) pLmFree(h->lcm);
607 #ifdef KDEBUG
608  h->lcm=NULL;
609 #endif
610  return 0;
611  }
612  h->SetShortExpVector();
613  not_sev = ~ h->sev;
614  /*
615  * try to reduce the s-polynomial h
616  *test first whether h should go to the lazyset L
617  *-if the degree jumps
618  *-if the number of pre-defined reductions jumps
619  */
620  pass++;
621  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
622  {
623  h->SetLmCurrRing();
624  at = strat->posInL(strat->L,strat->Ll,h,strat);
625  if (at <= strat->Ll)
626  {
627  int dummy=strat->sl;
628  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
629  return 1;
630  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
631 #ifdef KDEBUG
632  if (TEST_OPT_DEBUG)
633  Print(" lazy: -> L%d\n",at);
634 #endif
635  h->Clear();
636  return -1;
637  }
638  }
639  }
640 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int tl
Definition: kutil.h:348
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
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:1111
static int pLength(poly a)
Definition: p_polys.h:189
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
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:202
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:104
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
int redHoney ( LObject h,
kStrategy  strat 
)

Definition at line 1117 of file kstd2.cc.

1118 {
1119  if (strat->tl<0) return 1;
1120  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1121  assume(h->FDeg == h->pFDeg());
1122  poly h_p;
1123  int i,j,at,pass,ei, ii, h_d;
1124  unsigned long not_sev;
1125  long reddeg,d;
1126 
1127  pass = j = 0;
1128  d = reddeg = h->GetpFDeg() + h->ecart;
1129  h->SetShortExpVector();
1130  int li;
1131  h_p = h->GetLmTailRing();
1132  not_sev = ~ h->sev;
1133 
1134  h->PrepareRed(strat->use_buckets);
1135  loop
1136  {
1137  j=kFindDivisibleByInT(strat, h);
1138  if (j < 0) return 1;
1139 
1140  ei = strat->T[j].ecart;
1141  li = strat->T[j].pLength;
1142  ii = j;
1143  /*
1144  * the polynomial to reduce with (up to the moment) is;
1145  * pi with ecart ei
1146  */
1147  i = j;
1148  if (TEST_OPT_LENGTH)
1149  loop
1150  {
1151  /*- takes the first possible with respect to ecart -*/
1152  i++;
1153  if (i > strat->tl)
1154  break;
1155  //if (ei < h->ecart)
1156  // break;
1157  if (li<=1)
1158  break;
1159  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1160  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1161  &&
1162  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1163  h_p, not_sev, strat->tailRing))
1164  {
1165  /*
1166  * the polynomial to reduce with is now;
1167  */
1168  ei = strat->T[i].ecart;
1169  li = strat->T[i].pLength;
1170  ii = i;
1171  }
1172  }
1173 
1174  /*
1175  * end of search: have to reduce with pi
1176  */
1177  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1178  {
1179  h->GetTP(); // clears bucket
1180  h->SetLmCurrRing();
1181  /*
1182  * It is not possible to reduce h with smaller ecart;
1183  * if possible h goes to the lazy-set L,i.e
1184  * if its position in L would be not the last one
1185  */
1186  if (strat->Ll >= 0) /* L is not empty */
1187  {
1188  at = strat->posInL(strat->L,strat->Ll,h,strat);
1189  if(at <= strat->Ll)
1190  /*- h will not become the next element to reduce -*/
1191  {
1192  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1193 #ifdef KDEBUG
1194  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1195 #endif
1196  h->Clear();
1197  return -1;
1198  }
1199  }
1200  }
1201 #ifdef KDEBUG
1202  if (TEST_OPT_DEBUG)
1203  {
1204  PrintS("red:");
1205  h->wrp();
1206  PrintS(" with ");
1207  strat->T[ii].wrp();
1208  }
1209 #endif
1210  assume(strat->fromT == FALSE);
1211 
1212  number coef;
1213  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),&coef,strat);
1214 #if SBA_PRINT_REDUCTION_STEPS
1215  sba_interreduction_steps++;
1216 #endif
1217 #if SBA_PRINT_OPERATIONS
1218  sba_interreduction_operations += pLength(strat->T[ii].p);
1219 #endif
1220 #ifdef KDEBUG
1221  if (TEST_OPT_DEBUG)
1222  {
1223  PrintS("\nto:");
1224  h->wrp();
1225  PrintLn();
1226  }
1227 #endif
1228  if(h->IsNull())
1229  {
1230  h->Clear();
1231  if (h->lcm!=NULL) pLmFree(h->lcm);
1232  #ifdef KDEBUG
1233  h->lcm=NULL;
1234  #endif
1235  return 0;
1236  }
1237  if (TEST_OPT_IDLIFT)
1238  {
1239  if (h->p!=NULL)
1240  {
1241  if(p_GetComp(h->p,currRing)>strat->syzComp)
1242  {
1243  h->Delete();
1244  return 0;
1245  }
1246  }
1247  else if (h->t_p!=NULL)
1248  {
1249  if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1250  {
1251  h->Delete();
1252  return 0;
1253  }
1254  }
1255  }
1256  h->SetShortExpVector();
1257  not_sev = ~ h->sev;
1258  h_d = h->SetpFDeg();
1259  /* compute the ecart */
1260  if (ei <= h->ecart)
1261  h->ecart = d-h_d;
1262  else
1263  h->ecart = d-h_d+ei-h->ecart;
1264 
1265  /*
1266  * try to reduce the s-polynomial h
1267  *test first whether h should go to the lazyset L
1268  *-if the degree jumps
1269  *-if the number of pre-defined reductions jumps
1270  */
1271  pass++;
1272  d = h_d + h->ecart;
1273  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1274  {
1275  h->GetTP(); // clear bucket
1276  h->SetLmCurrRing();
1277  at = strat->posInL(strat->L,strat->Ll,h,strat);
1278  if (at <= strat->Ll)
1279  {
1280  int dummy=strat->sl;
1281  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1282  return 1;
1283  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1284 #ifdef KDEBUG
1285  if (TEST_OPT_DEBUG)
1286  Print(" degree jumped: -> L%d\n",at);
1287 #endif
1288  h->Clear();
1289  return -1;
1290  }
1291  }
1292  else if (d > reddeg)
1293  {
1294  if (d>=(long)strat->tailRing->bitmask)
1295  {
1296  if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
1297  {
1298  strat->overflow=TRUE;
1299  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1300  h->GetP();
1301  at = strat->posInL(strat->L,strat->Ll,h,strat);
1302  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1303  h->Clear();
1304  return -1;
1305  }
1306  }
1307  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1308  {
1309  //h->wrp(); Print("<%d>\n",h->GetpLength());
1310  reddeg = d;
1311  Print(".%ld",d); mflush();
1312  }
1313  }
1314  }
1315 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
void PrintLn()
Definition: reporter.cc:327
#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:140
#define p_GetComp(p, r)
Definition: monomials.h:72
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
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:1111
static int pLength(poly a)
Definition: p_polys.h:189
#define mflush()
Definition: reporter.h:55
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
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:202
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:394
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:373
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:104
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 redLazy ( LObject h,
kStrategy  strat 
)

TEST_OPT_REDTHROUGH &&

Definition at line 957 of file kstd2.cc.

958 {
959  if (strat->tl<0) return 1;
960  int at,i,ii,li;
961  int j = 0;
962  int pass = 0;
963  assume(h->pFDeg() == h->FDeg);
964  long reddeg = h->GetpFDeg();
965  long d;
966  unsigned long not_sev;
967 
968  h->SetShortExpVector();
969  poly h_p = h->GetLmTailRing();
970  not_sev = ~ h->sev;
971  loop
972  {
973  j = kFindDivisibleByInT(strat, h);
974  if (j < 0) return 1;
975 
976  li = strat->T[j].pLength;
977  #if 0
978  if (li==0)
979  {
980  li=strat->T[j].pLength=pLength(strat->T[j].p);
981  }
982  #endif
983  ii = j;
984  /*
985  * the polynomial to reduce with (up to the moment) is;
986  * pi with length li
987  */
988 
989  i = j;
990 #if 1
991  if (TEST_OPT_LENGTH)
992  loop
993  {
994  /*- search the shortest possible with respect to length -*/
995  i++;
996  if (i > strat->tl)
997  break;
998  if (li<=1)
999  break;
1000  #if 0
1001  if (strat->T[i].pLength==0)
1002  {
1003  PrintS("!");
1004  strat->T[i].pLength=pLength(strat->T[i].p);
1005  }
1006  #endif
1007  if ((strat->T[i].pLength < li)
1008  &&
1009  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1010  h_p, not_sev, strat->tailRing))
1011  {
1012  /*
1013  * the polynomial to reduce with is now;
1014  */
1015  PrintS("+");
1016  li = strat->T[i].pLength;
1017  ii = i;
1018  }
1019  }
1020 #endif
1021 
1022  /*
1023  * end of search: have to reduce with pi
1024  */
1025 
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 
1037  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
1038 #if SBA_PRINT_REDUCTION_STEPS
1039  sba_interreduction_steps++;
1040 #endif
1041 #if SBA_PRINT_OPERATIONS
1042  sba_interreduction_operations += pLength(strat->T[ii].p);
1043 #endif
1044 
1045 #ifdef KDEBUG
1046  if (TEST_OPT_DEBUG)
1047  {
1048  PrintS("\nto ");
1049  h->wrp();
1050  PrintLn();
1051  }
1052 #endif
1053 
1054  h_p=h->GetLmTailRing();
1055 
1056  if (h_p == NULL)
1057  {
1058  if (h->lcm!=NULL) pLmFree(h->lcm);
1059 #ifdef KDEBUG
1060  h->lcm=NULL;
1061 #endif
1062  return 0;
1063  }
1064  h->SetShortExpVector();
1065  not_sev = ~ h->sev;
1066  d = h->SetpFDeg();
1067  /*- try to reduce the s-polynomial -*/
1068  pass++;
1069  if (//!TEST_OPT_REDTHROUGH &&
1070  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1071  {
1072  h->SetLmCurrRing();
1073  at = strat->posInL(strat->L,strat->Ll,h,strat);
1074  if (at <= strat->Ll)
1075  {
1076 #if 1
1077  int dummy=strat->sl;
1078  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1079  return 1;
1080 #endif
1081 #ifdef KDEBUG
1082  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
1083 #endif
1084  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1085  h->Clear();
1086  return -1;
1087  }
1088  }
1089  else if (d != reddeg)
1090  {
1091  if (d>=(long)strat->tailRing->bitmask)
1092  {
1093  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
1094  {
1095  strat->overflow=TRUE;
1096  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1097  h->GetP();
1098  at = strat->posInL(strat->L,strat->Ll,h,strat);
1099  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1100  h->Clear();
1101  return -1;
1102  }
1103  }
1104  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
1105  {
1106  Print(".%ld",d);mflush();
1107  reddeg = d;
1108  }
1109  }
1110  }
1111 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
void PrintLn()
Definition: reporter.cc:327
#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:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
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:1111
static int pLength(poly a)
Definition: p_polys.h:189
#define mflush()
Definition: reporter.h:55
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
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:202
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:394
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:104
int LazyPass
Definition: kutil.h:351
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
poly redNF ( poly  h,
int &  max_ind,
int  nonorm,
kStrategy  strat 
)

Definition at line 1321 of file kstd2.cc.

1322 {
1323  if (h==NULL) return NULL;
1324  int j;
1325  max_ind=strat->sl;
1326 
1327  if (0 > strat->sl)
1328  {
1329  return h;
1330  }
1331  LObject P(h);
1332  P.SetShortExpVector();
1333  P.bucket = kBucketCreate(currRing);
1334  kBucketInit(P.bucket,P.p,pLength(P.p));
1335  kbTest(P.bucket);
1336 #ifdef HAVE_RINGS
1338 #endif
1339 #ifdef KDEBUG
1340 // if (TEST_OPT_DEBUG)
1341 // {
1342 // PrintS("redNF: starting S:\n");
1343 // for( j = 0; j <= max_ind; j++ )
1344 // {
1345 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1346 // pWrite(strat->S[j]);
1347 // }
1348 // };
1349 #endif
1350 
1351  loop
1352  {
1353  j=kFindDivisibleByInS(strat,&max_ind,&P);
1354  if (j>=0)
1355  {
1356 #ifdef HAVE_RINGS
1357  if (!is_ring)
1358  {
1359 #endif
1360  int sl=pSize(strat->S[j]);
1361  int jj=j;
1362  loop
1363  {
1364  int sll;
1365  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1366  if (jj<0) break;
1367  sll=pSize(strat->S[jj]);
1368  if (sll<sl)
1369  {
1370  #ifdef KDEBUG
1371  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1372  #endif
1373  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1374  j=jj;
1375  sl=sll;
1376  }
1377  }
1378  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1379  {
1380  pNorm(strat->S[j]);
1381  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1382  }
1383 #ifdef HAVE_RINGS
1384  }
1385 #endif
1386  nNormalize(pGetCoeff(P.p));
1387 #ifdef KDEBUG
1388  if (TEST_OPT_DEBUG)
1389  {
1390  PrintS("red:");
1391  wrp(h);
1392  PrintS(" with ");
1393  wrp(strat->S[j]);
1394  }
1395 #endif
1396 #ifdef HAVE_PLURAL
1397  if (rIsPluralRing(currRing))
1398  {
1399  number coef;
1400  nc_kBucketPolyRed(P.bucket,strat->S[j],&coef);
1401  nDelete(&coef);
1402  }
1403  else
1404 #endif
1405  {
1406  number coef;
1407  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1408  nDelete(&coef);
1409  }
1410  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1411  if (h==NULL)
1412  {
1413  kBucketDestroy(&P.bucket);
1414 
1415 #ifdef KDEBUG
1416 // if (TEST_OPT_DEBUG)
1417 // {
1418 // PrintS("redNF: starting S:\n");
1419 // for( j = 0; j <= max_ind; j++ )
1420 // {
1421 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1422 // pWrite(strat->S[j]);
1423 // }
1424 // };
1425 #endif
1426 
1427  return NULL;
1428  }
1429  kbTest(P.bucket);
1430  P.p=h;
1431  P.t_p=NULL;
1432  P.SetShortExpVector();
1433 #ifdef KDEBUG
1434  if (TEST_OPT_DEBUG)
1435  {
1436  PrintS("\nto:");
1437  wrp(h);
1438  PrintLn();
1439  }
1440 #endif
1441  }
1442  else
1443  {
1444  P.p=kBucketClear(P.bucket);
1445  kBucketDestroy(&P.bucket);
1446  pNormalize(P.p);
1447 
1448 #ifdef KDEBUG
1449 // if (TEST_OPT_DEBUG)
1450 // {
1451 // PrintS("redNF: starting S:\n");
1452 // for( j = 0; j <= max_ind; j++ )
1453 // {
1454 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1455 // pWrite(strat->S[j]);
1456 // }
1457 // };
1458 #endif
1459 
1460  return P.p;
1461  }
1462  }
1463 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:499
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:250
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:185
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:471
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
void PrintLn()
Definition: reporter.cc:327
#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:1061
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:484
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 bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:197
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:12
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:204
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:202
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
int sl
Definition: kutil.h:346
void wrp(poly p)
Definition: polys.h:281
kBucketDestroy & P
Definition: myNF.cc:191
static Poly * h
Definition: janet.cc:978
int int nonorm
Definition: myNF.cc:67
int BOOLEAN
Definition: auxiliary.h:131
#define pSize(p)
Definition: polys.h:289
int redNF0 ( LObject P,
kStrategy  strat 
)
poly redNFTail ( poly  h,
const int  sl,
kStrategy  strat 
)
int redRiloc ( LObject h,
kStrategy  strat 
)

Definition at line 355 of file kstd1.cc.

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

Definition at line 409 of file kstd2.cc.

410 {
411  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
412  if (strat->tl<0) return 1;
413 
414  int at/*,i*/;
415  long d;
416  int j = 0;
417  int pass = 0;
418  // poly zeroPoly = NULL;
419 
420 // TODO warum SetpFDeg notwendig?
421  h->SetpFDeg();
422  assume(h->pFDeg() == h->FDeg);
423  long reddeg = h->GetpFDeg();
424 
425  h->SetShortExpVector();
426  loop
427  {
428  j = kFindDivisibleByInT(strat, h);
429  if (j < 0)
430  {
431  // over ZZ: cleanup coefficients by complete reduction with monomials
432  postReduceByMon(h, strat);
433  if(nIsZero(pGetCoeff(h->p))) return 2;
434  j = kFindDivisibleByInT(strat, h);
435  if(j < 0)
436  {
437  if(strat->tl >= 0)
438  h->i_r1 = strat->tl;
439  else
440  h->i_r1 = -1;
441  if (h->GetLmTailRing() == NULL)
442  {
443  if (h->lcm!=NULL) pLmDelete(h->lcm);
444  h->Clear();
445  return 0;
446  }
447  return 1;
448  }
449  }
450  #if ADIDEBUG
451  pWrite(h->p);
452  printf("\nFound j = %i\n",j);pWrite(strat->T[j].p);
453  #endif
454  //enterT(*h, strat);
455  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
456  #if ADIDEBUG
457  printf("\nand after reduce: \n");pWrite(h->p);
458  #endif
459 
460  if (h->GetLmTailRing() == NULL)
461  {
462  if (h->lcm!=NULL) pLmDelete(h->lcm);
463 #ifdef KDEBUG
464  h->lcm=NULL;
465 #endif
466  h->Clear();
467  return 0;
468  }
469  h->SetShortExpVector();
470  d = h->SetpFDeg();
471  /*- try to reduce the s-polynomial -*/
472  pass++;
473  if (!TEST_OPT_REDTHROUGH &&
474  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
475  {
476  h->SetLmCurrRing();
477  if (strat->posInLDependsOnLength)
478  h->SetLength(strat->length_pLength);
479  at = strat->posInL(strat->L,strat->Ll,h,strat);
480  if (at <= strat->Ll)
481  {
482 #ifdef KDEBUG
483  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
484 #endif
485  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
486  h->Clear();
487  return -1;
488  }
489  }
490  if (d != reddeg)
491  {
492  if (d >= (long)strat->tailRing->bitmask)
493  {
494  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
495  {
496  strat->overflow=TRUE;
497  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
498  h->GetP();
499  at = strat->posInL(strat->L,strat->Ll,h,strat);
500  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
501  h->Clear();
502  return -1;
503  }
504  }
505  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
506  {
507  Print(".%ld",d);mflush();
508  reddeg = d;
509  }
510  }
511  }
512 }
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:377
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
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:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
void pWrite(poly p)
Definition: polys.h:279
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1111
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:55
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
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:9221
#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:394
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:104
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 678 of file kstd2.cc.

679 {
680  if (strat->tl<0) return 1;
681  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
682  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
683  assume(h->FDeg == h->pFDeg());
684 //#if 1
685 #ifdef DEBUGF5
686  Print("------- IN REDSIG -------\n");
687  Print("p: ");
688  pWrite(pHead(h->p));
689  Print("p1: ");
690  pWrite(pHead(h->p1));
691  Print("p2: ");
692  pWrite(pHead(h->p2));
693  Print("---------------------------\n");
694 #endif
695  poly h_p;
696  int i,j,at,pass, ii;
697  int start=0;
698  int sigSafe;
699  unsigned long not_sev;
700  // long reddeg,d;
701 
702  pass = j = 0;
703  // d = reddeg = h->GetpFDeg();
704  h->SetShortExpVector();
705  int li;
706  h_p = h->GetLmTailRing();
707  not_sev = ~ h->sev;
708  loop
709  {
710  j = kFindDivisibleByInT(strat, h, start);
711  if (j < 0)
712  {
713  return 1;
714  }
715 
716  li = strat->T[j].pLength;
717  ii = j;
718  /*
719  * the polynomial to reduce with (up to the moment) is;
720  * pi with length li
721  */
722  i = j;
723 #if 1
724  if (TEST_OPT_LENGTH)
725  loop
726  {
727  /*- search the shortest possible with respect to length -*/
728  i++;
729  if (i > strat->tl)
730  break;
731  if (li<=1)
732  break;
733  if ((strat->T[i].pLength < li)
734  &&
735  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
736  h_p, not_sev, strat->tailRing))
737  {
738  /*
739  * the polynomial to reduce with is now;
740  */
741  li = strat->T[i].pLength;
742  ii = i;
743  }
744  }
745  start = ii+1;
746 #endif
747 
748  /*
749  * end of search: have to reduce with pi
750  */
751 #ifdef KDEBUG
752  if (TEST_OPT_DEBUG)
753  {
754  PrintS("red:");
755  h->wrp();
756  PrintS(" with ");
757  strat->T[ii].wrp();
758  }
759 #endif
760  assume(strat->fromT == FALSE);
761 //#if 1
762 #ifdef DEBUGF5
763  Print("BEFORE REDUCTION WITH %d:\n",ii);
764  Print("--------------------------------\n");
765  pWrite(h->sig);
766  pWrite(strat->T[ii].sig);
767  pWrite(h->GetLmCurrRing());
768  pWrite(pHead(h->p1));
769  pWrite(pHead(h->p2));
770  pWrite(pHead(strat->T[ii].p));
771  Print("--------------------------------\n");
772  printf("INDEX OF REDUCER T: %d\n",ii);
773 #endif
774  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
775 #if SBA_PRINT_REDUCTION_STEPS
776  if (sigSafe != 3)
777  sba_reduction_steps++;
778 #endif
779 #if SBA_PRINT_OPERATIONS
780  if (sigSafe != 3)
781  sba_operations += pLength(strat->T[ii].p);
782 #endif
783  // if reduction has taken place, i.e. the reduction was sig-safe
784  // otherwise start is already at the next position and the loop
785  // searching reducers in T goes on from index start
786 //#if 1
787 #ifdef DEBUGF5
788  Print("SigSAFE: %d\n",sigSafe);
789 #endif
790  if (sigSafe != 3)
791  {
792  // start the next search for reducers in T from the beginning
793  start = 0;
794 #ifdef KDEBUG
795  if (TEST_OPT_DEBUG)
796  {
797  PrintS("\nto ");
798  h->wrp();
799  PrintLn();
800  }
801 #endif
802 
803  h_p = h->GetLmTailRing();
804  if (h_p == NULL)
805  {
806  if (h->lcm!=NULL) pLmFree(h->lcm);
807 #ifdef KDEBUG
808  h->lcm=NULL;
809 #endif
810  return 0;
811  }
812  h->SetShortExpVector();
813  not_sev = ~ h->sev;
814  /*
815  * try to reduce the s-polynomial h
816  *test first whether h should go to the lazyset L
817  *-if the degree jumps
818  *-if the number of pre-defined reductions jumps
819  */
820  pass++;
821  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
822  {
823  h->SetLmCurrRing();
824  at = strat->posInL(strat->L,strat->Ll,h,strat);
825  if (at <= strat->Ll)
826  {
827  int dummy=strat->sl;
828  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
829  {
830  return 1;
831  }
832  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
833 #ifdef KDEBUG
834  if (TEST_OPT_DEBUG)
835  Print(" lazy: -> L%d\n",at);
836 #endif
837  h->Clear();
838  return -1;
839  }
840  }
841  }
842  }
843 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
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:279
#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:1111
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:175
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
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:202
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#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:104
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
poly redtail ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 6041 of file kutil.cc.

6042 {
6043  LObject L(p, currRing);
6044  return redtail(&L, pos, strat);
6045 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
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:12
poly redtail ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 5971 of file kutil.cc.

5972 {
5973  poly h, hn;
5974  strat->redTailChange=FALSE;
5975 
5976  L->GetP();
5977  poly p = L->p;
5978  if (strat->noTailReduction || pNext(p) == NULL)
5979  return p;
5980 
5981  LObject Ln(strat->tailRing);
5982  TObject* With;
5983  // placeholder in case strat->tl < 0
5984  TObject With_s(strat->tailRing);
5985  h = p;
5986  hn = pNext(h);
5987  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
5988  long e;
5989  int l;
5990  BOOLEAN save_HE=strat->kHEdgeFound;
5991  strat->kHEdgeFound |=
5992  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
5993 
5994  while(hn != NULL)
5995  {
5996  op = strat->tailRing->pFDeg(hn, strat->tailRing);
5997  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
5998  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
5999  loop
6000  {
6001  Ln.Set(hn, strat->tailRing);
6002  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
6003  if (strat->kHEdgeFound)
6004  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6005  else
6006  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
6007  if (With == NULL) break;
6008  With->length=0;
6009  With->pLength=0;
6010  strat->redTailChange=TRUE;
6011  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
6012  {
6013  // reducing the tail would violate the exp bound
6014  if (kStratChangeTailRing(strat, L))
6015  {
6016  strat->kHEdgeFound = save_HE;
6017  return redtail(L, pos, strat);
6018  }
6019  else
6020  return NULL;
6021  }
6022  hn = pNext(h);
6023  if (hn == NULL) goto all_done;
6024  op = strat->tailRing->pFDeg(hn, strat->tailRing);
6025  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
6026  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
6027  }
6028  h = hn;
6029  hn = pNext(h);
6030  }
6031 
6032  all_done:
6033  if (strat->redTailChange)
6034  {
6035  L->pLength = 0;
6036  }
6037  strat->kHEdgeFound = save_HE;
6038  return p;
6039 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define TRUE
Definition: auxiliary.h:144
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
int Kstd1_deg
Definition: kutil.cc:228
BOOLEAN kHEdgeFound
Definition: kutil.h:366
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
#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:131
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:389
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:59
KINLINE poly redtailBba ( poly  p,
int  pos,
kStrategy  strat,
BOOLEAN  normalize = FALSE 
)

Definition at line 1120 of file kInline.h.

1121 {
1122  LObject L(p, currRing, strat->tailRing);
1123  return redtailBba(&L, pos, strat,FALSE, normalize);
1124 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
class sLObject LObject
Definition: kutil.h:60
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
ring tailRing
Definition: kutil.h:341
poly redtailBba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 6047 of file kutil.cc.

6048 {
6049 #define REDTAIL_CANONICALIZE 100
6050  strat->redTailChange=FALSE;
6051  if (strat->noTailReduction) return L->GetLmCurrRing();
6052  poly h, p;
6053  p = h = L->GetLmTailRing();
6054  if ((h==NULL) || (pNext(h)==NULL))
6055  return L->GetLmCurrRing();
6056 
6057  TObject* With;
6058  // placeholder in case strat->tl < 0
6059  TObject With_s(strat->tailRing);
6060 
6061  LObject Ln(pNext(h), strat->tailRing);
6062  Ln.pLength = L->GetpLength() - 1;
6063 
6064  pNext(h) = NULL;
6065  if (L->p != NULL) pNext(L->p) = NULL;
6066  L->pLength = 1;
6067 
6068  Ln.PrepareRed(strat->use_buckets);
6069 
6070  int cnt=REDTAIL_CANONICALIZE;
6071  while(!Ln.IsNull())
6072  {
6073  loop
6074  {
6075  if (TEST_OPT_IDLIFT)
6076  {
6077  if (Ln.p!=NULL)
6078  {
6079  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
6080  }
6081  else
6082  {
6083  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
6084  }
6085  }
6086  Ln.SetShortExpVector();
6087  if (withT)
6088  {
6089  int j;
6090  j = kFindDivisibleByInT(strat, &Ln);
6091  if (j < 0) break;
6092  With = &(strat->T[j]);
6093  }
6094  else
6095  {
6096  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6097  if (With == NULL) break;
6098  }
6099  cnt--;
6100  if (cnt==0)
6101  {
6103  /*poly tmp=*/Ln.CanonicalizeP();
6104  if (normalize)
6105  {
6106  Ln.Normalize();
6107  //pNormalize(tmp);
6108  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
6109  }
6110  }
6111  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
6112  {
6113  With->pNorm();
6114  }
6115  strat->redTailChange=TRUE;
6116  if (ksReducePolyTail(L, With, &Ln))
6117  {
6118  // reducing the tail would violate the exp bound
6119  // set a flag and hope for a retry (in bba)
6120  strat->completeReduce_retry=TRUE;
6121  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6122  do
6123  {
6124  pNext(h) = Ln.LmExtractAndIter();
6125  pIter(h);
6126  L->pLength++;
6127  } while (!Ln.IsNull());
6128  goto all_done;
6129  }
6130  if (Ln.IsNull()) goto all_done;
6131  if (! withT) With_s.Init(currRing);
6132  }
6133  pNext(h) = Ln.LmExtractAndIter();
6134  pIter(h);
6135  pNormalize(h);
6136  L->pLength++;
6137  }
6138 
6139  all_done:
6140  Ln.Delete();
6141  if (L->p != NULL) pNext(L->p) = pNext(p);
6142 
6143  if (strat->redTailChange)
6144  {
6145  L->length = 0;
6146  L->pLength = 0;
6147  }
6148 
6149  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6150  //L->Normalize(); // HANNES: should have a test
6151  kTest_L(L);
6152  return L->GetLmCurrRing();
6153 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
#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:393
#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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:623
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
#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:373
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:104
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
poly redtailBba ( TObject T,
int  pos,
kStrategy  strat 
)

Definition at line 1134 of file kInline.h.

1135 {
1136  LObject L;
1137  L = *T;
1138  poly p = redtailBba(&L, pos, strat, FALSE);
1139  *T = L;
1140  //kTest_T(T);
1141  assume( p == T->p);
1142  return p;
1143 }
class sLObject LObject
Definition: kutil.h:60
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define assume(x)
Definition: mod2.h:405
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
KINLINE poly redtailBba_Z ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 1127 of file kInline.h.

1128 {
1129  LObject L(p, currRing, strat->tailRing);
1130  return redtailBba_Z(&L, pos, strat);
1131 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
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:12
ring tailRing
Definition: kutil.h:341
poly redtailBba_Z ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 6156 of file kutil.cc.

6158 {
6159  strat->redTailChange=FALSE;
6160  if (strat->noTailReduction) return L->GetLmCurrRing();
6161  poly h, p;
6162  p = h = L->GetLmTailRing();
6163  if ((h==NULL) || (pNext(h)==NULL))
6164  return L->GetLmCurrRing();
6165 
6166  TObject* With;
6167  // placeholder in case strat->tl < 0
6168  TObject With_s(strat->tailRing);
6169 
6170  LObject Ln(pNext(h), strat->tailRing);
6171  Ln.pLength = L->GetpLength() - 1;
6172 
6173  pNext(h) = NULL;
6174  if (L->p != NULL) pNext(L->p) = NULL;
6175  L->pLength = 1;
6176 
6177  Ln.PrepareRed(strat->use_buckets);
6178 
6179  int cnt=REDTAIL_CANONICALIZE;
6180  while(!Ln.IsNull())
6181  {
6182  loop
6183  {
6184  Ln.SetShortExpVector();
6185  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6186  if (With == NULL) break;
6187  cnt--;
6188  if (cnt==0)
6189  {
6191  /*poly tmp=*/Ln.CanonicalizeP();
6192  }
6193  // we are in Z, do not call pNorm
6194  strat->redTailChange=TRUE;
6195  // test divisibility of coefs:
6196  poly p_Ln=Ln.GetLmCurrRing();
6197  poly p_With=With->GetLmCurrRing();
6198  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
6199  if (!nIsZero(z))
6200  {
6201  // subtract z*Ln, add z.Ln to L
6202  poly m=pHead(p_Ln);
6203  pSetCoeff(m,z);
6204  poly mm=pHead(m);
6205  pNext(h) = m;
6206  pIter(h);
6207  L->pLength++;
6208  mm=pNeg(mm);
6209  if (Ln.bucket!=NULL)
6210  {
6211  int dummy=1;
6212  kBucket_Add_q(Ln.bucket,mm,&dummy);
6213  }
6214  else
6215  {
6216  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
6217  Ln.GetP();
6218  if (Ln.p!=NULL)
6219  {
6220  Ln.p=pAdd(Ln.p,mm);
6221  if (Ln.t_p!=NULL)
6222  {
6223  pNext(Ln.t_p)=NULL;
6224  p_LmDelete(Ln.t_p,strat->tailRing);
6225  }
6226  }
6227  }
6228  }
6229  else
6230  nDelete(&z);
6231 
6232  if (ksReducePolyTail(L, With, &Ln))
6233  {
6234  // reducing the tail would violate the exp bound
6235  // set a flag and hope for a retry (in bba)
6236  strat->completeReduce_retry=TRUE;
6237  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6238  do
6239  {
6240  pNext(h) = Ln.LmExtractAndIter();
6241  pIter(h);
6242  L->pLength++;
6243  } while (!Ln.IsNull());
6244  goto all_done;
6245  }
6246  if (Ln.IsNull()) goto all_done;
6247  With_s.Init(currRing);
6248  }
6249  pNext(h) = Ln.LmExtractAndIter();
6250  pIter(h);
6251  pNormalize(h);
6252  L->pLength++;
6253  }
6254 
6255  all_done:
6256  Ln.Delete();
6257  if (L->p != NULL) pNext(L->p) = pNext(p);
6258 
6259  if (strat->redTailChange)
6260  {
6261  L->length = 0;
6262  }
6263 
6264  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6265  //L->Normalize(); // HANNES: should have a test
6266  kTest_L(L);
6267  return L->GetLmCurrRing();
6268 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
#define pAdd(p, q)
Definition: polys.h:174
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define pNeg(p)
Definition: polys.h:169
#define TRUE
Definition: auxiliary.h:144
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:393
#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:12
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:623
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
#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:707
BOOLEAN use_buckets
Definition: kutil.h:373
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:389
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:636
poly redtailBbaShift ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 10842 of file kutil.cc.

10843 {
10844  /* for the shift case need to run it with withT = TRUE */
10845  strat->redTailChange=FALSE;
10846  if (strat->noTailReduction) return L->GetLmCurrRing();
10847  poly h, p;
10848  p = h = L->GetLmTailRing();
10849  if ((h==NULL) || (pNext(h)==NULL))
10850  return L->GetLmCurrRing();
10851 
10852  TObject* With;
10853  // placeholder in case strat->tl < 0
10854  TObject With_s(strat->tailRing);
10855 
10856  LObject Ln(pNext(h), strat->tailRing);
10857  Ln.pLength = L->GetpLength() - 1;
10858 
10859  pNext(h) = NULL;
10860  if (L->p != NULL) pNext(L->p) = NULL;
10861  L->pLength = 1;
10862 
10863  Ln.PrepareRed(strat->use_buckets);
10864 
10865  while(!Ln.IsNull())
10866  {
10867  loop
10868  {
10869  Ln.SetShortExpVector();
10870  if (withT)
10871  {
10872  int j;
10873  j = kFindDivisibleByInT(strat, &Ln);
10874  if (j < 0) break;
10875  With = &(strat->T[j]);
10876  }
10877  else
10878  {
10879  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
10880  if (With == NULL) break;
10881  }
10882  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
10883  {
10884  With->pNorm();
10885  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
10886  }
10887  strat->redTailChange=TRUE;
10888  if (ksReducePolyTail(L, With, &Ln))
10889  {
10890  // reducing the tail would violate the exp bound
10891  // set a flag and hope for a retry (in bba)
10892  strat->completeReduce_retry=TRUE;
10893  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
10894  do
10895  {
10896  pNext(h) = Ln.LmExtractAndIter();
10897  pIter(h);
10898  L->pLength++;
10899  } while (!Ln.IsNull());
10900  goto all_done;
10901  }
10902  if (Ln.IsNull()) goto all_done;
10903  if (! withT) With_s.Init(currRing);
10904  }
10905  pNext(h) = Ln.LmExtractAndIter();
10906  pIter(h);
10907  L->pLength++;
10908  }
10909 
10910  all_done:
10911  Ln.Delete();
10912  if (L->p != NULL) pNext(L->p) = pNext(p);
10913 
10914  if (strat->redTailChange)
10915  {
10916  L->length = 0;
10917  }
10918  L->Normalize(); // HANNES: should have a test
10919  kTest_L(L);
10920  return L->GetLmCurrRing();
10921 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define TRUE
Definition: auxiliary.h:144
#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:393
#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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define kTest_L(T)
Definition: kutil.h:623
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5868
#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:373
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:104
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
poly redtailSba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 846 of file kstd2.cc.

847 {
848 #define REDTAIL_CANONICALIZE 100
849  strat->redTailChange=FALSE;
850  if (strat->noTailReduction) return L->GetLmCurrRing();
851  poly h, p;
852  p = h = L->GetLmTailRing();
853  if ((h==NULL) || (pNext(h)==NULL))
854  return L->GetLmCurrRing();
855 
856  TObject* With;
857  // placeholder in case strat->tl < 0
858  TObject With_s(strat->tailRing);
859 
860  LObject Ln(pNext(h), strat->tailRing);
861  Ln.sig = L->sig;
862  Ln.sevSig = L->sevSig;
863  Ln.pLength = L->GetpLength() - 1;
864 
865  pNext(h) = NULL;
866  if (L->p != NULL) pNext(L->p) = NULL;
867  L->pLength = 1;
868 
869  Ln.PrepareRed(strat->use_buckets);
870 
871  int cnt=REDTAIL_CANONICALIZE;
872  while(!Ln.IsNull())
873  {
874  loop
875  {
876  Ln.SetShortExpVector();
877  if (withT)
878  {
879  int j;
880  j = kFindDivisibleByInT(strat, &Ln);
881  if (j < 0) break;
882  With = &(strat->T[j]);
883  }
884  else
885  {
886  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
887  if (With == NULL) break;
888  }
889  cnt--;
890  if (cnt==0)
891  {
893  /*poly tmp=*/Ln.CanonicalizeP();
894  if (normalize)
895  {
896  Ln.Normalize();
897  //pNormalize(tmp);
898  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
899  }
900  }
901  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
902  {
903  With->pNorm();
904  }
905  strat->redTailChange=TRUE;
906  int ret = ksReducePolyTailSig(L, With, &Ln);
907 #if SBA_PRINT_REDUCTION_STEPS
908  if (ret != 3)
909  sba_reduction_steps++;
910 #endif
911 #if SBA_PRINT_OPERATIONS
912  if (ret != 3)
913  sba_operations += pLength(With->p);
914 #endif
915  if (ret)
916  {
917  // reducing the tail would violate the exp bound
918  // set a flag and hope for a retry (in bba)
919  strat->completeReduce_retry=TRUE;
920  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
921  do
922  {
923  pNext(h) = Ln.LmExtractAndIter();
924  pIter(h);
925  L->pLength++;
926  } while (!Ln.IsNull());
927  goto all_done;
928  }
929  if (Ln.IsNull()) goto all_done;
930  if (! withT) With_s.Init(currRing);
931  }
932  pNext(h) = Ln.LmExtractAndIter();
933  pIter(h);
934  pNormalize(h);
935  L->pLength++;
936  }
937 
938  all_done:
939  Ln.Delete();
940  if (L->p != NULL) pNext(L->p) = pNext(p);
941 
942  if (strat->redTailChange)
943  {
944  L->length = 0;
945  }
946 
947  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
948  //L->Normalize(); // HANNES: should have a test
949  kTest_L(L);
950  return L->GetLmCurrRing();
951 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#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
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red)
Definition: kstd2.cc:642
static int pLength(poly a)
Definition: p_polys.h:189
char completeReduce_retry
Definition: kutil.h:393
#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:12
#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:202
#define kTest_L(T)
Definition: kutil.h:623
#define REDTAIL_CANONICALIZE
#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:373
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:104
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 4144 of file kutil.cc.

4145 {
4146  int i,j,at,ecart, s2r;
4147  int fq=0;
4148  unsigned long sev;
4149  poly p;
4150  int new_suc=strat->sl+1;
4151  i= *suc;
4152  if (i<0) i=0;
4153 
4154  for (; i<=strat->sl; i++)
4155  {
4156  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4157  if (at != i)
4158  {
4159  if (new_suc > at) new_suc = at;
4160  p = strat->S[i];
4161  ecart = strat->ecartS[i];
4162  sev = strat->sevS[i];
4163  s2r = strat->S_2_R[i];
4164  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
4165  for (j=i; j>=at+1; j--)
4166  {
4167  strat->S[j] = strat->S[j-1];
4168  strat->ecartS[j] = strat->ecartS[j-1];
4169  strat->sevS[j] = strat->sevS[j-1];
4170  strat->S_2_R[j] = strat->S_2_R[j-1];
4171  }
4172  strat->S[at] = p;
4173  strat->ecartS[at] = ecart;
4174  strat->sevS[at] = sev;
4175  strat->S_2_R[at] = s2r;
4176  if (strat->fromQ!=NULL)
4177  {
4178  for (j=i; j>=at+1; j--)
4179  {
4180  strat->fromQ[j] = strat->fromQ[j-1];
4181  }
4182  strat->fromQ[at]=fq;
4183  }
4184  }
4185  }
4186  if (new_suc <= strat->sl) *suc=new_suc;
4187  else *suc=-1;
4188 }
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:4197
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal sba ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1879 of file kstd2.cc.

1880 {
1881  // ring order stuff:
1882  // in sba we have (until now) two possibilities:
1883  // 1. an incremental computation w.r.t. (C,monomial order)
1884  // 2. a (possibly non-incremental) computation w.r.t. the
1885  // induced Schreyer order.
1886  // The corresponding orders are computed in sbaRing(), depending
1887  // on the flag strat->sbaOrder
1888 #if SBA_PRINT_ZERO_REDUCTIONS
1889  long zeroreductions = 0;
1890 #endif
1891 #if SBA_PRINT_PRODUCT_CRITERION
1892  long product_criterion = 0;
1893 #endif
1894 #if SBA_PRINT_SIZE_G
1895  int size_g = 0;
1896  int size_g_non_red = 0;
1897 #endif
1898 #if SBA_PRINT_SIZE_SYZ
1899  long size_syz = 0;
1900 #endif
1901  // global variable
1902 #if SBA_PRINT_REDUCTION_STEPS
1903  sba_reduction_steps = 0;
1904  sba_interreduction_steps = 0;
1905 #endif
1906 #if SBA_PRINT_OPERATIONS
1907  sba_operations = 0;
1908  sba_interreduction_operations = 0;
1909 #endif
1910 
1911  ideal F1 = F0;
1912  ring sRing, currRingOld;
1913  currRingOld = currRing;
1914  if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
1915  {
1916  sRing = sbaRing(strat);
1917  if (sRing!=currRingOld)
1918  {
1919  rChangeCurrRing (sRing);
1920  F1 = idrMoveR (F0, currRingOld, currRing);
1921  }
1922  }
1923  // sort ideal F
1924  ideal F = idInit(IDELEMS(F1),F1->rank);
1925  intvec *sort = idSort(F1);
1926  for (int i=0; i<sort->length();++i)
1927  F->m[i] = F1->m[(*sort)[i]-1];
1928 #if SBA_INTERRED_START
1929  F = kInterRed(F,NULL);
1930 #endif
1931 #if F5DEBUG
1932  printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
1933  rWrite (currRing);
1934  printf("ordSgn = %d\n",currRing->OrdSgn);
1935  printf("\n");
1936 #endif
1937  int srmax,lrmax, red_result = 1;
1938  int olddeg,reduc;
1939  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1940  LObject L;
1941  BOOLEAN withT = TRUE;
1942  strat->max_lower_index = 0;
1943 
1944  //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1945  initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
1946  initSbaPos(strat);
1947  //initBuchMoraPos(strat);
1948  initHilbCrit(F,Q,&hilb,strat);
1949  initSba(F,strat);
1950  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1951  /*Shdl=*/initSbaBuchMora(F, Q,strat);
1952  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1953  srmax = strat->sl;
1954  reduc = olddeg = lrmax = 0;
1955 
1956 #ifndef NO_BUCKETS
1957  if (!TEST_OPT_NOT_BUCKETS)
1958  strat->use_buckets = 1;
1959 #endif
1960 
1961  // redtailBBa against T for inhomogenous input
1962  // if (!TEST_OPT_OLDSTD)
1963  // withT = ! strat->homog;
1964 
1965  // strat->posInT = posInT_pLength;
1966  kTest_TS(strat);
1967 
1968 #ifdef KDEBUG
1969 #if MYTEST
1970  if (TEST_OPT_DEBUG)
1971  {
1972  PrintS("bba start GB: currRing: ");
1973  // rWrite(currRing);PrintLn();
1975  PrintLn();
1976  }
1977 #endif /* MYTEST */
1978 #endif /* KDEBUG */
1979 
1980 #ifdef HAVE_TAIL_RING
1981  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1982  kStratInitChangeTailRing(strat);
1983 #endif
1984  if (BVERBOSE(23))
1985  {
1986  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1987  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1988  kDebugPrint(strat);
1989  }
1990 
1991 
1992 #ifdef KDEBUG
1993  //kDebugPrint(strat);
1994 #endif
1995  /* compute------------------------------------------------------- */
1996  while (strat->Ll >= 0)
1997  {
1998  if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
1999  #ifdef KDEBUG
2000  if (TEST_OPT_DEBUG) messageSets(strat);
2001  #endif
2002  if (strat->Ll== 0) strat->interpt=TRUE;
2003  /*
2004  if (TEST_OPT_DEGBOUND
2005  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2006  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2007  {
2008 
2009  //stops computation if
2010  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2011  //a predefined number Kstd1_deg
2012  while ((strat->Ll >= 0)
2013  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2014  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2015  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2016  )
2017  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2018  if (strat->Ll<0) break;
2019  else strat->noClearS=TRUE;
2020  }
2021  */
2022  if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
2023  {
2024  strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
2025 #if F5C
2026  // 1. interreduction of the current standard basis
2027  // 2. generation of new principal syzygy rules for syzCriterion
2028  f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2029  lrmax, reduc, Q, w, hilb );
2030 #endif
2031  // initialize new syzygy rules for the next iteration step
2032  initSyzRules(strat);
2033 
2034  }
2035  /*********************************************************************
2036  * interrreduction step is done, we can go on with the next iteration
2037  * step of the signature-based algorithm
2038  ********************************************************************/
2039  /* picks the last element from the lazyset L */
2040  strat->P = strat->L[strat->Ll];
2041  strat->Ll--;
2042  /* reduction of the element chosen from L */
2043 
2044  if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) {
2045  //#if 1
2046 #ifdef DEBUGF5
2047  Print("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2048  Print("-------------------------------------------------\n");
2049  pWrite(strat->P.sig);
2050  pWrite(pHead(strat->P.p));
2051  pWrite(pHead(strat->P.p1));
2052  pWrite(pHead(strat->P.p2));
2053  Print("-------------------------------------------------\n");
2054 #endif
2055  if (pNext(strat->P.p) == strat->tail)
2056  {
2057  // deletes the short spoly
2058  /*
2059 #ifdef HAVE_RINGS
2060  if (rField_is_Ring(currRing))
2061  pLmDelete(strat->P.p);
2062  else
2063 #endif
2064  pLmFree(strat->P.p);
2065 */
2066  // TODO: needs some masking
2067  // TODO: masking needs to vanish once the signature
2068  // sutff is completely implemented
2069  strat->P.p = NULL;
2070  poly m1 = NULL, m2 = NULL;
2071 
2072  // check that spoly creation is ok
2073  while (strat->tailRing != currRing &&
2074  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2075  {
2076  assume(m1 == NULL && m2 == NULL);
2077  // if not, change to a ring where exponents are at least
2078  // large enough
2079  if (!kStratChangeTailRing(strat))
2080  {
2081  WerrorS("OVERFLOW...");
2082  break;
2083  }
2084  }
2085  // create the real one
2086  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2087  strat->tailRing, m1, m2, strat->R);
2088 
2089  }
2090  else if (strat->P.p1 == NULL)
2091  {
2092  if (strat->minim > 0)
2093  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2094  // for input polys, prepare reduction
2095  strat->P.PrepareRed(strat->use_buckets);
2096  }
2097  if (strat->P.p == NULL && strat->P.t_p == NULL)
2098  {
2099  red_result = 0;
2100  }
2101  else
2102  {
2103  //#if 1
2104 #ifdef DEBUGF5
2105  Print("Poly before red: ");
2106  pWrite(pHead(strat->P.p));
2107  pWrite(strat->P.sig);
2108 #endif
2109 #if SBA_PRODUCT_CRITERION
2110  if (strat->P.prod_crit) {
2111 #if SBA_PRINT_PRODUCT_CRITERION
2112  product_criterion++;
2113 #endif
2114  int pos = posInSyz(strat, strat->P.sig);
2115  enterSyz(strat->P, strat, pos);
2116  if (strat->P.lcm!=NULL)
2117  pLmFree(strat->P.lcm);
2118  red_result = 2;
2119  } else {
2120  red_result = strat->red(&strat->P,strat);
2121  }
2122 #else
2123  red_result = strat->red(&strat->P,strat);
2124 #endif
2125  }
2126  } else {
2127  /*
2128  if (strat->P.lcm != NULL)
2129  pLmFree(strat->P.lcm);
2130  */
2131  red_result = 2;
2132  }
2133  if (errorreported) break;
2134 
2135 //#if 1
2136 #ifdef DEBUGF5
2137  if (red_result != 0) {
2138  Print("Poly after red: ");
2139  pWrite(pHead(strat->P.p));
2140  pWrite(strat->P.GetLmCurrRing());
2141  pWrite(strat->P.sig);
2142  printf("%d\n",red_result);
2143  }
2144 #endif
2145 
2146  if (strat->overflow)
2147  {
2148  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
2149  }
2150 
2151  // reduction to non-zero new poly
2152  if (red_result == 1)
2153  {
2154  // get the polynomial (canonicalize bucket, make sure P.p is set)
2155  strat->P.GetP(strat->lmBin);
2156 
2157  // sig-safe computations may lead to wrong FDeg computation, thus we need
2158  // to recompute it to make sure everything is alright
2159  (strat->P).FDeg = (strat->P).pFDeg();
2160  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2161  // but now, for entering S, T, we reset it
2162  // in the inhomogeneous case: FDeg == pFDeg
2163  if (strat->homog) strat->initEcart(&(strat->P));
2164 
2165  /* statistic */
2166  if (TEST_OPT_PROT) PrintS("s");
2167 
2168  //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2169  // in F5E we know that the last reduced element is already the
2170  // the one with highest signature
2171  int pos = strat->sl+1;
2172 
2173 #ifdef KDEBUG
2174 #if MYTEST
2175  PrintS("New S: "); pDebugPrint(strat->P.p); PrintLn();
2176 #endif /* MYTEST */
2177 #endif /* KDEBUG */
2178 
2179  // reduce the tail and normalize poly
2180  // in the ring case we cannot expect LC(f) = 1,
2181  // therefore we call pContent instead of pNorm
2182 #if SBA_TAIL_RED
2183  if (strat->sbaOrder != 2) {
2185  {
2186  strat->P.pCleardenom();
2188  {
2189  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2190  strat->P.pCleardenom();
2191  }
2192  }
2193  else
2194  {
2195  strat->P.pNorm();
2197  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2198  }
2199  }
2200 #endif
2201 
2202  // remove sigsafe label since it is no longer valid for the next element to
2203  // be reduced
2204  if (strat->sbaOrder == 1)
2205  {
2206  for (int jj = 0; jj<strat->tl+1; jj++)
2207  {
2208  if (pGetComp(strat->T[jj].sig) == strat->currIdx)
2209  {
2210  strat->T[jj].is_sigsafe = FALSE;
2211  }
2212  }
2213  }
2214  else
2215  {
2216  for (int jj = 0; jj<strat->tl+1; jj++)
2217  {
2218  strat->T[jj].is_sigsafe = FALSE;
2219  }
2220  }
2221 #ifdef KDEBUG
2222  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2223 #if MYTEST
2224 //#if 1
2225  PrintS("New (reduced) S: "); pDebugPrint(strat->P.p); PrintLn();
2226 #endif /* MYTEST */
2227 #endif /* KDEBUG */
2228 
2229  // min_std stuff
2230  if ((strat->P.p1==NULL) && (strat->minim>0))
2231  {
2232  if (strat->minim==1)
2233  {
2234  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2235  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2236  }
2237  else
2238  {
2239  strat->M->m[minimcnt]=strat->P.p2;
2240  strat->P.p2=NULL;
2241  }
2242  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2243  pNext(strat->M->m[minimcnt])
2244  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2245  strat->tailRing, currRing,
2246  currRing->PolyBin);
2247  minimcnt++;
2248  }
2249 
2250  // enter into S, L, and T
2251  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2252  enterT(strat->P, strat);
2253  strat->T[strat->tl].is_sigsafe = FALSE;
2254  /*
2255  printf("hier\n");
2256  pWrite(strat->P.GetLmCurrRing());
2257  pWrite(strat->P.sig);
2258  */
2259 #ifdef HAVE_RINGS
2260  if (rField_is_Ring(currRing))
2261  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2262  else
2263 #endif
2264  enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2265  // posInS only depends on the leading term
2266  strat->enterS(strat->P, pos, strat, strat->tl);
2267  if(strat->sbaOrder != 1)
2268  {
2269  BOOLEAN overwrite = FALSE;
2270  for (int tk=0; tk<strat->sl+1; tk++)
2271  {
2272  if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
2273  {
2274  //printf("TK %d / %d\n",tk,strat->sl);
2275  overwrite = FALSE;
2276  break;
2277  }
2278  }
2279  //printf("OVERWRITE %d\n",overwrite);
2280  if (overwrite)
2281  {
2282  int cmp = pGetComp(strat->P.sig);
2283  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2284  pGetExpV (strat->P.p,vv);
2285  pSetExpV (strat->P.sig, vv);
2286  pSetComp (strat->P.sig,cmp);
2287 
2288  strat->P.sevSig = pGetShortExpVector (strat->P.sig);
2289  int i;
2290  LObject Q;
2291  for(int ps=0;ps<strat->sl+1;ps++)
2292  {
2293 
2294  strat->newt = TRUE;
2295  if (strat->syzl == strat->syzmax)
2296  {
2297  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
2298  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
2299  (strat->syzmax)*sizeof(unsigned long),
2300  ((strat->syzmax)+setmaxTinc)
2301  *sizeof(unsigned long));
2302  strat->syzmax += setmaxTinc;
2303  }
2304  Q.sig = pCopy(strat->P.sig);
2305  // add LM(F->m[i]) to the signature to get a Schreyer order
2306  // without changing the underlying polynomial ring at all
2307  if (strat->sbaOrder == 0)
2308  p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
2309  // since p_Add_q() destroys all input
2310  // data we need to recreate help
2311  // each time
2312  // ----------------------------------------------------------
2313  // in the Schreyer order we always know that the multiplied
2314  // module monomial strat->P.sig gives the leading monomial of
2315  // the corresponding principal syzygy
2316  // => we do not need to compute the "real" syzygy completely
2317  poly help = p_Copy(strat->sig[ps],currRing);
2318  p_ExpVectorAdd (help,strat->P.p,currRing);
2319  Q.sig = p_Add_q(Q.sig,help,currRing);
2320  //printf("%d. SYZ ",i+1);
2321  //pWrite(strat->syz[i]);
2322  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
2323  i = posInSyz(strat, Q.sig);
2324  enterSyz(Q, strat, i);
2325  }
2326  }
2327  }
2328  // deg - idx - lp/rp
2329  // => we need to add syzygies with indices > pGetComp(strat->P.sig)
2330  if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
2331  {
2332  int cmp = pGetComp(strat->P.sig);
2333  int max_cmp = IDELEMS(F);
2334  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2335  pGetExpV (strat->P.p,vv);
2336  LObject Q;
2337  int pos;
2338  int idx = p_GetComp(strat->P.sig,currRing);
2339  //printf("++ -- adding syzygies -- ++\n");
2340  // if new element is the first one in this index
2341  if (strat->currIdx < idx) {
2342  for (int i=0; i<strat->sl; ++i) {
2343  Q.sig = p_Copy(strat->P.sig,currRing);
2344  p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
2345  poly help = p_Copy(strat->sig[i],currRing);
2346  p_ExpVectorAdd(help,strat->P.p,currRing);
2347  Q.sig = p_Add_q(Q.sig,help,currRing);
2348  //pWrite(Q.sig);
2349  pos = posInSyz(strat, Q.sig);
2350  enterSyz(Q, strat, pos);
2351  }
2352  strat->currIdx = idx;
2353  } else {
2354  // if the element is not the first one in the given index we build all
2355  // possible syzygies with elements of higher index
2356  for (int i=cmp+1; i<=max_cmp; ++i) {
2357  pos = -1;
2358  for (int j=0; j<strat->sl; ++j) {
2359  if (p_GetComp(strat->sig[j],currRing) == i) {
2360  pos = j;
2361  break;
2362  }
2363  }
2364  if (pos != -1) {
2365  Q.sig = p_One(currRing);
2366  p_SetExpV(Q.sig, vv, currRing);
2367  // F->m[i-1] corresponds to index i
2368  p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
2369  p_SetComp(Q.sig, i, currRing);
2370  poly help = p_Copy(strat->P.sig,currRing);
2371  p_ExpVectorAdd(help,strat->S[pos],currRing);
2372  Q.sig = p_Add_q(Q.sig,help,currRing);
2373  if (strat->sbaOrder == 0) {
2374  if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn) {
2375  pos = posInSyz(strat, Q.sig);
2376  enterSyz(Q, strat, pos);
2377  }
2378  } else {
2379  pos = posInSyz(strat, Q.sig);
2380  enterSyz(Q, strat, pos);
2381  }
2382  }
2383  }
2384  //printf("++ -- done adding syzygies -- ++\n");
2385  }
2386  }
2387 //#if 1
2388 #if DEBUGF50
2389  printf("---------------------------\n");
2390  Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
2391  Print("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
2392  Print("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
2393 #endif
2394  /*
2395  if (newrules)
2396  {
2397  newrules = FALSE;
2398  }
2399  */
2400 #if 0
2401  int pl=pLength(strat->P.p);
2402  if (pl==1)
2403  {
2404  //if (TEST_OPT_PROT)
2405  //PrintS("<1>");
2406  }
2407  else if (pl==2)
2408  {
2409  //if (TEST_OPT_PROT)
2410  //PrintS("<2>");
2411  }
2412 #endif
2413  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2414 // Print("[%d]",hilbeledeg);
2415  if (strat->P.lcm!=NULL)
2416 #ifdef HAVE_RINGS
2417  pLmDelete(strat->P.lcm);
2418 #else
2419  pLmFree(strat->P.lcm);
2420 #endif
2421  if (strat->sl>srmax) srmax = strat->sl;
2422  }
2423  else
2424  {
2425  // adds signature of the zero reduction to
2426  // strat->syz. This is the leading term of
2427  // syzygy and can be used in syzCriterion()
2428  // the signature is added if and only if the
2429  // pair was not detected by the rewritten criterion in strat->red = redSig
2430  if (red_result!=2) {
2431 #if SBA_PRINT_ZERO_REDUCTIONS
2432  zeroreductions++;
2433 #endif
2434  int pos = posInSyz(strat, strat->P.sig);
2435  enterSyz(strat->P, strat, pos);
2436 //#if 1
2437 #ifdef DEBUGF5
2438  Print("ADDING STUFF TO SYZ : ");
2439  //pWrite(strat->P.p);
2440  pWrite(strat->P.sig);
2441 #endif
2442  }
2443  if (strat->P.p1 == NULL && strat->minim > 0)
2444  {
2445  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2446  }
2447  }
2448 
2449 #ifdef KDEBUG
2450  memset(&(strat->P), 0, sizeof(strat->P));
2451 #endif /* KDEBUG */
2452  kTest_TS(strat);
2453  }
2454 #ifdef KDEBUG
2455 #if MYTEST
2456  PrintS("bba finish GB: currRing: "); rWrite(currRing);
2457 #endif /* MYTEST */
2458  if (TEST_OPT_DEBUG) messageSets(strat);
2459 #endif /* KDEBUG */
2460 
2461  if (TEST_OPT_SB_1)
2462  {
2463  #ifdef HAVE_RINGS
2464  if(!rField_is_Ring(currRing))
2465  #endif
2466  {
2467  int k=1;
2468  int j;
2469  while(k<=strat->sl)
2470  {
2471  j=0;
2472  loop
2473  {
2474  if (j>=k) break;
2475  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2476  j++;
2477  }
2478  k++;
2479  }
2480  }
2481  }
2482 
2483  /* complete reduction of the standard basis--------- */
2484  if (TEST_OPT_REDSB)
2485  {
2486  completeReduce(strat);
2487 #ifdef HAVE_TAIL_RING
2488  if (strat->completeReduce_retry)
2489  {
2490  // completeReduce needed larger exponents, retry
2491  // to reduce with S (instead of T)
2492  // and in currRing (instead of strat->tailRing)
2493  cleanT(strat);strat->tailRing=currRing;
2494  int i;
2495  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2496  completeReduce(strat);
2497  }
2498 #endif
2499  }
2500  else if (TEST_OPT_PROT) PrintLn();
2501 
2502 #if SBA_PRINT_SIZE_SYZ
2503  // that is correct, syzl is counting one too far
2504  size_syz = strat->syzl;
2505 #endif
2506  exitSba(strat);
2507 // if (TEST_OPT_WEIGHTM)
2508 // {
2509 // pRestoreDegProcs(pFDegOld, pLDegOld);
2510 // if (ecartWeights)
2511 // {
2512 // omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
2513 // ecartWeights=NULL;
2514 // }
2515 // }
2516  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
2517  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2518 
2519 #ifdef KDEBUG
2520 #if MYTEST
2521  PrintS("bba_end: currRing: "); rWrite(currRing);
2522 #endif /* MYTEST */
2523 #endif /* KDEBUG */
2524 #if SBA_PRINT_SIZE_G
2525  size_g_non_red = IDELEMS(strat->Shdl);
2526 #endif
2527  if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
2528  {
2529  rChangeCurrRing (currRingOld);
2530  F0 = idrMoveR (F1, sRing, currRing);
2531  strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
2532  rDelete (sRing);
2533  }
2534  id_DelDiv(strat->Shdl, currRing);
2535  idSkipZeroes(strat->Shdl);
2536  idTest(strat->Shdl);
2537 
2538 #if SBA_PRINT_SIZE_G
2539  size_g = IDELEMS(strat->Shdl);
2540 #endif
2541 #ifdef DEBUGF5
2542  printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
2543  int oo = 0;
2544  while (oo<IDELEMS(strat->Shdl))
2545  {
2546  printf(" %d. ",oo+1);
2547  pWrite(pHead(strat->Shdl->m[oo]));
2548  oo++;
2549  }
2550 #endif
2551 #if SBA_PRINT_ZERO_REDUCTIONS
2552  printf("----------------------------------------------------------\n");
2553  printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
2554  zeroreductions = 0;
2555 #endif
2556 #if SBA_PRINT_REDUCTION_STEPS
2557  printf("----------------------------------------------------------\n");
2558  printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
2559 #endif
2560 #if SBA_PRINT_OPERATIONS
2561  printf("OPERATIONS: %ld\n",sba_operations);
2562 #endif
2563 #if SBA_PRINT_REDUCTION_STEPS
2564  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2565  printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
2566 #endif
2567 #if SBA_PRINT_OPERATIONS
2568  printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
2569 #endif
2570 #if SBA_PRINT_REDUCTION_STEPS
2571  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2572  printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
2573  sba_interreduction_steps = 0;
2574  sba_reduction_steps = 0;
2575 #endif
2576 #if SBA_PRINT_OPERATIONS
2577  printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
2578  sba_interreduction_operations = 0;
2579  sba_operations = 0;
2580 #endif
2581 #if SBA_PRINT_SIZE_G
2582  printf("----------------------------------------------------------\n");
2583  printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
2584  size_g = 0;
2585  size_g_non_red = 0;
2586 #endif
2587 #if SBA_PRINT_SIZE_SYZ
2588  printf("SIZE OF SYZ: %ld\n",size_syz);
2589  printf("----------------------------------------------------------\n");
2590  size_syz = 0;
2591 #endif
2592 #if SBA_PRINT_PRODUCT_CRITERION
2593  printf("PRODUCT CRITERIA: %ld\n",product_criterion);
2594  product_criterion = 0;
2595 #endif
2596  return (strat->Shdl);
2597 }
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:8433
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:6315
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:340
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#define p_GetComp(p, r)
Definition: monomials.h:72
char newt
Definition: kutil.h:391
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:1443
void initSyzRules(kStrategy strat)
Definition: kutil.cc:6733
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:144
#define TEST_OPT_REDSB
Definition: options.h:99
int length() const
Definition: intvec.h:86
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:9487
void pWrite(poly p)
Definition: polys.h:279
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:8531
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:181
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
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:4040
#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:1456
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void rDebugPrint(ring r)
Definition: ring.cc:4035
char completeReduce_retry
Definition: kutil.h:393
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:9460
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
BOOLEAN interpt
Definition: kutil.h:361
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:12
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:16
#define kTest_TS(A)
Definition: kutil.h:620
poly p_One(const ring r)
Definition: p_polys.cc:1318
int max_lower_index
Definition: kutil.h:314
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:8068
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:508
#define pSetExpV(p, e)
Definition: polys.h:97
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
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:379
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3277
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:1472
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:9357
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:8610
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1339
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:2755
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:14
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8990
#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:850
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:4557
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:437
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:505
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3900
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:5041
ring tailRing
Definition: kutil.h:341
#define TEST_OPT_SB_1
Definition: options.h:113
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:8155
char overflow
Definition: kutil.h:394
unsigned long * sevS
Definition: kutil.h:318
#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:8797
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:8644
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:1145
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:98
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
omBin lmBin
Definition: kutil.h:342
BOOLEAN use_buckets
Definition: kutil.h:373
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:99
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
ideal Shdl
Definition: kutil.h:299
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kstd2.cc:846
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int syzl
Definition: kutil.h:347
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:9903
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:8003
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:156
#define idTest(id)
Definition: ideals.h:60
ring sbaRing ( kStrategy  strat,
const ring  r = currRing,
BOOLEAN  complete = TRUE,
int  sgn = 1 
)

Definition at line 9487 of file kutil.cc.

9488 {
9489  int n = rBlocks(r); // Including trailing zero!
9490  // if sbaOrder == 1 => use (C,monomial order from r)
9491  if (strat->sbaOrder == 1)
9492  {
9493  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
9494  {
9495  return r;
9496  }
9497  ring res = rCopy0(r, TRUE, FALSE);
9498  res->order = (int *)omAlloc0((n+1)*sizeof(int));
9499  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
9500  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
9501  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
9502  res->wvhdl = wvhdl;
9503  for (int i=1; i<n; i++)
9504  {
9505  res->order[i] = r->order[i-1];
9506  res->block0[i] = r->block0[i-1];
9507  res->block1[i] = r->block1[i-1];
9508  res->wvhdl[i] = r->wvhdl[i-1];
9509  }
9510 
9511  // new 1st block
9512  res->order[0] = ringorder_C; // Prefix
9513  // removes useless secondary component order if defined in old ring
9514  for (int i=rBlocks(res); i>0; --i) {
9515  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
9516  res->order[i] = 0;
9517  }
9518  }
9519  rComplete(res, 1);
9520 #ifdef HAVE_PLURAL
9521  if (rIsPluralRing(r))
9522  {
9523  if ( nc_rComplete(r, res, false) ) // no qideal!
9524  {
9525 #ifndef SING_NDEBUG
9526  WarnS("error in nc_rComplete");
9527 #endif
9528  // cleanup?
9529 
9530  // rDelete(res);
9531  // return r;
9532 
9533  // just go on..
9534  }
9535  }
9536 #endif
9537  strat->tailRing = res;
9538  return (res);
9539  }
9540  // if sbaOrder == 3 => degree - position - ring order
9541  if (strat->sbaOrder == 3)
9542  {
9543  ring res = rCopy0(r, TRUE, FALSE);
9544  res->order = (int *)omAlloc0((n+2)*sizeof(int));
9545  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
9546  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
9547  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
9548  res->wvhdl = wvhdl;
9549  for (int i=2; i<n+2; i++)
9550  {
9551  res->order[i] = r->order[i-2];
9552  res->block0[i] = r->block0[i-2];
9553  res->block1[i] = r->block1[i-2];
9554  res->wvhdl[i] = r->wvhdl[i-2];
9555  }
9556 
9557  // new 1st block
9558  res->order[0] = ringorder_a; // Prefix
9559  res->block0[0] = 1;
9560  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
9561  for (int i=0; i<res->N; ++i)
9562  res->wvhdl[0][i] = 1;
9563  res->block1[0] = si_min(res->N, rVar(res));
9564  // new 2nd block
9565  res->order[1] = ringorder_C; // Prefix
9566  res->wvhdl[1] = NULL;
9567  // removes useless secondary component order if defined in old ring
9568  for (int i=rBlocks(res); i>1; --i) {
9569  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
9570  res->order[i] = 0;
9571  }
9572  }
9573  rComplete(res, 1);
9574 #ifdef HAVE_PLURAL
9575  if (rIsPluralRing(r))
9576  {
9577  if ( nc_rComplete(r, res, false) ) // no qideal!
9578  {
9579 #ifndef SING_NDEBUG
9580  WarnS("error in nc_rComplete");
9581 #endif
9582  // cleanup?
9583 
9584  // rDelete(res);
9585  // return r;
9586 
9587  // just go on..
9588  }
9589  }
9590 #endif
9591  strat->tailRing = res;
9592  return (res);
9593  }
9594 
9595  // not sbaOrder == 1 => use Schreyer order
9596  // this is done by a trick when initializing the signatures
9597  // in initSLSba():
9598  // Instead of using the signature 1e_i for F->m[i], we start
9599  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
9600  // Schreyer order w.r.t. the underlying monomial order.
9601  // => we do not need to change the underlying polynomial ring at all!
9602 
9603  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
9604 
9605  /*
9606  else
9607  {
9608  ring res = rCopy0(r, FALSE, FALSE);
9609  // Create 2 more blocks for prefix/suffix:
9610  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
9611  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
9612  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
9613  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
9614 
9615  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
9616  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
9617 
9618  // new 1st block
9619  int j = 0;
9620  res->order[j] = ringorder_IS; // Prefix
9621  res->block0[j] = res->block1[j] = 0;
9622  // wvhdl[j] = NULL;
9623  j++;
9624 
9625  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
9626  {
9627  res->order [j] = r->order [i];
9628  res->block0[j] = r->block0[i];
9629  res->block1[j] = r->block1[i];
9630 
9631  if (r->wvhdl[i] != NULL)
9632  {
9633  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
9634  } // else wvhdl[j] = NULL;
9635  }
9636 
9637  // new last block
9638  res->order [j] = ringorder_IS; // Suffix
9639  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
9640  // wvhdl[j] = NULL;
9641  j++;
9642 
9643  // res->order [j] = 0; // The End!
9644  res->wvhdl = wvhdl;
9645 
9646  // j == the last zero block now!
9647  assume(j == (n+1));
9648  assume(res->order[0]==ringorder_IS);
9649  assume(res->order[j-1]==ringorder_IS);
9650  assume(res->order[j]==0);
9651 
9652  if (complete)
9653  {
9654  rComplete(res, 1);
9655 
9656 #ifdef HAVE_PLURAL
9657  if (rIsPluralRing(r))
9658  {
9659  if ( nc_rComplete(r, res, false) ) // no qideal!
9660  {
9661  }
9662  }
9663  assume(rIsPluralRing(r) == rIsPluralRing(res));
9664 #endif
9665 
9666 
9667 #ifdef HAVE_PLURAL
9668  ring old_ring = r;
9669 
9670 #endif
9671 
9672  if (r->qideal!=NULL)
9673  {
9674  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
9675 
9676  assume(idRankFreeModule(res->qideal, res) == 0);
9677 
9678 #ifdef HAVE_PLURAL
9679  if( rIsPluralRing(res) )
9680  if( nc_SetupQuotient(res, r, true) )
9681  {
9682  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
9683  }
9684 
9685 #endif
9686  assume(idRankFreeModule(res->qideal, res) == 0);
9687  }
9688 
9689 #ifdef HAVE_PLURAL
9690  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
9691  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
9692  assume(rIsSCA(res) == rIsSCA(old_ring));
9693  assume(ncRingType(res) == ncRingType(old_ring));
9694 #endif
9695  }
9696  strat->tailRing = res;
9697  return res;
9698  }
9699  */
9700 
9701  assume(FALSE);
9702  return(NULL);
9703 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5531
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:516
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:3436
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1318
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
void superenterpairs ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3900 of file kutil.cc.

3901 {
3902 #if ADIDEBUG
3903  PrintS("\nEnter superenterpairs\n");
3904  int iii = strat->Ll;
3905  printf("\nstrat->tl = %i\n",strat->tl);
3906 #endif
3908  // enter also zero divisor * poly, if this is non zero and of smaller degree
3909  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
3910 //#if ADIDEBUG
3911  #if 0
3912  if(iii==strat->Ll)
3913  {
3914  PrintS("\n enterExtendedSpoly has not changed the list L.\n");
3915  }
3916  else
3917  {
3918  PrintLn();
3919  PrintS("\n enterExtendedSpoly changed the list L:\n");
3920  for(iii=0;iii<=strat->Ll;iii++)
3921  {
3922  Print("\n L[%d]:\n",iii);
3923  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3924  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3925  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3926  }
3927  }
3928  printf("\nstrat->tl = %i\n",strat->tl);
3929  iii = strat->Ll;
3930 #endif
3931  initenterpairs(h, k, ecart, 0, strat, atR);
3932 //#if ADIDEBUG
3933  #if 0
3934  if(iii==strat->Ll)
3935  {
3936  PrintS("\n initenterpairs has not changed the list L.\n");
3937  }
3938  else
3939  {
3940  PrintS("\n initenterpairs changed the list L:\n");
3941  for(iii=0;iii<=strat->Ll;iii++)
3942  {
3943  Print("\n L[%d]:\n",iii);
3944  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3945  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3946  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3947  }
3948  }
3949  printf("\nstrat->tl = %i\n",strat->tl);
3950  iii = strat->Ll;
3951 #endif
3952  initenterstrongPairs(h, k, ecart, 0, strat, atR);
3953 //#if ADIDEBUG
3954  #if 0
3955  if(iii==strat->Ll)
3956  {
3957  PrintS("\n initenterstrongPairs has not changed the list L.\n");
3958  }
3959  else
3960  {
3961  PrintS("\n initenterstrongPairs changed the list L:\n");
3962  for(iii=0;iii<=strat->Ll;iii++)
3963  {
3964  Print("\n L[%d]:\n",iii);
3965  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3966  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3967  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3968  }
3969  }
3970  printf("\nstrat->tl = %i\n",strat->tl);
3971  PrintS("\nEnd of superenterpairs\n");
3972 #endif
3973  clearSbatch(h, k, pos, strat);
3974 #if ADIDEBUG
3975  printf("\nstrat->tl = %i\n",strat->tl);
3976 #endif
3977 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:3874
int Ll
Definition: kutil.h:349
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3028
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3749
int tl
Definition: kutil.h:348
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:440
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:3780
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
ring tailRing
Definition: kutil.h:341
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
static Poly * h
Definition: janet.cc:978
BOOLEAN syzCriterion ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5672 of file kutil.cc.

5673 {
5674 //#if 1
5675 #ifdef DEBUGF5
5676  Print("syzygy criterion checks: ");
5677  pWrite(sig);
5678 #endif
5679  for (int k=0; k<strat->syzl; k++)
5680  {
5681  //printf("-%d",k);
5682 //#if 1
5683 #ifdef DEBUGF5
5684  Print("checking with: %d / %d -- \n",k,strat->syzl);
5685  pWrite(pHead(strat->syz[k]));
5686 #endif
5687  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5688  {
5689 //#if 1
5690 #ifdef DEBUGF5
5691  PrintS("DELETE!\n");
5692 #endif
5693  //printf("- T -\n\n");
5694  return TRUE;
5695  }
5696  }
5697  //printf("- F -\n\n");
5698  return FALSE;
5699 }
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
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:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
void PrintS(const char *s)
Definition: reporter.cc:294
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
BOOLEAN syzCriterionInc ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5704 of file kutil.cc.

5705 {
5706 //#if 1
5707 #ifdef DEBUGF5
5708  Print("--- syzygy criterion checks: ");
5709  pWrite(sig);
5710 #endif
5711  int comp = p_GetComp(sig, currRing);
5712  int min, max;
5713  if (comp<=1)
5714  return FALSE;
5715  else
5716  {
5717  min = strat->syzIdx[comp-2];
5718  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
5719  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
5720  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
5721  if (comp == strat->currIdx)
5722  {
5723  max = strat->syzl;
5724  }
5725  else
5726  {
5727  max = strat->syzIdx[comp-1];
5728  }
5729  for (int k=min; k<max; k++)
5730  {
5731 #ifdef F5DEBUG
5732  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
5733  Print("checking with: %d -- ",k);
5734  pWrite(pHead(strat->syz[k]));
5735 #endif
5736  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5737  return TRUE;
5738  }
5739  return FALSE;
5740  }
5741 }
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:140
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
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:12
static int max(int a, int b)
Definition: fast_mult.cc:264
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
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
long twoPow ( long  arg)

Definition at line 3362 of file kutil.cc.

3363 {
3364  return 1L << arg;
3365 }
void updateResult ( ideal  r,
ideal  Q,
kStrategy  strat 
)

Definition at line 8644 of file kutil.cc.

8645 {
8646  int l;
8647  if (strat->ak>0)
8648  {
8649  for (l=IDELEMS(r)-1;l>=0;l--)
8650  {
8651  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
8652  {
8653  pDelete(&r->m[l]); // and set it to NULL
8654  }
8655  }
8656  int q;
8657  poly p;
8658  for (l=IDELEMS(r)-1;l>=0;l--)
8659  {
8660  if ((r->m[l]!=NULL)
8661  //&& (strat->syzComp>0)
8662  //&& (pGetComp(r->m[l])<=strat->syzComp)
8663  )
8664  {
8665  for(q=IDELEMS(Q)-1; q>=0;q--)
8666  {
8667  if ((Q->m[q]!=NULL)
8668  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
8669  {
8670  #if HAVE_RINGS
8671  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8672  #endif
8673  {
8674  if (TEST_OPT_REDSB)
8675  {
8676  p=r->m[l];
8677  r->m[l]=kNF(Q,NULL,p);
8678  pDelete(&p);
8679  }
8680  else
8681  {
8682  pDelete(&r->m[l]); // and set it to NULL
8683  }
8684  break;
8685  }
8686  }
8687  }
8688  }
8689  }
8690  }
8691  else
8692  {
8693  int q;
8694  poly p;
8695  BOOLEAN reduction_found=FALSE;
8696  if (!rField_is_Ring(currRing))
8697  {
8698  for (l=IDELEMS(r)-1;l>=0;l--)
8699  {
8700  if (r->m[l]!=NULL)
8701  {
8702  for(q=IDELEMS(Q)-1; q>=0;q--)
8703  {
8704  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
8705  {
8706  if (TEST_OPT_REDSB)
8707  {
8708  p=r->m[l];
8709  r->m[l]=kNF(Q,NULL,p);
8710  pDelete(&p);
8711  reduction_found=TRUE;
8712  }
8713  else
8714  {
8715  pDelete(&r->m[l]); // and set it to NULL
8716  }
8717  break;
8718  }
8719  }
8720  }
8721  }
8722  }
8723  #ifdef HAVE_RINGS
8724  //Also need divisibility of the leading coefficients
8725  else
8726  {
8727  for (l=IDELEMS(r)-1;l>=0;l--)
8728  {
8729  if (r->m[l]!=NULL)
8730  {
8731  for(q=IDELEMS(Q)-1; q>=0;q--)
8732  {
8733  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8734  {
8735  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
8736  {
8737  if (TEST_OPT_REDSB)
8738  {
8739  p=r->m[l];
8740  r->m[l]=kNF(Q,NULL,p);
8741  pDelete(&p);
8742  reduction_found=TRUE;
8743  }
8744  else
8745  {
8746  pDelete(&r->m[l]); // and set it to NULL
8747  }
8748  break;
8749  }
8750  }
8751  }
8752  }
8753  }
8754  }
8755  #endif
8756  if (/*TEST_OPT_REDSB &&*/ reduction_found)
8757  {
8758  for (l=IDELEMS(r)-1;l>=0;l--)
8759  {
8760  if (r->m[l]!=NULL)
8761  {
8762  for(q=IDELEMS(r)-1;q>=0;q--)
8763  {
8764  if ((l!=q)
8765  && (r->m[q]!=NULL)
8766  &&(pLmDivisibleBy(r->m[l],r->m[q]))
8767  #if HAVE_RINGS
8768  && (!rField_is_Ring(currRing) ||
8769  n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8770  #endif
8771  )
8772  {
8773  //If they are equal then take the one with the smallest length
8774  if(pLmDivisibleBy(r->m[q],r->m[l])
8775  #ifdef HAVE_RINGS
8776  && ((rField_is_Ring(currRing)
8777  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8778  || !(rField_is_Ring(currRing)))
8779  #endif
8780  && (pLength(r->m[q]) < pLength(r->m[l]) ||
8781  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
8782  {
8783  pDelete(&r->m[l]);
8784  break;
8785  }
8786  else
8787  pDelete(&r->m[q]);
8788  }
8789  }
8790  }
8791  }
8792  }
8793  }
8794  idSkipZeroes(r);
8795 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#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:128
#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:12
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:771
#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:437
#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:126
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 7341 of file kutil.cc.

7342 {
7343  LObject h;
7344  int i, suc=0;
7345  poly redSi=NULL;
7346  BOOLEAN change,any_change;
7347 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
7348 // for (i=0; i<=(strat->sl); i++)
7349 // {
7350 // Print("s%d:",i);
7351 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
7352 // pWrite(strat->S[i]);
7353 // }
7354 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
7355  any_change=FALSE;
7357  {
7358  while (suc != -1)
7359  {
7360  i=suc+1;
7361  while (i<=strat->sl)
7362  {
7363  change=FALSE;
7364  #ifdef HAVE_RINGS
7366  any_change = FALSE;
7367  #endif
7368  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
7369  {
7370  redSi = pHead(strat->S[i]);
7371  strat->S[i] = redBba(strat->S[i],i-1,strat);
7372  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
7373  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
7374  if (pCmp(redSi,strat->S[i])!=0)
7375  {
7376  change=TRUE;
7377  any_change=TRUE;
7378  #ifdef KDEBUG
7379  if (TEST_OPT_DEBUG)
7380  {
7381  PrintS("reduce:");
7382  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
7383  }
7384  #endif
7385  if (TEST_OPT_PROT)
7386  {
7387  if (strat->S[i]==NULL)
7388  PrintS("V");
7389  else
7390  PrintS("v");
7391  mflush();
7392  }
7393  }
7394  pLmDelete(&redSi);
7395  if (strat->S[i]==NULL)
7396  {
7397  deleteInS(i,strat);
7398  i--;
7399  }
7400  else if (change)
7401  {
7403  {
7404  if (TEST_OPT_CONTENTSB)
7405  {
7406  number n;
7407  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
7408  if (!nIsOne(n))
7409  {
7411  denom->n=nInvers(n);
7412  denom->next=DENOMINATOR_LIST;
7413  DENOMINATOR_LIST=denom;
7414  }
7415  nDelete(&n);
7416  }
7417  else
7418  {
7419  //pContent(strat->S[i]);
7420  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
7421  }
7422  }
7423  else
7424  {
7425  pNorm(strat->S[i]);
7426  }
7427  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
7428  }
7429  }
7430  i++;
7431  }
7432  if (any_change) reorderS(&suc,strat);
7433  else break;
7434  }
7435  if (toT)
7436  {
7437  for (i=0; i<=strat->sl; i++)
7438  {
7439  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7440  {
7441  h.p = redtailBba(strat->S[i],i-1,strat);
7443  {
7444  h.pCleardenom();// also does a pContent
7445  }
7446  }
7447  else
7448  {
7449  h.p = strat->S[i];
7450  }
7451  strat->initEcart(&h);
7452  if (strat->honey)
7453  {
7454  strat->ecartS[i] = h.ecart;
7455  }
7456  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
7457  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
7458  h.sev = strat->sevS[i];
7459  /*puts the elements of S also to T*/
7460  strat->initEcart(&h);
7461  enterT(h,strat);
7462  strat->S_2_R[i] = strat->tl;
7463  }
7464  }
7465  }
7466  else
7467  {
7468  while (suc != -1)
7469  {
7470  i=suc;
7471  while (i<=strat->sl)
7472  {
7473  change=FALSE;
7474  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
7475  {
7476  redSi=pHead((strat->S)[i]);
7477  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
7478  if ((strat->S)[i]==NULL)
7479  {
7480  deleteInS(i,strat);
7481  i--;
7482  }
7483  else if (pCmp((strat->S)[i],redSi)!=0)
7484  {
7485  any_change=TRUE;
7486  h.p = strat->S[i];
7487  strat->initEcart(&h);
7488  strat->ecartS[i] = h.ecart;
7490  {
7491  if (TEST_OPT_CONTENTSB)
7492  {
7493  number n;
7494  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
7495  if (!nIsOne(n))
7496  {
7498  denom->n=nInvers(n);
7499  denom->next=DENOMINATOR_LIST;
7500  DENOMINATOR_LIST=denom;
7501  }
7502  nDelete(&n);
7503  }
7504  else
7505  {
7506  //pContent(strat->S[i]);
7507  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
7508  }
7509  }
7510  else
7511  {
7512  pNorm(strat->S[i]); // == h.p
7513  }
7514  h.sev = pGetShortExpVector(h.p);
7515  strat->sevS[i] = h.sev;
7516  }
7517  pLmDelete(&redSi);
7518  kTest(strat);
7519  }
7520  i++;
7521  }
7522 #ifdef KDEBUG
7523  kTest(strat);
7524 #endif
7525  if (any_change) reorderS(&suc,strat);
7526  else { suc=-1; break; }
7527  if (h.p!=NULL)
7528  {
7529  if (!strat->kHEdgeFound)
7530  {
7531  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
7532  }
7533  if (strat->kHEdgeFound)
7534  newHEdge(strat);
7535  }
7536  }
7537  for (i=0; i<=strat->sl; i++)
7538  {
7539  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7540  {
7541  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
7542  strat->initEcart(&h);
7543  strat->ecartS[i] = h.ecart;
7544  h.sev = pGetShortExpVector(h.p);
7545  strat->sevS[i] = h.sev;
7546  }
7547  else
7548  {
7549  h.p = strat->S[i];
7550  h.ecart=strat->ecartS[i];
7551  h.sev = strat->sevS[i];
7552  h.length = h.pLength = pLength(h.p);
7553  }
7554  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
7555  cancelunit1(&h,&suc,strat->sl,strat);
7556  h.SetpFDeg();
7557  /*puts the elements of S also to T*/
7558  enterT(h,strat);
7559  strat->S_2_R[i] = strat->tl;
7560  }
7561  if (suc!= -1) updateS(toT,strat);
7562  }
7563 #ifdef KDEBUG
7564  kTest(strat);
7565 #endif
7566 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5971
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:327
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:340
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:7189
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4144
#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:144
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
#define kTest(A)
Definition: kutil.h:619
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:942
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:6047
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:436
static int pLength(poly a)
Definition: p_polys.h:189
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:7277
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7807
#define mflush()
Definition: reporter.h:55
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2826
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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:405
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:140
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#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:366
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
denominator_list next
Definition: kutil.h:67
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7341
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:7300
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8920
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2682
void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 10148 of file kutil.cc.

10149 {
10150  /* to use after updateS(toT=FALSE,strat) */
10151  /* fills T with shifted elt's of S */
10152  int i;
10153  LObject h;
10154  int atT = -1; // or figure out smth better
10155  strat->tl = -1; // init
10156  for (i=0; i<=strat->sl; i++)
10157  {
10158  memset(&h,0,sizeof(h));
10159  h.p = strat->S[i]; // lm in currRing, tail in TR
10160  strat->initEcart(&h);
10161  h.sev = strat->sevS[i];
10162  h.t_p = NULL;
10163  h.GetTP(); // creates correct t_p
10164  /*puts the elements of S with their shifts to T*/
10165  // int atT, int uptodeg, int lV)
10166  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
10167  // need a small check for above; we insert >=1 elements
10168  // insert this check into kTest_TS ?
10169  enterTShift(h,strat,atT,uptodeg,lV);
10170  }
10171  /* what about setting strat->tl? */
10172 }
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:10799
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

Definition at line 81 of file kutil.cc.

int HCord

Definition at line 227 of file kutil.cc.

int strat_nr

Definition at line 27 of file kstdfac.cc.

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

Definition at line 99 of file kstd2.cc.

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

Definition at line 98 of file kstd2.cc.