Data Structures | Macros | Typedefs | Functions | Variables
kutil.h File Reference
#include <string.h>
#include <omalloc/omalloc.h>
#include <misc/mylimits.h>
#include <kernel/polys.h>
#include <polys/operations/pShallowCopyDelete.h>
#include <kernel/structs.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 intintset
 
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
 
typedef skStrategykStrategy
 

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 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 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 ()
 
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 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 enterOnePairSig (int i, poly p, poly pSig, int ecart, int isFromQ, kStrategy strat, int atR)
 
void chainCritNormal (poly p, int ecart, 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 TSet &T, const unsigned long *sevT, const int tl, 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 (ideal F, 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)
 
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 (ideal F, 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 strat_fac_debug
 
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 65 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 390 of file kutil.h.

#define HAVE_TAIL_RING

Definition at line 23 of file kutil.h.

#define KINLINE

Definition at line 49 of file kutil.h.

#define kTest (   A)    (TRUE)

Definition at line 615 of file kutil.h.

#define kTest_L (   T)    (TRUE)

Definition at line 619 of file kutil.h.

#define kTest_S (   T)    (TRUE)

Definition at line 618 of file kutil.h.

#define kTest_T (   T)    (TRUE)

Definition at line 617 of file kutil.h.

#define kTest_TS (   A)    (TRUE)

Definition at line 616 of file kutil.h.

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

Definition at line 506 of file kutil.h.

#define NO_KINLINE   1

Definition at line 50 of file kutil.h.

#define setmax   16

Definition at line 26 of file kutil.h.

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

Definition at line 27 of file kutil.h.

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

Definition at line 28 of file kutil.h.

#define setmaxT   64

Definition at line 30 of file kutil.h.

#define setmaxTinc   32

Definition at line 31 of file kutil.h.

Typedef Documentation

Definition at line 63 of file kutil.h.

typedef int* intset

Definition at line 53 of file kutil.h.

Definition at line 271 of file kutil.h.

typedef class sLObject LObject

Definition at line 58 of file kutil.h.

typedef LObject* LSet

Definition at line 60 of file kutil.h.

typedef class sTObject TObject

Definition at line 57 of file kutil.h.

typedef TObject* TSet

Definition at line 59 of file kutil.h.

typedef wlen_type* wlen_set

Definition at line 55 of file kutil.h.

typedef int64 wlen_type

Definition at line 54 of file kutil.h.

Function Documentation

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

Definition at line 5201 of file kutil.cc.

5202 {
5203  poly p1 = pOne();
5204  poly p2 = pOne();
5205  for (int ii=strat->sl; ii>start; ii--)
5206  {
5207  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
5208  {
5209  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
5210  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
5211  if (!(pLmCmp(p1,p2) == 1))
5212  {
5213  pDelete(&p1);
5214  pDelete(&p2);
5215  return TRUE;
5216  }
5217  }
5218  }
5219  pDelete(&p1);
5220  pDelete(&p2);
5221  return FALSE;
5222 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
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
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
LObject P
Definition: kutil.h:300
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
#define pDelete(p_ptr)
Definition: polys.h:157
int sl
Definition: kutil.h:351
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
BOOLEAN arriRewCriterionPre ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int  start 
)

Definition at line 5224 of file kutil.cc.

5225 {
5226  int found = -1;
5227  for (int i=strat->Bl; i>-1; i--) {
5228  if (pLmEqual(strat->B[i].sig,sig)) {
5229  found = i;
5230  break;
5231  }
5232  }
5233  if (found != -1) {
5234  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1) {
5235  deleteInL(strat->B,&strat->Bl,found,strat);
5236  } else {
5237  return TRUE;
5238  }
5239  }
5240  poly p1 = pOne();
5241  poly p2 = pOne();
5242  for (int ii=strat->sl; ii>-1; ii--)
5243  {
5244  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
5245  {
5246  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
5247  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
5248  if (!(pLmCmp(p1,p2) == 1))
5249  {
5250  pDelete(&p1);
5251  pDelete(&p2);
5252  return TRUE;
5253  }
5254  }
5255  }
5256  pDelete(&p1);
5257  pDelete(&p2);
5258  return FALSE;
5259 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int Bl
Definition: kutil.h:355
#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:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
LSet B
Definition: kutil.h:326
#define pDelete(p_ptr)
Definition: polys.h:157
int sl
Definition: kutil.h:351
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
#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 1158 of file kInline.h.

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

Definition at line 1338 of file kstd2.cc.

1339 {
1340 #ifdef KDEBUG
1341  bba_count++;
1342  int loop_count = 0;
1343 #endif /* KDEBUG */
1344  int red_result = 1;
1345  int olddeg,reduc;
1346  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1347  BOOLEAN withT = FALSE;
1348  BITSET save;
1349  SI_SAVE_OPT1(save);
1350 
1351  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1352  initBuchMoraPos(strat);
1353  initHilbCrit(F,Q,&hilb,strat);
1354  initBba(F,strat);
1355  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1356  /*Shdl=*/initBuchMora(F, Q,strat);
1357  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1358  reduc = olddeg = 0;
1359 
1360 #ifndef NO_BUCKETS
1361  if (!TEST_OPT_NOT_BUCKETS)
1362  strat->use_buckets = 1;
1363 #endif
1364  // redtailBBa against T for inhomogenous input
1365  if (!TEST_OPT_OLDSTD)
1366  withT = ! strat->homog;
1367 
1368  // strat->posInT = posInT_pLength;
1369  kTest_TS(strat);
1370 
1371 #ifdef KDEBUG
1372 #if MYTEST
1373  if (TEST_OPT_DEBUG)
1374  {
1375  PrintS("bba start GB: currRing: ");
1376  // rWrite(currRing);PrintLn();
1378  PrintLn();
1379  }
1380 #endif /* MYTEST */
1381 #endif /* KDEBUG */
1382 
1383 #ifdef HAVE_TAIL_RING
1384  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1385  kStratInitChangeTailRing(strat);
1386 #endif
1387  if (BVERBOSE(23))
1388  {
1389  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1390  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1391  kDebugPrint(strat);
1392  }
1393 
1394 
1395 #ifdef KDEBUG
1396  //kDebugPrint(strat);
1397 #endif
1398  /* compute------------------------------------------------------- */
1399  while (strat->Ll >= 0)
1400  {
1401  #ifdef KDEBUG
1402  loop_count++;
1403  if (TEST_OPT_DEBUG) messageSets(strat);
1404  #endif
1405  if (strat->Ll== 0) strat->interpt=TRUE;
1406  if (TEST_OPT_DEGBOUND
1407  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1408  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1409  {
1410  /*
1411  *stops computation if
1412  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1413  *a predefined number Kstd1_deg
1414  */
1415  while ((strat->Ll >= 0)
1416  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1417  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1418  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1419  )
1420  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1421  if (strat->Ll<0) break;
1422  else strat->noClearS=TRUE;
1423  }
1424  /* picks the last element from the lazyset L */
1425  strat->P = strat->L[strat->Ll];
1426  strat->Ll--;
1427 
1428  if (pNext(strat->P.p) == strat->tail)
1429  {
1430  // deletes the short spoly
1431 #ifdef HAVE_RINGS
1432  if (rField_is_Ring(currRing))
1433  pLmDelete(strat->P.p);
1434  else
1435 #endif
1436  pLmFree(strat->P.p);
1437  strat->P.p = NULL;
1438  poly m1 = NULL, m2 = NULL;
1439 
1440  // check that spoly creation is ok
1441  while (strat->tailRing != currRing &&
1442  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1443  {
1444  assume(m1 == NULL && m2 == NULL);
1445  // if not, change to a ring where exponents are at least
1446  // large enough
1447  if (!kStratChangeTailRing(strat))
1448  {
1449  WerrorS("OVERFLOW...");
1450  break;
1451  }
1452  }
1453  // create the real one
1454  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
1455  strat->tailRing, m1, m2, strat->R);
1456  }
1457  else if (strat->P.p1 == NULL)
1458  {
1459  if (strat->minim > 0)
1460  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
1461  // for input polys, prepare reduction
1462  strat->P.PrepareRed(strat->use_buckets);
1463  }
1464 
1465  if (strat->P.p == NULL && strat->P.t_p == NULL)
1466  {
1467  red_result = 0;
1468  }
1469  else
1470  {
1471  if (TEST_OPT_PROT)
1472  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
1473  &olddeg,&reduc,strat, red_result);
1474 
1475  /* reduction of the element chosen from L */
1476  red_result = strat->red(&strat->P,strat);
1477  if (errorreported) break;
1478  }
1479 
1480  if (strat->overflow)
1481  {
1482  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
1483  }
1484 
1485  // reduction to non-zero new poly
1486  if (red_result == 1)
1487  {
1488  // get the polynomial (canonicalize bucket, make sure P.p is set)
1489  strat->P.GetP(strat->lmBin);
1490  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
1491  // but now, for entering S, T, we reset it
1492  // in the inhomogeneous case: FDeg == pFDeg
1493  if (strat->homog) strat->initEcart(&(strat->P));
1494 
1495  /* statistic */
1496  if (TEST_OPT_PROT) PrintS("s");
1497 
1498  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1499 
1500 #ifdef KDEBUG
1501 #if MYTEST
1502  PrintS("New S: "); p_DebugPrint(strat->P.p, currRing); PrintLn();
1503 #endif /* MYTEST */
1504 #endif /* KDEBUG */
1505 
1506  // reduce the tail and normalize poly
1507  // in the ring case we cannot expect LC(f) = 1,
1508  // therefore we call pContent instead of pNorm
1510  {
1511  strat->P.pCleardenom();
1513  {
1514  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1515  strat->P.pCleardenom();
1516  }
1517  }
1518  else
1519  {
1520  strat->P.pNorm();
1522  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1523  }
1524 
1525 #ifdef KDEBUG
1526  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
1527 #if MYTEST
1528  PrintS("New (reduced) S: "); p_DebugPrint(strat->P.p, currRing); PrintLn();
1529 #endif /* MYTEST */
1530 #endif /* KDEBUG */
1531 
1532  // min_std stuff
1533  if ((strat->P.p1==NULL) && (strat->minim>0))
1534  {
1535  if (strat->minim==1)
1536  {
1537  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
1538  p_Delete(&strat->P.p2, currRing, strat->tailRing);
1539  }
1540  else
1541  {
1542  strat->M->m[minimcnt]=strat->P.p2;
1543  strat->P.p2=NULL;
1544  }
1545  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
1546  pNext(strat->M->m[minimcnt])
1547  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
1548  strat->tailRing, currRing,
1549  currRing->PolyBin);
1550  minimcnt++;
1551  }
1552 
1553  // enter into S, L, and T
1554  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
1555  {
1556  enterT(strat->P, strat);
1557 #ifdef HAVE_RINGS
1558  if (rField_is_Ring(currRing))
1559  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1560  else
1561 #endif
1562  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1563  // posInS only depends on the leading term
1564  strat->enterS(strat->P, pos, strat, strat->tl);
1565 #if 0
1566  int pl=pLength(strat->P.p);
1567  if (pl==1)
1568  {
1569  //if (TEST_OPT_PROT)
1570  //PrintS("<1>");
1571  }
1572  else if (pl==2)
1573  {
1574  //if (TEST_OPT_PROT)
1575  //PrintS("<2>");
1576  }
1577 #endif
1578  }
1579  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1580 // Print("[%d]",hilbeledeg);
1581  if (strat->P.lcm!=NULL)
1582 #ifdef HAVE_RINGS
1583  pLmDelete(strat->P.lcm);
1584 #else
1585  pLmFree(strat->P.lcm);
1586 #endif
1587  }
1588  else if (strat->P.p1 == NULL && strat->minim > 0)
1589  {
1590  p_Delete(&strat->P.p2, currRing, strat->tailRing);
1591  }
1592 
1593 #ifdef KDEBUG
1594  memset(&(strat->P), 0, sizeof(strat->P));
1595 #endif /* KDEBUG */
1596  kTest_TS(strat);
1597  }
1598 #ifdef KDEBUG
1599 #if MYTEST
1600  PrintS("bba finish GB: currRing: "); rWrite(currRing);
1601 #endif /* MYTEST */
1602  if (TEST_OPT_DEBUG) messageSets(strat);
1603 #endif /* KDEBUG */
1604 
1605  if (TEST_OPT_SB_1)
1606  {
1607  #ifdef HAVE_RINGS
1608  if(!rField_is_Ring(currRing))
1609  #endif
1610  {
1611  int k=1;
1612  int j;
1613  while(k<=strat->sl)
1614  {
1615  j=0;
1616  loop
1617  {
1618  if (j>=k) break;
1619  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
1620  j++;
1621  }
1622  k++;
1623  }
1624  }
1625  }
1626 
1627  /* complete reduction of the standard basis--------- */
1628  if (TEST_OPT_REDSB)
1629  {
1630  completeReduce(strat);
1631 #ifdef HAVE_TAIL_RING
1632  if (strat->completeReduce_retry)
1633  {
1634  // completeReduce needed larger exponents, retry
1635  // to reduce with S (instead of T)
1636  // and in currRing (instead of strat->tailRing)
1637  cleanT(strat);strat->tailRing=currRing;
1638  int i;
1639  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
1640  completeReduce(strat);
1641  }
1642 #endif
1643  }
1644  else if (TEST_OPT_PROT) PrintLn();
1645 
1646  /* release temp data-------------------------------- */
1647  exitBuchMora(strat);
1648 // if (TEST_OPT_WEIGHTM)
1649 // {
1650 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
1651 // if (ecartWeights)
1652 // {
1653 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1654 // ecartWeights=NULL;
1655 // }
1656 // }
1657  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
1658  SI_RESTORE_OPT1(save);
1659  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1660 
1661 #ifdef KDEBUG
1662 #if MYTEST
1663  PrintS("bba_end: currRing: "); rWrite(currRing);
1664 #endif /* MYTEST */
1665 #endif /* KDEBUG */
1666  idTest(strat->Shdl);
1667 
1668  return (strat->Shdl);
1669 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4176
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7558
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3671
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
char noClearS
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
#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:280
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
int minim
Definition: kutil.h:361
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:3971
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
BOOLEAN interpt
Definition: kutil.h:365
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:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:616
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:7305
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
void initBba(ideal, kStrategy strat)
Definition: kstd1.cc:1279
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:376
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
ideal M
Definition: kutil.h:303
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define IDELEMS(i)
Definition: simpleideals.h:19
short errorreported
Definition: feFopen.cc:22
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
#define BVERBOSE(a)
Definition: options.h:33
kStrategy strat
Definition: myNF.cc:319
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)
Definition: simpleideals.cc:40
static int bba_count
Definition: kstd2.cc:1334
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
void cleanT(kStrategy strat)
Definition: kutil.cc:491
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3597
ring tailRing
Definition: kutil.h:343
#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:3860
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:95
BOOLEAN use_buckets
Definition: kutil.h:377
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:96
int Kstd1_deg
Definition: kutil.cc:228
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
#define idTest(id)
Definition: ideals.h:63
ideal bbaShift ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 2868 of file kstd2.cc.

2869 {
2870 #ifdef KDEBUG
2871  bba_count++;
2872  int loop_count = 0;
2873 #endif
2874  int red_result = 1;
2875  int olddeg,reduc;
2876  int hilbeledeg=1,hilbcount=0,minimcnt=0;
2877  BOOLEAN withT = TRUE; // very important for shifts
2878 
2879  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
2880  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
2881  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
2882  initBbaShift(F,strat); /* DONE */
2883  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2884  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
2885  updateSShift(strat,uptodeg,lV); /* initializes T */
2886 
2887  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2888  reduc = olddeg = 0;
2889  strat->lV=lV;
2890 
2891 #ifndef NO_BUCKETS
2892  if (!TEST_OPT_NOT_BUCKETS)
2893  strat->use_buckets = 1;
2894 #endif
2895 
2896  // redtailBBa against T for inhomogenous input
2897  // if (!TEST_OPT_OLDSTD)
2898  // withT = ! strat->homog;
2899 
2900  // strat->posInT = posInT_pLength;
2901  kTest_TS(strat);
2902 
2903 #ifdef HAVE_TAIL_RING
2904  kStratInitChangeTailRing(strat);
2905 #endif
2906 
2907  /* compute------------------------------------------------------- */
2908  while (strat->Ll >= 0)
2909  {
2910 #ifdef KDEBUG
2911  loop_count++;
2912  if (TEST_OPT_DEBUG) messageSets(strat);
2913 #endif
2914  if (strat->Ll== 0) strat->interpt=TRUE;
2915  if (TEST_OPT_DEGBOUND
2916  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2917  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2918  {
2919  /*
2920  *stops computation if
2921  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2922  *a predefined number Kstd1_deg
2923  */
2924  while ((strat->Ll >= 0)
2925  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2926  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2927  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2928  )
2929  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2930  if (strat->Ll<0) break;
2931  else strat->noClearS=TRUE;
2932  }
2933  /* picks the last element from the lazyset L */
2934  strat->P = strat->L[strat->Ll];
2935  strat->Ll--;
2936 
2937  if (pNext(strat->P.p) == strat->tail)
2938  {
2939  // deletes the short spoly
2940  pLmFree(strat->P.p);
2941  strat->P.p = NULL;
2942  poly m1 = NULL, m2 = NULL;
2943 
2944  // check that spoly creation is ok
2945  while (strat->tailRing != currRing &&
2946  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2947  {
2948  assume(m1 == NULL && m2 == NULL);
2949  // if not, change to a ring where exponents are at least
2950  // large enough
2951  kStratChangeTailRing(strat);
2952  }
2953  // create the real one
2954  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2955  strat->tailRing, m1, m2, strat->R);
2956  }
2957  else if (strat->P.p1 == NULL)
2958  {
2959  if (strat->minim > 0)
2960  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2961  // for input polys, prepare reduction
2962  strat->P.PrepareRed(strat->use_buckets);
2963  }
2964 
2965  poly qq;
2966 
2967  /* here in the nonhomog case we shrink the new spoly */
2968 
2969  if ( ! strat->homog)
2970  {
2971  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
2972  /* in the nonhomog case we have to shrink the polynomial */
2973  assume(strat->P.t_p!=NULL);
2974  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
2975  if (qq != NULL)
2976  {
2977  /* we're here if Shrink is nonzero */
2978  // strat->P.p = NULL;
2979  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
2980  strat->P.p = NULL; // is not set by Delete
2981  strat->P.t_p = qq;
2982  strat->P.GetP(strat->lmBin);
2983  // update sev and length
2984  strat->initEcart(&(strat->P));
2985  strat->P.sev = pGetShortExpVector(strat->P.p);
2986 // strat->P.FDeg = strat->P.pFDeg();
2987 // strat->P.length = strat->P.pLDeg();
2988 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
2989  }
2990  else
2991  {
2992  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
2993 #ifdef KDEBUG
2994  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
2995 #endif
2996  // strat->P.Delete(); // cause error
2997  strat->P.p = NULL;
2998  strat->P.t_p = NULL;
2999  // strat->P.p = NULL; // or delete strat->P.p ?
3000  }
3001  }
3002  /* end shrinking poly in the nonhomog case */
3003 
3004  if (strat->P.p == NULL && strat->P.t_p == NULL)
3005  {
3006  red_result = 0;
3007  }
3008  else
3009  {
3010  if (TEST_OPT_PROT)
3011  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3012  &olddeg,&reduc,strat, red_result);
3013 
3014  /* reduction of the element chosen from L */
3015  red_result = strat->red(&strat->P,strat);
3016  }
3017 
3018  // reduction to non-zero new poly
3019  if (red_result == 1)
3020  {
3021  /* statistic */
3022  if (TEST_OPT_PROT) PrintS("s");
3023 
3024  // get the polynomial (canonicalize bucket, make sure P.p is set)
3025  strat->P.GetP(strat->lmBin);
3026 
3027  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3028 
3029  // reduce the tail and normalize poly
3031  {
3032  strat->P.pCleardenom();
3034  {
3035  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3036  strat->P.pCleardenom();
3037  }
3038  }
3039  else
3040  {
3041  strat->P.pNorm();
3043  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3044  }
3045 
3046  // here we must shrink again! and optionally reduce again
3047  // or build shrink into redtailBba!
3048 
3049 #ifdef KDEBUG
3050  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3051 #endif
3052 
3053  // min_std stuff
3054  if ((strat->P.p1==NULL) && (strat->minim>0))
3055  {
3056  if (strat->minim==1)
3057  {
3058  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3059  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3060  }
3061  else
3062  {
3063  strat->M->m[minimcnt]=strat->P.p2;
3064  strat->P.p2=NULL;
3065  }
3066  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3067  pNext(strat->M->m[minimcnt])
3068  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3069  strat->tailRing, currRing,
3070  currRing->PolyBin);
3071  minimcnt++;
3072  }
3073 
3074  /* here in the nonhomog case we shrink the reduced poly AGAIN */
3075 
3076  if ( ! strat->homog)
3077  {
3078  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3079  /* assume strat->P.t_p != NULL */
3080  /* in the nonhomog case we have to shrink the polynomial */
3081  assume(strat->P.t_p!=NULL); // poly qq defined above
3082  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
3083  if (qq != NULL)
3084  {
3085  /* we're here if Shrink is nonzero */
3086  // strat->P.p = NULL;
3087  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
3088  strat->P.p = NULL; // is not set by Delete
3089  strat->P.t_p = qq;
3090  strat->P.GetP(strat->lmBin);
3091  // update sev and length
3092  strat->initEcart(&(strat->P));
3093  strat->P.sev = pGetShortExpVector(strat->P.p);
3094  }
3095  else
3096  {
3097  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3098 #ifdef PDEBUG
3099  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
3100 #endif
3101  // strat->P.Delete(); // cause error
3102  strat->P.p = NULL;
3103  strat->P.t_p = NULL;
3104  // strat->P.p = NULL; // or delete strat->P.p ?
3105  goto red_shrink2zero;
3106  }
3107  }
3108  /* end shrinking poly AGAIN in the nonhomog case */
3109 
3110 
3111  // enter into S, L, and T
3112  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3113  // enterT(strat->P, strat); // this was here before Shift stuff
3114  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
3115  // the default value for atT = -1 as in bba
3116  /* strat->P.GetP(); */
3117  // because shifts are counted with .p structure // done before, but ?
3118  enterTShift(strat->P,strat,-1,uptodeg, lV);
3119  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3120  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3121  // posInS only depends on the leading term
3122  strat->enterS(strat->P, pos, strat, strat->tl);
3123 
3124  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3125 // Print("[%d]",hilbeledeg);
3126  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
3127  }
3128  else
3129  {
3130  red_shrink2zero:
3131  if (strat->P.p1 == NULL && strat->minim > 0)
3132  {
3133  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3134  }
3135  }
3136 #ifdef KDEBUG
3137  memset(&(strat->P), 0, sizeof(strat->P));
3138 #endif
3139  kTest_TS(strat);
3140  }
3141 #ifdef KDEBUG
3142  if (TEST_OPT_DEBUG) messageSets(strat);
3143 #endif
3144  /* complete reduction of the standard basis--------- */
3145  /* shift case: look for elt's in S such that they are divisible by elt in T */
3146  // if (TEST_OPT_SB_1)
3147  if (TEST_OPT_REDSB)
3148  {
3149  int k=0;
3150  int j=-1;
3151  while(k<=strat->sl)
3152  {
3153 // loop
3154 // {
3155 // if (j>=k) break;
3156 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3157 // j++;
3158 // }
3159  LObject Ln (strat->S[k],currRing, strat->tailRing);
3160  Ln.SetShortExpVector();
3161  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln, j+1);
3162  if (j<0) { k++; j=-1;}
3163  else
3164  {
3165  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
3166  {
3167  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln, j+1);
3168  if (j<0) { k++; j=-1;}
3169  else
3170  {
3171  deleteInS(k,strat);
3172  }
3173  }
3174  else
3175  {
3176  deleteInS(k,strat);
3177  }
3178  }
3179  }
3180  }
3181 
3182  if (TEST_OPT_REDSB)
3183  { completeReduce(strat, TRUE); //shift: withT = TRUE
3184  if (strat->completeReduce_retry)
3185  {
3186  // completeReduce needed larger exponents, retry
3187  // to reduce with S (instead of T)
3188  // and in currRing (instead of strat->tailRing)
3189  cleanT(strat);strat->tailRing=currRing;
3190  int i;
3191  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3192  completeReduce(strat, TRUE);
3193  }
3194  }
3195  else if (TEST_OPT_PROT) PrintLn();
3196 
3197  /* release temp data-------------------------------- */
3198  exitBuchMora(strat);
3199 // if (TEST_OPT_WEIGHTM)
3200 // {
3201 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
3202 // if (ecartWeights)
3203 // {
3204 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3205 // ecartWeights=NULL;
3206 // }
3207 // }
3208  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
3209  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3210  return (strat->Shdl);
3211 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
class sLObject LObject
Definition: kutil.h:58
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
char noClearS
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
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:9571
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int minim
Definition: kutil.h:361
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:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void updateSShift(kStrategy strat, int uptodeg, int lV)
Definition: kutil.cc:9021
BOOLEAN interpt
Definition: kutil.h:365
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:509
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:9678
int lV
Definition: kutil.h:363
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:616
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:7305
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
#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:376
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
ideal M
Definition: kutil.h:303
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:9049
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
kStrategy strat
Definition: myNF.cc:319
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)
Definition: simpleideals.cc:40
static int bba_count
Definition: kstd2.cc:1334
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:491
void initBbaShift(ideal, kStrategy strat)
Definition: kstd2.cc:3374
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:344
BOOLEAN use_buckets
Definition: kutil.h:377
int Kstd1_deg
Definition: kutil.cc:228
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
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 
341 #ifdef HAVE_RINGS
342  // Leading coef have to be a unit
343  // example 2x+4x2 should be simplified to 2x*(1+2x)
344  // and 2 is not a unit in Z
345  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
346 #endif
347 
348  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
349 
350 // for(i=r->N;i>0;i--)
351 // {
352 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
353 // }
354  h = pNext(p);
355 
356  loop
357  {
358  if (h==NULL)
359  {
360  p_Delete(&pNext(p), r);
361  if (!inNF)
362  {
363  number eins;
364 #ifdef HAVE_RINGS
365  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
366  eins = nCopy(lc);
367  else
368 #endif
369  eins=nInit(1);
370  if (L->p != NULL)
371  {
372  pSetCoeff(L->p,eins);
373  if (L->t_p != NULL)
374  pSetCoeff0(L->t_p,eins);
375  }
376  else
377  pSetCoeff(L->t_p,eins);
378  /* p and t_p share the same coeff, if both are !=NULL */
379  /* p==NULL==t_p cannot happen here */
380  }
381  L->ecart = 0;
382  L->length = 1;
383  //if (L->pLength > 0)
384  L->pLength = 1;
385  L->max = NULL;
386 
387  if (L->t_p != NULL && pNext(L->t_p) != NULL)
388  p_Delete(&pNext(L->t_p),r);
389  if (L->p != NULL && pNext(L->p) != NULL)
390  pNext(L->p) = NULL;
391 
392  return;
393  }
394  i = 0;
395  loop
396  {
397  i++;
398  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
399  #ifdef HAVE_RINGS
400  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
401  // domains), no zerodivisor test needed CAUTION
402  if (rField_is_Ring(r) /*&&(rHasLocalOrMixedOrdering(r)) */)
403  if(n_DivBy(pGetCoeff(h),lc,r->cf) == 0)
404  return;
405  #endif
406  if (i == r->N) break; // does divide, try next monom
407  }
408  pIter(h);
409  }
410 }
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
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
polyrec * poly
Definition: hilb.h:10
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
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:428
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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
#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 2186 of file kutil.cc.

2187 {
2188  int i,j,l;
2189 
2190  /*
2191  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2192  *In this case all elements in B such
2193  *that their lcm is divisible by the leading term of S[i] can be canceled
2194  */
2195  if (strat->pairtest!=NULL)
2196  {
2197  {
2198  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2199  for (j=0; j<=strat->sl; j++)
2200  {
2201  if (strat->pairtest[j])
2202  {
2203  for (i=strat->Bl; i>=0; i--)
2204  {
2205  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
2206  {
2207  deleteInL(strat->B,&strat->Bl,i,strat);
2208  strat->c3++;
2209  }
2210  }
2211  }
2212  }
2213  }
2214  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2215  strat->pairtest=NULL;
2216  }
2217  if (strat->Gebauer || strat->fromT)
2218  {
2219  if (strat->sugarCrit)
2220  {
2221  /*
2222  *suppose L[j] == (s,r) and p/lcm(s,r)
2223  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2224  *and in case the sugar is o.k. then L[j] can be canceled
2225  */
2226  for (j=strat->Ll; j>=0; j--)
2227  {
2228  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
2229  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2230  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2231  {
2232  if (strat->L[j].p == strat->tail)
2233  {
2234  deleteInL(strat->L,&strat->Ll,j,strat);
2235  strat->c3++;
2236  }
2237  }
2238  }
2239  /*
2240  *this is GEBAUER-MOELLER:
2241  *in B all elements with the same lcm except the "best"
2242  *(i.e. the last one in B with this property) will be canceled
2243  */
2244  j = strat->Bl;
2245  loop /*cannot be changed into a for !!! */
2246  {
2247  if (j <= 0) break;
2248  i = j-1;
2249  loop
2250  {
2251  if (i < 0) break;
2252  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2253  {
2254  strat->c3++;
2255  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
2256  {
2257  deleteInL(strat->B,&strat->Bl,i,strat);
2258  j--;
2259  }
2260  else
2261  {
2262  deleteInL(strat->B,&strat->Bl,j,strat);
2263  break;
2264  }
2265  }
2266  i--;
2267  }
2268  j--;
2269  }
2270  }
2271  else /*sugarCrit*/
2272  {
2273  /*
2274  *suppose L[j] == (s,r) and p/lcm(s,r)
2275  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2276  *and in case the sugar is o.k. then L[j] can be canceled
2277  */
2278  for (j=strat->Ll; j>=0; j--)
2279  {
2280  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2281  {
2282  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2283  {
2284  deleteInL(strat->L,&strat->Ll,j,strat);
2285  strat->c3++;
2286  }
2287  }
2288  }
2289  /*
2290  *this is GEBAUER-MOELLER:
2291  *in B all elements with the same lcm except the "best"
2292  *(i.e. the last one in B with this property) will be canceled
2293  */
2294  j = strat->Bl;
2295  loop /*cannot be changed into a for !!! */
2296  {
2297  if (j <= 0) break;
2298  for(i=j-1; i>=0; i--)
2299  {
2300  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2301  {
2302  strat->c3++;
2303  deleteInL(strat->B,&strat->Bl,i,strat);
2304  j--;
2305  }
2306  }
2307  j--;
2308  }
2309  }
2310  /*
2311  *the elements of B enter L
2312  */
2313  kMergeBintoL(strat);
2314  }
2315  else
2316  {
2317  for (j=strat->Ll; j>=0; j--)
2318  {
2319  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2320  {
2321  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2322  {
2323  deleteInL(strat->L,&strat->Ll,j,strat);
2324  strat->c3++;
2325  }
2326  }
2327  }
2328  /*
2329  *this is our MODIFICATION of GEBAUER-MOELLER:
2330  *First the elements of B enter L,
2331  *then we fix a lcm and the "best" element in L
2332  *(i.e the last in L with this lcm and of type (s,p))
2333  *and cancel all the other elements of type (r,p) with this lcm
2334  *except the case the element (s,r) has also the same lcm
2335  *and is on the worst position with respect to (s,p) and (r,p)
2336  */
2337  /*
2338  *B enters to L/their order with respect to B is permutated for elements
2339  *B[i].p with the same leading term
2340  */
2341  kMergeBintoL(strat);
2342  j = strat->Ll;
2343  loop /*cannot be changed into a for !!! */
2344  {
2345  if (j <= 0)
2346  {
2347  /*now L[0] cannot be canceled any more and the tail can be removed*/
2348  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2349  break;
2350  }
2351  if (strat->L[j].p2 == p)
2352  {
2353  i = j-1;
2354  loop
2355  {
2356  if (i < 0) break;
2357  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2358  {
2359  /*L[i] could be canceled but we search for a better one to cancel*/
2360  strat->c3++;
2361  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2362  && (pNext(strat->L[l].p) == strat->tail)
2363  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2364  && pDivisibleBy(p,strat->L[l].lcm))
2365  {
2366  /*
2367  *"NOT equal(...)" because in case of "equal" the element L[l]
2368  *is "older" and has to be from theoretical point of view behind
2369  *L[i], but we do not want to reorder L
2370  */
2371  strat->L[i].p2 = strat->tail;
2372  /*
2373  *L[l] will be canceled, we cannot cancel L[i] later on,
2374  *so we mark it with "tail"
2375  */
2376  deleteInL(strat->L,&strat->Ll,l,strat);
2377  i--;
2378  }
2379  else
2380  {
2381  deleteInL(strat->L,&strat->Ll,i,strat);
2382  }
2383  j--;
2384  }
2385  i--;
2386  }
2387  }
2388  else if (strat->L[j].p2 == strat->tail)
2389  {
2390  /*now L[j] cannot be canceled any more and the tail can be removed*/
2391  strat->L[j].p2 = p;
2392  }
2393  j--;
2394  }
2395  }
2396 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
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:373
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:567
BOOLEAN Gebauer
Definition: kutil.h:372
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:334
polyset S
Definition: kutil.h:304
BOOLEAN sugarCrit
Definition: kutil.h:371
LSet L
Definition: kutil.h:325
#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:326
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2140
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void chainCritSig ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2401 of file kutil.cc.

2402 {
2403  int i,j,l;
2404  kMergeBintoLSba(strat);
2405  j = strat->Ll;
2406  loop /*cannot be changed into a for !!! */
2407  {
2408  if (j <= 0)
2409  {
2410  /*now L[0] cannot be canceled any more and the tail can be removed*/
2411  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2412  break;
2413  }
2414  if (strat->L[j].p2 == p)
2415  {
2416  i = j-1;
2417  loop
2418  {
2419  if (i < 0) break;
2420  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2421  {
2422  /*L[i] could be canceled but we search for a better one to cancel*/
2423  strat->c3++;
2424  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2425  && (pNext(strat->L[l].p) == strat->tail)
2426  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2427  && pDivisibleBy(p,strat->L[l].lcm))
2428  {
2429  /*
2430  *"NOT equal(...)" because in case of "equal" the element L[l]
2431  *is "older" and has to be from theoretical point of view behind
2432  *L[i], but we do not want to reorder L
2433  */
2434  strat->L[i].p2 = strat->tail;
2435  /*
2436  *L[l] will be canceled, we cannot cancel L[i] later on,
2437  *so we mark it with "tail"
2438  */
2439  deleteInL(strat->L,&strat->Ll,l,strat);
2440  i--;
2441  }
2442  else
2443  {
2444  deleteInL(strat->L,&strat->Ll,i,strat);
2445  }
2446  j--;
2447  }
2448  i--;
2449  }
2450  }
2451  else if (strat->L[j].p2 == strat->tail)
2452  {
2453  /*now L[j] cannot be canceled any more and the tail can be removed*/
2454  strat->L[j].p2 = p;
2455  }
2456  j--;
2457  }
2458 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:567
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:2163
LSet L
Definition: kutil.h:325
#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 491 of file kutil.cc.

492 {
493  int i,j;
494  poly p;
495  assume(currRing == strat->tailRing || strat->tailRing != NULL);
496 
497  pShallowCopyDeleteProc p_shallow_copy_delete =
498  (strat->tailRing != currRing ?
500  NULL);
501 
502  for (j=0; j<=strat->tl; j++)
503  {
504  p = strat->T[j].p;
505  strat->T[j].p=NULL;
506  if (strat->T[j].max != NULL)
507  {
508  p_LmFree(strat->T[j].max, strat->tailRing);
509  }
510  i = -1;
511  loop
512  {
513  i++;
514  if (i>strat->sl)
515  {
516  if (strat->T[j].t_p != NULL)
517  {
518  p_Delete(&(strat->T[j].t_p), strat->tailRing);
519  p_LmFree(p, currRing);
520  }
521  else
522  pDelete(&p);
523  break;
524  }
525  if (p == strat->S[i])
526  {
527  if (strat->T[j].t_p != NULL)
528  {
529  assume(p_shallow_copy_delete != NULL);
530  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
531  currRing->PolyBin);
532  p_LmFree(strat->T[j].t_p, strat->tailRing);
533  }
534  break;
535  }
536  }
537  }
538  strat->tl=-1;
539 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:353
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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
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:343
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
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 (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1151  deleteInS((*at),strat);
1152  (*at)--;
1153  (*k)--;
1154 }
return P p
Definition: myNF.cc:203
char noClearS
Definition: kutil.h:397
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
#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 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:304
unsigned long * sevS
Definition: kutil.h:320
void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 7991 of file kutil.cc.

7992 {
7993  int i;
7994  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
7995  LObject L;
7996 
7997 #ifdef KDEBUG
7998  // need to set this: during tailreductions of T[i], T[i].max is out of
7999  // sync
8000  sloppy_max = TRUE;
8001 #endif
8002 
8003  strat->noTailReduction = FALSE;
8004  if (TEST_OPT_PROT)
8005  {
8006  PrintLn();
8007 // if (timerv) writeTime("standard base computed:");
8008  }
8009  if (TEST_OPT_PROT)
8010  {
8011  Print("(S:%d)",strat->sl);mflush();
8012  }
8013  for (i=strat->sl; i>=low; i--)
8014  {
8015  int end_pos=strat->sl;
8016  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
8017  if (strat->ak==0) end_pos=i-1;
8018  TObject* T_j = strat->s_2_t(i);
8019  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
8020  {
8021  L = *T_j;
8022  #ifdef KDEBUG
8023  if (TEST_OPT_DEBUG)
8024  {
8025  Print("test S[%d]:",i);
8026  p_wrp(L.p,currRing,strat->tailRing);
8027  PrintLn();
8028  }
8029  #endif
8031  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
8032  else
8033  strat->S[i] = redtail(&L, strat->sl, strat);
8034  #ifdef KDEBUG
8035  if (TEST_OPT_DEBUG)
8036  {
8037  Print("to (tailR) S[%d]:",i);
8038  p_wrp(strat->S[i],currRing,strat->tailRing);
8039  PrintLn();
8040  }
8041  #endif
8042 
8043  if (strat->redTailChange && strat->tailRing != currRing)
8044  {
8045  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
8046  if (pNext(T_j->p) != NULL)
8047  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
8048  else
8049  T_j->max = NULL;
8050  }
8052  T_j->pCleardenom();
8053  }
8054  else
8055  {
8056  assume(currRing == strat->tailRing);
8057  #ifdef KDEBUG
8058  if (TEST_OPT_DEBUG)
8059  {
8060  Print("test S[%d]:",i);
8061  p_wrp(strat->S[i],currRing,strat->tailRing);
8062  PrintLn();
8063  }
8064  #endif
8066  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
8067  else
8068  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
8070  {
8071  if (TEST_OPT_CONTENTSB)
8072  {
8073  number n;
8074  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8075  if (!nIsOne(n))
8076  {
8078  denom->n=nInvers(n);
8079  denom->next=DENOMINATOR_LIST;
8080  DENOMINATOR_LIST=denom;
8081  }
8082  nDelete(&n);
8083  }
8084  else
8085  {
8086  //pContent(strat->S[i]);
8087  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8088  }
8089  }
8090  #ifdef KDEBUG
8091  if (TEST_OPT_DEBUG)
8092  {
8093  Print("to (-tailR) S[%d]:",i);
8094  p_wrp(strat->S[i],currRing,strat->tailRing);
8095  PrintLn();
8096  }
8097  #endif
8098  }
8099  if (TEST_OPT_PROT)
8100  PrintS("-");
8101  }
8102  if (TEST_OPT_PROT) PrintLn();
8103 #ifdef KDEBUG
8104  sloppy_max = FALSE;
8105 #endif
8106 }
denominator_list_s * denominator_list
Definition: kutil.h:63
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
#define TEST_OPT_CONTENTSB
Definition: options.h:121
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#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:356
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:5412
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
#define mflush()
Definition: reporter.h:42
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2799
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:319
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
#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:741
ring tailRing
Definition: kutil.h:343
denominator_list next
Definition: kutil.h:65
#define pNext(p)
Definition: monomials.h:43
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:351
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
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 3385 of file kutil.cc.

3386 {
3387  // Initialize
3388  long exp[50]; // The exponent of \hat{X} (basepoint)
3389  long cexp[50]; // The current exponent for iterating over all
3390  long ind[50]; // The power of 2 in the i-th component of exp
3391  long cind[50]; // analog for cexp
3392  long mult[50]; // How to multiply the elements of G
3393  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3394  long habsind = 0; // The abs. index of the coefficient of h
3395  long step[50]; // The last increases
3396  for (int i = 1; i <= currRing->N; i++)
3397  {
3398  exp[i] = 0;
3399  cexp[i] = exp[i];
3400  ind[i] = 0;
3401  step[i] = 500000;
3402  cind[i] = ind[i];
3403  }
3404  long bound = currRing->ch;
3405  step[1] = 500000;
3406 #ifdef OLI_DEBUG
3407  PrintS("-------------\npoly :");
3408 // wrp(p);
3409  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3410  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3411  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3412  Print("bound : %d\n", bound);
3413  Print("cind : %d\n", cabsind);
3414 #endif
3415  if (cabsind == 0)
3416  {
3417  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3418  {
3419  return idInit(1, 1);
3420  }
3421  }
3422  ideal G0 = idInit(1, 1);
3423  // Now the whole simplex
3424  do
3425  {
3426  // Build s-polynomial
3427  // 2**ind-def * mult * g - exp-def * h
3428  poly t_p;
3429  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
3430 #ifdef OLI_DEBUG
3431  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3432  Print("zPoly : ");
3433  wrp(zeroPoly);
3434  Print("\n");
3435 #endif
3436  // Add to ideal
3437  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
3438  IDELEMS(G0) += 1;
3439  G0->m[IDELEMS(G0) - 1] = zeroPoly;
3440  }
3441  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3442  idSkipZeroes(G0);
3443  return G0;
3444 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
const ideal
Definition: gb_hack.h:42
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:3256
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:3190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
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:3511
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:281
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:58
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:343
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:500
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
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:205
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:619
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:370
BOOLEAN LDegLast
Definition: kutil.h:380
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
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 1039 of file kutil.cc.

1040 {
1041  if (set[j].lcm!=NULL)
1042  {
1043 #ifdef HAVE_RINGS
1044  if (pGetCoeff(set[j].lcm) != NULL)
1045  pLmDelete(set[j].lcm);
1046  else
1047 #endif
1048  pLmFree(set[j].lcm);
1049  }
1050  if (set[j].sig!=NULL)
1051  {
1052 #ifdef HAVE_RINGS
1053  if (pGetCoeff(set[j].sig) != NULL)
1054  pLmDelete(set[j].sig);
1055  else
1056 #endif
1057  pLmFree(set[j].sig);
1058  }
1059  if (set[j].p!=NULL)
1060  {
1061  if (pNext(set[j].p) == strat->tail)
1062  {
1063 #ifdef HAVE_RINGS
1064  if (pGetCoeff(set[j].p) != NULL)
1065  pLmDelete(set[j].p);
1066  else
1067 #endif
1068  pLmFree(set[j].p);
1069  /*- tail belongs to several int spolys -*/
1070  }
1071  else
1072  {
1073  // search p in T, if it is there, do not delete it
1074  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1075  {
1076  // assure that for global orderings kFindInT fails
1077  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1078  set[j].Delete();
1079  }
1080  }
1081  }
1082  if (*length > 0 && j < *length)
1083  {
1084 #ifdef ENTER_USE_MEMMOVE
1085  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1086 #else
1087  int i;
1088  for (i=j; i < (*length); i++)
1089  set[i] = set[i+1];
1090 #endif
1091  }
1092 #ifdef KDEBUG
1093  memset(&(set[*length]),0,sizeof(LObject));
1094 #endif
1095  (*length)--;
1096 }
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:58
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:603
#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:334
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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 932 of file kutil.cc.

933 {
934 #ifdef ENTER_USE_MEMMOVE
935  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
936  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
937  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
938  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
939 #else
940  int j;
941  for (j=i; j<strat->sl; j++)
942  {
943  strat->S[j] = strat->S[j+1];
944  strat->ecartS[j] = strat->ecartS[j+1];
945  strat->sevS[j] = strat->sevS[j+1];
946  strat->S_2_R[j] = strat->S_2_R[j+1];
947  }
948 #endif
949  if (strat->lenS!=NULL)
950  {
951 #ifdef ENTER_USE_MEMMOVE
952  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
953 #else
954  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
955 #endif
956  }
957  if (strat->lenSw!=NULL)
958  {
959 #ifdef ENTER_USE_MEMMOVE
960  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
961 #else
962  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
963 #endif
964  }
965  if (strat->fromQ!=NULL)
966  {
967 #ifdef ENTER_USE_MEMMOVE
968  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
969 #else
970  for (j=i; j<strat->sl; j++)
971  {
972  strat->fromQ[j] = strat->fromQ[j+1];
973  }
974 #endif
975  }
976  strat->S[strat->sl] = NULL;
977  strat->sl--;
978 }
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 984 of file kutil.cc.

985 {
986 #ifdef ENTER_USE_MEMMOVE
987  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
988  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
989  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
990  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
991  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
992  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
993 #else
994  int j;
995  for (j=i; j<strat->sl; j++)
996  {
997  strat->S[j] = strat->S[j+1];
998  strat->sig[j] = strat->sig[j+1];
999  strat->ecartS[j] = strat->ecartS[j+1];
1000  strat->sevS[j] = strat->sevS[j+1];
1001  strat->sevSig[j] = strat->sevSig[j+1];
1002  strat->S_2_R[j] = strat->S_2_R[j+1];
1003  }
1004 #endif
1005  if (strat->lenS!=NULL)
1006  {
1007 #ifdef ENTER_USE_MEMMOVE
1008  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1009 #else
1010  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1011 #endif
1012  }
1013  if (strat->lenSw!=NULL)
1014  {
1015 #ifdef ENTER_USE_MEMMOVE
1016  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1017 #else
1018  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1019 #endif
1020  }
1021  if (strat->fromQ!=NULL)
1022  {
1023 #ifdef ENTER_USE_MEMMOVE
1024  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1025 #else
1026  for (j=i; j<strat->sl; j++)
1027  {
1028  strat->fromQ[j] = strat->fromQ[j+1];
1029  }
1030 #endif
1031  }
1032  strat->S[strat->sl] = NULL;
1033  strat->sl--;
1034 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 3481 of file kutil.cc.

3482 {
3483  if (nIsOne(pGetCoeff(h))) return;
3484  number gcd;
3485  bool go = false;
3486  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
3487  {
3488  gcd = n_Ann(pGetCoeff(h),currRing->cf);
3489  go = true;
3490  }
3491  else
3492  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
3493  if (go || !nIsOne(gcd))
3494  {
3495  poly p = h->next;
3496  if (!go)
3497  {
3498  number tmp = gcd;
3499  gcd = n_Ann(gcd,currRing->cf);
3500  nDelete(&tmp);
3501  }
3502  p_Test(p,strat->tailRing);
3503  p = pp_Mult_nn(p, gcd, strat->tailRing);
3504  nDelete(&gcd);
3505 
3506  if (p != NULL)
3507  {
3508  if (TEST_OPT_PROT)
3509  {
3510  PrintS("Z");
3511  }
3512 #ifdef KDEBUG
3513  if (TEST_OPT_DEBUG)
3514  {
3515  PrintS("--- create zero spoly: ");
3516  p_wrp(h,currRing,strat->tailRing);
3517  PrintS(" ---> ");
3518  }
3519 #endif
3520  poly tmp = pInit();
3521  pSetCoeff0(tmp, pGetCoeff(p));
3522  for (int i = 1; i <= rVar(currRing); i++)
3523  {
3524  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
3525  }
3527  {
3528  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
3529  }
3530  p_Setm(tmp, currRing);
3531  p = p_LmFreeAndNext(p, strat->tailRing);
3532  pNext(tmp) = p;
3533  LObject h;
3534  h.Init();
3535  h.p = tmp;
3536  h.tailRing = strat->tailRing;
3537  int posx;
3538  if (h.p!=NULL)
3539  {
3541  {
3542  //pContent(h.p);
3543  h.pCleardenom(); // also does a pContent
3544  }
3545  else
3546  {
3547  h.pNorm();
3548  }
3549  strat->initEcart(&h);
3550  if (strat->Ll==-1)
3551  posx =0;
3552  else
3553  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
3554  h.sev = pGetShortExpVector(h.p);
3555  if (strat->tailRing != currRing)
3556  {
3557  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
3558  }
3559 #ifdef KDEBUG
3560  if (TEST_OPT_DEBUG)
3561  {
3562  p_wrp(tmp,currRing,strat->tailRing);
3563  PrintLn();
3564  }
3565 #endif
3566  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
3567  }
3568  }
3569  }
3570  nDelete(&gcd);
3571 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:683
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#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:531
#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:1101
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:698
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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
polyrec * poly
Definition: hilb.h:10
#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 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
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:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
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:235
static Poly * h
Definition: janet.cc:978
void enterL ( LSet set,
int length,
int LSetmax,
LObject  p,
int  at 
)

Definition at line 1101 of file kutil.cc.

1102 {
1103  // this should be corrected
1104  assume(p.FDeg == p.pFDeg());
1105 
1106  if ((*length)>=0)
1107  {
1108  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1109  if (at <= (*length))
1110 #ifdef ENTER_USE_MEMMOVE
1111  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1112 #else
1113  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1114 #endif
1115  }
1116  else at = 0;
1117  (*set)[at] = p;
1118  (*length)++;
1119 }
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:28
#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:548
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:42
void enterOnePairManyShifts ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 9134 of file kutil.cc.

9135 {
9136  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
9137 
9140 
9141  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
9142  /* that is create the pairs (f, s \dot g) */
9143 
9144  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
9145 
9146  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
9147  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
9148 
9149  /* determine how many elements we have to insert for a given s[i] */
9150  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
9151  /* hence, a total number of elt's to add is: */
9152  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
9153  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
9154 
9155 #ifdef KDEBUG
9156  if (TEST_OPT_DEBUG)
9157  {
9158  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
9159  }
9160 #endif
9161 
9162  assume(i<=strat->sl); // from OnePair
9163  if (strat->interred_flag) return; // ?
9164 
9165  /* these vars hold for all shifts of s[i] */
9166  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
9167 
9168  int qfromQ;
9169  if (strat->fromQ != NULL)
9170  {
9171  qfromQ = strat->fromQ[i];
9172  }
9173  else
9174  {
9175  qfromQ = -1;
9176  }
9177 
9178  int j;
9179 
9180  poly q/*, s*/;
9181 
9182  // for the 0th shift: insert the orig. pair
9183  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
9184 
9185  for (j=1; j<= toInsert; j++)
9186  {
9187  // q = pLPshift(strat->S[i],j,uptodeg,lV);
9188  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
9189  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
9190  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
9191  // pNext(q) = s; // in tailRing
9192  /* here we need to call enterOnePair with two polys ... */
9193 
9194 #ifdef KDEBUG
9195  if (TEST_OPT_DEBUG)
9196  {
9197  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
9198  }
9199 #endif
9200  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
9201  }
9202 }
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:9275
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:460
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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN interred_flag
Definition: kutil.h:378
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
void enterOnePairNormal ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)

Definition at line 1490 of file kutil.cc.

1491 {
1492  assume(i<=strat->sl);
1493  if (strat->interred_flag) return;
1494 
1495  int l,j,compare;
1496  LObject Lp;
1497  Lp.i_r = -1;
1498 
1499 #ifdef KDEBUG
1500  Lp.ecart=0; Lp.length=0;
1501 #endif
1502  /*- computes the lcm(s[i],p) -*/
1503  Lp.lcm = pInit();
1504 
1505 #ifndef HAVE_RATGRING
1506  pLcm(p,strat->S[i],Lp.lcm);
1507 #elif defined(HAVE_RATGRING)
1508  // if (rIsRatGRing(currRing))
1509  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1510 #endif
1511  pSetm(Lp.lcm);
1512 
1513 
1514  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1515  {
1516  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1517  && pHasNotCF(p,strat->S[i]))
1518  {
1519  /*
1520  *the product criterion has applied for (s,p),
1521  *i.e. lcm(s,p)=product of the leading terms of s and p.
1522  *Suppose (s,r) is in L and the leading term
1523  *of p divides lcm(s,r)
1524  *(==> the leading term of p divides the leading term of r)
1525  *but the leading term of s does not divide the leading term of r
1526  *(notice that tis condition is automatically satisfied if r is still
1527  *in S), then (s,r) can be cancelled.
1528  *This should be done here because the
1529  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1530  *
1531  *Moreover, skipping (s,r) holds also for the noncommutative case.
1532  */
1533  strat->cp++;
1534  pLmFree(Lp.lcm);
1535  Lp.lcm=NULL;
1536  return;
1537  }
1538  else
1539  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1540  if (strat->fromT && (strat->ecartS[i]>ecart))
1541  {
1542  pLmFree(Lp.lcm);
1543  Lp.lcm=NULL;
1544  return;
1545  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1546  }
1547  /*
1548  *the set B collects the pairs of type (S[j],p)
1549  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1550  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1551  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1552  */
1553  {
1554  j = strat->Bl;
1555  loop
1556  {
1557  if (j < 0) break;
1558  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1559  if ((compare==1)
1560  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1561  {
1562  strat->c3++;
1563  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1564  {
1565  pLmFree(Lp.lcm);
1566  return;
1567  }
1568  break;
1569  }
1570  else
1571  if ((compare ==-1)
1572  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1573  {
1574  deleteInL(strat->B,&strat->Bl,j,strat);
1575  strat->c3++;
1576  }
1577  j--;
1578  }
1579  }
1580  }
1581  else /*sugarcrit*/
1582  {
1583  if (ALLOW_PROD_CRIT(strat))
1584  {
1585  // if currRing->nc_type!=quasi (or skew)
1586  // TODO: enable productCrit for super commutative algebras...
1587  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1588  pHasNotCF(p,strat->S[i]))
1589  {
1590  /*
1591  *the product criterion has applied for (s,p),
1592  *i.e. lcm(s,p)=product of the leading terms of s and p.
1593  *Suppose (s,r) is in L and the leading term
1594  *of p devides lcm(s,r)
1595  *(==> the leading term of p devides the leading term of r)
1596  *but the leading term of s does not devide the leading term of r
1597  *(notice that tis condition is automatically satisfied if r is still
1598  *in S), then (s,r) can be canceled.
1599  *This should be done here because the
1600  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1601  */
1602  strat->cp++;
1603  pLmFree(Lp.lcm);
1604  Lp.lcm=NULL;
1605  return;
1606  }
1607  if (strat->fromT && (strat->ecartS[i]>ecart))
1608  {
1609  pLmFree(Lp.lcm);
1610  Lp.lcm=NULL;
1611  return;
1612  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1613  }
1614  /*
1615  *the set B collects the pairs of type (S[j],p)
1616  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1617  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1618  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1619  */
1620  for(j = strat->Bl;j>=0;j--)
1621  {
1622  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1623  if (compare==1)
1624  {
1625  strat->c3++;
1626  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1627  {
1628  pLmFree(Lp.lcm);
1629  return;
1630  }
1631  break;
1632  }
1633  else
1634  if (compare ==-1)
1635  {
1636  deleteInL(strat->B,&strat->Bl,j,strat);
1637  strat->c3++;
1638  }
1639  }
1640  }
1641  }
1642  /*
1643  *the pair (S[i],p) enters B if the spoly != 0
1644  */
1645  /*- compute the short s-polynomial -*/
1646  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1647  pNorm(p);
1648 
1649  if ((strat->S[i]==NULL) || (p==NULL))
1650  return;
1651 
1652  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1653  Lp.p=NULL;
1654  else
1655  {
1656  #ifdef HAVE_PLURAL
1657  if ( rIsPluralRing(currRing) )
1658  {
1659  if(pHasNotCF(p, strat->S[i]))
1660  {
1661  if(ncRingType(currRing) == nc_lie)
1662  {
1663  // generalized prod-crit for lie-type
1664  strat->cp++;
1665  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
1666  }
1667  else
1668  if( ALLOW_PROD_CRIT(strat) )
1669  {
1670  // product criterion for homogeneous case in SCA
1671  strat->cp++;
1672  Lp.p = NULL;
1673  }
1674  else
1675  {
1676  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1677  nc_CreateShortSpoly(strat->S[i], p, currRing);
1678 
1679  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1680  pNext(Lp.p) = strat->tail; // !!!
1681  }
1682  }
1683  else
1684  {
1685  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1686  nc_CreateShortSpoly(strat->S[i], p, currRing);
1687 
1688  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1689  pNext(Lp.p) = strat->tail; // !!!
1690 
1691  }
1692 
1693 
1694 #if MYTEST
1695  if (TEST_OPT_DEBUG)
1696  {
1697  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1698  PrintS("p: "); pWrite(p);
1699  PrintS("SPoly: "); pWrite(Lp.p);
1700  }
1701 #endif
1702 
1703  }
1704  else
1705  #endif
1706  {
1708  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1709 #if MYTEST
1710  if (TEST_OPT_DEBUG)
1711  {
1712  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1713  PrintS("p: "); pWrite(p);
1714  PrintS("commutative SPoly: "); pWrite(Lp.p);
1715  }
1716 #endif
1717 
1718  }
1719  }
1720  if (Lp.p == NULL)
1721  {
1722  /*- the case that the s-poly is 0 -*/
1723  if (strat->pairtest==NULL) initPairtest(strat);
1724  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
1725  strat->pairtest[strat->sl+1] = TRUE;
1726  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
1727  /*
1728  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
1729  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
1730  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
1731  *term of p devides the lcm(s,r)
1732  *(this canceling should be done here because
1733  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
1734  *the first case is handeled in chainCrit
1735  */
1736  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
1737  }
1738  else
1739  {
1740  /*- the pair (S[i],p) enters B -*/
1741  Lp.p1 = strat->S[i];
1742  Lp.p2 = p;
1743 
1744  if (
1746 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
1747  )
1748  {
1749  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1750  pNext(Lp.p) = strat->tail; // !!!
1751  }
1752 
1753  if (atR >= 0)
1754  {
1755  Lp.i_r1 = strat->S_2_R[i];
1756  Lp.i_r2 = atR;
1757  }
1758  else
1759  {
1760  Lp.i_r1 = -1;
1761  Lp.i_r2 = -1;
1762  }
1763  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
1764 
1766  {
1767  if (!rIsPluralRing(currRing))
1768  nDelete(&(Lp.p->coef));
1769  }
1770 
1771  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
1772  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
1773  }
1774 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2295
#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:58
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
#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:286
void pWrite(poly p)
Definition: polys.h:279
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1926
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
int Bmax
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
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:373
#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:319
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:334
polyset S
Definition: kutil.h:304
BOOLEAN sugarCrit
Definition: kutil.h:371
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:349
intset ecartS
Definition: kutil.h:307
BOOLEAN interred_flag
Definition: kutil.h:378
void initPairtest(kStrategy strat)
Definition: kutil.cc:558
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
ring tailRing
Definition: kutil.h:343
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:351
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:390
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
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 9210 of file kutil.cc.

9211 {
9212 
9213  /* format: p,qq are in LObject form: lm in CR, tail in TR */
9214  /* for true self pairs qq ==p */
9215  /* we test both qq and p */
9217  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
9220 
9221  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
9222 
9223  // int j = 0;
9224  int j = 1;
9225 
9226  /* for such self pairs start with 1, not with 0 */
9227  if (qq == p) j=1;
9228 
9229  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
9230  /* that is create the pairs (f, s \dot g) */
9231 
9232  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
9233 
9234 #ifdef KDEBUG
9235  if (TEST_OPT_DEBUG)
9236  {
9237  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
9238  }
9239 #endif
9240 
9241  poly q;
9242 
9243  if (strat->interred_flag) return; // ?
9244 
9245  /* these vars hold for all shifts of s[i] */
9246  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
9247  int qfromQ = 0; // strat->fromQ[i];
9248 
9249  for (; j<= toInsert; j++)
9250  {
9251  // q = pLPshift(strat->S[i],j,uptodeg,lV);
9252  /* we increase shifts by one; must delete q there*/
9253  // q = qq; q = pMoveCurrTail2poly(q,strat);
9254  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
9255  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
9256  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
9257  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
9258  // pNext(q) = s; // in tailRing
9259  /* here we need to call enterOnePair with two polys ... */
9260 #ifdef KDEBUG
9261  if (TEST_OPT_DEBUG)
9262  {
9263  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
9264  }
9265 #endif
9266  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
9267  }
9268 }
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:9275
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:460
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
polyrec * poly
Definition: hilb.h:10
#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 interred_flag
Definition: kutil.h:378
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
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 9275 of file kutil.cc.

9276 {
9277 
9278  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
9279 
9280  /* check this Formats: */
9282  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
9285 
9286 #ifdef KDEBUG
9287  if (TEST_OPT_DEBUG)
9288  {
9289 // PrintS("enterOnePairShift(q,p) invoked with q = ");
9290 // wrp(q); // wrp(pHead(q));
9291 // PrintS(", p = ");
9292 // wrp(p); //wrp(pHead(p));
9293 // PrintLn();
9294  }
9295 #endif
9296 
9297  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
9298 
9299  int qfromQ = qisFromQ;
9300 
9301  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
9302 
9303  if (strat->interred_flag) return;
9304 
9305  int l,j,compare;
9306  LObject Lp;
9307  Lp.i_r = -1;
9308 
9309 #ifdef KDEBUG
9310  Lp.ecart=0; Lp.length=0;
9311 #endif
9312  /*- computes the lcm(s[i],p) -*/
9313  Lp.lcm = pInit();
9314 
9315  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
9316  pSetm(Lp.lcm);
9317 
9318  /* apply the V criterion */
9319  if (!isInV(Lp.lcm, lV))
9320  {
9321 #ifdef KDEBUG
9322  if (TEST_OPT_DEBUG)
9323  {
9324  PrintS("V crit applied to q = ");
9325  wrp(q); // wrp(pHead(q));
9326  PrintS(", p = ");
9327  wrp(p); //wrp(pHead(p));
9328  PrintLn();
9329  }
9330 #endif
9331  pLmFree(Lp.lcm);
9332  Lp.lcm=NULL;
9333  /* + counter for applying the V criterion */
9334  strat->cv++;
9335  return;
9336  }
9337 
9338  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
9339  {
9340  if((!((ecartq>0)&&(ecart>0)))
9341  && pHasNotCF(p,q))
9342  {
9343  /*
9344  *the product criterion has applied for (s,p),
9345  *i.e. lcm(s,p)=product of the leading terms of s and p.
9346  *Suppose (s,r) is in L and the leading term
9347  *of p divides lcm(s,r)
9348  *(==> the leading term of p divides the leading term of r)
9349  *but the leading term of s does not divide the leading term of r
9350  *(notice that this condition is automatically satisfied if r is still
9351  *in S), then (s,r) can be cancelled.
9352  *This should be done here because the
9353  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
9354  *
9355  *Moreover, skipping (s,r) holds also for the noncommutative case.
9356  */
9357  strat->cp++;
9358  pLmFree(Lp.lcm);
9359  Lp.lcm=NULL;
9360  return;
9361  }
9362  else
9363  Lp.ecart = si_max(ecart,ecartq);
9364  if (strat->fromT && (ecartq>ecart))
9365  {
9366  pLmFree(Lp.lcm);
9367  Lp.lcm=NULL;
9368  return;
9369  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
9370  }
9371  /*
9372  *the set B collects the pairs of type (S[j],p)
9373  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
9374  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
9375  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
9376  */
9377  {
9378  j = strat->Bl;
9379  loop
9380  {
9381  if (j < 0) break;
9382  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
9383  if ((compare==1)
9384  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
9385  {
9386  strat->c3++;
9387  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
9388  {
9389  pLmFree(Lp.lcm);
9390  return;
9391  }
9392  break;
9393  }
9394  else
9395  if ((compare ==-1)
9396  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
9397  {
9398  deleteInL(strat->B,&strat->Bl,j,strat);
9399  strat->c3++;
9400  }
9401  j--;
9402  }
9403  }
9404  }
9405  else /*sugarcrit*/
9406  {
9407  if (ALLOW_PROD_CRIT(strat))
9408  {
9409  // if currRing->nc_type!=quasi (or skew)
9410  // TODO: enable productCrit for super commutative algebras...
9411  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
9412  pHasNotCF(p,q))
9413  {
9414  /*
9415  *the product criterion has applied for (s,p),
9416  *i.e. lcm(s,p)=product of the leading terms of s and p.
9417  *Suppose (s,r) is in L and the leading term
9418  *of p devides lcm(s,r)
9419  *(==> the leading term of p devides the leading term of r)
9420  *but the leading term of s does not devide the leading term of r
9421  *(notice that tis condition is automatically satisfied if r is still
9422  *in S), then (s,r) can be canceled.
9423  *This should be done here because the
9424  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
9425  */
9426  strat->cp++;
9427  pLmFree(Lp.lcm);
9428  Lp.lcm=NULL;
9429  return;
9430  }
9431  if (strat->fromT && (ecartq>ecart))
9432  {
9433  pLmFree(Lp.lcm);
9434  Lp.lcm=NULL;
9435  return;
9436  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
9437  }
9438  /*
9439  *the set B collects the pairs of type (S[j],p)
9440  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
9441  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
9442  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
9443  */
9444  for(j = strat->Bl;j>=0;j--)
9445  {
9446  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
9447  if (compare==1)
9448  {
9449  strat->c3++;
9450  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
9451  {
9452  pLmFree(Lp.lcm);
9453  return;
9454  }
9455  break;
9456  }
9457  else
9458  if (compare ==-1)
9459  {
9460  deleteInL(strat->B,&strat->Bl,j,strat);
9461  strat->c3++;
9462  }
9463  }
9464  }
9465  }
9466  /*
9467  *the pair (S[i],p) enters B if the spoly != 0
9468  */
9469  /*- compute the short s-polynomial -*/
9470  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
9471  pNorm(p);
9472  if ((q==NULL) || (p==NULL))
9473  return;
9474  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
9475  Lp.p=NULL;
9476  else
9477  {
9478 // if ( rIsPluralRing(currRing) )
9479 // {
9480 // if(pHasNotCF(p, q))
9481 // {
9482 // if(ncRingType(currRing) == nc_lie)
9483 // {
9484 // // generalized prod-crit for lie-type
9485 // strat->cp++;
9486 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
9487 // }
9488 // else
9489 // if( ALLOW_PROD_CRIT(strat) )
9490 // {
9491 // // product criterion for homogeneous case in SCA
9492 // strat->cp++;
9493 // Lp.p = NULL;
9494 // }
9495 // else
9496 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
9497 // }
9498 // else Lp.p = nc_CreateSpoly(q,p,currRing);
9499 // }
9500 // else
9501 // {
9502 
9503  /* ksCreateShortSpoly needs two Lobject-kind presentations */
9504  /* p is already in this form, so convert q */
9505  // q = pMove2CurrTail(q, strat);
9506  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
9507  // }
9508  }
9509  if (Lp.p == NULL)
9510  {
9511  /*- the case that the s-poly is 0 -*/
9512  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
9513 // if (strat->pairtest==NULL) initPairtest(strat);
9514 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
9515 // strat->pairtest[strat->sl+1] = TRUE;
9516  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
9517  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
9518  /*
9519  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
9520  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
9521  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
9522  *term of p devides the lcm(s,r)
9523  *(this canceling should be done here because
9524  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
9525  *the first case is handeled in chainCrit
9526  */
9527  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
9528  }
9529  else
9530  {
9531  /*- the pair (S[i],p) enters B -*/
9532  /* both of them should have their LM in currRing and TAIL in tailring */
9533  Lp.p1 = q; // already in the needed form
9534  Lp.p2 = p; // already in the needed form
9535 
9536  if ( !rIsPluralRing(currRing) )
9537  pNext(Lp.p) = strat->tail;
9538 
9539  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
9540  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
9541  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
9542  {
9543  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
9544  Lp.i_r2 = atR;
9545  }
9546  else
9547  {
9548  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
9549  Lp.i_r1 = -1;
9550  Lp.i_r2 = -1;
9551  }
9552  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
9553 
9555  {
9556  if (!rIsPluralRing(currRing))
9557  nDelete(&(Lp.p->coef));
9558  }
9559 
9560  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
9561  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
9562  }
9563 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define pSetm(p)
Definition: polys.h:241
void PrintLn()
Definition: reporter.cc:322
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:603
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
int cv
Definition: kutil.h:350
int Bl
Definition: kutil.h:355
#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:286
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
int Bmax
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
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:373
#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:319
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:377
poly tail
Definition: kutil.h:334
BOOLEAN sugarCrit
Definition: kutil.h:371
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:349
BOOLEAN interred_flag
Definition: kutil.h:378
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
ring tailRing
Definition: kutil.h:343
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:390
void wrp(poly p)
Definition: polys.h:281
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
int l
Definition: cfEzgcd.cc:94
void enterOnePairSig ( int  i,
poly  p,
poly  pSig,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)
void enterpairs ( poly  h,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3671 of file kutil.cc.

3672 {
3673  int j=pos;
3674 
3675 #ifdef HAVE_RINGS
3677 #endif
3678 
3679  initenterpairs(h,k,ecart,0,strat, atR);
3680  if ( (!strat->fromT)
3681  && ((strat->syzComp==0)
3682  ||(pGetComp(h)<=strat->syzComp)))
3683  {
3684  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3685  unsigned long h_sev = pGetShortExpVector(h);
3686  loop
3687  {
3688  if (j > k) break;
3689  clearS(h,h_sev, &j,&k,strat);
3690  j++;
3691  }
3692  //Print("end clearS sl=%d\n",strat->sl);
3693  }
3694  // PrintS("end enterpairs\n");
3695 }
int syzComp
Definition: kutil.h:357
loop
Definition: myNF.cc:98
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2751
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:373
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:428
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 enterpairsShift ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 9571 of file kutil.cc.

9572 {
9573  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
9574  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
9575  int j=pos;
9576 
9577 #ifdef HAVE_RINGS
9579 #endif
9580  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
9581  if ( (!strat->fromT)
9582  && ((strat->syzComp==0)
9583  ||(pGetComp(h)<=strat->syzComp)))
9584  {
9585  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
9586  unsigned long h_sev = pGetShortExpVector(h);
9587  loop
9588  {
9589  if (j > k) break;
9590  clearS(h,h_sev, &j,&k,strat);
9591  j++;
9592  }
9593  //Print("end clearS sl=%d\n",strat->sl);
9594  }
9595  // PrintS("end enterpairs\n");
9596 }
int syzComp
Definition: kutil.h:357
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:9605
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:373
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:428
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 3703 of file kutil.cc.

3704 {
3705 int j=pos;
3706 
3707 #ifdef HAVE_RINGS
3709 #endif
3710 
3711 initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
3712 if ( (!strat->fromT)
3713 && ((strat->syzComp==0)
3714  ||(pGetComp(h)<=strat->syzComp)))
3715 {
3716  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3717  unsigned long h_sev = pGetShortExpVector(h);
3718  loop
3719  {
3720  if (j > k) break;
3721  clearS(h,h_sev, &j,&k,strat);
3722  j++;
3723  }
3724  //Print("end clearS sl=%d\n",strat->sl);
3725 }
3726 // PrintS("end enterpairs\n");
3727 }
int syzComp
Definition: kutil.h:357
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:2820
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:373
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:428
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 6927 of file kutil.cc.

6928 {
6929  strat->news = TRUE;
6930  /*- puts p to the standardbasis s at position at -*/
6931  if (strat->sl == IDELEMS(strat->Shdl)-1)
6932  {
6933  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
6934  IDELEMS(strat->Shdl)*sizeof(unsigned long),
6935  (IDELEMS(strat->Shdl)+setmaxTinc)
6936  *sizeof(unsigned long));
6937  strat->ecartS = (intset)omReallocSize(strat->ecartS,
6938  IDELEMS(strat->Shdl)*sizeof(int),
6939  (IDELEMS(strat->Shdl)+setmaxTinc)
6940  *sizeof(int));
6941  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
6942  IDELEMS(strat->Shdl)*sizeof(int),
6943  (IDELEMS(strat->Shdl)+setmaxTinc)
6944  *sizeof(int));
6945  if (strat->lenS!=NULL)
6946  strat->lenS=(int*)omRealloc0Size(strat->lenS,
6947  IDELEMS(strat->Shdl)*sizeof(int),
6948  (IDELEMS(strat->Shdl)+setmaxTinc)
6949  *sizeof(int));
6950  if (strat->lenSw!=NULL)
6951  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
6952  IDELEMS(strat->Shdl)*sizeof(wlen_type),
6953  (IDELEMS(strat->Shdl)+setmaxTinc)
6954  *sizeof(wlen_type));
6955  if (strat->fromQ!=NULL)
6956  {
6957  strat->fromQ = (intset)omReallocSize(strat->fromQ,
6958  IDELEMS(strat->Shdl)*sizeof(int),
6959  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
6960  }
6961  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
6962  IDELEMS(strat->Shdl)+=setmaxTinc;
6963  strat->Shdl->m=strat->S;
6964  }
6965  if (atS <= strat->sl)
6966  {
6967 #ifdef ENTER_USE_MEMMOVE
6968 // #if 0
6969  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
6970  (strat->sl - atS + 1)*sizeof(poly));
6971  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
6972  (strat->sl - atS + 1)*sizeof(int));
6973  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
6974  (strat->sl - atS + 1)*sizeof(unsigned long));
6975  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
6976  (strat->sl - atS + 1)*sizeof(int));
6977  if (strat->lenS!=NULL)
6978  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
6979  (strat->sl - atS + 1)*sizeof(int));
6980  if (strat->lenSw!=NULL)
6981  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
6982  (strat->sl - atS + 1)*sizeof(wlen_type));
6983 #else
6984  for (i=strat->sl+1; i>=atS+1; i--)
6985  {
6986  strat->S[i] = strat->S[i-1];
6987  strat->ecartS[i] = strat->ecartS[i-1];
6988  strat->sevS[i] = strat->sevS[i-1];
6989  strat->S_2_R[i] = strat->S_2_R[i-1];
6990  }
6991  if (strat->lenS!=NULL)
6992  for (i=strat->sl+1; i>=atS+1; i--)
6993  strat->lenS[i] = strat->lenS[i-1];
6994  if (strat->lenSw!=NULL)
6995  for (i=strat->sl+1; i>=atS+1; i--)
6996  strat->lenSw[i] = strat->lenSw[i-1];
6997 #endif
6998  }
6999  if (strat->fromQ!=NULL)
7000  {
7001 #ifdef ENTER_USE_MEMMOVE
7002  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7003  (strat->sl - atS + 1)*sizeof(int));
7004 #else
7005  for (i=strat->sl+1; i>=atS+1; i--)
7006  {
7007  strat->fromQ[i] = strat->fromQ[i-1];
7008  }
7009 #endif
7010  strat->fromQ[atS]=0;
7011  }
7012 
7013  /*- save result -*/
7014  strat->S[atS] = p.p;
7015  if (strat->honey) strat->ecartS[atS] = p.ecart;
7016  if (p.sev == 0)
7017  p.sev = pGetShortExpVector(p.p);
7018  else
7019  assume(p.sev == pGetShortExpVector(p.p));
7020  strat->sevS[atS] = p.sev;
7021  strat->ecartS[atS] = p.ecart;
7022  strat->S_2_R[atS] = atR;
7023  strat->sl++;
7024 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:371
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:395
#define TRUE
Definition: auxiliary.h:144
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
#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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
int * intset
Definition: kutil.h:53
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void entersets ( LObject  h)
void enterSSba ( LObject  p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 7030 of file kutil.cc.

7031 {
7032  strat->news = TRUE;
7033  /*- puts p to the standardbasis s at position at -*/
7034  if (strat->sl == IDELEMS(strat->Shdl)-1)
7035  {
7036  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7037  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7038  (IDELEMS(strat->Shdl)+setmaxTinc)
7039  *sizeof(unsigned long));
7040  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
7041  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7042  (IDELEMS(strat->Shdl)+setmaxTinc)
7043  *sizeof(unsigned long));
7044  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7045  IDELEMS(strat->Shdl)*sizeof(int),
7046  (IDELEMS(strat->Shdl)+setmaxTinc)
7047  *sizeof(int));
7048  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7049  IDELEMS(strat->Shdl)*sizeof(int),
7050  (IDELEMS(strat->Shdl)+setmaxTinc)
7051  *sizeof(int));
7052  if (strat->lenS!=NULL)
7053  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7054  IDELEMS(strat->Shdl)*sizeof(int),
7055  (IDELEMS(strat->Shdl)+setmaxTinc)
7056  *sizeof(int));
7057  if (strat->lenSw!=NULL)
7058  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7059  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7060  (IDELEMS(strat->Shdl)+setmaxTinc)
7061  *sizeof(wlen_type));
7062  if (strat->fromQ!=NULL)
7063  {
7064  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7065  IDELEMS(strat->Shdl)*sizeof(int),
7066  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7067  }
7068  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7069  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
7070  IDELEMS(strat->Shdl)+=setmaxTinc;
7071  strat->Shdl->m=strat->S;
7072  }
7073  // in a signature-based algorithm the following situation will never
7074  // appear due to the fact that the critical pairs are already sorted
7075  // by increasing signature.
7076  if (atS <= strat->sl)
7077  {
7078 #ifdef ENTER_USE_MEMMOVE
7079 // #if 0
7080  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7081  (strat->sl - atS + 1)*sizeof(poly));
7082  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7083  (strat->sl - atS + 1)*sizeof(int));
7084  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7085  (strat->sl - atS + 1)*sizeof(unsigned long));
7086  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7087  (strat->sl - atS + 1)*sizeof(int));
7088  if (strat->lenS!=NULL)
7089  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7090  (strat->sl - atS + 1)*sizeof(int));
7091  if (strat->lenSw!=NULL)
7092  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7093  (strat->sl - atS + 1)*sizeof(wlen_type));
7094 #else
7095  for (i=strat->sl+1; i>=atS+1; i--)
7096  {
7097  strat->S[i] = strat->S[i-1];
7098  strat->ecartS[i] = strat->ecartS[i-1];
7099  strat->sevS[i] = strat->sevS[i-1];
7100  strat->S_2_R[i] = strat->S_2_R[i-1];
7101  }
7102  if (strat->lenS!=NULL)
7103  for (i=strat->sl+1; i>=atS+1; i--)
7104  strat->lenS[i] = strat->lenS[i-1];
7105  if (strat->lenSw!=NULL)
7106  for (i=strat->sl+1; i>=atS+1; i--)
7107  strat->lenSw[i] = strat->lenSw[i-1];
7108 #endif
7109  }
7110  if (strat->fromQ!=NULL)
7111  {
7112 #ifdef ENTER_USE_MEMMOVE
7113  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7114  (strat->sl - atS + 1)*sizeof(int));
7115 #else
7116  for (i=strat->sl+1; i>=atS+1; i--)
7117  {
7118  strat->fromQ[i] = strat->fromQ[i-1];
7119  }
7120 #endif
7121  strat->fromQ[atS]=0;
7122  }
7123 
7124  /*- save result -*/
7125  strat->S[atS] = p.p;
7126  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
7127  if (strat->honey) strat->ecartS[atS] = p.ecart;
7128  if (p.sev == 0)
7129  p.sev = pGetShortExpVector(p.p);
7130  else
7131  assume(p.sev == pGetShortExpVector(p.p));
7132  strat->sevS[atS] = p.sev;
7133  // during the interreduction process of a signature-based algorithm we do not
7134  // compute the signature at this point, but when the whole interreduction
7135  // process finishes, i.e. f5c terminates!
7136  if (p.sig != NULL)
7137  {
7138  if (p.sevSig == 0)
7139  p.sevSig = pGetShortExpVector(p.sig);
7140  else
7141  assume(p.sevSig == pGetShortExpVector(p.sig));
7142  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
7143  }
7144  strat->ecartS[atS] = p.ecart;
7145  strat->S_2_R[atS] = atR;
7146  strat->sl++;
7147 #ifdef DEBUGF5
7148  int k;
7149  Print("--- LIST S: %d ---\n",strat->sl);
7150  for(k=0;k<=strat->sl;k++)
7151  {
7152  pWrite(strat->sig[k]);
7153  }
7154  Print("--- LIST S END ---\n");
7155 #endif
7156 }
unsigned long * sevSig
Definition: kutil.h:322
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
polyset sig
Definition: kutil.h:306
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:371
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:395
#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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
#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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
int * intset
Definition: kutil.h:53
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void enterSyz ( LObject  p,
kStrategy  strat,
int  atT 
)

Definition at line 7240 of file kutil.cc.

7241 {
7242  int i;
7243  strat->newt = TRUE;
7244  if (strat->syzl == strat->syzmax-1)
7245  {
7246  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
7247  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
7248  (strat->syzmax)*sizeof(unsigned long),
7249  ((strat->syzmax)+setmaxTinc)
7250  *sizeof(unsigned long));
7251  strat->syzmax += setmaxTinc;
7252  }
7253  if (atT < strat->syzl)
7254  {
7255 #ifdef ENTER_USE_MEMMOVE
7256  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
7257  (strat->syzl-atT+1)*sizeof(poly));
7258  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
7259  (strat->syzl-atT+1)*sizeof(unsigned long));
7260 #endif
7261  for (i=strat->syzl; i>=atT+1; i--)
7262  {
7263 #ifndef ENTER_USE_MEMMOVE
7264  strat->syz[i] = strat->syz[i-1];
7265  strat->sevSyz[i] = strat->sevSyz[i-1];
7266 #endif
7267  }
7268  }
7269  //i = strat->syzl;
7270  i = atT;
7271  strat->syz[atT] = p.sig;
7272  strat->sevSyz[atT] = p.sevSig;
7273  strat->syzl++;
7274 #if F5DEBUG
7275  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
7276  pWrite(strat->syz[atT]);
7277 #endif
7278  // recheck pairs in strat->L with new rule and delete correspondingly
7279  int cc = strat->Ll;
7280  while (cc>-1)
7281  {
7282  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
7283  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing))
7284  {
7285  deleteInL(strat->L,&strat->Ll,cc,strat);
7286  }
7287  cc--;
7288  }
7289 //#if 1
7290 #ifdef DEBUGF5
7291  PrintS("--- Syzygies ---\n");
7292  Print("syzl %d\n",strat->syzl);
7293  Print("syzmax %d\n",strat->syzmax);
7294  PrintS("--------------------------------\n");
7295  for(i=0;i<=strat->syzl-1;i++)
7296  {
7297  Print("%d - ",i);
7298  pWrite(strat->syz[i]);
7299  }
7300  PrintS("--------------------------------\n");
7301 #endif
7302 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:352
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:396
#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:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
unsigned long * sevSyz
Definition: kutil.h:321
#define setmaxTinc
Definition: kutil.h:31
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
void enterT ( LObject  p,
kStrategy  strat,
int  atT = -1 
)

Definition at line 7161 of file kutil.cc.

7162 {
7163  int i;
7164 
7165  pp_Test(p.p, currRing, p.tailRing);
7166  assume(strat->tailRing == p.tailRing);
7167  // redMoraNF complains about this -- but, we don't really
7168  // neeed this so far
7169  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7170  assume(p.FDeg == p.pFDeg());
7171  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7172 
7173 #ifdef KDEBUG
7174  // do not put an LObject twice into T:
7175  for(i=strat->tl;i>=0;i--)
7176  {
7177  if (p.p==strat->T[i].p)
7178  {
7179  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7180  return;
7181  }
7182  }
7183 #endif
7184 #ifdef HAVE_TAIL_RING
7185  if (currRing!=strat->tailRing)
7186  {
7187  p.t_p=p.GetLmTailRing();
7188  }
7189 #endif
7190  strat->newt = TRUE;
7191  if (atT < 0)
7192  atT = strat->posInT(strat->T, strat->tl, p);
7193  if (strat->tl == strat->tmax-1)
7194  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7195  if (atT <= strat->tl)
7196  {
7197 #ifdef ENTER_USE_MEMMOVE
7198  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7199  (strat->tl-atT+1)*sizeof(TObject));
7200  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7201  (strat->tl-atT+1)*sizeof(unsigned long));
7202 #endif
7203  for (i=strat->tl+1; i>=atT+1; i--)
7204  {
7205 #ifndef ENTER_USE_MEMMOVE
7206  strat->T[i] = strat->T[i-1];
7207  strat->sevT[i] = strat->sevT[i-1];
7208 #endif
7209  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7210  }
7211  }
7212 
7213  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7214  {
7216  (strat->tailRing != NULL ?
7217  strat->tailRing : currRing),
7218  strat->tailBin);
7219  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7220  }
7221  strat->T[atT] = (TObject) p;
7222 
7223  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7224  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7225  else
7226  strat->T[atT].max = NULL;
7227 
7228  strat->tl++;
7229  strat->R[strat->tl] = &(strat->T[atT]);
7230  strat->T[atT].i_r = strat->tl;
7231  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7232  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7233  kTest_T(&(strat->T[atT]));
7234 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:705
char newt
Definition: kutil.h:396
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:280
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:470
#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:340
int tmax
Definition: kutil.h:353
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
omBin tailBin
Definition: kutil.h:345
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:31
TSet T
Definition: kutil.h:324
#define kTest_T(T)
Definition: kutil.h:617
class sTObject TObject
Definition: kutil.h:57
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 9678 of file kutil.cc.

9679 {
9680  /* determine how many elements we have to insert */
9681  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
9682  /* hence, a total number of elt's to add is: */
9683  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
9684 
9685  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
9686 
9687 #ifdef PDEBUG
9688  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
9689 #endif
9690  int i;
9691 
9692  if (atT < 0)
9693  atT = strat->posInT(strat->T, strat->tl, p);
9694 
9695  /* can call enterT in a sequence, e.g. */
9696 
9697  /* shift0 = it's our model for further shifts */
9698  enterT(p,strat,atT);
9699  LObject qq;
9700  for (i=1; i<=toInsert; i++) // toIns - 1?
9701  {
9702  qq = p; //qq.Copy();
9703  qq.p = NULL;
9704  qq.max = NULL;
9705  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
9706  qq.GetP();
9707  // update q.sev
9708  qq.sev = pGetShortExpVector(qq.p);
9709  /* enter it into T, first el't is with the shift 0 */
9710  // compute the position for qq
9711  atT = strat->posInT(strat->T, strat->tl, qq);
9712  enterT(qq,strat,atT);
9713  }
9714 /* Q: what to do with this one in the orig enterT ? */
9715 /* strat->R[strat->tl] = &(strat->T[atT]); */
9716 /* Solution: it is done by enterT each time separately */
9717 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:460
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
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:343
TSet T
Definition: kutil.h:324
void exitBuchMora ( kStrategy  strat)

Definition at line 7637 of file kutil.cc.

7638 {
7639  /*- release temp data -*/
7640  cleanT(strat);
7641  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
7642  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
7643  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
7644  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
7645  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
7646  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
7647  /*- set L: should be empty -*/
7648  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
7649  /*- set B: should be empty -*/
7650  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
7651  pLmDelete(&strat->tail);
7652  strat->syzComp=0;
7653 }
int syzComp
Definition: kutil.h:357
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
#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:323
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:355
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
void cleanT(kStrategy strat)
Definition: kutil.cc:491
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
unsigned long * sevS
Definition: kutil.h:320
TSet T
Definition: kutil.h:324
ideal Shdl
Definition: kutil.h:301
class sTObject TObject
Definition: kutil.h:57
void exitSba ( kStrategy  strat)

Definition at line 7830 of file kutil.cc.

7831 {
7832  /*- release temp data -*/
7833  cleanT(strat);
7834  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
7835  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
7836  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
7837  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
7838  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
7839  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
7840  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
7841  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
7842  if (strat->sbaOrder == 1)
7843  {
7844  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
7845  }
7846  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
7847  /*- set L: should be empty -*/
7848  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
7849  /*- set B: should be empty -*/
7850  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
7851  /*- set sig: no need for the signatures anymore -*/
7852  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
7853  pLmDelete(&strat->tail);
7854  strat->syzComp=0;
7855 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
int syzComp
Definition: kutil.h:357
int syzmax
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
#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:323
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:355
polyrec * poly
Definition: hilb.h:10
unsigned sbaOrder
Definition: kutil.h:314
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
void cleanT(kStrategy strat)
Definition: kutil.cc:491
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
int syzidxmax
Definition: kutil.h:352
unsigned long * sevS
Definition: kutil.h:320
unsigned long * sevSyz
Definition: kutil.h:321
polyset syz
Definition: kutil.h:305
TSet T
Definition: kutil.h:324
ideal Shdl
Definition: kutil.h:301
class sTObject TObject
Definition: kutil.h:57
intset syzIdx
Definition: kutil.h:311
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 2551 of file kstd2.cc.

2554 {
2555  int Ll_old, red_result = 1;
2556  int pos = 0;
2557  hilbeledeg=1;
2558  hilbcount=0;
2559  minimcnt=0;
2560  srmax = 0; // strat->sl is 0 at this point
2561  reduc = olddeg = lrmax = 0;
2562  // we cannot use strat->T anymore
2563  //cleanT(strat);
2564  //strat->tl = -1;
2565  Ll_old = strat->Ll;
2566  while (strat->tl >= 0)
2567  {
2568  if(!strat->T[strat->tl].is_redundant)
2569  {
2570  LObject h;
2571  h.p = strat->T[strat->tl].p;
2572  h.tailRing = strat->T[strat->tl].tailRing;
2573  h.t_p = strat->T[strat->tl].t_p;
2574  if (h.p!=NULL)
2575  {
2576  if (currRing->OrdSgn==-1)
2577  {
2578  cancelunit(&h);
2579  deleteHC(&h, strat);
2580  }
2581  if (h.p!=NULL)
2582  {
2584  {
2585  //pContent(h.p);
2586  h.pCleardenom(); // also does a pContent
2587  }
2588  else
2589  {
2590  h.pNorm();
2591  }
2592  strat->initEcart(&h);
2593  pos = strat->Ll+1;
2594  h.sev = pGetShortExpVector(h.p);
2595  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
2596  }
2597  }
2598  }
2599  strat->tl--;
2600  }
2601  strat->sl = -1;
2602 #if 0
2603 //#ifdef HAVE_TAIL_RING
2604  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2605  kStratInitChangeTailRing(strat);
2606 #endif
2607  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
2608  //strat->sl = -1;
2609  /* picks the last element from the lazyset L */
2610  while (strat->Ll>Ll_old)
2611  {
2612  strat->P = strat->L[strat->Ll];
2613  strat->Ll--;
2614 //#if 1
2615 #ifdef DEBUGF5
2616  Print("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
2617  Print("-------------------------------------------------\n");
2618  pWrite(pHead(strat->P.p));
2619  pWrite(pHead(strat->P.p1));
2620  pWrite(pHead(strat->P.p2));
2621  printf("%d\n",strat->tl);
2622  Print("-------------------------------------------------\n");
2623 #endif
2624  if (pNext(strat->P.p) == strat->tail)
2625  {
2626  // deletes the short spoly
2627 #ifdef HAVE_RINGS
2628  if (rField_is_Ring(currRing))
2629  pLmDelete(strat->P.p);
2630  else
2631 #endif
2632  pLmFree(strat->P.p);
2633 
2634  // TODO: needs some masking
2635  // TODO: masking needs to vanish once the signature
2636  // sutff is completely implemented
2637  strat->P.p = NULL;
2638  poly m1 = NULL, m2 = NULL;
2639 
2640  // check that spoly creation is ok
2641  while (strat->tailRing != currRing &&
2642  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2643  {
2644  assume(m1 == NULL && m2 == NULL);
2645  // if not, change to a ring where exponents are at least
2646  // large enough
2647  if (!kStratChangeTailRing(strat))
2648  {
2649  WerrorS("OVERFLOW...");
2650  break;
2651  }
2652  }
2653  // create the real one
2654  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2655  strat->tailRing, m1, m2, strat->R);
2656  }
2657  else if (strat->P.p1 == NULL)
2658  {
2659  if (strat->minim > 0)
2660  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2661  // for input polys, prepare reduction
2662  strat->P.PrepareRed(strat->use_buckets);
2663  }
2664 
2665  if (strat->P.p == NULL && strat->P.t_p == NULL)
2666  {
2667  red_result = 0;
2668  }
2669  else
2670  {
2671  if (TEST_OPT_PROT)
2672  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2673  &olddeg,&reduc,strat, red_result);
2674 
2675 #ifdef DEBUGF5
2676  Print("Poly before red: ");
2677  pWrite(strat->P.p);
2678 #endif
2679  /* complete reduction of the element chosen from L */
2680  red_result = strat->red2(&strat->P,strat);
2681  if (errorreported) break;
2682  }
2683 
2684  if (strat->overflow)
2685  {
2686  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
2687  }
2688 
2689  // reduction to non-zero new poly
2690  if (red_result == 1)
2691  {
2692  // get the polynomial (canonicalize bucket, make sure P.p is set)
2693  strat->P.GetP(strat->lmBin);
2694  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2695  // but now, for entering S, T, we reset it
2696  // in the inhomogeneous case: FDeg == pFDeg
2697  if (strat->homog) strat->initEcart(&(strat->P));
2698 
2699  /* statistic */
2700  if (TEST_OPT_PROT) PrintS("s");
2701 
2702  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2703 
2704 #ifdef KDEBUG
2705 #if MYTEST
2706  PrintS("New S: "); pDebugPrint(strat->P.p); PrintLn();
2707 #endif /* MYTEST */
2708 #endif /* KDEBUG */
2709 
2710  // reduce the tail and normalize poly
2711  // in the ring case we cannot expect LC(f) = 1,
2712  // therefore we call pContent instead of pNorm
2713 #if F5CTAILRED
2714  BOOLEAN withT = TRUE;
2716  {
2717  strat->P.pCleardenom();
2719  {
2720  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2721  strat->P.pCleardenom();
2722  }
2723  }
2724  else
2725  {
2726  strat->P.pNorm();
2728  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2729  }
2730 #endif
2731 #ifdef KDEBUG
2732  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2733 #if MYTEST
2734 //#if 1
2735  PrintS("New (reduced) S: "); pDebugPrint(strat->P.p); PrintLn();
2736 #endif /* MYTEST */
2737 #endif /* KDEBUG */
2738 
2739  // min_std stuff
2740  if ((strat->P.p1==NULL) && (strat->minim>0))
2741  {
2742  if (strat->minim==1)
2743  {
2744  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2745  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2746  }
2747  else
2748  {
2749  strat->M->m[minimcnt]=strat->P.p2;
2750  strat->P.p2=NULL;
2751  }
2752  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2753  pNext(strat->M->m[minimcnt])
2754  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2755  strat->tailRing, currRing,
2756  currRing->PolyBin);
2757  minimcnt++;
2758  }
2759 
2760  // enter into S, L, and T
2761  // here we need to recompute new signatures, but those are trivial ones
2762  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2763  {
2764  enterT(strat->P, strat);
2765  // posInS only depends on the leading term
2766  strat->enterS(strat->P, pos, strat, strat->tl);
2767 //#if 1
2768 #ifdef DEBUGF5
2769  Print("ELEMENT ADDED TO GCURR DURING INTERRED: ");
2770  pWrite(pHead(strat->S[strat->sl]));
2771  pWrite(strat->sig[strat->sl]);
2772 #endif
2773  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2774  }
2775  // Print("[%d]",hilbeledeg);
2776  if (strat->P.lcm!=NULL)
2777 #ifdef HAVE_RINGS
2778  pLmDelete(strat->P.lcm);
2779 #else
2780  pLmFree(strat->P.lcm);
2781 #endif
2782  if (strat->sl>srmax) srmax = strat->sl;
2783  }
2784  else
2785  {
2786  // adds signature of the zero reduction to
2787  // strat->syz. This is the leading term of
2788  // syzygy and can be used in syzCriterion()
2789  // the signature is added if and only if the
2790  // pair was not detected by the rewritten criterion in strat->red = redSig
2791  if (strat->P.p1 == NULL && strat->minim > 0)
2792  {
2793  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2794  }
2795  }
2796 
2797 #ifdef KDEBUG
2798  memset(&(strat->P), 0, sizeof(strat->P));
2799 #endif /* KDEBUG */
2800  }
2801  int cc = 0;
2802  while (cc<strat->tl+1)
2803  {
2804  strat->T[cc].sig = pOne();
2805  p_SetComp(strat->T[cc].sig,cc+1,currRing);
2806  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
2807  strat->sig[cc] = strat->T[cc].sig;
2808  strat->sevSig[cc] = strat->T[cc].sevSig;
2809  strat->T[cc].is_sigsafe = TRUE;
2810  cc++;
2811  }
2812  strat->max_lower_index = strat->tl;
2813  // set current signature index of upcoming iteration step
2814  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
2815  // the corresponding syzygy rules correctly
2816  strat->currIdx = cc+1;
2817  for (int cd=strat->Ll; cd>=0; cd--)
2818  {
2819  p_SetComp(strat->L[cd].sig,cc+1,currRing);
2820  cc++;
2821  }
2822  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
2823  strat->Shdl->m[cc] = NULL;
2824 //#if 1
2825 #if DEBUGF5
2826  Print("------------------- STRAT S ---------------------\n");
2827  cc = 0;
2828  while (cc<strat->tl+1)
2829  {
2830  pWrite(pHead(strat->S[cc]));
2831  pWrite(strat->sig[cc]);
2832  printf("- - - - - -\n");
2833  cc++;
2834  }
2835  Print("-------------------------------------------------\n");
2836  Print("------------------- STRAT T ---------------------\n");
2837  cc = 0;
2838  while (cc<strat->tl+1)
2839  {
2840  pWrite(pHead(strat->T[cc].p));
2841  pWrite(strat->T[cc].sig);
2842  printf("- - - - - -\n");
2843  cc++;
2844  }
2845  Print("-------------------------------------------------\n");
2846  Print("------------------- STRAT L ---------------------\n");
2847  cc = 0;
2848  while (cc<strat->Ll+1)
2849  {
2850  pWrite(pHead(strat->L[cc].p));
2851  pWrite(pHead(strat->L[cc].p1));
2852  pWrite(pHead(strat->L[cc].p2));
2853  pWrite(strat->L[cc].sig);
2854  printf("- - - - - -\n");
2855  cc++;
2856  }
2857  Print("-------------------------------------------------\n");
2858  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
2859 #endif
2860 
2861 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
CanonicalForm cd(bCommonDen(FF))
Definition: cfModGcd.cc:4030
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
#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:23
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#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:361
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:8334
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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
polyrec * poly
Definition: hilb.h:10
#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:376
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define pOne()
Definition: polys.h:286
TObject ** R
Definition: kutil.h:340
#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:19
short errorreported
Definition: feFopen.cc:22
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
kStrategy strat
Definition: myNF.cc:319
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:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
#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:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
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 5145 of file kutil.cc.

5146 {
5147  //printf("Faugere Rewritten Criterion\n");
5148 //#if 1
5149 #ifdef DEBUGF5
5150  PrintS("rewritten criterion checks: ");
5151  pWrite(sig);
5152 #endif
5153  for(int k = strat->sl; k>=start; k--)
5154  {
5155 //#if 1
5156 #ifdef DEBUGF5
5157  Print("checking with: ");
5158  pWrite(strat->sig[k]);
5159  pWrite(pHead(strat->S[k]));
5160 #endif
5161  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
5162  {
5163 //#if 1
5164 #ifdef DEBUGF5
5165  PrintS("DELETE!\n");
5166 #endif
5167  return TRUE;
5168  }
5169  //k--;
5170  }
5171 #ifdef DEBUGF5
5172  Print("ALL ELEMENTS OF S\n----------------------------------------\n");
5173  for(int kk = 0; kk<strat->sl+1; kk++)
5174  {
5175  pWrite(pHead(strat->S[kk]));
5176  }
5177  Print("------------------------------\n");
5178 #endif
5179  return FALSE;
5180 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
#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:1707
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:304
int sl
Definition: kutil.h:351
BOOLEAN findMinLMPair ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat,
int  start 
)
ideal freegb ( ideal  I,
int  uptodeg,
int  lVblock 
)

Definition at line 3214 of file kstd2.cc.

3215 {
3216  /* todo main call */
3217 
3218  /* assume: ring is prepared, ideal is copied into shifted ring */
3219  /* uptodeg and lVblock are correct - test them! */
3220 
3221  /* check whether the ideal is in V */
3222 
3223 // if (0)
3224  if (! ideal_isInV(I,lVblock) )
3225  {
3226  WerrorS("The input ideal contains incorrectly encoded elements! ");
3227  return(NULL);
3228  }
3229 
3230  // kStrategy strat = new skStrategy;
3231  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
3232  /* at the moment:
3233 - no quotient (check)
3234 - no *w, no *hilb
3235  */
3236  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
3237  int newIdeal, intvec *vw) */
3238  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
3239  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
3240  idSkipZeroes(RS);
3241  return(RS);
3242 }
int ideal_isInV(ideal I, int lV)
Definition: shiftgb.cc:444
const ideal
Definition: gb_hack.h:42
void WerrorS(const char *s)
Definition: feFopen.cc:23
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:2345
void idSkipZeroes(ideal ide)
#define NULL
Definition: omList.c:10
void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 422 of file kutil.cc.

423 {
424  int j,/*k,*/p;
425 
426  strat->kHEdgeFound=FALSE;
427  if (currRing->pLexOrder || currRing->MixedOrder)
428  {
429  return;
430  }
431  if (strat->ak > 1) /*we are in the module case*/
432  {
433  return; // until ....
434  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
435  // return FALSE;
436  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
437  // return FALSE;
438  }
439  // k = 0;
440  p=pIsPurePower(pp);
441  if (p!=0) strat->NotUsedAxis[p] = FALSE;
442  /*- the leading term of pp is a power of the p-th variable -*/
443  for (j=(currRing->N);j>0; j--)
444  {
445  if (strat->NotUsedAxis[j])
446  {
447  return;
448  }
449  }
450  strat->kHEdgeFound=TRUE;
451 }
#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:332
#define TRUE
Definition: auxiliary.h:144
int ak
Definition: kutil.h:356
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 kHEdgeFound
Definition: kutil.h:370
BOOLEAN homogTest ( polyset  F,
int  Fmax 
)
long ind2 ( long  arg)

Definition at line 3036 of file kutil.cc.

3037 {
3038  long ind = 0;
3039  if (arg <= 0) return 0;
3040  while (arg%2 == 0)
3041  {
3042  arg = arg / 2;
3043  ind++;
3044  }
3045  return ind;
3046 }
long ind_fact_2 ( long  arg)

Definition at line 3048 of file kutil.cc.

3049 {
3050  long ind = 0;
3051  if (arg <= 0) return 0;
3052  if (arg%2 == 1) { arg--; }
3053  while (arg > 0)
3054  {
3055  ind += ind2(arg);
3056  arg = arg - 2;
3057  }
3058  return ind;
3059 }
long ind2(long arg)
Definition: kutil.cc:3036
void initBba ( ideal  F,
kStrategy  strat 
)

Definition at line 1279 of file kstd1.cc.

1280 {
1281  /* setting global variables ------------------- */
1282  strat->enterS = enterSBba;
1283  strat->red = redHoney;
1284  if (strat->honey)
1285  strat->red = redHoney;
1286  else if (currRing->pLexOrder && !strat->homog)
1287  strat->red = redLazy;
1288  else
1289  {
1290  strat->LazyPass *=4;
1291  strat->red = redHomog;
1292  }
1293 #ifdef HAVE_RINGS //TODO Oliver
1294  if (rField_is_Ring(currRing))
1295  {
1296  strat->red = redRing;
1297  }
1298 #endif
1299  if (currRing->pLexOrder && strat->honey)
1300  strat->initEcart = initEcartNormal;
1301  else
1302  strat->initEcart = initEcartBBA;
1303  if (strat->honey)
1305  else
1307 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1308 // {
1309 // //interred machen Aenderung
1310 // strat->pOrigFDeg=pFDeg;
1311 // strat->pOrigLDeg=pLDeg;
1312 // //h=ggetid("ecart");
1313 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1314 // //{
1315 // // ecartWeights=iv2array(IDINTVEC(h));
1316 // //}
1317 // //else
1318 // {
1319 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1320 // /*uses automatic computation of the ecartWeights to set them*/
1321 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1322 // }
1323 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1324 // if (TEST_OPT_PROT)
1325 // {
1326 // for(i=1; i<=(currRing->N); i++)
1327 // Print(" %d",ecartWeights[i]);
1328 // PrintLn();
1329 // mflush();
1330 // }
1331 // }
1332 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
BOOLEAN honey
Definition: kutil.h:371
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:324
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:406
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1004
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:844
BOOLEAN homog
Definition: kutil.h:366
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1147
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
void initEcartNormal(TObject *h)
Definition: kutil.cc:1125
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
int LazyPass
Definition: kutil.h:356
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
void initBbaShift ( ideal  F,
kStrategy  strat 
)

Definition at line 3374 of file kstd2.cc.

3375 {
3376  /* setting global variables ------------------- */
3377  strat->enterS = enterSBba; /* remains as is, we change enterT! */
3378 
3379  strat->red = redFirstShift; /* no redHomog ! */
3380 
3381  if (currRing->pLexOrder && strat->honey)
3382  strat->initEcart = initEcartNormal;
3383  else
3384  strat->initEcart = initEcartBBA;
3385  if (strat->honey)
3387  else
3389 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
3390 // {
3391 // //interred machen Aenderung
3392 // pFDegOld=currRing->pFDeg;
3393 // pLDegOld=pLDeg;
3394 // //h=ggetid("ecart");
3395 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
3396 // //{
3397 // // ecartWeights=iv2array(IDINTVEC(h));
3398 // //}
3399 // //else
3400 // {
3401 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
3402 // /*uses automatic computation of the ecartWeights to set them*/
3403 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
3404 // }
3405 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
3406 // if (TEST_OPT_PROT)
3407 // {
3408 // for(int i=1; i<=rVar(currRing); i++)
3409 // Print(" %d",ecartWeights[i]);
3410 // PrintLn();
3411 // mflush();
3412 // }
3413 // }
3414 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
BOOLEAN honey
Definition: kutil.h:371
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:3248
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:1147
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
void initEcartNormal(TObject *h)
Definition: kutil.cc:1125
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
void initBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 7558 of file kutil.cc.

7559 {
7560  strat->interpt = BTEST1(OPT_INTERRUPT);
7561  strat->kHEdge=NULL;
7563  /*- creating temp data structures------------------- -*/
7564  strat->cp = 0;
7565  strat->c3 = 0;
7566  strat->tail = pInit();
7567  /*- set s -*/
7568  strat->sl = -1;
7569  /*- set L -*/
7570  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
7571  strat->Ll = -1;
7572  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
7573  /*- set B -*/
7574  strat->Bmax = setmaxL;
7575  strat->Bl = -1;
7576  strat->B = initL();
7577  /*- set T -*/
7578  strat->tl = -1;
7579  strat->tmax = setmaxT;
7580  strat->T = initT();
7581  strat->R = initR();
7582  strat->sevT = initsevT();
7583  /*- init local data struct.---------------------------------------- -*/
7584  strat->P.ecart=0;
7585  strat->P.length=0;
7587  {
7588  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
7589  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
7590  }
7591  #ifdef HAVE_RINGS
7593  {
7594  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
7595  }
7596  else
7597  #endif
7598  {
7599  if(TEST_OPT_SB_1)
7600  {
7601  int i;
7602  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
7603  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7604  {
7605  P->m[i-strat->newIdeal] = F->m[i];
7606  F->m[i] = NULL;
7607  }
7608  initSSpecial(F,Q,P,strat);
7609  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7610  {
7611  F->m[i] = P->m[i-strat->newIdeal];
7612  P->m[i-strat->newIdeal] = NULL;
7613  }
7614  idDelete(&P);
7615  }
7616 
7617  else
7618  {
7619  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
7620  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
7621  }
7622  }
7623  strat->fromT = FALSE;
7625  if ((!TEST_OPT_SB_1)
7626  #ifdef HAVE_RINGS
7627  || (rField_is_Ring(currRing))
7628  #endif
7629  )
7630  {
7631  updateS(TRUE,strat);
7632  }
7633  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
7634  strat->fromQ=NULL;
7635 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:27
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:327
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5836
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
unsigned long * sevT
Definition: kutil.h:323
int ak
Definition: kutil.h:356
#define setmaxLinc
Definition: kutil.h:28
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:355
BOOLEAN interpt
Definition: kutil.h:365
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:373
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6236
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
int cp
Definition: kutil.h:349
BOOLEAN kHEdgeFound
Definition: kutil.h:370
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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:6695
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:416
int newIdeal
Definition: kutil.h:360
ideal Shdl
Definition: kutil.h:301
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void initBuchMoraCrit ( kStrategy  strat)

Definition at line 7325 of file kutil.cc.

7326 {
7328  strat->chainCrit=chainCritNormal;
7329 #ifdef HAVE_RINGS
7330  if (rField_is_Ring(currRing))
7331  {
7333  strat->chainCrit=chainCritRing;
7334  }
7335 #endif
7336 #ifdef HAVE_RATGRING
7337  if (rIsRatGRing(currRing))
7338  {
7339  strat->chainCrit=chainCritPart;
7340  /* enterOnePairNormal get rational part in it */
7341  }
7342 #endif
7343 
7344  strat->sugarCrit = TEST_OPT_SUGARCRIT;
7345  strat->Gebauer = strat->homog || strat->sugarCrit;
7346  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
7347  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
7348  strat->pairtest = NULL;
7349  /* alway use tailreduction, except:
7350  * - in local rings, - in lex order case, -in ring over extensions */
7352 
7353 #ifdef HAVE_PLURAL
7354  // and r is plural_ring
7355  // hence this holds for r a rational_plural_ring
7356  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
7357  { //or it has non-quasi-comm type... later
7358  strat->sugarCrit = FALSE;
7359  strat->Gebauer = FALSE;
7360  strat->honey = FALSE;
7361  }
7362 #endif
7363 
7364 #ifdef HAVE_RINGS
7365  // Coefficient ring?
7366  if (rField_is_Ring(currRing))
7367  {
7368  strat->sugarCrit = FALSE;
7369  strat->Gebauer = FALSE ;
7370  strat->honey = FALSE;
7371  }
7372 #endif
7373  #ifdef KDEBUG
7374  if (TEST_OPT_DEBUG)
7375  {
7376  if (strat->homog) PrintS("ideal/module is homogeneous\n");
7377  else PrintS("ideal/module is not homogeneous\n");
7378  }
7379  #endif
7380 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2186
BOOLEAN * pairtest
Definition: kutil.h:333
BOOLEAN z2homog
Definition: kutil.h:368
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1490
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:289
BOOLEAN homog
Definition: kutil.h:366
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:2885
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:372
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:371
#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:290
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1167
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2460
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
void initBuchMoraPos ( kStrategy  strat)

Definition at line 7466 of file kutil.cc.

7467 {
7469  {
7470  if (strat->honey)
7471  {
7472  strat->posInL = posInL15;
7473  // ok -- here is the deal: from my experiments for Singular-2-0
7474  // I conclude that that posInT_EcartpLength is the best of
7475  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
7476  // see the table at the end of this file
7477  if (TEST_OPT_OLDSTD)
7478  strat->posInT = posInT15;
7479  else
7480  strat->posInT = posInT_EcartpLength;
7481  }
7482  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
7483  {
7484  strat->posInL = posInL11;
7485  strat->posInT = posInT11;
7486  }
7487  else if (TEST_OPT_INTSTRATEGY)
7488  {
7489  strat->posInL = posInL11;
7490  strat->posInT = posInT11;
7491  }
7492  else
7493  {
7494  strat->posInL = posInL0;
7495  strat->posInT = posInT0;
7496  }
7497  //if (strat->minim>0) strat->posInL =posInLSpecial;
7498  if (strat->homog)
7499  {
7500  strat->posInL = posInL110;
7501  strat->posInT = posInT110;
7502  }
7503  }
7504  else
7505  {
7506  if (strat->homog)
7507  {
7508  strat->posInL = posInL11;
7509  strat->posInT = posInT11;
7510  }
7511  else
7512  {
7513  if ((currRing->order[0]==ringorder_c)
7514  ||(currRing->order[0]==ringorder_C))
7515  {
7516  strat->posInL = posInL17_c;
7517  strat->posInT = posInT17_c;
7518  }
7519  else
7520  {
7521  strat->posInL = posInL17;
7522  strat->posInT = posInT17;
7523  }
7524  }
7525  }
7526  if (strat->minim>0) strat->posInL =posInLSpecial;
7527  // for further tests only
7528  if ((BTEST1(11)) || (BTEST1(12)))
7529  strat->posInL = posInL11;
7530  else if ((BTEST1(13)) || (BTEST1(14)))
7531  strat->posInL = posInL13;
7532  else if ((BTEST1(15)) || (BTEST1(16)))
7533  strat->posInL = posInL15;
7534  else if ((BTEST1(17)) || (BTEST1(18)))
7535  strat->posInL = posInL17;
7536  if (BTEST1(11))
7537  strat->posInT = posInT11;
7538  else if (BTEST1(13))
7539  strat->posInT = posInT13;
7540  else if (BTEST1(15))
7541  strat->posInT = posInT15;
7542  else if ((BTEST1(17)))
7543  strat->posInT = posInT17;
7544  else if ((BTEST1(19)))
7545  strat->posInT = posInT19;
7546  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
7547  strat->posInT = posInT1;
7548 #ifdef HAVE_RINGS
7549  if (rField_is_Ring(currRing))
7550  {
7551  strat->posInL = posInL11;
7552  strat->posInT = posInT11;
7553  }
7554 #endif
7556 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
#define BTEST1(a)
Definition: options.h:32
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4281
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int minim
Definition: kutil.h:361
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:7455
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:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4339
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 9049 of file kutil.cc.

9050 {
9051  strat->interpt = BTEST1(OPT_INTERRUPT);
9052  strat->kHEdge=NULL;
9054  /*- creating temp data structures------------------- -*/
9055  strat->cp = 0;
9056  strat->c3 = 0;
9057  strat->cv = 0;
9058  strat->tail = pInit();
9059  /*- set s -*/
9060  strat->sl = -1;
9061  /*- set L -*/
9062  strat->Lmax = setmaxL;
9063  strat->Ll = -1;
9064  strat->L = initL();
9065  /*- set B -*/
9066  strat->Bmax = setmaxL;
9067  strat->Bl = -1;
9068  strat->B = initL();
9069  /*- set T -*/
9070  strat->tl = -1;
9071  strat->tmax = setmaxT;
9072  strat->T = initT();
9073  strat->R = initR();
9074  strat->sevT = initsevT();
9075  /*- init local data struct.---------------------------------------- -*/
9076  strat->P.ecart=0;
9077  strat->P.length=0;
9079  {
9080  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
9081  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
9082  }
9083  #ifdef HAVE_RINGS
9085  {
9086  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
9087  }
9088  #endif
9089  {
9090  if(TEST_OPT_SB_1)
9091  {
9092  int i;
9093  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
9094  for (i=strat->newIdeal;i<IDELEMS(F);i++)
9095  {
9096  P->m[i-strat->newIdeal] = F->m[i];
9097  F->m[i] = NULL;
9098  }
9099  initSSpecial(F,Q,P,strat);
9100  for (i=strat->newIdeal;i<IDELEMS(F);i++)
9101  {
9102  F->m[i] = P->m[i-strat->newIdeal];
9103  P->m[i-strat->newIdeal] = NULL;
9104  }
9105  idDelete(&P);
9106  }
9107  else
9108  {
9109  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
9110  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
9111  }
9112  }
9113  strat->fromT = FALSE;
9115  if (!TEST_OPT_SB_1)
9116  {
9117  /* the only change: we do not fill the set T*/
9118  #ifdef HAVE_RINGS
9119  if(!rField_is_Ring(currRing))
9120  #endif
9121  updateS(FALSE,strat);
9122  }
9123  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
9124  strat->fromQ=NULL;
9125  /* more changes: fill the set T with all the shifts of elts of S*/
9126  /* is done by other procedure */
9127 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:27
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:327
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
int cv
Definition: kutil.h:350
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5836
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:323
int ak
Definition: kutil.h:356
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:355
BOOLEAN interpt
Definition: kutil.h:365
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:373
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6236
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
int cp
Definition: kutil.h:349
BOOLEAN kHEdgeFound
Definition: kutil.h:370
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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:6695
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:416
int newIdeal
Definition: kutil.h:360
ideal Shdl
Definition: kutil.h:301
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void initEcartBBA ( TObject h)

Definition at line 1133 of file kutil.cc.

1134 {
1135  h->FDeg = h->pFDeg();
1136  (*h).ecart = 0;
1137  h->length=h->pLength=pLength(h->p);
1138 }
static int pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978
void initEcartNormal ( TObject h)

Definition at line 1125 of file kutil.cc.

1126 {
1127  h->FDeg = h->pFDeg();
1128  h->ecart = h->pLDeg() - h->FDeg;
1129  // h->length is set by h->pLDeg
1130  h->length=h->pLength=pLength(h->p);
1131 }
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 1140 of file kutil.cc.

1141 {
1142  Lp->FDeg = Lp->pFDeg();
1143  (*Lp).ecart = 0;
1144  (*Lp).length = 0;
1145 }
void initEcartPairMora ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1147 of file kutil.cc.

1148 {
1149  Lp->FDeg = Lp->pFDeg();
1150  (*Lp).ecart = si_max(ecartF,ecartG);
1151  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1152  (*Lp).length = 0;
1153 }
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 9605 of file kutil.cc.

9606 {
9607  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
9608  // atR = -1;
9609  if ((strat->syzComp==0)
9610  || (pGetComp(h)<=strat->syzComp))
9611  {
9612  int j;
9613  BOOLEAN new_pair=FALSE;
9614 
9615  if (pGetComp(h)==0)
9616  {
9617  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
9618  if ((isFromQ)&&(strat->fromQ!=NULL))
9619  {
9620  for (j=0; j<=k; j++)
9621  {
9622  if (!strat->fromQ[j])
9623  {
9624  new_pair=TRUE;
9625  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
9626  // other side pairs:
9627  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
9628  //Print("j:%d, Ll:%d\n",j,strat->Ll);
9629  }
9630  }
9631  }
9632  else
9633  {
9634  new_pair=TRUE;
9635  for (j=0; j<=k; j++)
9636  {
9637  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
9638  // other side pairs
9639  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
9640  }
9641  /* HERE we put (h, s*h) pairs */
9642  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
9643  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
9644  }
9645  }
9646  else
9647  {
9648  for (j=0; j<=k; j++)
9649  {
9650  if ((pGetComp(h)==pGetComp(strat->S[j]))
9651  || (pGetComp(strat->S[j])==0))
9652  {
9653  new_pair=TRUE;
9654  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
9655  // other side pairs
9656  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
9657  //Print("j:%d, Ll:%d\n",j,strat->Ll);
9658  }
9659  }
9660  /* HERE we put (h, s*h) pairs */
9661  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
9662  }
9663 
9664  if (new_pair)
9665  {
9666  strat->chainCrit(h,ecart,strat);
9667  }
9668 
9669  }
9670 }
int syzComp
Definition: kutil.h:357
#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:319
polyset S
Definition: kutil.h:304
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:290
#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:9134
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:9210
void initHilbCrit ( ideal  F,
ideal  Q,
intvec **  hilb,
kStrategy  strat 
)

Definition at line 7305 of file kutil.cc.

7306 {
7307 
7308  //if the ordering is local, then hilb criterion
7309  //can be used also if tzhe ideal is not homogenous
7310  if((rHasLocalOrMixedOrdering(currRing)) && (currRing->MixedOrder == 0 ))
7311  #ifdef HAVE_RINGS
7312  {
7314  *hilb=NULL;
7315  else
7316  return;
7317  }
7318 #endif
7319  if (strat->homog!=isHomog)
7320  {
7321  *hilb=NULL;
7322  }
7323 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
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:366
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
static LSet initL ( int  nr = setmaxL)
inlinestatic

Definition at line 416 of file kutil.h.

417 { return (LSet)omAlloc(nr*sizeof(LObject)); }
class sLObject LObject
Definition: kutil.h:58
#define omAlloc(size)
Definition: omAllocDecl.h:210
LObject * LSet
Definition: kutil.h:60
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:30
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:57
void initS ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 5733 of file kutil.cc.

5734 {
5735  int i,pos;
5736 
5737  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5738  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5739  strat->ecartS=initec(i);
5740  strat->sevS=initsevS(i);
5741  strat->S_2_R=initS_2_R(i);
5742  strat->fromQ=NULL;
5743  strat->Shdl=idInit(i,F->rank);
5744  strat->S=strat->Shdl->m;
5745  /*- put polys into S -*/
5746  if (Q!=NULL)
5747  {
5748  strat->fromQ=initec(i);
5749  memset(strat->fromQ,0,i*sizeof(int));
5750  for (i=0; i<IDELEMS(Q); i++)
5751  {
5752  if (Q->m[i]!=NULL)
5753  {
5754  LObject h;
5755  h.p = pCopy(Q->m[i]);
5757  {
5758  //pContent(h.p);
5759  h.pCleardenom(); // also does a pContent
5760  }
5761  else
5762  {
5763  h.pNorm();
5764  }
5766  {
5767  deleteHC(&h, strat);
5768  }
5769  if (h.p!=NULL)
5770  {
5771  strat->initEcart(&h);
5772  if (strat->sl==-1)
5773  pos =0;
5774  else
5775  {
5776  pos = posInS(strat,strat->sl,h.p,h.ecart);
5777  }
5778  h.sev = pGetShortExpVector(h.p);
5779  strat->enterS(h,pos,strat,-1);
5780  strat->fromQ[pos]=1;
5781  }
5782  }
5783  }
5784  }
5785  for (i=0; i<IDELEMS(F); i++)
5786  {
5787  if (F->m[i]!=NULL)
5788  {
5789  LObject h;
5790  h.p = pCopy(F->m[i]);
5792  {
5793  /*#ifdef HAVE_RINGS
5794  if (rField_is_Ring(currRing))
5795  {
5796  h.pCleardenom();
5797  }
5798  else
5799  #endif*/
5800  cancelunit(&h); /*- tries to cancel a unit -*/
5801  deleteHC(&h, strat);
5802  }
5803  if (h.p!=NULL)
5804  // do not rely on the input being a SB!
5805  {
5807  {
5808  //pContent(h.p);
5809  h.pCleardenom(); // also does a pContent
5810  }
5811  else
5812  {
5813  h.pNorm();
5814  }
5815  strat->initEcart(&h);
5816  if (strat->sl==-1)
5817  pos =0;
5818  else
5819  pos = posInS(strat,strat->sl,h.p,h.ecart);
5820  h.sev = pGetShortExpVector(h.p);
5821  strat->enterS(h,pos,strat,-1);
5822  }
5823  }
5824  }
5825  /*- test, if a unit is in F -*/
5826  if ((strat->sl>=0)
5827 #ifdef HAVE_RINGS
5828  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
5829 #endif
5830  && pIsConstant(strat->S[0]))
5831  {
5832  while (strat->sl>0) deleteInS(strat->sl,strat);
5833  }
5834 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:465
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
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:461
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
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 1334 of file kstd1.cc.

1335 {
1336  int i;
1337  //idhdl h;
1338  /* setting global variables ------------------- */
1339  strat->enterS = enterSSba;
1340  strat->red2 = redHoney;
1341  if (strat->honey)
1342  strat->red2 = redHoney;
1343  else if (currRing->pLexOrder && !strat->homog)
1344  strat->red2 = redLazy;
1345  else
1346  {
1347  strat->LazyPass *=4;
1348  strat->red2 = redHomog;
1349  }
1350 #if defined(HAVE_RINGS)
1351  if (rField_is_Ring(currRing))
1352  {
1354  {strat->red = redRiloc;}
1355  else
1356  {strat->red2 = redRing;}
1357  }
1358 #endif
1359  if (currRing->pLexOrder && strat->honey)
1360  strat->initEcart = initEcartNormal;
1361  else
1362  strat->initEcart = initEcartBBA;
1363  if (strat->honey)
1365  else
1367  //strat->kIdeal = NULL;
1368  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1369  //else strat->kIdeal->rtyp=MODUL_CMD;
1370  //strat->kIdeal->data=(void *)strat->Shdl;
1371  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1372  {
1373  //interred machen Aenderung
1374  strat->pOrigFDeg = currRing->pFDeg;
1375  strat->pOrigLDeg = currRing->pLDeg;
1376  //h=ggetid("ecart");
1377  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1378  //{
1379  // ecartWeights=iv2array(IDINTVEC(h));
1380  //}
1381  //else
1382  {
1383  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1384  /*uses automatic computation of the ecartWeights to set them*/
1386  }
1388  if (TEST_OPT_PROT)
1389  {
1390  for(i=1; i<=(currRing->N); i++)
1391  Print(" %d",ecartWeights[i]);
1392  PrintLn();
1393  mflush();
1394  }
1395  }
1396  // for sig-safe reductions in signature-based
1397  // standard basis computations
1398  strat->red = redSig;
1399  //strat->sbaOrder = 1;
1400  strat->currIdx = 1;
1401 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
BOOLEAN honey
Definition: kutil.h:371
void enterSSba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7030
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:324
void PrintLn()
Definition: reporter.cc:322
#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:286
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:565
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:406
unsigned long currIdx
Definition: kutil.h:315
#define mflush()
Definition: reporter.h:42
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1004
pFDegProc pOrigFDeg
Definition: kutil.h:295
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:351
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:844
pLDegProc pOrigLDeg
Definition: kutil.h:296
BOOLEAN homog
Definition: kutil.h:366
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1147
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3464
#define TEST_OPT_WEIGHTM
Definition: options.h:115
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#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:1125
int LazyPass
Definition: kutil.h:356
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:278
void initSbaBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 7751 of file kutil.cc.

7752 {
7753  strat->interpt = BTEST1(OPT_INTERRUPT);
7754  strat->kHEdge=NULL;
7756  /*- creating temp data structures------------------- -*/
7757  strat->cp = 0;
7758  strat->c3 = 0;
7759  strat->tail = pInit();
7760  /*- set s -*/
7761  strat->sl = -1;
7762  /*- set ps -*/
7763  strat->syzl = -1;
7764  /*- set L -*/
7765  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
7766  strat->Ll = -1;
7767  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
7768  /*- set B -*/
7769  strat->Bmax = setmaxL;
7770  strat->Bl = -1;
7771  strat->B = initL();
7772  /*- set T -*/
7773  strat->tl = -1;
7774  strat->tmax = setmaxT;
7775  strat->T = initT();
7776  strat->R = initR();
7777  strat->sevT = initsevT();
7778  /*- init local data struct.---------------------------------------- -*/
7779  strat->P.ecart=0;
7780  strat->P.length=0;
7782  {
7783  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
7784  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
7785  }
7786  #ifdef HAVE_RINGS
7788  {
7789  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
7790  }
7791  else
7792  #endif
7793  {
7794  if(TEST_OPT_SB_1)
7795  {
7796  int i;
7797  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
7798  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7799  {
7800  P->m[i-strat->newIdeal] = F->m[i];
7801  F->m[i] = NULL;
7802  }
7803  initSSpecialSba(F,Q,P,strat);
7804  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7805  {
7806  F->m[i] = P->m[i-strat->newIdeal];
7807  P->m[i-strat->newIdeal] = NULL;
7808  }
7809  idDelete(&P);
7810  }
7811  else
7812  {
7813  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
7814  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
7815  }
7816  }
7817  strat->fromT = FALSE;
7819  if (!TEST_OPT_SB_1)
7820  {
7821  #ifdef HAVE_RINGS
7822  if(!rField_is_Ring(currRing))
7823  #endif
7824  updateS(TRUE,strat);
7825  }
7826  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
7827  strat->fromQ=NULL;
7828 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:27
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:327
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
#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:6381
unsigned long * sevT
Definition: kutil.h:323
int ak
Definition: kutil.h:356
#define setmaxLinc
Definition: kutil.h:28
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5935
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:355
BOOLEAN interpt
Definition: kutil.h:365
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:373
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
int cp
Definition: kutil.h:349
BOOLEAN kHEdgeFound
Definition: kutil.h:370
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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:6695
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:416
int newIdeal
Definition: kutil.h:360
ideal Shdl
Definition: kutil.h:301
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:352
void initSbaCrit ( kStrategy  strat)

Definition at line 7382 of file kutil.cc.

7383 {
7384  //strat->enterOnePair=enterOnePairNormal;
7386  //strat->chainCrit=chainCritNormal;
7387  strat->chainCrit = chainCritSig;
7388  /******************************************
7389  * rewCrit1 and rewCrit2 are already set in
7390  * kSba() in kstd1.cc
7391  *****************************************/
7392  //strat->rewCrit1 = faugereRewCriterion;
7393  if (strat->sbaOrder == 1)
7394  {
7395  strat->syzCrit = syzCriterionInc;
7396  }
7397  else
7398  {
7399  strat->syzCrit = syzCriterion;
7400  }
7401 #ifdef HAVE_RINGS
7402  if (rField_is_Ring(currRing))
7403  {
7405  strat->chainCrit=chainCritRing;
7406  }
7407 #endif
7408 #ifdef HAVE_RATGRING
7409  if (rIsRatGRing(currRing))
7410  {
7411  strat->chainCrit=chainCritPart;
7412  /* enterOnePairNormal get rational part in it */
7413  }
7414 #endif
7415 
7416  strat->sugarCrit = TEST_OPT_SUGARCRIT;
7417  strat->Gebauer = strat->homog || strat->sugarCrit;
7418  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
7419  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
7420  strat->pairtest = NULL;
7421  /* alway use tailreduction, except:
7422  * - in local rings, - in lex order case, -in ring over extensions */
7424  //strat->noTailReduction = NULL;
7425 
7426 #ifdef HAVE_PLURAL
7427  // and r is plural_ring
7428  // hence this holds for r a rational_plural_ring
7429  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
7430  { //or it has non-quasi-comm type... later
7431  strat->sugarCrit = FALSE;
7432  strat->Gebauer = FALSE;
7433  strat->honey = FALSE;
7434  }
7435 #endif
7436 
7437 #ifdef HAVE_RINGS
7438  // Coefficient ring?
7439  if (rField_is_Ring(currRing))
7440  {
7441  strat->sugarCrit = FALSE;
7442  strat->Gebauer = FALSE ;
7443  strat->honey = FALSE;
7444  }
7445 #endif
7446  #ifdef KDEBUG
7447  if (TEST_OPT_DEBUG)
7448  {
7449  if (strat->homog) PrintS("ideal/module is homogeneous\n");
7450  else PrintS("ideal/module is not homogeneous\n");
7451  }
7452  #endif
7453 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
BOOLEAN * pairtest
Definition: kutil.h:333
BOOLEAN z2homog
Definition: kutil.h:368
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:2401
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1490
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:291
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:289
BOOLEAN homog
Definition: kutil.h:366
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:2885
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:372
unsigned sbaOrder
Definition: kutil.h:314
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:371
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5071
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5103
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:290
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1167
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2460
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
void initSbaPos ( kStrategy  strat)

Definition at line 7655 of file kutil.cc.

7656 {
7658  {
7659  if (strat->honey)
7660  {
7661  strat->posInL = posInL15;
7662  // ok -- here is the deal: from my experiments for Singular-2-0
7663  // I conclude that that posInT_EcartpLength is the best of
7664  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
7665  // see the table at the end of this file
7666  if (TEST_OPT_OLDSTD)
7667  strat->posInT = posInT15;
7668  else
7669  strat->posInT = posInT_EcartpLength;
7670  }
7671  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
7672  {
7673  strat->posInL = posInL11;
7674  strat->posInT = posInT11;
7675  }
7676  else if (TEST_OPT_INTSTRATEGY)
7677  {
7678  strat->posInL = posInL11;
7679  strat->posInT = posInT11;
7680  }
7681  else
7682  {
7683  strat->posInL = posInL0;
7684  strat->posInT = posInT0;
7685  }
7686  //if (strat->minim>0) strat->posInL =posInLSpecial;
7687  if (strat->homog)
7688  {
7689  strat->posInL = posInL110;
7690  strat->posInT = posInT110;
7691  }
7692  }
7693  else
7694  {
7695  if (strat->homog)
7696  {
7697  strat->posInL = posInL11;
7698  strat->posInT = posInT11;
7699  }
7700  else
7701  {
7702  if ((currRing->order[0]==ringorder_c)
7703  ||(currRing->order[0]==ringorder_C))
7704  {
7705  strat->posInL = posInL17_c;
7706  strat->posInT = posInT17_c;
7707  }
7708  else
7709  {
7710  strat->posInL = posInL17;
7711  strat->posInT = posInT17;
7712  }
7713  }
7714  }
7715  if (strat->minim>0) strat->posInL =posInLSpecial;
7716  // for further tests only
7717  if ((BTEST1(11)) || (BTEST1(12)))
7718  strat->posInL = posInL11;
7719  else if ((BTEST1(13)) || (BTEST1(14)))
7720  strat->posInL = posInL13;
7721  else if ((BTEST1(15)) || (BTEST1(16)))
7722  strat->posInL = posInL15;
7723  else if ((BTEST1(17)) || (BTEST1(18)))
7724  strat->posInL = posInL17;
7725  if (BTEST1(11))
7726  strat->posInT = posInT11;
7727  else if (BTEST1(13))
7728  strat->posInT = posInT13;
7729  else if (BTEST1(15))
7730  strat->posInT = posInT15;
7731  else if ((BTEST1(17)))
7732  strat->posInT = posInT17;
7733  else if ((BTEST1(19)))
7734  strat->posInT = posInT19;
7735  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
7736  strat->posInT = posInT1;
7737 #ifdef HAVE_RINGS
7738  if (rField_is_Ring(currRing))
7739  {
7740  strat->posInL = posInL11;
7741  strat->posInT = posInT11;
7742  }
7743 #endif
7744  strat->posInLDependsOnLength = FALSE;
7745  strat->posInLSba = posInLSig;
7746  //strat->posInL = posInLSig;
7747  strat->posInL = posInLF5C;
7748  //strat->posInT = posInTSig;
7749 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
#define FALSE
Definition: auxiliary.h:140
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:281
#define BTEST1(a)
Definition: options.h:32
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:4652
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4281
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int minim
Definition: kutil.h:361
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4599
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:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4339
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
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:30
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void initSL ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 5836 of file kutil.cc.

5837 {
5838  int i,pos;
5839 
5840  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5841  else i=setmaxT;
5842  strat->ecartS=initec(i);
5843  strat->sevS=initsevS(i);
5844  strat->S_2_R=initS_2_R(i);
5845  strat->fromQ=NULL;
5846  strat->Shdl=idInit(i,F->rank);
5847  strat->S=strat->Shdl->m;
5848  /*- put polys into S -*/
5849  if (Q!=NULL)
5850  {
5851  strat->fromQ=initec(i);
5852  memset(strat->fromQ,0,i*sizeof(int));
5853  for (i=0; i<IDELEMS(Q); i++)
5854  {
5855  if (Q->m[i]!=NULL)
5856  {
5857  LObject h;
5858  h.p = pCopy(Q->m[i]);
5860  {
5861  deleteHC(&h,strat);
5862  }
5864  {
5865  //pContent(h.p);
5866  h.pCleardenom(); // also does a pContent
5867  }
5868  else
5869  {
5870  h.pNorm();
5871  }
5872  if (h.p!=NULL)
5873  {
5874  strat->initEcart(&h);
5875  if (strat->sl==-1)
5876  pos =0;
5877  else
5878  {
5879  pos = posInS(strat,strat->sl,h.p,h.ecart);
5880  }
5881  h.sev = pGetShortExpVector(h.p);
5882  strat->enterS(h,pos,strat,-1);
5883  strat->fromQ[pos]=1;
5884  }
5885  }
5886  }
5887  }
5888  for (i=0; i<IDELEMS(F); i++)
5889  {
5890  if (F->m[i]!=NULL)
5891  {
5892  LObject h;
5893  h.p = pCopy(F->m[i]);
5894  if (h.p!=NULL)
5895  {
5897  {
5898  cancelunit(&h); /*- tries to cancel a unit -*/
5899  deleteHC(&h, strat);
5900  }
5901  if (h.p!=NULL)
5902  {
5904  {
5905  //pContent(h.p);
5906  h.pCleardenom(); // also does a pContent
5907  }
5908  else
5909  {
5910  h.pNorm();
5911  }
5912  strat->initEcart(&h);
5913  if (strat->Ll==-1)
5914  pos =0;
5915  else
5916  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
5917  h.sev = pGetShortExpVector(h.p);
5918  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
5919  }
5920  }
5921  }
5922  }
5923  /*- test, if a unit is in F -*/
5924 
5925  if ((strat->Ll>=0)
5926 #ifdef HAVE_RINGS
5927  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
5928 #endif
5929  && pIsConstant(strat->L[strat->Ll].p))
5930  {
5931  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
5932  }
5933 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:465
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int * S_2_R
Definition: kutil.h:342
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:1101
#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:461
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:30
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
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 5935 of file kutil.cc.

5936 {
5937  int i,pos;
5938  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5939  else i=setmaxT;
5940  strat->ecartS = initec(i);
5941  strat->sevS = initsevS(i);
5942  strat->sevSig = initsevS(i);
5943  strat->S_2_R = initS_2_R(i);
5944  strat->fromQ = NULL;
5945  strat->Shdl = idInit(i,F->rank);
5946  strat->S = strat->Shdl->m;
5947  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
5948  if (strat->sbaOrder != 1)
5949  {
5950  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
5951  strat->sevSyz = initsevS(i);
5952  strat->syzmax = i;
5953  strat->syzl = 0;
5954  }
5955  /*- put polys into S -*/
5956  if (Q!=NULL)
5957  {
5958  strat->fromQ=initec(i);
5959  memset(strat->fromQ,0,i*sizeof(int));
5960  for (i=0; i<IDELEMS(Q); i++)
5961  {
5962  if (Q->m[i]!=NULL)
5963  {
5964  LObject h;
5965  h.p = pCopy(Q->m[i]);
5967  {
5968  deleteHC(&h,strat);
5969  }
5971  {
5972  //pContent(h.p);
5973  h.pCleardenom(); // also does a pContent
5974  }
5975  else
5976  {
5977  h.pNorm();
5978  }
5979  if (h.p!=NULL)
5980  {
5981  strat->initEcart(&h);
5982  if (strat->sl==-1)
5983  pos =0;
5984  else
5985  {
5986  pos = posInS(strat,strat->sl,h.p,h.ecart);
5987  }
5988  h.sev = pGetShortExpVector(h.p);
5989  strat->enterS(h,pos,strat,-1);
5990  strat->fromQ[pos]=1;
5991  }
5992  }
5993  }
5994  }
5995  for (i=0; i<IDELEMS(F); i++)
5996  {
5997  if (F->m[i]!=NULL)
5998  {
5999  LObject h;
6000  h.p = pCopy(F->m[i]);
6001  h.sig = pOne();
6002  //h.sig = pInit();
6003  //p_SetCoeff(h.sig,nInit(1),currRing);
6004  p_SetComp(h.sig,i+1,currRing);
6005  // if we are working with the Schreyer order we generate it
6006  // by multiplying the initial signatures with the leading monomial
6007  // of the corresponding initial polynomials generating the ideal
6008  // => we can keep the underlying monomial order and get a Schreyer
6009  // order without any bigger overhead
6010  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
6011  {
6012  p_ExpVectorAdd (h.sig,F->m[i],currRing);
6013  }
6014  h.sevSig = pGetShortExpVector(h.sig);
6015 #ifdef DEBUGF5
6016  pWrite(h.p);
6017  pWrite(h.sig);
6018 #endif
6019  if (h.p!=NULL)
6020  {
6022  {
6023  cancelunit(&h); /*- tries to cancel a unit -*/
6024  deleteHC(&h, strat);
6025  }
6026  if (h.p!=NULL)
6027  {
6029  {
6030  //pContent(h.p);
6031  h.pCleardenom(); // also does a pContent
6032  }
6033  else
6034  {
6035  h.pNorm();
6036  }
6037  strat->initEcart(&h);
6038  if (strat->Ll==-1)
6039  pos =0;
6040  else
6041  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
6042  h.sev = pGetShortExpVector(h.p);
6043  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6044  }
6045  }
6046  /*
6047  if (strat->sbaOrder != 1)
6048  {
6049  for(j=0;j<i;j++)
6050  {
6051  strat->syz[ctr] = pCopy(F->m[j]);
6052  p_SetCompP(strat->syz[ctr],i+1,currRing);
6053  // add LM(F->m[i]) to the signature to get a Schreyer order
6054  // without changing the underlying polynomial ring at all
6055  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
6056  // since p_Add_q() destroys all input
6057  // data we need to recreate help
6058  // each time
6059  poly help = pCopy(F->m[i]);
6060  p_SetCompP(help,j+1,currRing);
6061  pWrite(strat->syz[ctr]);
6062  pWrite(help);
6063  printf("%d\n",pLmCmp(strat->syz[ctr],help));
6064  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
6065  printf("%d. SYZ ",ctr);
6066  pWrite(strat->syz[ctr]);
6067  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
6068  ctr++;
6069  }
6070  strat->syzl = ps;
6071  }
6072  */
6073  }
6074  }
6075  /*- test, if a unit is in F -*/
6076 
6077  if ((strat->Ll>=0)
6078 #ifdef HAVE_RINGS
6079  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6080 #endif
6081  && pIsConstant(strat->L[strat->Ll].p))
6082  {
6083  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6084  }
6085 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
int syzmax
Definition: kutil.h:352
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:465
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int * S_2_R
Definition: kutil.h:342
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:281
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:1101
#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:461
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:30
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
unsigned sbaOrder
Definition: kutil.h:314
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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
unsigned long * sevSyz
Definition: kutil.h:321
#define setmaxTinc
Definition: kutil.h:31
polyset syz
Definition: kutil.h:305
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:352
#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 6087 of file kutil.cc.

6088 {
6089  if( strat->S[0] )
6090  {
6091  if( strat->S[1] )
6092  {
6093  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
6094  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
6095  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
6096  }
6097  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
6098  /************************************************************
6099  * computing the length of the syzygy array needed
6100  ***********************************************************/
6101  for(i=1; i<=strat->sl; i++)
6102  {
6103  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6104  {
6105  ps += i;
6106  }
6107  }
6108  ps += strat->sl+1;
6109  //comp = pGetComp (strat->P.sig);
6110  comp = strat->currIdx;
6111  strat->syzIdx = initec(comp);
6112  strat->sevSyz = initsevS(ps);
6113  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
6114  strat->syzmax = ps;
6115  strat->syzl = 0;
6116  strat->syzidxmax = comp;
6117 #if defined(DEBUGF5) || defined(DEBUGF51)
6118  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
6119 #endif
6120  i = 1;
6121  j = 0;
6122  /************************************************************
6123  * generating the leading terms of the principal syzygies
6124  ***********************************************************/
6125  while (i <= strat->sl)
6126  {
6127  /**********************************************************
6128  * principal syzygies start with component index 2
6129  * the array syzIdx starts with index 0
6130  * => the rules for a signature with component comp start
6131  * at strat->syz[strat->syzIdx[comp-2]] !
6132  *********************************************************/
6133  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6134  {
6135  comp = pGetComp(strat->sig[i]);
6136  comp_old = pGetComp(strat->sig[i-1]);
6137  diff = comp - comp_old - 1;
6138  // diff should be zero, but sometimes also the initial generating
6139  // elements of the input ideal reduce to zero. then there is an
6140  // index-gap between the signatures. for these inbetween signatures we
6141  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6142  // in the following.
6143  // doing this, we keep the relation "j = comp - 2" alive, which makes
6144  // jumps way easier when checking criteria
6145  while (diff>0)
6146  {
6147  strat->syzIdx[j] = 0;
6148  diff--;
6149  j++;
6150  }
6151  strat->syzIdx[j] = ctr;
6152  j++;
6153  LObject Q;
6154  int pos;
6155  for (k = 0; k<i; k++)
6156  {
6157  Q.sig = pOne();
6158  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6159  p_SetCompP (Q.sig, comp, currRing);
6160  poly q = p_One(currRing);
6161  p_ExpVectorCopy(q,strat->S[i],currRing);
6162  q = p_Neg (q, currRing);
6163  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6164  Q.sig = p_Add_q (Q.sig, q, currRing);
6165  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6166  pos = posInSyz(strat, Q.sig);
6167  enterSyz(Q, strat, pos);
6168  ctr++;
6169  }
6170  }
6171  i++;
6172  }
6173  /**************************************************************
6174  * add syzygies for upcoming first element of new iteration step
6175  **************************************************************/
6176  comp = strat->currIdx;
6177  comp_old = pGetComp(strat->sig[i-1]);
6178  diff = comp - comp_old - 1;
6179  // diff should be zero, but sometimes also the initial generating
6180  // elements of the input ideal reduce to zero. then there is an
6181  // index-gap between the signatures. for these inbetween signatures we
6182  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6183  // in the following.
6184  // doing this, we keep the relation "j = comp - 2" alive, which makes
6185  // jumps way easier when checking criteria
6186  while (diff>0)
6187  {
6188  strat->syzIdx[j] = 0;
6189  diff--;
6190  j++;
6191  }
6192  strat->syzIdx[j] = ctr;
6193  LObject Q;
6194  int pos;
6195  for (k = 0; k<strat->sl+1; k++)
6196  {
6197  Q.sig = pOne();
6198  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6199  p_SetCompP (Q.sig, comp, currRing);
6200  poly q = p_One(currRing);
6201  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
6202  q = p_Neg (q, currRing);
6203  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6204  Q.sig = p_Add_q (Q.sig, q, currRing);
6205  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6206  pos = posInSyz(strat, Q.sig);
6207  enterSyz(Q, strat, pos);
6208  ctr++;
6209  }
6210 //#if 1
6211 #ifdef DEBUGF5
6212  PrintS("Principal syzygies:\n");
6213  Print("syzl %d\n",strat->syzl);
6214  Print("syzmax %d\n",strat->syzmax);
6215  Print("ps %d\n",ps);
6216  PrintS("--------------------------------\n");
6217  for(i=0;i<=strat->syzl-1;i++)
6218  {
6219  Print("%d - ",i);
6220  pWrite(strat->syz[i]);
6221  }
6222  for(i=0;i<strat->currIdx;i++)
6223  {
6224  Print("%d - %d\n",i,strat->syzIdx[i]);
6225  }
6226  PrintS("--------------------------------\n");
6227 #endif
6228  }
6229 }
polyset sig
Definition: kutil.h:306
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
void enterSyz(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7240
#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:461
#define omAlloc(size)
Definition: omAllocDecl.h:210
unsigned long currIdx
Definition: kutil.h:315
#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
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
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:304
LSet L
Definition: kutil.h:325
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:4624
int syzidxmax
Definition: kutil.h:352
unsigned long * sevSyz
Definition: kutil.h:321
polyset syz
Definition: kutil.h:305
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int syzl
Definition: kutil.h:352
intset syzIdx
Definition: kutil.h:311
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:59
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:30
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:57
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
polyrec * poly
Definition: hilb.h:10
#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
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
polyrec * poly
Definition: hilb.h:10
#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
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 8176 of file kutil.cc.

8177 {
8178  if (strat->overflow) return FALSE;
8179  assume(L->p1 != NULL && L->p2 != NULL);
8180  // shift changes: from 0 to -1
8181  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
8182  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
8183  assume(strat->tailRing != currRing);
8184 
8185  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
8186  return FALSE;
8187  // shift changes: extra case inserted
8188  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
8189  {
8190  return TRUE;
8191  }
8192  poly p1_max = (strat->R[L->i_r1])->max;
8193  poly p2_max = (strat->R[L->i_r2])->max;
8194 
8195  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
8196  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
8197  {
8198  p_LmFree(m1, strat->tailRing);
8199  p_LmFree(m2, strat->tailRing);
8200  m1 = NULL;
8201  m2 = NULL;
8202  return FALSE;
8203  }
8204  return TRUE;
8205 }
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:1818
int tl
Definition: kutil.h:353
#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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:340
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
char overflow
Definition: kutil.h:399
BOOLEAN kCheckStrongCreation ( int  atR,
poly  m1,
int  atS,
poly  m2,
kStrategy  strat 
)

Definition at line 8214 of file kutil.cc.

8215 {
8216  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
8217  //assume(strat->tailRing != currRing);
8218 
8219  poly p1_max = (strat->R[atR])->max;
8220  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
8221 
8222  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
8223  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
8224  {
8225  return FALSE;
8226  }
8227  return TRUE;
8228 }
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1818
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
static int max(int a, int b)
Definition: fast_mult.cc:264
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:340
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
poly kCreateZeroPoly ( long  exp[],
long  cabsind,
poly t_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 3256 of file kutil.cc.

3257 {
3258 
3259  poly zeroPoly = NULL;
3260 
3261  number tmp1;
3262  poly tmp2, tmp3;
3263 
3264  if (cabsind == -1)
3265  {
3266  cabsind = 0;
3267  for (int i = 1; i <= leadRing->N; i++)
3268  {
3269  cabsind += ind_fact_2(exp[i]);
3270  }
3271 // Print("cabsind: %d\n", cabsind);
3272  }
3273  if (cabsind < leadRing->ch)
3274  {
3275  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
3276  }
3277  else
3278  {
3279  zeroPoly = p_ISet(1, tailRing);
3280  }
3281  for (int i = 1; i <= leadRing->N; i++)
3282  {
3283  for (long j = 1; j <= exp[i]; j++)
3284  {
3285  tmp1 = nInit(j);
3286  tmp2 = p_ISet(1, tailRing);
3287  p_SetExp(tmp2, i, 1, tailRing);
3288  p_Setm(tmp2, tailRing);
3289  if (nIsZero(tmp1))
3290  { // should nowbe obsolet, test ! TODO OLIVER
3291  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
3292  }
3293  else
3294  {
3295  tmp3 = p_NSet(nCopy(tmp1), tailRing);
3296  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
3297  }
3298  }
3299  }
3300  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
3301  for (int i = 1; i <= leadRing->N; i++)
3302  {
3303  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
3304  }
3305  p_Setm(tmp2, leadRing);
3306  *t_p = zeroPoly;
3307  zeroPoly = pNext(zeroPoly);
3308  pNext(*t_p) = NULL;
3309  pNext(tmp2) = zeroPoly;
3310  return tmp2;
3311 }
#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:3063
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
polyrec * poly
Definition: hilb.h:10
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:3048
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
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 8780 of file kutil.cc.

8781 {
8782  PrintS("red: ");
8783  if (strat->red==redFirst) PrintS("redFirst\n");
8784  else if (strat->red==redHoney) PrintS("redHoney\n");
8785  else if (strat->red==redEcart) PrintS("redEcart\n");
8786  else if (strat->red==redHomog) PrintS("redHomog\n");
8787  else Print("%p\n",(void*)strat->red);
8788  PrintS("posInT: ");
8789  if (strat->posInT==posInT0) PrintS("posInT0\n");
8790  else if (strat->posInT==posInT1) PrintS("posInT1\n");
8791  else if (strat->posInT==posInT11) PrintS("posInT11\n");
8792  else if (strat->posInT==posInT110) PrintS("posInT110\n");
8793  else if (strat->posInT==posInT13) PrintS("posInT13\n");
8794  else if (strat->posInT==posInT15) PrintS("posInT15\n");
8795  else if (strat->posInT==posInT17) PrintS("posInT17\n");
8796  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
8797  else if (strat->posInT==posInT19) PrintS("posInT19\n");
8798  else if (strat->posInT==posInT2) PrintS("posInT2\n");
8799 #ifdef HAVE_MORE_POS_IN_T
8800  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
8801  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
8802  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
8803 #endif
8804  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
8805  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
8806  else Print("%p\n",(void*)strat->posInT);
8807  PrintS("posInL: ");
8808  if (strat->posInL==posInL0) PrintS("posInL0\n");
8809  else if (strat->posInL==posInL10) PrintS("posInL10\n");
8810  else if (strat->posInL==posInL11) PrintS("posInL11\n");
8811  else if (strat->posInL==posInL110) PrintS("posInL110\n");
8812  else if (strat->posInL==posInL13) PrintS("posInL13\n");
8813  else if (strat->posInL==posInL15) PrintS("posInL15\n");
8814  else if (strat->posInL==posInL17) PrintS("posInL17\n");
8815  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
8816  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
8817  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
8818  else Print("%p\n",(void*)strat->posInL);
8819  PrintS("enterS: ");
8820  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
8821  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
8822  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
8823  else Print("%p\n",(void*)strat->enterS);
8824  PrintS("initEcart: ");
8825  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
8826  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
8827  else Print("%p\n",(void*)strat->initEcart);
8828  PrintS("initEcartPair: ");
8829  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
8830  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
8831  else Print("%p\n",(void*)strat->initEcartPair);
8832  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
8833  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
8834  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
8835  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
8836  Print("posInLDependsOnLength=%d\n",
8837  strat->posInLDependsOnLength);
8838  PrintS(showOption());PrintLn();
8839  PrintS("LDeg: ");
8840  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
8841  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
8842  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
8843  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
8844  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
8845  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
8846  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
8847  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
8848  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
8849  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
8850  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
8851  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
8852  else Print("? (%lx)", (long)currRing->pLDeg);
8853  PrintS(" / ");
8854  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
8855  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
8856  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
8857  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
8858  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
8859  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
8860  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
8861  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
8862  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
8863  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
8864  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
8865  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
8866  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
8867  PrintLn();
8868  PrintS("currRing->pFDeg: ");
8869  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
8870  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
8871  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
8872  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
8873  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
8874  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
8875  else Print("? (%lx)", (long)currRing->pFDeg);
8876  PrintLn();
8877  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
8878  if(TEST_OPT_DEGBOUND)
8879  Print(" degBound: %d\n", Kstd1_deg);
8880 
8881  if( ecartWeights != NULL )
8882  {
8883  PrintS("ecartWeights: ");
8884  for (int i = rVar(currRing); i > 0; i--)
8885  Print("%hd ", ecartWeights[i]);
8886  PrintLn();
8888  }
8889 
8890 #ifndef SING_NDEBUG
8892 #endif
8893 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8746
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4091
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
void PrintLn()
Definition: reporter.cc:322
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4004
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:357
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:372
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4734
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:705
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:708
void enterSMora(LObject p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1215
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
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:286
int ak
Definition: kutil.h:356
char * showOption()
Definition: misc_ip.cc:726
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:4281
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:406
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
void rDebugPrint(ring r)
Definition: ring.cc:3971
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1004
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:366
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1147
BOOLEAN Gebauer
Definition: kutil.h:372
#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:1133
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2054
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
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:4339
BOOLEAN sugarCrit
Definition: kutil.h:371
int Kstd1_deg
Definition: kutil.cc:228
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8655
#define TEST_OPT_WEIGHTM
Definition: options.h:115
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:176
ring tailRing
Definition: kutil.h:343
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
void enterSMoraNF(LObject p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1269
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:574
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
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:377
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
void initEcartNormal(TObject *h)
Definition: kutil.cc:1125
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
int LazyPass
Definition: kutil.h:356
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8709
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:947
int LazyDegree
Definition: kutil.h:356
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
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 149 of file kstd2.cc.

150 {
151  unsigned long not_sev = ~L->sev;
152  poly p = L->GetLmCurrRing();
153  int j = 0;
154 
155  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
156 #if 1
157  int ende;
158  if ((strat->ak>0) || currRing->pLexOrder) ende=strat->sl;
159  else ende=posInS(strat,*max_ind,p,0)+1;
160  if (ende>(*max_ind)) ende=(*max_ind);
161 #else
162  int ende=strat->sl;
163 #endif
164  (*max_ind)=ende;
165  loop
166  {
167  if (j > ende) return -1;
168 #if defined(PDEBUG) || defined(PDIV_DEBUG)
169  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
170  p, not_sev, currRing))
171  return j;
172 #else
173  if ( !(strat->sevS[j] & not_sev) &&
174  p_LmDivisibleBy(strat->S[j], p, currRing))
175  return j;
176 #endif
177  j++;
178  }
179 }
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:356
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
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart = LONG_MAX 
)

Definition at line 5267 of file kutil.cc.

5269 {
5270  int j = 0;
5271  const unsigned long not_sev = ~L->sev;
5272  const unsigned long* sev = strat->sevS;
5273  poly p;
5274  ring r;
5275  L->GetLm(p, r);
5276 
5277  assume(~not_sev == p_GetShortExpVector(p, r));
5278 
5279  if (r == currRing)
5280  {
5281  loop
5282  {
5283  if (j > pos) return NULL;
5284 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5285  if (p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
5286  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5287  break;
5288 #else
5289  if (!(sev[j] & not_sev) &&
5290  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
5291  p_LmDivisibleBy(strat->S[j], p, r))
5292  break;
5293 
5294 #endif
5295  j++;
5296  }
5297  // if called from NF, T objects do not exist:
5298  if (strat->tl < 0 || strat->S_2_R[j] == -1)
5299  {
5300  T->Set(strat->S[j], r, strat->tailRing);
5301  return T;
5302  }
5303  else
5304  {
5305 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
5306 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
5307 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
5308  return strat->S_2_T(j);
5309  }
5310  }
5311  else
5312  {
5313  TObject* t;
5314  loop
5315  {
5316  if (j > pos) return NULL;
5317  assume(strat->S_2_R[j] != -1);
5318 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5319  t = strat->S_2_T(j);
5320  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
5321  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
5322  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5323  return t;
5324 #else
5325  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5326  {
5327  t = strat->S_2_T(j);
5328  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
5329  if (p_LmDivisibleBy(t->t_p, p, r)) return t;
5330  }
5331 #endif
5332  j++;
5333  }
5334  }
5335 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:353
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
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#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:1707
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
unsigned long * sevS
Definition: kutil.h:320
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:57
int kFindDivisibleByInT ( const TSet T,
const unsigned long *  sevT,
const int  tl,
const LObject L,
const int  start = 0 
)

return -1 if no divisor is found number of first divisor in T, otherwise

Definition at line 101 of file kstd2.cc.

103 {
104  unsigned long not_sev = ~L->sev;
105  int j = start;
106  poly p=L->p;
107  ring r=currRing;
108  L->GetLm(p, r);
109 
110  pAssume(~not_sev == p_GetShortExpVector(p, r));
111 
112  if (r == currRing)
113  {
114  loop
115  {
116  if (j > tl) return -1;
117 #if defined(PDEBUG) || defined(PDIV_DEBUG)
118  if (p_LmShortDivisibleBy(T[j].p, sevT[j],
119  p, not_sev, r))
120  return j;
121 #else
122  if (!(sevT[j] & not_sev) &&
123  p_LmDivisibleBy(T[j].p, p, r))
124  return j;
125 #endif
126  j++;
127  }
128  }
129  else
130  {
131  loop
132  {
133  if (j > tl) return -1;
134 #if defined(PDEBUG) || defined(PDIV_DEBUG)
135  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
136  p, not_sev, r))
137  return j;
138 #else
139  if (!(sevT[j] & not_sev) &&
140  p_LmDivisibleBy(T[j].t_p, p, r))
141  return j;
142 #endif
143  j++;
144  }
145  }
146 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
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
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
static jList * T
Definition: janet.cc:37
int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 603 of file kutil.cc.

604 {
605  int i;
606 
607  for (i=0; i<=tlength; i++)
608  {
609  if (T[i].p == p) return i;
610  }
611  return -1;
612 }
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 181 of file kstd2.cc.

182 {
183  unsigned long not_sev = ~L->sev;
184  poly p = L->GetLmCurrRing();
185  int j = start;
186 
187  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
188 #if 1
189  int ende=max_ind;
190 #else
191  int ende=strat->sl;
192 #endif
193  loop
194  {
195  if (j > ende) return -1;
196 #if defined(PDEBUG) || defined(PDIV_DEBUG)
197  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
198  p, not_sev, currRing))
199  return j;
200 #else
201  if ( !(strat->sevS[j] & not_sev) &&
202  p_LmDivisibleBy(strat->S[j], p, currRing))
203  return j;
204 #endif
205  j++;
206  }
207 }
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
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
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
poly kFindZeroPoly ( poly  input_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 210 of file kstd2.cc.

211 {
212  // m = currRing->ch
213 
214  if (input_p == NULL) return NULL;
215 
216  poly p = input_p;
217  poly zeroPoly = NULL;
218  unsigned long a = (unsigned long) pGetCoeff(p);
219 
220  int k_ind2 = 0;
221  int a_ind2 = ind2(a);
222 
223  // unsigned long k = 1;
224  // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
225  for (int i = 1; i <= leadRing->N; i++)
226  {
227  k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
228  }
229 
230  a = (unsigned long) pGetCoeff(p);
231 
232  number tmp1;
233  poly tmp2, tmp3;
234  poly lead_mult = p_ISet(1, tailRing);
235  if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
236  {
237  int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
238  int s_exp;
239  zeroPoly = p_ISet(a, tailRing);
240  for (int i = 1; i <= leadRing->N; i++)
241  {
242  s_exp = p_GetExp(p, i,leadRing);
243  if (s_exp % 2 != 0)
244  {
245  s_exp = s_exp - 1;
246  }
247  while ( (0 < ind2(s_exp)) && (ind2(s_exp) <= too_much) )
248  {
249  too_much = too_much - ind2(s_exp);
250  s_exp = s_exp - 2;
251  }
252  p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
253  for (unsigned long j = 1; j <= s_exp; j++)
254  {
255  tmp1 = nInit(j);
256  tmp2 = p_ISet(1, tailRing);
257  p_SetExp(tmp2, i, 1, tailRing);
258  p_Setm(tmp2, tailRing);
259  if (nIsZero(tmp1))
260  { // should nowbe obsolet, test ! TODO OLIVER
261  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
262  }
263  else
264  {
265  tmp3 = p_NSet(nCopy(tmp1), tailRing);
266  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
267  }
268  }
269  }
270  p_Setm(lead_mult, tailRing);
271  zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
272  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
273  for (int i = 1; i <= leadRing->N; i++)
274  {
275  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
276  }
277  p_Setm(tmp2, leadRing);
278  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
279  pNext(tmp2) = zeroPoly;
280  return tmp2;
281  }
282 /* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
283  if (1 == 0 && alpha_k <= a)
284  { // Temporarly disabled, reducing coefficients not compatible with std TODO Oliver
285  zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
286  for (int i = 1; i <= leadRing->N; i++)
287  {
288  for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
289  {
290  tmp1 = nInit(j);
291  tmp2 = p_ISet(1, tailRing);
292  p_SetExp(tmp2, i, 1, tailRing);
293  p_Setm(tmp2, tailRing);
294  if (nIsZero(tmp1))
295  {
296  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
297  }
298  else
299  {
300  tmp3 = p_ISet((unsigned long) tmp1, tailRing);
301  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
302  }
303  }
304  }
305  tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
306  for (int i = 1; i <= leadRing->N; i++)
307  {
308  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
309  }
310  p_Setm(tmp2, leadRing);
311  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
312  pNext(tmp2) = zeroPoly;
313  return tmp2;
314  } */
315  return NULL;
316 }
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:444
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
polyrec * poly
Definition: hilb.h:10
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:3048
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:3036
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 2395 of file kstd2.cc.

2396 {
2397  assume(q!=NULL);
2398  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
2399 
2400 // lazy_reduce flags: can be combined by |
2401 //#define KSTD_NF_LAZY 1
2402  // do only a reduction of the leading term
2403 //#define KSTD_NF_NONORM 4
2404  // only global: avoid normalization, return a multiply of NF
2405  poly p;
2406 
2407  //if ((idIs0(F))&&(Q==NULL))
2408  // return pCopy(q); /*F=0*/
2409  //strat->ak = idRankFreeModule(F);
2410  /*- creating temp data structures------------------- -*/
2411  BITSET save1;
2412  SI_SAVE_OPT1(save1);
2414  initBuchMoraCrit(strat);
2415  strat->initEcart = initEcartBBA;
2416  strat->enterS = enterSBba;
2417 #ifndef NO_BUCKETS
2419 #endif
2420  /*- set S -*/
2421  strat->sl = -1;
2422  /*- init local data struct.---------------------------------------- -*/
2423  /*Shdl=*/initS(F,Q,strat);
2424  /*- compute------------------------------------------------------- -*/
2425  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
2426  //{
2427  // for (i=strat->sl;i>=0;i--)
2428  // pNorm(strat->S[i]);
2429  //}
2430  kTest(strat);
2431  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2432  if (BVERBOSE(23)) kDebugPrint(strat);
2433  int max_ind;
2434  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2435  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2436  {
2437  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2438  #ifdef HAVE_RINGS
2439  if (rField_is_Ring(currRing))
2440  {
2441  p = redtailBba_Z(p,max_ind,strat);
2442  }
2443  else
2444  #endif
2445  {
2447  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2448  }
2449  }
2450  /*- release temp data------------------------------- -*/
2451  assume(strat->L==NULL); /* strat->L unused */
2452  assume(strat->B==NULL); /* strat->B unused */
2453  omFree(strat->sevS);
2454  omFree(strat->ecartS);
2455  assume(strat->T==NULL);//omfree(strat->T);
2456  assume(strat->sevT==NULL);//omfree(strat->sevT);
2457  assume(strat->R==NULL);//omfree(strat->R);
2458  omfree(strat->S_2_R);
2459  omfree(strat->fromQ);
2460  idDelete(&strat->Shdl);
2461  SI_RESTORE_OPT1(save1);
2462  if (TEST_OPT_PROT) PrintLn();
2463  return p;
2464 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:322
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:615
unsigned long * sevT
Definition: kutil.h:323
#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:355
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:1189
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:42
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:5733
#define KSTD_NF_LAZY
Definition: kstd1.h:15
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
#define omfree(addr)
Definition: omAllocDecl.h:237
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
void PrintS(const char *s)
Definition: reporter.cc:294
TObject ** R
Definition: kutil.h:340
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define KSTD_NF_NONORM
Definition: kstd1.h:19
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
#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 2466 of file kstd2.cc.

2467 {
2468  assume(!idIs0(q));
2469  assume(!(idIs0(F)&&(Q==NULL)));
2470 // lazy_reduce flags: can be combined by |
2471 //#define KSTD_NF_LAZY 1
2472  // do only a reduction of the leading term
2473 //#define KSTD_NF_NONORM 4
2474  // only global: avoid normalization, return a multiply of NF
2475  poly p;
2476  int i;
2477  ideal res;
2478  int max_ind;
2479 
2480  //if (idIs0(q))
2481  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2482  //if ((idIs0(F))&&(Q==NULL))
2483  // return idCopy(q); /*F=0*/
2484  //strat->ak = idRankFreeModule(F);
2485  /*- creating temp data structures------------------- -*/
2486  BITSET save1;
2487  SI_SAVE_OPT1(save1);
2489  initBuchMoraCrit(strat);
2490  strat->initEcart = initEcartBBA;
2491  strat->enterS = enterSBba;
2492  /*- set S -*/
2493  strat->sl = -1;
2494 #ifndef NO_BUCKETS
2496 #endif
2497  /*- init local data struct.---------------------------------------- -*/
2498  /*Shdl=*/initS(F,Q,strat);
2499  /*- compute------------------------------------------------------- -*/
2500  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
2502  for (i=IDELEMS(q)-1; i>=0; i--)
2503  {
2504  if (q->m[i]!=NULL)
2505  {
2506  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
2507  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2508  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2509  {
2510  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2511  #ifdef HAVE_RINGS
2512  if (rField_is_Ring(currRing))
2513  {
2514  p = redtailBba_Z(p,max_ind,strat);
2515  }
2516  else
2517  #endif
2518  {
2519  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2520  }
2521  }
2522  res->m[i]=p;
2523  }
2524  //else
2525  // res->m[i]=NULL;
2526  }
2527  /*- release temp data------------------------------- -*/
2528  assume(strat->L==NULL); /* strat->L unused */
2529  assume(strat->B==NULL); /* strat->B unused */
2530  omFree(strat->sevS);
2531  omFree(strat->ecartS);
2532  assume(strat->T==NULL);//omfree(strat->T);
2533  assume(strat->sevT==NULL);//omfree(strat->sevT);
2534  assume(strat->R==NULL);//omfree(strat->R);
2535  omfree(strat->S_2_R);
2536  omfree(strat->fromQ);
2537  idDelete(&strat->Shdl);
2538  SI_RESTORE_OPT1(save1);
2539  if (TEST_OPT_PROT) PrintLn();
2540  return res;
2541 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:322
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
int & max_ind
Definition: myNF.cc:67
unsigned long * sevT
Definition: kutil.h:323
#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:355
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:1189
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:42
poly res
Definition: myNF.cc:322
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:5733
#define KSTD_NF_LAZY
Definition: kstd1.h:15
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
#define omfree(addr)
Definition: omAllocDecl.h:237
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
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:340
#define IDELEMS(i)
Definition: simpleideals.h:19
#define OPT_INTSTRATEGY
Definition: options.h:87
#define KSTD_NF_NONORM
Definition: kstd1.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
poly ksCreateShortSpoly ( poly  p1,
poly  p2,
ring  tailRing 
)

Definition at line 563 of file kspoly.cc.

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

379 {
380 #ifdef KDEBUG
381  create_count++;
382 #endif
383  kTest_L(Pair);
384  poly p1 = Pair->p1;
385  poly p2 = Pair->p2;
386  Pair->tailRing = tailRing;
387 
388  assume(p1 != NULL);
389  assume(p2 != NULL);
390  assume(tailRing != NULL);
391 
392  poly a1 = pNext(p1), a2 = pNext(p2);
393  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
394  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
395  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
396 
397  int l1=0, l2=0;
398 
399  if (p_GetComp(p1, currRing)!=p_GetComp(p2, currRing))
400  {
401  if (p_GetComp(p1, currRing)==0)
402  {
403  co=1;
405  }
406  else
407  {
408  co=2;
410  }
411  }
412 
413  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
414  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
415  if (m1 == NULL)
416  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
417 
418  pSetCoeff0(m1, lc2);
419  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
420 
421  if (R != NULL)
422  {
423  if (Pair->i_r1 == -1)
424  {
425  l1 = pLength(p1) - 1;
426  }
427  else
428  {
429  l1 = (R[Pair->i_r1])->GetpLength() - 1;
430  }
431  if (Pair->i_r2 == -1)
432  {
433  l2 = pLength(p2) - 1;
434  }
435  else
436  {
437  l2 = (R[Pair->i_r2])->GetpLength() - 1;
438  }
439  }
440 
441  // get m2 * a2
442  if (spNoether != NULL)
443  {
444  l2 = -1;
445  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
446  assume(l2 == pLength(a2));
447  }
448  else
449  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
450 #ifdef HAVE_RINGS
451  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
452 #endif
453 
454  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
455 
456  // get m2*a2 - m1*a1
457  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
458 
459  // Clean-up time
460  Pair->LmDeleteAndIter();
461  p_LmDelete(m1, tailRing);
462 
463  if (co != 0)
464  {
465  if (co==1)
466  {
467  p_SetCompP(p1,0, currRing, tailRing);
468  }
469  else
470  {
471  p_SetCompP(p2,0, currRing, tailRing);
472  }
473  }
474 
475  // the following is commented out: shrinking
476 #ifdef HAVE_SHIFTBBA_NONEXISTENT
477  if (currRing->isLPring)
478  {
479  // assume? h->p in currRing
480  Pair->GetP();
481  poly qq = p_Shrink(Pair->p, currRing->isLPring, currRing);
482  Pair->Clear(); // does the right things
483  Pair->p = qq;
484  Pair->t_p = NULL;
485  Pair->SetShortExpVector();
486  }
487 #endif
488 
489 }
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:431
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:509
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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:619
#define NULL
Definition: omList.c:10
int create_count
Definition: kspoly.cc:27
#define R
Definition: sirandom.c:26
#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
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:58
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:376
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:58
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:57
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:58
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:57
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:58
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:57
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  }
52 #endif
53 #endif
54  int ret = 0;
55  ring tailRing = PR->tailRing;
56  kTest_L(PR);
57  kTest_T(PW);
58 
59  poly p1 = PR->GetLmTailRing(); // p2 | p1
60  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
61  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
62  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
63  p_CheckPolyRing(p1, tailRing);
64  p_CheckPolyRing(p2, tailRing);
65 
66  pAssume1(p2 != NULL && p1 != NULL &&
67  p_DivisibleBy(p2, p1, tailRing));
68 
69  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
70  (p_GetComp(p2, tailRing) == 0 &&
71  p_MaxComp(pNext(p2),tailRing) == 0));
72 
73 #ifdef HAVE_PLURAL
75  {
76  // for the time being: we know currRing==strat->tailRing
77  // no exp-bound checking needed
78  // (only needed if exp-bound(tailring)<exp-b(currRing))
79  if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef);
80  else
81  {
82  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
83  assume(_p != NULL);
84  nc_PolyPolyRed(_p, p2,coef, currRing);
85  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
86  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
87  }
88  return 0;
89  }
90 #endif
91 
92  if (t2==NULL) // Divisor is just one term, therefore it will
93  { // just cancel the leading term
94  PR->LmDeleteAndIter();
95  if (coef != NULL) *coef = n_Init(1, tailRing);
96  return 0;
97  }
98 
99  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
100 
101  if (tailRing != currRing)
102  {
103  // check that reduction does not violate exp bound
104  while (PW->max != NULL && !p_LmExpVectorAddIsOk(lm, PW->max, tailRing))
105  {
106  // undo changes of lm
107  p_ExpVectorAdd(lm, p2, tailRing);
108  if (strat == NULL) return 2;
109  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
110  tailRing = strat->tailRing;
111  p1 = PR->GetLmTailRing();
112  p2 = PW->GetLmTailRing();
113  t2 = pNext(p2);
114  lm = p1;
115  p_ExpVectorSub(lm, p2, tailRing);
116  ret = 1;
117  }
118  }
119 
120  // take care of coef buisness
121  if (! n_IsOne(pGetCoeff(p2), tailRing))
122  {
123  number bn = pGetCoeff(lm);
124  number an = pGetCoeff(p2);
125  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
126  p_SetCoeff(lm, bn, tailRing);
127  if ((ct == 0) || (ct == 2))
128  PR->Tail_Mult_nn(an);
129  if (coef != NULL) *coef = an;
130  else n_Delete(&an, tailRing);
131  }
132  else
133  {
134  if (coef != NULL) *coef = n_Init(1, tailRing);
135  }
136 
137 
138  // and finally,
139  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
140  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
141  PR->LmDeleteAndIter();
142 
143  // the following is commented out: shrinking
144 #ifdef HAVE_SHIFTBBA_NONEXISTENT
145  if ( (currRing->isLPring) && (!strat->homog) )
146  {
147  // assume? h->p in currRing
148  PR->GetP();
149  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
150  PR->Clear(); // does the right things
151  PR->p = qq;
152  PR->t_p = NULL;
153  PR->SetShortExpVector();
154  }
155 #endif
156 
157 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
158  if (TEST_OPT_DEBUG)
159  {
160  Print(" to: "); PR->wrp(); Print("\n");
161  }
162 #endif
163  return ret;
164 }
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:2282
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#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:1818
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:537
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:355
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:509
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:366
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:619
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1682
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
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:343
#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 'p'
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:617
#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 172 of file kspoly.cc.

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

492 {
493  BOOLEAN ret;
494  number coef;
495  poly Lp = PR->GetLmCurrRing();
496  poly Save = PW->GetLmCurrRing();
497 
498  kTest_L(PR);
499  kTest_T(PW);
500  pAssume(pIsMonomOf(Lp, Current));
501 
502  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
503  assume(PR->bucket == NULL);
504 
505  LObject Red(pNext(Current), PR->tailRing);
506  TObject With(PW, Lp == Save);
507 
508  pAssume(!pHaveCommonMonoms(Red.p, With.p));
509  ret = ksReducePoly(&Red, &With, spNoether, &coef);
510 
511  if (!ret)
512  {
513  if (! n_IsOne(coef, currRing))
514  {
515  pNext(Current) = NULL;
516  if (Current == PR->p && PR->t_p != NULL)
517  pNext(PR->t_p) = NULL;
518  PR->Mult_nn(coef);
519  }
520 
521  n_Delete(&coef, currRing);
522  pNext(Current) = Red.GetLmTailRing();
523  if (Current == PR->p && PR->t_p != NULL)
524  pNext(PR->t_p) = pNext(Current);
525  }
526 
527  if (Lp == Save)
528  With.Delete();
529 
530  // the following is commented out: shrinking
531 #ifdef HAVE_SHIFTBBA_NONEXISTENT
532  if (currRing->isLPring)
533  {
534  // assume? h->p in currRing
535  PR->GetP();
536  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
537  PR->Clear(); // does the right things
538  PR->p = qq;
539  PR->t_p = NULL;
540  PR->SetShortExpVector();
541  }
542 #endif
543 
544  return ret;
545 }
class sLObject LObject
Definition: kutil.h:58
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#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:509
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:619
#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 'p'
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:617
int BOOLEAN
Definition: auxiliary.h:131
class sTObject TObject
Definition: kutil.h:57
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 'n' represents the one element.
Definition: coeffs.h:468
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 'p'
Definition: coeffs.h:455
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN kStratChangeTailRing ( kStrategy  strat,
LObject L = NULL,
TObject T = NULL,
unsigned long  new_expbound = 0 
)

Definition at line 8231 of file kutil.cc.

8232 {
8233  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask < currRing->bitmask));
8234  /* initial setup or extending */
8235 
8236  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
8237  if (expbound >= currRing->bitmask) return FALSE;
8238  strat->overflow=FALSE;
8239  ring new_tailRing = rModifyRing(currRing,
8240  // Hmmm .. the condition pFDeg == p_Deg
8241  // might be too strong
8242 #ifdef HAVE_RINGS
8243  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver
8244 #else
8245  (strat->homog && currRing->pFDeg == p_Deg), // omit_degree
8246 #endif
8247  (strat->ak==0), // omit_comp if the input is an ideal
8248  expbound); // exp_limit
8249 
8250  if (new_tailRing == currRing) return TRUE;
8251 
8252  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
8253  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
8254 
8255  if (currRing->pFDeg != currRing->pFDegOrig)
8256  {
8257  new_tailRing->pFDeg = currRing->pFDeg;
8258  new_tailRing->pLDeg = currRing->pLDeg;
8259  }
8260 
8261  if (TEST_OPT_PROT)
8262  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
8263  kTest_TS(strat);
8264  assume(new_tailRing != strat->tailRing);
8265  pShallowCopyDeleteProc p_shallow_copy_delete
8266  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
8267 
8268  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
8269 
8270  int i;
8271  for (i=0; i<=strat->tl; i++)
8272  {
8273  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
8274  p_shallow_copy_delete);
8275  }
8276  for (i=0; i<=strat->Ll; i++)
8277  {
8278  assume(strat->L[i].p != NULL);
8279  if (pNext(strat->L[i].p) != strat->tail)
8280  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8281  }
8282  if ((strat->P.t_p != NULL) ||
8283  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
8284  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8285 
8286  if ((L != NULL) && (L->tailRing != new_tailRing))
8287  {
8288  if (L->i_r < 0)
8289  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8290  else
8291  {
8292  assume(L->i_r <= strat->tl);
8293  TObject* t_l = strat->R[L->i_r];
8294  assume(t_l != NULL);
8295  L->tailRing = new_tailRing;
8296  L->p = t_l->p;
8297  L->t_p = t_l->t_p;
8298  L->max = t_l->max;
8299  }
8300  }
8301 
8302  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
8303  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
8304 
8305  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
8306  if (strat->tailRing != currRing)
8307  rKillModifiedRing(strat->tailRing);
8308 
8309  strat->tailRing = new_tailRing;
8310  strat->tailBin = new_tailBin;
8311  strat->p_shallow_copy_delete
8312  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
8313 
8314  if (strat->kHEdge != NULL)
8315  {
8316  if (strat->t_kHEdge != NULL)
8317  p_LmFree(strat->t_kHEdge, strat->tailRing);
8318  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
8319  }
8320 
8321  if (strat->kNoether != NULL)
8322  {
8323  if (strat->t_kNoether != NULL)
8324  p_LmFree(strat->t_kNoether, strat->tailRing);
8326  new_tailRing);
8327  }
8328  kTest_TS(strat);
8329  if (TEST_OPT_PROT)
8330  PrintS("]");
8331  return TRUE;
8332 }
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:327
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:298
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2557
#define TRUE
Definition: auxiliary.h:144
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:338
int ak
Definition: kutil.h:356
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:366
#define kTest_TS(A)
Definition: kutil.h:616
#define assume(x)
Definition: mod2.h:405
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:329
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:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
poly t_kNoether
Definition: kutil.h:331
omBin tailBin
Definition: kutil.h:345
char overflow
Definition: kutil.h:399
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2923
TSet T
Definition: kutil.h:324
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:57
void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 8334 of file kutil.cc.

8335 {
8336  unsigned long l = 0;
8337  int i;
8338  long e;
8339 
8340  assume(strat->tailRing == currRing);
8341 
8342  for (i=0; i<= strat->Ll; i++)
8343  {
8344  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
8345  }
8346  for (i=0; i<=strat->tl; i++)
8347  {
8348  // Hmm ... this we could do in one Step
8349  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
8350  }
8351  if (rField_is_Ring(currRing))
8352  {
8353  l *= 2;
8354  }
8355  e = p_GetMaxExp(l, currRing);
8356  if (e <= 1) e = 2;
8357 
8358  kStratChangeTailRing(strat, NULL, NULL, e);
8359 }
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:354
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:743
int tl
Definition: kutil.h:353
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:8231
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
TSet T
Definition: kutil.h:324
int l
Definition: cfEzgcd.cc:94
void message ( int  i,
int reduc,
int olddeg,
kStrategy  strat,
int  red_result 
)

Definition at line 5628 of file kutil.cc.

5629 {
5630  if (i != *olddeg)
5631  {
5632  Print("%d",i);
5633  *olddeg = i;
5634  }
5635  if (TEST_OPT_OLDSTD)
5636  {
5637  if (strat->Ll != *reduc)
5638  {
5639  if (strat->Ll != *reduc-1)
5640  Print("(%d)",strat->Ll+1);
5641  else
5642  PrintS("-");
5643  *reduc = strat->Ll;
5644  }
5645  else
5646  PrintS(".");
5647  mflush();
5648  }
5649  else
5650  {
5651  if (red_result == 0)
5652  PrintS("-");
5653  else if (red_result < 0)
5654  PrintS(".");
5655  if ((red_result > 0) || ((strat->Ll % 100)==99))
5656  {
5657  if (strat->Ll != *reduc && strat->Ll > 0)
5658  {
5659  Print("(%d)",strat->Ll+1);
5660  *reduc = strat->Ll;
5661  }
5662  }
5663  }
5664 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:354
#define mflush()
Definition: reporter.h:42
#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 5669 of file kutil.cc.

5670 {
5671  //PrintS("\nUsage/Allocation of temporary storage:\n");
5672  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
5673  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
5674  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
5675  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
5676  /* in usual case strat->cv is 0, it gets changed only in shift routines */
5677  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
5678  /*mflush();*/
5679 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:349
int cv
Definition: kutil.h:350
int cp
Definition: kutil.h:349
BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 8113 of file kutil.cc.

8114 {
8115  int i,j;
8116  poly newNoether;
8117 
8118 #if 0
8119  if (currRing->weight_all_1)
8120  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8121  else
8122  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8123 #else
8124  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8125 #endif
8126  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
8127  if (strat->tailRing != currRing)
8128  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
8129  /* compare old and new noether*/
8130  newNoether = pLmInit(strat->kHEdge);
8131  j = p_FDeg(newNoether,currRing);
8132 /* #ifdef HAVE_RINGS
8133  if (!rField_is_Ring(currRing))
8134  #endif */
8135  for (i=1; i<=(currRing->N); i++)
8136  {
8137  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
8138  }
8139  pSetm(newNoether);
8140  if (j < strat->HCord) /*- statistics -*/
8141  {
8142  if (TEST_OPT_PROT)
8143  {
8144  Print("H(%d)",j);
8145  mflush();
8146  }
8147  strat->HCord=j;
8148  #ifdef KDEBUG
8149  if (TEST_OPT_DEBUG)
8150  {
8151  Print("H(%d):",j);
8152  wrp(strat->kHEdge);
8153  PrintLn();
8154  }
8155  #endif
8156  }
8157  if (pCmp(strat->kNoether,newNoether)!=1)
8158  {
8159  pDelete(&strat->kNoether);
8160  strat->kNoether=newNoether;
8161  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
8162  if (strat->tailRing != currRing)
8163  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
8164 
8165  return TRUE;
8166  }
8167  pLmFree(newNoether);
8168  return FALSE;
8169 }
#define pSetm(p)
Definition: polys.h:241
int HCord
Definition: kutil.cc:227
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:327
#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:328
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:999
#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:356
#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:358
#define mflush()
Definition: reporter.h:42
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
polyrec * poly
Definition: hilb.h:10
#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
poly t_kHEdge
Definition: kutil.h:329
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
poly t_kNoether
Definition: kutil.h:331
#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
ideal Shdl
Definition: kutil.h:301
void pairs ( )
poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 8928 of file kutil.cc.

8929 {
8930  /* restores a poly in currRing from LObject */
8931  LObject h = H;
8932  h.Copy();
8933  poly p;
8934  if (h.p == NULL)
8935  {
8936  if (h.t_p != NULL)
8937  {
8938  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
8939  return(p);
8940  }
8941  else
8942  {
8943  /* h.tp == NULL -> the object is NULL */
8944  return(NULL);
8945  }
8946  }
8947  /* we're here if h.p != NULL */
8948  if (h.t_p == NULL)
8949  {
8950  /* then h.p is the whole poly in currRing */
8951  p = h.p;
8952  return(p);
8953  }
8954  /* we're here if h.p != NULL and h.t_p != NULL */
8955  // clean h.p, get poly from t_p
8956  pNext(h.p)=NULL;
8957  pDelete(&h.p);
8958  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
8959  /* dest. ring: */ currRing);
8960  // no need to clean h: we re-used the polys
8961  return(p);
8962 }
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
static Poly * h
Definition: janet.cc:978
poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 8897 of file kutil.cc.

8898 {
8899  /* assume: p is completely in currRing */
8900  /* produces an object with LM in curring
8901  and TAIL in tailring */
8902  if (pNext(p)!=NULL)
8903  {
8904  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
8905  }
8906  return(p);
8907 }
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
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:343
#define pNext(p)
Definition: monomials.h:43
poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 8911 of file kutil.cc.

8912 {
8913  /* assume: p has LM in curring and TAIL in tailring */
8914  /* convert it to complete currRing */
8915 
8916  /* check that LM is in currRing */
8918 
8919  if (pNext(p)!=NULL)
8920  {
8921  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
8922  }
8923  return(p);
8924 }
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:90
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:343
#define pNext(p)
Definition: monomials.h:43
int posInL0 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4568 of file kutil.cc.

4570 {
4571  if (length<0) return 0;
4572 
4573  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
4574  return length+1;
4575 
4576  int i;
4577  int an = 0;
4578  int en= length;
4579  loop
4580  {
4581  if (an >= en-1)
4582  {
4583  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
4584  return an;
4585  }
4586  i=(an+en) / 2;
4587  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
4588  else en=i;
4589  /*aend. fuer lazy == in !=- machen */
4590  }
4591 }
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
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 947 of file kstd1.cc.

948 {
949  int j,dp,dL;
950 
951  if (length<0) return 0;
952  if (hasPurePower(p,strat->lastAxis,&dp,strat))
953  {
954  int op= p->GetpFDeg() +p->ecart;
955  for (j=length; j>=0; j--)
956  {
957  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
958  return j+1;
959  if (dp < dL)
960  return j+1;
961  if ((dp == dL)
962  && (set[j].GetpFDeg()+set[j].ecart >= op))
963  return j+1;
964  }
965  }
966  j=length;
967  loop
968  {
969  if (j<0) break;
970  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
971  j--;
972  }
973  return strat->posInLOld(set,j,p,strat);
974 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int lastAxis
Definition: kutil.h:359
int j
Definition: myNF.cc:70
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:287
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:899
int posInL11 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4664 of file kutil.cc.

4683 {
4684  if (length<0) return 0;
4685 
4686  int o = p->GetpFDeg();
4687  int op = set[length].GetpFDeg();
4688 
4689  if ((op > o)
4690  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4691  return length+1;
4692  int i;
4693  int an = 0;
4694  int en= length;
4695  loop
4696  {
4697  if (an >= en-1)
4698  {
4699  op = set[an].GetpFDeg();
4700  if ((op > o)
4701  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4702  return en;
4703  return an;
4704  }
4705  i=(an+en) / 2;
4706  op = set[i].GetpFDeg();
4707  if ((op > o)
4708  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4709  an=i;
4710  else
4711  en=i;
4712  }
4713 }
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
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 4818 of file kutil.cc.

4820 {
4821  if (length<0) return 0;
4822 
4823  int o = p->GetpFDeg();
4824  int op = set[length].GetpFDeg();
4825 
4826  if ((op > o)
4827  || ((op == o) && (set[length].length >p->length))
4828  || ((op == o) && (set[length].length <= p->length)
4829  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4830  return length+1;
4831  int i;
4832  int an = 0;
4833  int en= length;
4834  loop
4835  {
4836  if (an >= en-1)
4837  {
4838  op = set[an].GetpFDeg();
4839  if ((op > o)
4840  || ((op == o) && (set[an].length >p->length))
4841  || ((op == o) && (set[an].length <=p->length)
4842  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4843  return en;
4844  return an;
4845  }
4846  i=(an+en) / 2;
4847  op = set[i].GetpFDeg();
4848  if ((op > o)
4849  || ((op == o) && (set[i].length > p->length))
4850  || ((op == o) && (set[i].length <= p->length)
4851  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4852  an=i;
4853  else
4854  en=i;
4855  }
4856 }
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
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 posInL13 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4864 of file kutil.cc.

4866 {
4867  if (length<0) return 0;
4868 
4869  int o = p->GetpFDeg();
4870 
4871  if (set[length].GetpFDeg() > o)
4872  return length+1;
4873 
4874  int i;
4875  int an = 0;
4876  int en= length;
4877  loop
4878  {
4879  if (an >= en-1)
4880  {
4881  if (set[an].GetpFDeg() >= o)
4882  return en;
4883  return an;
4884  }
4885  i=(an+en) / 2;
4886  if (set[i].GetpFDeg() >= o)
4887  an=i;
4888  else
4889  en=i;
4890  }
4891 }
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 4899 of file kutil.cc.

4919 {
4920  if (length<0) return 0;
4921 
4922  int o = p->GetpFDeg() + p->ecart;
4923  int op = set[length].GetpFDeg() + set[length].ecart;
4924 
4925  if ((op > o)
4926  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4927  return length+1;
4928  int i;
4929  int an = 0;
4930  int en= length;
4931  loop
4932  {
4933  if (an >= en-1)
4934  {
4935  op = set[an].GetpFDeg() + set[an].ecart;
4936  if ((op > o)
4937  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4938  return en;
4939  return an;
4940  }
4941  i=(an+en) / 2;
4942  op = set[i].GetpFDeg() + set[i].ecart;
4943  if ((op > o)
4944  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4945  an=i;
4946  else
4947  en=i;
4948  }
4949 }
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
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 4957 of file kutil.cc.

4959 {
4960  if (length<0) return 0;
4961 
4962  int o = p->GetpFDeg() + p->ecart;
4963 
4964  if ((set[length].GetpFDeg() + set[length].ecart > o)
4965  || ((set[length].GetpFDeg() + set[length].ecart == o)
4966  && (set[length].ecart > p->ecart))
4967  || ((set[length].GetpFDeg() + set[length].ecart == o)
4968  && (set[length].ecart == p->ecart)
4969  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4970  return length+1;
4971  int i;
4972  int an = 0;
4973  int en= length;
4974  loop
4975  {
4976  if (an >= en-1)
4977  {
4978  if ((set[an].GetpFDeg() + set[an].ecart > o)
4979  || ((set[an].GetpFDeg() + set[an].ecart == o)
4980  && (set[an].ecart > p->ecart))
4981  || ((set[an].GetpFDeg() + set[an].ecart == o)
4982  && (set[an].ecart == p->ecart)
4983  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4984  return en;
4985  return an;
4986  }
4987  i=(an+en) / 2;
4988  if ((set[i].GetpFDeg() + set[i].ecart > o)
4989  || ((set[i].GetpFDeg() + set[i].ecart == o)
4990  && (set[i].ecart > p->ecart))
4991  || ((set[i].GetpFDeg() +set[i].ecart == o)
4992  && (set[i].ecart == p->ecart)
4993  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4994  an=i;
4995  else
4996  en=i;
4997  }
4998 }
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
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 4652 of file kutil.cc.

4654 {
4655  return strat->Ll+1;
4656 }
int Ll
Definition: kutil.h:354
int posInLSig ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4599 of file kutil.cc.

4601 {
4602 if (length<0) return 0;
4603 if (pLmCmp(set[length].sig,p->sig)== currRing->OrdSgn)
4604  return length+1;
4605 
4606 int i;
4607 int an = 0;
4608 int en= length;
4609 loop
4610 {
4611  if (an >= en-1)
4612  {
4613  if (pLmCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
4614  return an;
4615  }
4616  i=(an+en) / 2;
4617  if (pLmCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
4618  else en=i;
4619  /*aend. fuer lazy == in !=- machen */
4620 }
4621 }
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
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 3860 of file kutil.cc.

3862 {
3863  if(length==-1) return 0;
3864  polyset set=strat->S;
3865  int i;
3866  int an = 0;
3867  int en = length;
3868  int cmp_int = currRing->OrdSgn;
3869  if ((currRing->MixedOrder)
3870 #ifdef HAVE_PLURAL
3871  && (currRing->real_var_start==0)
3872 #endif
3873 #if 0
3874  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
3875 #endif
3876  )
3877  {
3878  int o=p_Deg(p,currRing);
3879  int oo=p_Deg(set[length],currRing);
3880 
3881  if ((oo<o)
3882  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
3883  return length+1;
3884 
3885  loop
3886  {
3887  if (an >= en-1)
3888  {
3889  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
3890  {
3891  return an;
3892  }
3893  return en;
3894  }
3895  i=(an+en) / 2;
3896  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
3897  else an=i;
3898  }
3899  }
3900  else
3901  {
3902 #ifdef HAVE_RINGS
3903  if (rField_is_Ring(currRing))
3904  {
3905  if (pLmCmp(set[length],p)== -cmp_int)
3906  return length+1;
3907  int cmp;
3908  loop
3909  {
3910  if (an >= en-1)
3911  {
3912  cmp = pLmCmp(set[an],p);
3913  if (cmp == cmp_int) return an;
3914  if (cmp == -cmp_int) return en;
3915  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
3916  return an;
3917  }
3918  i = (an+en) / 2;
3919  cmp = pLmCmp(set[i],p);
3920  if (cmp == cmp_int) en = i;
3921  else if (cmp == -cmp_int) an = i;
3922  else
3923  {
3924  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
3925  else en = i;
3926  }
3927  }
3928  }
3929  else
3930 #endif
3931  if (pLmCmp(set[length],p)== -cmp_int)
3932  return length+1;
3933 
3934  loop
3935  {
3936  if (an >= en-1)
3937  {
3938  if (pLmCmp(set[an],p) == cmp_int) return an;
3939  if (pLmCmp(set[an],p) == -cmp_int) return en;
3940  if ((cmp_int!=1)
3941  && ((strat->ecartS[an])>ecart_p))
3942  return an;
3943  return en;
3944  }
3945  i=(an+en) / 2;
3946  if (pLmCmp(set[i],p) == cmp_int) en=i;
3947  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
3948  else
3949  {
3950  if ((cmp_int!=1)
3951  &&((strat->ecartS[i])<ecart_p))
3952  en=i;
3953  else
3954  an=i;
3955  }
3956  }
3957  }
3958 }
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
Definition: polys.h:105
int ak
Definition: kutil.h:356
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 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset ecartS
Definition: kutil.h:307
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
poly * polyset
Definition: hutil.h:17
int posInSyz ( const kStrategy  strat,
const poly  sig 
)

Definition at line 4624 of file kutil.cc.

4625 {
4626 if (strat->syzl==0) return 0;
4627 if (pLmCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
4628  return strat->syzl;
4629 int i;
4630 int an = 0;
4631 int en= strat->syzl-1;
4632 loop
4633 {
4634  if (an >= en-1)
4635  {
4636  if (pLmCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
4637  return an;
4638  }
4639  i=(an+en) / 2;
4640  if (pLmCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
4641  else en=i;
4642  /*aend. fuer lazy == in !=- machen */
4643 }
4644 }
loop
Definition: myNF.cc:98
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
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:305
int syzl
Definition: kutil.h:352
int posInT0 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 3965 of file kutil.cc.

3966 {
3967  return (length+1);
3968 }
int posInT1 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 3976 of file kutil.cc.

3977 {
3978  if (length==-1) return 0;
3979 
3980  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
3981 
3982  int i;
3983  int an = 0;
3984  int en= length;
3985 
3986  loop
3987  {
3988  if (an >= en-1)
3989  {
3990  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
3991  return en;
3992  }
3993  i=(an+en) / 2;
3994  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
3995  else an=i;
3996  }
3997 }
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
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 4034 of file kutil.cc.

4052 {
4053  if (length==-1) return 0;
4054 
4055  int o = p.GetpFDeg();
4056  int op = set[length].GetpFDeg();
4057 
4058  if ((op < o)
4059  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4060  return length+1;
4061 
4062  int i;
4063  int an = 0;
4064  int en= length;
4065 
4066  loop
4067  {
4068  if (an >= en-1)
4069  {
4070  op= set[an].GetpFDeg();
4071  if ((op > o)
4072  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4073  return an;
4074  return en;
4075  }
4076  i=(an+en) / 2;
4077  op = set[i].GetpFDeg();
4078  if (( op > o)
4079  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4080  en=i;
4081  else
4082  an=i;
4083  }
4084 }
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
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 4167 of file kutil.cc.

4168 {
4169  p.GetpLength();
4170  if (length==-1) return 0;
4171 
4172  int o = p.GetpFDeg();
4173  int op = set[length].GetpFDeg();
4174 
4175  if (( op < o)
4176  || (( op == o) && (set[length].length<p.length))
4177  || (( op == o) && (set[length].length == p.length)
4178  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4179  return length+1;
4180 
4181  int i;
4182  int an = 0;
4183  int en= length;
4184  loop
4185  {
4186  if (an >= en-1)
4187  {
4188  op = set[an].GetpFDeg();
4189  if (( op > o)
4190  || (( op == o) && (set[an].length > p.length))
4191  || (( op == o) && (set[an].length == p.length)
4192  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4193  return an;
4194  return en;
4195  }
4196  i=(an+en) / 2;
4197  op = set[i].GetpFDeg();
4198  if (( op > o)
4199  || (( op == o) && (set[i].length > p.length))
4200  || (( op == o) && (set[i].length == p.length)
4201  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4202  en=i;
4203  else
4204  an=i;
4205  }
4206 }
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
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 4213 of file kutil.cc.

4214 {
4215  if (length==-1) return 0;
4216 
4217  int o = p.GetpFDeg();
4218 
4219  if (set[length].GetpFDeg() <= o)
4220  return length+1;
4221 
4222  int i;
4223  int an = 0;
4224  int en= length;
4225  loop
4226  {
4227  if (an >= en-1)
4228  {
4229  if (set[an].GetpFDeg() > o)
4230  return an;
4231  return en;
4232  }
4233  i=(an+en) / 2;
4234  if (set[i].GetpFDeg() > o)
4235  en=i;
4236  else
4237  an=i;
4238  }
4239 }
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 4281 of file kutil.cc.

4300 {
4301  if (length==-1) return 0;
4302 
4303  int o = p.GetpFDeg() + p.ecart;
4304  int op = set[length].GetpFDeg()+set[length].ecart;
4305 
4306  if ((op < o)
4307  || ((op == o)
4308  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4309  return length+1;
4310 
4311  int i;
4312  int an = 0;
4313  int en= length;
4314  loop
4315  {
4316  if (an >= en-1)
4317  {
4318  op = set[an].GetpFDeg()+set[an].ecart;
4319  if (( op > o)
4320  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4321  return an;
4322  return en;
4323  }
4324  i=(an+en) / 2;
4325  op = set[i].GetpFDeg()+set[i].ecart;
4326  if (( op > o)
4327  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4328  en=i;
4329  else
4330  an=i;
4331  }
4332 }
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
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 4339 of file kutil.cc.

4360 {
4361  if (length==-1) return 0;
4362 
4363  int o = p.GetpFDeg() + p.ecart;
4364  int op = set[length].GetpFDeg()+set[length].ecart;
4365 
4366  if ((op < o)
4367  || (( op == o) && (set[length].ecart > p.ecart))
4368  || (( op == o) && (set[length].ecart==p.ecart)
4369  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4370  return length+1;
4371 
4372  int i;
4373  int an = 0;
4374  int en= length;
4375  loop
4376  {
4377  if (an >= en-1)
4378  {
4379  op = set[an].GetpFDeg()+set[an].ecart;
4380  if (( op > o)
4381  || (( op == o) && (set[an].ecart < p.ecart))
4382  || (( op == o) && (set[an].ecart==p.ecart)
4383  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4384  return an;
4385  return en;
4386  }
4387  i=(an+en) / 2;
4388  op = set[i].GetpFDeg()+set[i].ecart;
4389  if ((op > o)
4390  || (( op == o) && (set[i].ecart < p.ecart))
4391  || (( op == o) && (set[i].ecart == p.ecart)
4392  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4393  en=i;
4394  else
4395  an=i;
4396  }
4397 }
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
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 4468 of file kutil.cc.

4469 {
4470  p.GetpLength();
4471  if (length==-1) return 0;
4472 
4473  int o = p.ecart;
4474  int op=p.GetpFDeg();
4475 
4476  if (set[length].ecart < o)
4477  return length+1;
4478  if (set[length].ecart == o)
4479  {
4480  int oo=set[length].GetpFDeg();
4481  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
4482  return length+1;
4483  }
4484 
4485  int i;
4486  int an = 0;
4487  int en= length;
4488  loop
4489  {
4490  if (an >= en-1)
4491  {
4492  if (set[an].ecart > o)
4493  return an;
4494  if (set[an].ecart == o)
4495  {
4496  int oo=set[an].GetpFDeg();
4497  if((oo > op)
4498  || ((oo==op) && (set[an].length > p.length)))
4499  return an;
4500  }
4501  return en;
4502  }
4503  i=(an+en) / 2;
4504  if (set[i].ecart > o)
4505  en=i;
4506  else if (set[i].ecart == o)
4507  {
4508  int oo=set[i].GetpFDeg();
4509  if ((oo > op)
4510  || ((oo == op) && (set[i].length > p.length)))
4511  en=i;
4512  else
4513  an=i;
4514  }
4515  else
4516  an=i;
4517  }
4518 }
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 4004 of file kutil.cc.

4005 {
4006  p.GetpLength();
4007  if (length==-1)
4008  return 0;
4009  if (set[length].length<p.length)
4010  return length+1;
4011 
4012  int i;
4013  int an = 0;
4014  int en= length;
4015 
4016  loop
4017  {
4018  if (an >= en-1)
4019  {
4020  if (set[an].length>p.length) return an;
4021  return en;
4022  }
4023  i=(an+en) / 2;
4024  if (set[i].length>p.length) en=i;
4025  else an=i;
4026  }
4027 }
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 4242 of file kutil.cc.

4243 {
4244  int ol = p.GetpLength();
4245  if (length==-1) return 0;
4246 
4247  int op=p.ecart;
4248 
4249  int oo=set[length].ecart;
4250  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
4251  return length+1;
4252 
4253  int i;
4254  int an = 0;
4255  int en= length;
4256  loop
4257  {
4258  if (an >= en-1)
4259  {
4260  int oo=set[an].ecart;
4261  if((oo > op)
4262  || ((oo==op) && (set[an].pLength > ol)))
4263  return an;
4264  return en;
4265  }
4266  i=(an+en) / 2;
4267  int oo=set[i].ecart;
4268  if ((oo > op)
4269  || ((oo == op) && (set[i].pLength > ol)))
4270  en=i;
4271  else
4272  an=i;
4273  }
4274 }
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 
)
int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 3248 of file kstd2.cc.

3249 {
3250  if (h->IsNull()) return 0;
3251 
3252  int at, reddeg,d;
3253  int pass = 0;
3254  int j = 0;
3255 
3256  if (! strat->homog)
3257  {
3258  d = h->GetpFDeg() + h->ecart;
3259  reddeg = strat->LazyDegree+d;
3260  }
3261  h->SetShortExpVector();
3262  loop
3263  {
3264  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
3265  if (j < 0)
3266  {
3267  h->SetDegStuffReturnLDeg(strat->LDegLast);
3268  return 1;
3269  }
3270 
3271  if (!TEST_OPT_INTSTRATEGY)
3272  strat->T[j].pNorm();
3273 #ifdef KDEBUG
3274  if (TEST_OPT_DEBUG)
3275  {
3276  PrintS("reduce ");
3277  h->wrp();
3278  PrintS(" with ");
3279  strat->T[j].wrp();
3280  }
3281 #endif
3282  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
3283  if (!h->IsNull())
3284  {
3285  poly qq=p_Shrink(h->GetTP(),strat->lV,strat->tailRing);
3286  h->p=NULL;
3287  h->t_p=qq;
3288  if (qq!=NULL) h->GetP(strat->lmBin);
3289  }
3290 
3291 #ifdef KDEBUG
3292  if (TEST_OPT_DEBUG)
3293  {
3294  PrintS(" to ");
3295  wrp(h->p);
3296  PrintLn();
3297  }
3298 #endif
3299  if (h->IsNull())
3300  {
3301  if (h->lcm!=NULL) pLmFree(h->lcm);
3302  h->Clear();
3303  return 0;
3304  }
3305  h->SetShortExpVector();
3306 
3307 #if 0
3308  if ((strat->syzComp!=0) && !strat->honey)
3309  {
3310  if ((strat->syzComp>0) &&
3311  (h->Comp() > strat->syzComp))
3312  {
3313  assume(h->MinComp() > strat->syzComp);
3314 #ifdef KDEBUG
3315  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
3316 #endif
3317  if (strat->homog)
3318  h->SetDegStuffReturnLDeg(strat->LDegLast);
3319  return -2;
3320  }
3321  }
3322 #endif
3323  if (!strat->homog)
3324  {
3325  if (!TEST_OPT_OLDSTD && strat->honey)
3326  {
3327  h->SetpFDeg();
3328  if (strat->T[j].ecart <= h->ecart)
3329  h->ecart = d - h->GetpFDeg();
3330  else
3331  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
3332 
3333  d = h->GetpFDeg() + h->ecart;
3334  }
3335  else
3336  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
3337  /*- try to reduce the s-polynomial -*/
3338  pass++;
3339  /*
3340  *test whether the polynomial should go to the lazyset L
3341  *-if the degree jumps
3342  *-if the number of pre-defined reductions jumps
3343  */
3344  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
3345  && ((d >= reddeg) || (pass > strat->LazyPass)))
3346  {
3347  h->SetLmCurrRing();
3348  if (strat->posInLDependsOnLength)
3349  h->SetLength(strat->length_pLength);
3350  at = strat->posInL(strat->L,strat->Ll,h,strat);
3351  if (at <= strat->Ll)
3352  {
3353  int dummy=strat->sl;
3354  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
3355  if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
3356  return 1;
3357  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
3358 #ifdef KDEBUG
3359  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
3360 #endif
3361  h->Clear();
3362  return -1;
3363  }
3364  }
3365  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
3366  {
3367  reddeg = d+1;
3368  Print(".%d",d);mflush();
3369  }
3370  }
3371  }
3372 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:357
BOOLEAN length_pLength
Definition: kutil.h:382
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int tl
Definition: kutil.h:353
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define mflush()
Definition: reporter.h:42
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:509
int lV
Definition: kutil.h:363
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
void PrintS(const char *s)
Definition: reporter.cc:294
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
BOOLEAN LDegLast
Definition: kutil.h:380
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
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:351
TSet T
Definition: kutil.h:324
omBin lmBin
Definition: kutil.h:344
void wrp(poly p)
Definition: polys.h:281
int LazyPass
Definition: kutil.h:356
#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:356
int redHomog ( LObject h,
kStrategy  strat 
)

Definition at line 406 of file kstd2.cc.

407 {
408  if (strat->tl<0) return 1;
409  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
410  assume(h->FDeg == h->pFDeg());
411 
412  poly h_p;
413  int i,j,at,pass, ii;
414  unsigned long not_sev;
415  // long reddeg,d;
416 
417  pass = j = 0;
418  // d = reddeg = h->GetpFDeg();
419  h->SetShortExpVector();
420  int li;
421  h_p = h->GetLmTailRing();
422  not_sev = ~ h->sev;
423  loop
424  {
425  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
426  if (j < 0) return 1;
427 
428  li = strat->T[j].pLength;
429  ii = j;
430  /*
431  * the polynomial to reduce with (up to the moment) is;
432  * pi with length li
433  */
434  i = j;
435 #if 1
436  if (TEST_OPT_LENGTH)
437  loop
438  {
439  /*- search the shortest possible with respect to length -*/
440  i++;
441  if (i > strat->tl)
442  break;
443  if (li<=1)
444  break;
445  if ((strat->T[i].pLength < li)
446  &&
447  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
448  h_p, not_sev, strat->tailRing))
449  {
450  /*
451  * the polynomial to reduce with is now;
452  */
453  li = strat->T[i].pLength;
454  ii = i;
455  }
456  }
457 #endif
458 
459  /*
460  * end of search: have to reduce with pi
461  */
462 #ifdef KDEBUG
463  if (TEST_OPT_DEBUG)
464  {
465  PrintS("red:");
466  h->wrp();
467  PrintS(" with ");
468  strat->T[ii].wrp();
469  }
470 #endif
471  assume(strat->fromT == FALSE);
472 
473  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
474 #if SBA_PRINT_REDUCTION_STEPS
475  sba_interreduction_steps++;
476 #endif
477 #if SBA_PRINT_OPERATIONS
478  sba_interreduction_operations += pLength(strat->T[ii].p);
479 #endif
480 
481 #ifdef KDEBUG
482  if (TEST_OPT_DEBUG)
483  {
484  PrintS("\nto ");
485  h->wrp();
486  PrintLn();
487  }
488 #endif
489 
490  h_p = h->GetLmTailRing();
491  if (h_p == NULL)
492  {
493  if (h->lcm!=NULL) pLmFree(h->lcm);
494 #ifdef KDEBUG
495  h->lcm=NULL;
496 #endif
497  return 0;
498  }
499  h->SetShortExpVector();
500  not_sev = ~ h->sev;
501  /*
502  * try to reduce the s-polynomial h
503  *test first whether h should go to the lazyset L
504  *-if the degree jumps
505  *-if the number of pre-defined reductions jumps
506  */
507  pass++;
508  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
509  {
510  h->SetLmCurrRing();
511  at = strat->posInL(strat->L,strat->Ll,h,strat);
512  if (at <= strat->Ll)
513  {
514  int dummy=strat->sl;
515  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
516  return 1;
517  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
518 #ifdef KDEBUG
519  if (TEST_OPT_DEBUG)
520  Print(" lazy: -> L%d\n",at);
521 #endif
522  h->Clear();
523  return -1;
524  }
525  }
526  }
527 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int tl
Definition: kutil.h:353
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#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:1101
static int pLength(poly a)
Definition: p_polys.h:189
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#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:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
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:351
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int redHoney ( LObject h,
kStrategy  strat 
)

Definition at line 1004 of file kstd2.cc.

1005 {
1006  if (strat->tl<0) return 1;
1007  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1008  assume(h->FDeg == h->pFDeg());
1009  poly h_p;
1010  int i,j,at,pass,ei, ii, h_d;
1011  unsigned long not_sev;
1012  long reddeg,d;
1013 
1014  pass = j = 0;
1015  d = reddeg = h->GetpFDeg() + h->ecart;
1016  h->SetShortExpVector();
1017  int li;
1018  h_p = h->GetLmTailRing();
1019  not_sev = ~ h->sev;
1020 
1021  h->PrepareRed(strat->use_buckets);
1022  loop
1023  {
1024  j=kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
1025  if (j < 0) return 1;
1026 
1027  ei = strat->T[j].ecart;
1028  li = strat->T[j].pLength;
1029  ii = j;
1030  /*
1031  * the polynomial to reduce with (up to the moment) is;
1032  * pi with ecart ei
1033  */
1034  i = j;
1035  if (TEST_OPT_LENGTH)
1036  loop
1037  {
1038  /*- takes the first possible with respect to ecart -*/
1039  i++;
1040  if (i > strat->tl)
1041  break;
1042  //if (ei < h->ecart)
1043  // break;
1044  if (li<=1)
1045  break;
1046  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1047  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1048  &&
1049  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1050  h_p, not_sev, strat->tailRing))
1051  {
1052  /*
1053  * the polynomial to reduce with is now;
1054  */
1055  ei = strat->T[i].ecart;
1056  li = strat->T[i].pLength;
1057  ii = i;
1058  }
1059  }
1060 
1061  /*
1062  * end of search: have to reduce with pi
1063  */
1064  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1065  {
1066  h->GetTP(); // clears bucket
1067  h->SetLmCurrRing();
1068  /*
1069  * It is not possible to reduce h with smaller ecart;
1070  * if possible h goes to the lazy-set L,i.e
1071  * if its position in L would be not the last one
1072  */
1073  if (strat->Ll >= 0) /* L is not empty */
1074  {
1075  at = strat->posInL(strat->L,strat->Ll,h,strat);
1076  if(at <= strat->Ll)
1077  /*- h will not become the next element to reduce -*/
1078  {
1079  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1080 #ifdef KDEBUG
1081  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1082 #endif
1083  h->Clear();
1084  return -1;
1085  }
1086  }
1087  }
1088 #ifdef KDEBUG
1089  if (TEST_OPT_DEBUG)
1090  {
1091  PrintS("red:");
1092  h->wrp();
1093  PrintS(" with ");
1094  strat->T[ii].wrp();
1095  }
1096 #endif
1097  assume(strat->fromT == FALSE);
1098 
1099  number coef;
1100  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),&coef,strat);
1101 #if SBA_PRINT_REDUCTION_STEPS
1102  sba_interreduction_steps++;
1103 #endif
1104 #if SBA_PRINT_OPERATIONS
1105  sba_interreduction_operations += pLength(strat->T[ii].p);
1106 #endif
1107 #ifdef KDEBUG
1108  if (TEST_OPT_DEBUG)
1109  {
1110  PrintS("\nto:");
1111  h->wrp();
1112  PrintLn();
1113  }
1114 #endif
1115  if(h->IsNull())
1116  {
1117  h->Clear();
1118  if (h->lcm!=NULL) pLmFree(h->lcm);
1119  #ifdef KDEBUG
1120  h->lcm=NULL;
1121  #endif
1122  return 0;
1123  }
1124  h->SetShortExpVector();
1125  not_sev = ~ h->sev;
1126  h_d = h->SetpFDeg();
1127  /* compute the ecart */
1128  if (ei <= h->ecart)
1129  h->ecart = d-h_d;
1130  else
1131  h->ecart = d-h_d+ei-h->ecart;
1132 
1133  /*
1134  * try to reduce the s-polynomial h
1135  *test first whether h should go to the lazyset L
1136  *-if the degree jumps
1137  *-if the number of pre-defined reductions jumps
1138  */
1139  pass++;
1140  d = h_d + h->ecart;
1141  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1142  {
1143  h->GetTP(); // clear bucket
1144  h->SetLmCurrRing();
1145  at = strat->posInL(strat->L,strat->Ll,h,strat);
1146  if (at <= strat->Ll)
1147  {
1148  int dummy=strat->sl;
1149  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1150  return 1;
1151  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1152 #ifdef KDEBUG
1153  if (TEST_OPT_DEBUG)
1154  Print(" degree jumped: -> L%d\n",at);
1155 #endif
1156  h->Clear();
1157  return -1;
1158  }
1159  }
1160  else if (d > reddeg)
1161  {
1162  if (d>=strat->tailRing->bitmask)
1163  {
1164  if (h->pTotalDeg()+h->ecart >= strat->tailRing->bitmask)
1165  {
1166  strat->overflow=TRUE;
1167  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1168  h->GetP();
1169  at = strat->posInL(strat->L,strat->Ll,h,strat);
1170  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1171  h->Clear();
1172  return -1;
1173  }
1174  }
1175  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1176  {
1177  //h->wrp(); Print("<%d>\n",h->GetpLength());
1178  reddeg = d;
1179  Print(".%ld",d); mflush();
1180  }
1181  }
1182  }
1183 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int tl
Definition: kutil.h:353
#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:323
#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:1101
static int pLength(poly a)
Definition: p_polys.h:189
#define mflush()
Definition: reporter.h:42
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#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:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
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:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
int LazyPass
Definition: kutil.h:356
#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 844 of file kstd2.cc.

845 {
846  if (strat->tl<0) return 1;
847  int at,i,ii,li;
848  int j = 0;
849  int pass = 0;
850  assume(h->pFDeg() == h->FDeg);
851  long reddeg = h->GetpFDeg();
852  long d;
853  unsigned long not_sev;
854 
855  h->SetShortExpVector();
856  poly h_p = h->GetLmTailRing();
857  not_sev = ~ h->sev;
858  loop
859  {
860  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
861  if (j < 0) return 1;
862 
863  li = strat->T[j].pLength;
864  #if 0
865  if (li==0)
866  {
867  li=strat->T[j].pLength=pLength(strat->T[j].p);
868  }
869  #endif
870  ii = j;
871  /*
872  * the polynomial to reduce with (up to the moment) is;
873  * pi with length li
874  */
875 
876  i = j;
877 #if 1
878  if (TEST_OPT_LENGTH)
879  loop
880  {
881  /*- search the shortest possible with respect to length -*/
882  i++;
883  if (i > strat->tl)
884  break;
885  if (li<=1)
886  break;
887  #if 0
888  if (strat->T[i].pLength==0)
889  {
890  PrintS("!");
891  strat->T[i].pLength=pLength(strat->T[i].p);
892  }
893  #endif
894  if ((strat->T[i].pLength < li)
895  &&
896  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
897  h_p, not_sev, strat->tailRing))
898  {
899  /*
900  * the polynomial to reduce with is now;
901  */
902  PrintS("+");
903  li = strat->T[i].pLength;
904  ii = i;
905  }
906  }
907 #endif
908 
909  /*
910  * end of search: have to reduce with pi
911  */
912 
913 
914 #ifdef KDEBUG
915  if (TEST_OPT_DEBUG)
916  {
917  PrintS("red:");
918  h->wrp();
919  PrintS(" with ");
920  strat->T[ii].wrp();
921  }
922 #endif
923 
924  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
925 #if SBA_PRINT_REDUCTION_STEPS
926  sba_interreduction_steps++;
927 #endif
928 #if SBA_PRINT_OPERATIONS
929  sba_interreduction_operations += pLength(strat->T[ii].p);
930 #endif
931 
932 #ifdef KDEBUG
933  if (TEST_OPT_DEBUG)
934  {
935  PrintS("\nto ");
936  h->wrp();
937  PrintLn();
938  }
939 #endif
940 
941  h_p=h->GetLmTailRing();
942 
943  if (h_p == NULL)
944  {
945  if (h->lcm!=NULL) pLmFree(h->lcm);
946 #ifdef KDEBUG
947  h->lcm=NULL;
948 #endif
949  return 0;
950  }
951  h->SetShortExpVector();
952  not_sev = ~ h->sev;
953  d = h->SetpFDeg();
954  /*- try to reduce the s-polynomial -*/
955  pass++;
956  if (//!TEST_OPT_REDTHROUGH &&
957  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
958  {
959  h->SetLmCurrRing();
960  at = strat->posInL(strat->L,strat->Ll,h,strat);
961  if (at <= strat->Ll)
962  {
963 #if 1
964  int dummy=strat->sl;
965  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
966  return 1;
967 #endif
968 #ifdef KDEBUG
969  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
970 #endif
971  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
972  h->Clear();
973  return -1;
974  }
975  }
976  else if (d != reddeg)
977  {
978  if (d>=strat->tailRing->bitmask)
979  {
980  if (h->pTotalDeg() >= strat->tailRing->bitmask)
981  {
982  strat->overflow=TRUE;
983  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
984  h->GetP();
985  at = strat->posInL(strat->L,strat->Ll,h,strat);
986  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
987  h->Clear();
988  return -1;
989  }
990  }
991  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
992  {
993  Print(".%ld",d);mflush();
994  reddeg = d;
995  }
996  }
997  }
998 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
int tl
Definition: kutil.h:353
#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:323
#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:1101
static int pLength(poly a)
Definition: p_polys.h:189
#define mflush()
Definition: reporter.h:42
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#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:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
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:351
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
static Poly * h
Definition: janet.cc:978
poly redNF ( poly  h,
int max_ind,
int  nonorm,
kStrategy  strat 
)

Definition at line 1189 of file kstd2.cc.

1190 {
1191  if (h==NULL) return NULL;
1192  int j;
1193  max_ind=strat->sl;
1194 
1195  if (0 > strat->sl)
1196  {
1197  return h;
1198  }
1199  LObject P(h);
1200  P.SetShortExpVector();
1201  P.bucket = kBucketCreate(currRing);
1202  kBucketInit(P.bucket,P.p,pLength(P.p));
1203  kbTest(P.bucket);
1204 #ifdef HAVE_RINGS
1206 #endif
1207 #ifdef KDEBUG
1208  if (TEST_OPT_DEBUG)
1209  {
1210  PrintS("redNF: starting S: ");
1211  for( j = 0; j <= max_ind; j++ )
1212  {
1213  Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1214  pWrite(strat->S[j]);
1215  }
1216  };
1217 #endif
1218 
1219  loop
1220  {
1221  j=kFindDivisibleByInS(strat,&max_ind,&P);
1222  if (j>=0)
1223  {
1224 #ifdef HAVE_RINGS
1225  if (!is_ring)
1226  {
1227 #endif
1228  int sl=pSize(strat->S[j]);
1229  int jj=j;
1230  loop
1231  {
1232  int sll;
1233  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1234  if (jj<0) break;
1235  sll=pSize(strat->S[jj]);
1236  if (sll<sl)
1237  {
1238  #ifdef KDEBUG
1239  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1240  #endif
1241  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1242  j=jj;
1243  sl=sll;
1244  }
1245  }
1246  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1247  {
1248  pNorm(strat->S[j]);
1249  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1250  }
1251 #ifdef HAVE_RINGS
1252  }
1253 #endif
1254  nNormalize(pGetCoeff(P.p));
1255 #ifdef KDEBUG
1256  if (TEST_OPT_DEBUG)
1257  {
1258  PrintS("red:");
1259  wrp(h);
1260  PrintS(" with ");
1261  wrp(strat->S[j]);
1262  }
1263 #endif
1264 #ifdef HAVE_PLURAL
1265  if (rIsPluralRing(currRing))
1266  {
1267  number coef;
1268  nc_kBucketPolyRed(P.bucket,strat->S[j],&coef);
1269  nDelete(&coef);
1270  }
1271  else
1272 #endif
1273  {
1274  number coef;
1275  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1276  nDelete(&coef);
1277  }
1278  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1279  if (h==NULL)
1280  {
1281  kBucketDestroy(&P.bucket);
1282 
1283 #ifdef KDEBUG
1284  if (TEST_OPT_DEBUG)
1285  {
1286  PrintS("redNF: starting S: ");
1287  for( j = 0; j <= max_ind; j++ )
1288  {
1289  Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1290  pWrite(strat->S[j]);
1291  }
1292  };
1293 #endif
1294 
1295  return NULL;
1296  }
1297  kbTest(P.bucket);
1298  P.p=h;
1299  P.t_p=NULL;
1300  P.SetShortExpVector();
1301 #ifdef KDEBUG
1302  if (TEST_OPT_DEBUG)
1303  {
1304  PrintS("\nto:");
1305  wrp(h);
1306  PrintLn();
1307  }
1308 #endif
1309  }
1310  else
1311  {
1312  P.p=kBucketClear(P.bucket);
1313  kBucketDestroy(&P.bucket);
1314  pNormalize(P.p);
1315 
1316 #ifdef KDEBUG
1317  if (TEST_OPT_DEBUG)
1318  {
1319  PrintS("redNF: starting S: ");
1320  for( j = 0; j <= max_ind; j++ )
1321  {
1322  Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1323  pWrite(strat->S[j]);
1324  }
1325  };
1326 #endif
1327 
1328  return P.p;
1329  }
1330  }
1331 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:181
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:186
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:58
#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:1064
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
int & max_ind
Definition: myNF.cc:67
poly kNoether
Definition: kutil.h:328
#define nIsOne(n)
Definition: numbers.h:25
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:355
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:198
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:205
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:149
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
#define nDelete(n)
Definition: numbers.h:16
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
int sl
Definition: kutil.h:351
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 351 of file kstd1.cc.

352 {
353  int i,at,ei,li,ii;
354  int j = 0;
355  int pass = 0;
356  long d,reddeg;
357 
358 
359 #if ADIDEBUG_NF
360  int iii;
361  PrintLn();
362  PrintS("---------------------------- NEW REDRILOC COMPUTATION ----------------------------");
363  PrintLn();
364  PrintS(" The pair h : "); PrintLn(); PrintLn();
365  PrintS(" p1 = "); p_Write(h->p1,strat->tailRing); PrintLn();
366  PrintS(" p2 = "); p_Write(h->p2,strat->tailRing); PrintLn();
367  PrintS(" p = "); p_Write(h->p,strat->tailRing); PrintLn();
368  PrintLn();
369  PrintS(" The actual reducer T is: ");
370  if(strat->tl<0)
371  {PrintS(" Empty.\n");
372  else
373  for (iii=0;iii<=strat->tl;iii++)
374  {
375  PrintLn();
376  Print(" T[%i] = ",iii);p_Write(strat->T[iii].p,strat->tailRing);
377  PrintLn();
378  }
379 #endif /* ADIDEBUG_NF */
380 
381  d = h->GetpFDeg()+ h->ecart;
382  reddeg = strat->LazyDegree+d;
383  h->SetShortExpVector();
384 #if ADIDEBUG_NF
385  Print("\n Searching for a poly in T that divides h (of ecart %i) ...\n",h->ecart);
386 #endif
387  loop
388  {
389  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
390 #if ADIDEBUG_NF
391  if(j != -1)
392  {
393  ei = strat->T[j].ecart;
394  Print("\n Found one: T[%i] of ecart %i: ",j,ei);
395  p_Write(strat->T[j].p,strat->tailRing);
396  PrintS("\n Try to find another with smaller ecart:\n");
397  }
398  else
399  {
400  PrintS("\n No poly in T divides h.\n");
401  }
402 #endif
403  if (j < 0)
404  {
405  if (strat->honey) h->SetLength(strat->length_pLength);
406  return 1;
407  }
408 
409  ei = strat->T[j].ecart;
410  ii = j;
411 #if ADIDEBUG_NF
412  iii=ii;
413 #endif
414  if (ei > h->ecart && ii < strat->tl)
415  {
416  li = strat->T[j].length;
417  // the polynomial to reduce with (up to the moment) is;
418  // pi with ecart ei and length li
419  // look for one with smaller ecart
420  i = j;
421  loop
422  {
423  /*- takes the first possible with respect to ecart -*/
424  i++;
425 #if 1
426  if (i > strat->tl) break;
427  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
428  strat->T[i].length < li))
429  &&
430  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing))
431 #else
432  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h, i);
433  if (j < 0) break;
434  i = j;
435  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
436  strat->T[i].length < li))
437 #endif
438  {
439  // the polynomial to reduce with is now
440  ii = i;
441  ei = strat->T[i].ecart;
442  if (ei <= h->ecart) break;
443  li = strat->T[i].length;
444  }
445  }
446 
447 #if ADIDEBUG_NF
448  if(iii == ii)
449  {
450  PrintS("\n None was found.\n");
451  }
452  else
453  {
454  Print("\n A better one (ecart = %i): T[%i] = ",ei,ii);
455  p_Write(strat->T[ii].p,strat->tailRing);
456  PrintLn();
457  }
458 #endif
459  }
460 
461  // end of search: have to reduce with pi
462  if (ei > h->ecart)
463  {
464  // It is not possible to reduce h with smaller ecart;
465  // if possible h goes to the lazy-set L,i.e
466  // if its position in L would be not the last one
467  strat->fromT = TRUE;
468  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
469  {
470  h->SetLmCurrRing();
471  if (strat->honey && strat->posInLDependsOnLength)
472  h->SetLength(strat->length_pLength);
473  assume(h->FDeg == h->pFDeg());
474  at = strat->posInL(strat->L,strat->Ll,h,strat);
475  if (at <= strat->Ll)
476  {
477  /*- h will not become the next element to reduce -*/
478  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
479 #ifdef KDEBUG
480  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
481 #endif
482  h->Clear();
483  strat->fromT = FALSE;
484  return -1;
485  }
486  }
487  }
488 
489  // now we finally can reduce
490  doRed(h,&(strat->T[ii]),strat->fromT,strat);
491  #if ADIDEBUG_NF
492  PrintS("\n Partial Reduced h = ");p_Write(h->p,strat->tailRing);
493  PrintLn();
494  #endif
495  strat->fromT=FALSE;
496 
497  // are we done ???
498  if (h->IsNull())
499  {
500  if (h->lcm!=NULL) pLmDelete(h->lcm);
501  h->Clear();
502  return 0;
503  }
504 
505  // NO!
506  h->SetShortExpVector();
507  h->SetpFDeg();
508  if (strat->honey)
509  {
510  if (ei <= h->ecart)
511  h->ecart = d-h->GetpFDeg();
512  else
513  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
514  }
515  else
516  // this has the side effect of setting h->length
517  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
518 
519  /*- try to reduce the s-polynomial -*/
520  pass++;
521  d = h->GetpFDeg()+h->ecart;
522  /*
523  *test whether the polynomial should go to the lazyset L
524  *-if the degree jumps
525  *-if the number of pre-defined reductions jumps
526  */
527  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
528  && ((d >= reddeg) || (pass > strat->LazyPass)))
529  {
530  h->SetLmCurrRing();
531  if (strat->honey && strat->posInLDependsOnLength)
532  h->SetLength(strat->length_pLength);
533  assume(h->FDeg == h->pFDeg());
534  at = strat->posInL(strat->L,strat->Ll,h,strat);
535  if (at <= strat->Ll)
536  {
537  int dummy=strat->sl;
538  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
539  {
540  if (strat->honey && !strat->posInLDependsOnLength)
541  h->SetLength(strat->length_pLength);
542  return 1;
543  }
544  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
545 #ifdef KDEBUG
546  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
547 #endif
548  h->Clear();
549  return -1;
550  }
551  }
552  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
553  {
554  Print(".%ld",d);mflush();
555  reddeg = d+1;
556  if (h->pTotalDeg()+h->ecart >= strat->tailRing->bitmask)
557  {
558  strat->overflow=TRUE;
559  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
560  h->GetP();
561  at = strat->posInL(strat->L,strat->Ll,h,strat);
562  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
563  h->Clear();
564  return -1;
565  }
566  }
567  }
568 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:382
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat)
Definition: kstd1.cc:129
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int tl
Definition: kutil.h:353
#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:323
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define mflush()
Definition: reporter.h:42
BOOLEAN fromT
Definition: kutil.h:373
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:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
BOOLEAN LDegLast
Definition: kutil.h:380
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:356
int redRing ( LObject h,
kStrategy  strat 
)

Definition at line 324 of file kstd2.cc.

325 {
326  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
327  if (strat->tl<0) return 1;
328 
329  int at/*,i*/;
330  long d;
331  int j = 0;
332  int pass = 0;
333  // poly zeroPoly = NULL;
334 
335 // TODO warum SetpFDeg notwendig?
336  h->SetpFDeg();
337  assume(h->pFDeg() == h->FDeg);
338  long reddeg = h->GetpFDeg();
339 
340  h->SetShortExpVector();
341  loop
342  {
343  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
344  if (j < 0) return 1;
345  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
346 
347  if (h->GetLmTailRing() == NULL)
348  {
349  if (h->lcm!=NULL) pLmDelete(h->lcm);
350 #ifdef KDEBUG
351  h->lcm=NULL;
352 #endif
353  h->Clear();
354  return 0;
355  }
356  h->SetShortExpVector();
357  d = h->SetpFDeg();
358  /*- try to reduce the s-polynomial -*/
359  pass++;
360  if (!TEST_OPT_REDTHROUGH &&
361  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
362  {
363  h->SetLmCurrRing();
364  if (strat->posInLDependsOnLength)
365  h->SetLength(strat->length_pLength);
366  at = strat->posInL(strat->L,strat->Ll,h,strat);
367  if (at <= strat->Ll)
368  {
369 #ifdef KDEBUG
370  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
371 #endif
372  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
373  h->Clear();
374  return -1;
375  }
376  }
377  if (d != reddeg)
378  {
379  if (d >= strat->tailRing->bitmask)
380  {
381  if (h->pTotalDeg() >= strat->tailRing->bitmask)
382  {
383  strat->overflow=TRUE;
384  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
385  h->GetP();
386  at = strat->posInL(strat->L,strat->Ll,h,strat);
387  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
388  h->Clear();
389  return -1;
390  }
391  }
392  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
393  {
394  Print(".%ld",d);mflush();
395  reddeg = d;
396  }
397  }
398  }
399 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:382
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int tl
Definition: kutil.h:353
#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
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define mflush()
Definition: reporter.h:42
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 565 of file kstd2.cc.

566 {
567  if (strat->tl<0) return 1;
568  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
569  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
570  assume(h->FDeg == h->pFDeg());
571 //#if 1
572 #ifdef DEBUGF5
573  Print("------- IN REDSIG -------\n");
574  Print("p: ");
575  pWrite(pHead(h->p));
576  Print("p1: ");
577  pWrite(pHead(h->p1));
578  Print("p2: ");
579  pWrite(pHead(h->p2));
580  Print("---------------------------\n");
581 #endif
582  poly h_p;
583  int i,j,at,pass, ii;
584  int start=0;
585  int sigSafe;
586  unsigned long not_sev;
587  // long reddeg,d;
588 
589  pass = j = 0;
590  // d = reddeg = h->GetpFDeg();
591  h->SetShortExpVector();
592  int li;
593  h_p = h->GetLmTailRing();
594  not_sev = ~ h->sev;
595  loop
596  {
597  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h, start);
598  if (j < 0)
599  {
600  return 1;
601  }
602 
603  li = strat->T[j].pLength;
604  ii = j;
605  /*
606  * the polynomial to reduce with (up to the moment) is;
607  * pi with length li
608  */
609  i = j;
610 #if 1
611  if (TEST_OPT_LENGTH)
612  loop
613  {
614  /*- search the shortest possible with respect to length -*/
615  i++;
616  if (i > strat->tl)
617  break;
618  if (li<=1)
619  break;
620  if ((strat->T[i].pLength < li)
621  &&
622  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
623  h_p, not_sev, strat->tailRing))
624  {
625  /*
626  * the polynomial to reduce with is now;
627  */
628  li = strat->T[i].pLength;
629  ii = i;
630  }
631  }
632  start = ii+1;
633 #endif
634 
635  /*
636  * end of search: have to reduce with pi
637  */
638 #ifdef KDEBUG
639  if (TEST_OPT_DEBUG)
640  {
641  PrintS("red:");
642  h->wrp();
643  PrintS(" with ");
644  strat->T[ii].wrp();
645  }
646 #endif
647  assume(strat->fromT == FALSE);
648 //#if 1
649 #ifdef DEBUGF5
650  Print("BEFORE REDUCTION WITH %d:\n",ii);
651  Print("--------------------------------\n");
652  pWrite(h->sig);
653  pWrite(strat->T[ii].sig);
654  pWrite(h->GetLmCurrRing());
655  pWrite(pHead(h->p1));
656  pWrite(pHead(h->p2));
657  pWrite(pHead(strat->T[ii].p));
658  Print("--------------------------------\n");
659  printf("INDEX OF REDUCER T: %d\n",ii);
660 #endif
661  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
662 #if SBA_PRINT_REDUCTION_STEPS
663  if (sigSafe != 3)
664  sba_reduction_steps++;
665 #endif
666 #if SBA_PRINT_OPERATIONS
667  if (sigSafe != 3)
668  sba_operations += pLength(strat->T[ii].p);
669 #endif
670  // if reduction has taken place, i.e. the reduction was sig-safe
671  // otherwise start is already at the next position and the loop
672  // searching reducers in T goes on from index start
673 //#if 1
674 #ifdef DEBUGF5
675  Print("SigSAFE: %d\n",sigSafe);
676 #endif
677  if (sigSafe != 3)
678  {
679  // start the next search for reducers in T from the beginning
680  start = 0;
681 #ifdef KDEBUG
682  if (TEST_OPT_DEBUG)
683  {
684  PrintS("\nto ");
685  h->wrp();
686  PrintLn();
687  }
688 #endif
689 
690  h_p = h->GetLmTailRing();
691  if (h_p == NULL)
692  {
693  if (h->lcm!=NULL) pLmFree(h->lcm);
694 #ifdef KDEBUG
695  h->lcm=NULL;
696 #endif
697  return 0;
698  }
699  h->SetShortExpVector();
700  not_sev = ~ h->sev;
701  /*
702  * try to reduce the s-polynomial h
703  *test first whether h should go to the lazyset L
704  *-if the degree jumps
705  *-if the number of pre-defined reductions jumps
706  */
707  pass++;
708  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
709  {
710  h->SetLmCurrRing();
711  at = strat->posInL(strat->L,strat->Ll,h,strat);
712  if (at <= strat->Ll)
713  {
714  int dummy=strat->sl;
715  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
716  {
717  return 1;
718  }
719  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
720 #ifdef KDEBUG
721  if (TEST_OPT_DEBUG)
722  Print(" lazy: -> L%d\n",at);
723 #endif
724  h->Clear();
725  return -1;
726  }
727  }
728  }
729  }
730 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
int tl
Definition: kutil.h:353
unsigned long * sevT
Definition: kutil.h:323
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:1101
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:172
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#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:1707
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:149
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:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
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:351
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
#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 5406 of file kutil.cc.

5407 {
5408  LObject L(p, currRing);
5409  return redtail(&L, pos, strat);
5410 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
class sLObject LObject
Definition: kutil.h:58
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 5337 of file kutil.cc.

5338 {
5339  poly h, hn;
5340  strat->redTailChange=FALSE;
5341 
5342  poly p = L->p;
5343  if (strat->noTailReduction || pNext(p) == NULL)
5344  return p;
5345 
5346  LObject Ln(strat->tailRing);
5347  TObject* With;
5348  // placeholder in case strat->tl < 0
5349  TObject With_s(strat->tailRing);
5350  h = p;
5351  hn = pNext(h);
5352  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
5353  long e;
5354  int l;
5355  BOOLEAN save_HE=strat->kHEdgeFound;
5356  strat->kHEdgeFound |=
5357  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
5358 
5359  while(hn != NULL)
5360  {
5361  op = strat->tailRing->pFDeg(hn, strat->tailRing);
5362  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
5363  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
5364  loop
5365  {
5366  Ln.Set(hn, strat->tailRing);
5367  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
5368  if (strat->kHEdgeFound)
5369  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
5370  else
5371  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
5372  if (With == NULL) break;
5373  With->length=0;
5374  With->pLength=0;
5375  strat->redTailChange=TRUE;
5376  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
5377  {
5378  // reducing the tail would violate the exp bound
5379  if (kStratChangeTailRing(strat, L))
5380  {
5381  strat->kHEdgeFound = save_HE;
5382  return redtail(L, pos, strat);
5383  }
5384  else
5385  return NULL;
5386  }
5387  hn = pNext(h);
5388  if (hn == NULL) goto all_done;
5389  op = strat->tailRing->pFDeg(hn, strat->tailRing);
5390  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
5391  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
5392  }
5393  h = hn;
5394  hn = pNext(h);
5395  }
5396 
5397  all_done:
5398  if (strat->redTailChange)
5399  {
5400  L->pLength = 0;
5401  }
5402  strat->kHEdgeFound = save_HE;
5403  return p;
5404 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
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
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
int Kstd1_deg
Definition: kutil.cc:228
BOOLEAN kHEdgeFound
Definition: kutil.h:370
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
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:394
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:57
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:58
#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:343
poly redtailBba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 5412 of file kutil.cc.

5413 {
5414 #define REDTAIL_CANONICALIZE 100
5415  strat->redTailChange=FALSE;
5416  if (strat->noTailReduction) return L->GetLmCurrRing();
5417  poly h, p;
5418  p = h = L->GetLmTailRing();
5419  if ((h==NULL) || (pNext(h)==NULL))
5420  return L->GetLmCurrRing();
5421 
5422  TObject* With;
5423  // placeholder in case strat->tl < 0
5424  TObject With_s(strat->tailRing);
5425 
5426  LObject Ln(pNext(h), strat->tailRing);
5427  Ln.pLength = L->GetpLength() - 1;
5428 
5429  pNext(h) = NULL;
5430  if (L->p != NULL) pNext(L->p) = NULL;
5431  L->pLength = 1;
5432 
5433  Ln.PrepareRed(strat->use_buckets);
5434 
5435  int cnt=REDTAIL_CANONICALIZE;
5436  while(!Ln.IsNull())
5437  {
5438  loop
5439  {
5440  Ln.SetShortExpVector();
5441  if (withT)
5442  {
5443  int j;
5444  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
5445  if (j < 0) break;
5446  With = &(strat->T[j]);
5447  }
5448  else
5449  {
5450  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
5451  if (With == NULL) break;
5452  }
5453  cnt--;
5454  if (cnt==0)
5455  {
5457  /*poly tmp=*/Ln.CanonicalizeP();
5458  if (normalize)
5459  {
5460  Ln.Normalize();
5461  //pNormalize(tmp);
5462  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
5463  }
5464  }
5465  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
5466  {
5467  With->pNorm();
5468  }
5469  strat->redTailChange=TRUE;
5470  if (ksReducePolyTail(L, With, &Ln))
5471  {
5472  // reducing the tail would violate the exp bound
5473  // set a flag and hope for a retry (in bba)
5474  strat->completeReduce_retry=TRUE;
5475  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
5476  do
5477  {
5478  pNext(h) = Ln.LmExtractAndIter();
5479  pIter(h);
5480  L->pLength++;
5481  } while (!Ln.IsNull());
5482  goto all_done;
5483  }
5484  if (Ln.IsNull()) goto all_done;
5485  if (! withT) With_s.Init(currRing);
5486  }
5487  pNext(h) = Ln.LmExtractAndIter();
5488  pIter(h);
5489  pNormalize(h);
5490  L->pLength++;
5491  }
5492 
5493  all_done:
5494  Ln.Delete();
5495  if (L->p != NULL) pNext(L->p) = pNext(p);
5496 
5497  if (strat->redTailChange)
5498  {
5499  L->length = 0;
5500  L->pLength = 0;
5501  }
5502 
5503  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
5504  //L->Normalize(); // HANNES: should have a test
5505  kTest_L(L);
5506  return L->GetLmCurrRing();
5507 }
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:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:398
#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
polyrec * poly
Definition: hilb.h:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:619
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
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:58
#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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static jList * T
Definition: janet.cc:37
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:58
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:343
poly redtailBba_Z ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 5510 of file kutil.cc.

5512 {
5513  strat->redTailChange=FALSE;
5514  if (strat->noTailReduction) return L->GetLmCurrRing();
5515  poly h, p;
5516  p = h = L->GetLmTailRing();
5517  if ((h==NULL) || (pNext(h)==NULL))
5518  return L->GetLmCurrRing();
5519 
5520  TObject* With;
5521  // placeholder in case strat->tl < 0
5522  TObject With_s(strat->tailRing);
5523 
5524  LObject Ln(pNext(h), strat->tailRing);
5525  Ln.pLength = L->GetpLength() - 1;
5526 
5527  pNext(h) = NULL;
5528  if (L->p != NULL) pNext(L->p) = NULL;
5529  L->pLength = 1;
5530 
5531  Ln.PrepareRed(strat->use_buckets);
5532 
5533  int cnt=REDTAIL_CANONICALIZE;
5534  while(!Ln.IsNull())
5535  {
5536  loop
5537  {
5538  Ln.SetShortExpVector();
5539  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
5540  if (With == NULL) break;
5541  cnt--;
5542  if (cnt==0)
5543  {
5545  /*poly tmp=*/Ln.CanonicalizeP();
5546  }
5547  // we are in Z, do not call pNorm
5548  strat->redTailChange=TRUE;
5549  // test divisibility of coefs:
5550  poly p_Ln=Ln.GetLmCurrRing();
5551  poly p_With=With->GetLmCurrRing();
5552  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
5553  if (!nIsZero(z))
5554  {
5555  // subtract z*Ln, add z.Ln to L
5556  poly m=pHead(p_Ln);
5557  pSetCoeff(m,z);
5558  poly mm=pHead(m);
5559  pNext(h) = m;
5560  pIter(h);
5561  L->pLength++;
5562  mm=pNeg(mm);
5563  if (Ln.bucket!=NULL)
5564  {
5565  int dummy=1;
5566  kBucket_Add_q(Ln.bucket,mm,&dummy);
5567  }
5568  else
5569  {
5570  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
5571  Ln.GetP();
5572  if (Ln.p!=NULL)
5573  {
5574  Ln.p=pAdd(Ln.p,mm);
5575  if (Ln.t_p!=NULL)
5576  {
5577  pNext(Ln.t_p)=NULL;
5578  p_LmDelete(Ln.t_p,strat->tailRing);
5579  }
5580  }
5581  }
5582  }
5583  else
5584  nDelete(&z);
5585 
5586  if (ksReducePolyTail(L, With, &Ln))
5587  {
5588  // reducing the tail would violate the exp bound
5589  // set a flag and hope for a retry (in bba)
5590  strat->completeReduce_retry=TRUE;
5591  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
5592  do
5593  {
5594  pNext(h) = Ln.LmExtractAndIter();
5595  pIter(h);
5596  L->pLength++;
5597  } while (!Ln.IsNull());
5598  goto all_done;
5599  }
5600  if (Ln.IsNull()) goto all_done;
5601  With_s.Init(currRing);
5602  }
5603  pNext(h) = Ln.LmExtractAndIter();
5604  pIter(h);
5605  pNormalize(h);
5606  L->pLength++;
5607  }
5608 
5609  all_done:
5610  Ln.Delete();
5611  if (L->p != NULL) pNext(L->p) = pNext(p);
5612 
5613  if (strat->redTailChange)
5614  {
5615  L->length = 0;
5616  }
5617 
5618  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
5619  //L->Normalize(); // HANNES: should have a test
5620  kTest_L(L);
5621  return L->GetLmCurrRing();
5622 }
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:625
#define pAdd(p, q)
Definition: polys.h:174
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
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:398
#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
polyrec * poly
Definition: hilb.h:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:619
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
#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:343
#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:377
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:394
class sTObject TObject
Definition: kutil.h:57
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:637
poly redtailBbaShift ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 9721 of file kutil.cc.

9722 {
9723  /* for the shift case need to run it with withT = TRUE */
9724  strat->redTailChange=FALSE;
9725  if (strat->noTailReduction) return L->GetLmCurrRing();
9726  poly h, p;
9727  p = h = L->GetLmTailRing();
9728  if ((h==NULL) || (pNext(h)==NULL))
9729  return L->GetLmCurrRing();
9730 
9731  TObject* With;
9732  // placeholder in case strat->tl < 0
9733  TObject With_s(strat->tailRing);
9734 
9735  LObject Ln(pNext(h), strat->tailRing);
9736  Ln.pLength = L->GetpLength() - 1;
9737 
9738  pNext(h) = NULL;
9739  if (L->p != NULL) pNext(L->p) = NULL;
9740  L->pLength = 1;
9741 
9742  Ln.PrepareRed(strat->use_buckets);
9743 
9744  while(!Ln.IsNull())
9745  {
9746  loop
9747  {
9748  Ln.SetShortExpVector();
9749  if (withT)
9750  {
9751  int j;
9752  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
9753  if (j < 0) break;
9754  With = &(strat->T[j]);
9755  }
9756  else
9757  {
9758  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
9759  if (With == NULL) break;
9760  }
9761  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
9762  {
9763  With->pNorm();
9764  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
9765  }
9766  strat->redTailChange=TRUE;
9767  if (ksReducePolyTail(L, With, &Ln))
9768  {
9769  // reducing the tail would violate the exp bound
9770  // set a flag and hope for a retry (in bba)
9771  strat->completeReduce_retry=TRUE;
9772  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
9773  do
9774  {
9775  pNext(h) = Ln.LmExtractAndIter();
9776  pIter(h);
9777  L->pLength++;
9778  } while (!Ln.IsNull());
9779  goto all_done;
9780  }
9781  if (Ln.IsNull()) goto all_done;
9782  if (! withT) With_s.Init(currRing);
9783  }
9784  pNext(h) = Ln.LmExtractAndIter();
9785  pIter(h);
9786  L->pLength++;
9787  }
9788 
9789  all_done:
9790  Ln.Delete();
9791  if (L->p != NULL) pNext(L->p) = pNext(p);
9792 
9793  if (strat->redTailChange)
9794  {
9795  L->length = 0;
9796  }
9797  L->Normalize(); // HANNES: should have a test
9798  kTest_L(L);
9799  return L->GetLmCurrRing();
9800 }
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:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:398
#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
polyrec * poly
Definition: hilb.h:10
#define kTest_L(T)
Definition: kutil.h:619
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
poly redtailSba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 733 of file kstd2.cc.

734 {
735 #define REDTAIL_CANONICALIZE 100
736  strat->redTailChange=FALSE;
737  if (strat->noTailReduction) return L->GetLmCurrRing();
738  poly h, p;
739  p = h = L->GetLmTailRing();
740  if ((h==NULL) || (pNext(h)==NULL))
741  return L->GetLmCurrRing();
742 
743  TObject* With;
744  // placeholder in case strat->tl < 0
745  TObject With_s(strat->tailRing);
746 
747  LObject Ln(pNext(h), strat->tailRing);
748  Ln.sig = L->sig;
749  Ln.sevSig = L->sevSig;
750  Ln.pLength = L->GetpLength() - 1;
751 
752  pNext(h) = NULL;
753  if (L->p != NULL) pNext(L->p) = NULL;
754  L->pLength = 1;
755 
756  Ln.PrepareRed(strat->use_buckets);
757 
758  int cnt=REDTAIL_CANONICALIZE;
759  while(!Ln.IsNull())
760  {
761  loop
762  {
763  Ln.SetShortExpVector();
764  if (withT)
765  {
766  int j;
767  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
768  if (j < 0) break;
769  With = &(strat->T[j]);
770  }
771  else
772  {
773  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
774  if (With == NULL) break;
775  }
776  cnt--;
777  if (cnt==0)
778  {
780  /*poly tmp=*/Ln.CanonicalizeP();
781  if (normalize)
782  {
783  Ln.Normalize();
784  //pNormalize(tmp);
785  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
786  }
787  }
788  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
789  {
790  With->pNorm();
791  }
792  strat->redTailChange=TRUE;
793  int ret = ksReducePolyTailSig(L, With, &Ln);
794 #if SBA_PRINT_REDUCTION_STEPS
795  if (ret != 3)
796  sba_reduction_steps++;
797 #endif
798 #if SBA_PRINT_OPERATIONS
799  if (ret != 3)
800  sba_operations += pLength(With->p);
801 #endif
802  if (ret)
803  {
804  // reducing the tail would violate the exp bound
805  // set a flag and hope for a retry (in bba)
806  strat->completeReduce_retry=TRUE;
807  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
808  do
809  {
810  pNext(h) = Ln.LmExtractAndIter();
811  pIter(h);
812  L->pLength++;
813  } while (!Ln.IsNull());
814  goto all_done;
815  }
816  if (Ln.IsNull()) goto all_done;
817  if (! withT) With_s.Init(currRing);
818  }
819  pNext(h) = Ln.LmExtractAndIter();
820  pIter(h);
821  pNormalize(h);
822  L->pLength++;
823  }
824 
825  all_done:
826  Ln.Delete();
827  if (L->p != NULL) pNext(L->p) = pNext(p);
828 
829  if (strat->redTailChange)
830  {
831  L->length = 0;
832  }
833 
834  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
835  //L->Normalize(); // HANNES: should have a test
836  kTest_L(L);
837  return L->GetLmCurrRing();
838 }
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:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:529
static int pLength(poly a)
Definition: p_polys.h:189
char completeReduce_retry
Definition: kutil.h:398
#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
polyrec * poly
Definition: hilb.h:10
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:149
#define kTest_L(T)
Definition: kutil.h:619
#define REDTAIL_CANONICALIZE
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
void reorderS ( int suc,
kStrategy  strat 
)

Definition at line 3807 of file kutil.cc.

3808 {
3809  int i,j,at,ecart, s2r;
3810  int fq=0;
3811  unsigned long sev;
3812  poly p;
3813  int new_suc=strat->sl+1;
3814  i= *suc;
3815  if (i<0) i=0;
3816 
3817  for (; i<=strat->sl; i++)
3818  {
3819  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
3820  if (at != i)
3821  {
3822  if (new_suc > at) new_suc = at;
3823  p = strat->S[i];
3824  ecart = strat->ecartS[i];
3825  sev = strat->sevS[i];
3826  s2r = strat->S_2_R[i];
3827  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
3828  for (j=i; j>=at+1; j--)
3829  {
3830  strat->S[j] = strat->S[j-1];
3831  strat->ecartS[j] = strat->ecartS[j-1];
3832  strat->sevS[j] = strat->sevS[j-1];
3833  strat->S_2_R[j] = strat->S_2_R[j-1];
3834  }
3835  strat->S[at] = p;
3836  strat->ecartS[at] = ecart;
3837  strat->sevS[at] = sev;
3838  strat->S_2_R[at] = s2r;
3839  if (strat->fromQ!=NULL)
3840  {
3841  for (j=i; j>=at+1; j--)
3842  {
3843  strat->fromQ[j] = strat->fromQ[j-1];
3844  }
3845  strat->fromQ[at]=fq;
3846  }
3847  }
3848  }
3849  if (new_suc <= strat->sl) *suc=new_suc;
3850  else *suc=-1;
3851 }
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
ideal sba ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1670 of file kstd2.cc.

1671 {
1672  // ring order stuff:
1673  // in sba we have (until now) two possibilities:
1674  // 1. an incremental computation w.r.t. (C,monomial order)
1675  // 2. a (possibly non-incremental) computation w.r.t. the
1676  // induced Schreyer order.
1677  // The corresponding orders are computed in sbaRing(), depending
1678  // on the flag strat->sbaOrder
1679 #if SBA_PRINT_ZERO_REDUCTIONS
1680  long zeroreductions = 0;
1681 #endif
1682 #if SBA_PRINT_PRODUCT_CRITERION
1683  long product_criterion = 0;
1684 #endif
1685 #if SBA_PRINT_SIZE_G
1686  int size_g = 0;
1687  int size_g_non_red = 0;
1688 #endif
1689 #if SBA_PRINT_SIZE_SYZ
1690  long size_syz = 0;
1691 #endif
1692  // global variable
1693 #if SBA_PRINT_REDUCTION_STEPS
1694  sba_reduction_steps = 0;
1695  sba_interreduction_steps = 0;
1696 #endif
1697 #if SBA_PRINT_OPERATIONS
1698  sba_operations = 0;
1699  sba_interreduction_operations = 0;
1700 #endif
1701 
1702  ideal F1 = F0;
1703  ring sRing, currRingOld;
1704  currRingOld = currRing;
1705  if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
1706  {
1707  sRing = sbaRing(strat);
1708  if (sRing!=currRingOld)
1709  {
1710  rChangeCurrRing (sRing);
1711  F1 = idrMoveR (F0, currRingOld, currRing);
1712  }
1713  }
1714  // sort ideal F
1715  ideal F = idInit(IDELEMS(F1),F1->rank);
1716  intvec *sort = idSort(F1);
1717  for (int i=0; i<sort->length();++i)
1718  F->m[i] = F1->m[(*sort)[i]-1];
1719 #if SBA_INTERRED_START
1720  F = kInterRed(F,NULL);
1721 #endif
1722 #if F5DEBUG
1723  printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
1724  rWrite (currRing);
1725  printf("ordSgn = %d\n",currRing->OrdSgn);
1726  printf("\n");
1727 #endif
1728 #ifdef KDEBUG
1729  bba_count++;
1730  int loop_count = 0;
1731 #endif /* KDEBUG */
1732  int srmax,lrmax, red_result = 1;
1733  int olddeg,reduc;
1734  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1735  LObject L;
1736  BOOLEAN withT = TRUE;
1737  strat->max_lower_index = 0;
1738 
1739  //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1740  initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
1741  initSbaPos(strat);
1742  //initBuchMoraPos(strat);
1743  initHilbCrit(F,Q,&hilb,strat);
1744  initSba(F,strat);
1745  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1746  /*Shdl=*/initSbaBuchMora(F, Q,strat);
1747  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1748  srmax = strat->sl;
1749  reduc = olddeg = lrmax = 0;
1750 
1751 #ifndef NO_BUCKETS
1752  if (!TEST_OPT_NOT_BUCKETS)
1753  strat->use_buckets = 1;
1754 #endif
1755 
1756  // redtailBBa against T for inhomogenous input
1757  // if (!TEST_OPT_OLDSTD)
1758  // withT = ! strat->homog;
1759 
1760  // strat->posInT = posInT_pLength;
1761  kTest_TS(strat);
1762 
1763 #ifdef KDEBUG
1764 #if MYTEST
1765  if (TEST_OPT_DEBUG)
1766  {
1767  PrintS("bba start GB: currRing: ");
1768  // rWrite(currRing);PrintLn();
1770  PrintLn();
1771  }
1772 #endif /* MYTEST */
1773 #endif /* KDEBUG */
1774 
1775 #ifdef HAVE_TAIL_RING
1776  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1777  kStratInitChangeTailRing(strat);
1778 #endif
1779  if (BVERBOSE(23))
1780  {
1781  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1782  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1783  kDebugPrint(strat);
1784  }
1785 
1786 
1787 #ifdef KDEBUG
1788  //kDebugPrint(strat);
1789 #endif
1790  /* compute------------------------------------------------------- */
1791  while (strat->Ll >= 0)
1792  {
1793  if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
1794  #ifdef KDEBUG
1795  loop_count++;
1796  if (TEST_OPT_DEBUG) messageSets(strat);
1797  #endif
1798  if (strat->Ll== 0) strat->interpt=TRUE;
1799  /*
1800  if (TEST_OPT_DEGBOUND
1801  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1802  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1803  {
1804 
1805  //stops computation if
1806  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1807  //a predefined number Kstd1_deg
1808  while ((strat->Ll >= 0)
1809  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1810  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1811  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1812  )
1813  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1814  if (strat->Ll<0) break;
1815  else strat->noClearS=TRUE;
1816  }
1817  */
1818  if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
1819  {
1820  strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
1821 #if F5C
1822  // 1. interreduction of the current standard basis
1823  // 2. generation of new principal syzygy rules for syzCriterion
1824  f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
1825  lrmax, reduc, Q, w, hilb );
1826 #endif
1827  // initialize new syzygy rules for the next iteration step
1828  initSyzRules(strat);
1829 
1830  }
1831  /*********************************************************************
1832  * interrreduction step is done, we can go on with the next iteration
1833  * step of the signature-based algorithm
1834  ********************************************************************/
1835  /* picks the last element from the lazyset L */
1836  strat->P = strat->L[strat->Ll];
1837  strat->Ll--;
1838  /* reduction of the element chosen from L */
1839 
1840  if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) {
1841  //#if 1
1842 #ifdef DEBUGF5
1843  Print("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
1844  Print("-------------------------------------------------\n");
1845  pWrite(strat->P.sig);
1846  pWrite(pHead(strat->P.p));
1847  pWrite(pHead(strat->P.p1));
1848  pWrite(pHead(strat->P.p2));
1849  Print("-------------------------------------------------\n");
1850 #endif
1851  if (pNext(strat->P.p) == strat->tail)
1852  {
1853  // deletes the short spoly
1854  /*
1855 #ifdef HAVE_RINGS
1856  if (rField_is_Ring(currRing))
1857  pLmDelete(strat->P.p);
1858  else
1859 #endif
1860  pLmFree(strat->P.p);
1861 */
1862  // TODO: needs some masking
1863  // TODO: masking needs to vanish once the signature
1864  // sutff is completely implemented
1865  strat->P.p = NULL;
1866  poly m1 = NULL, m2 = NULL;
1867 
1868  // check that spoly creation is ok
1869  while (strat->tailRing != currRing &&
1870  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1871  {
1872  assume(m1 == NULL && m2 == NULL);
1873  // if not, change to a ring where exponents are at least
1874  // large enough
1875  if (!kStratChangeTailRing(strat))
1876  {
1877  WerrorS("OVERFLOW...");
1878  break;
1879  }
1880  }
1881  // create the real one
1882  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
1883  strat->tailRing, m1, m2, strat->R);
1884 
1885  }
1886  else if (strat->P.p1 == NULL)
1887  {
1888  if (strat->minim > 0)
1889  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
1890  // for input polys, prepare reduction
1891  strat->P.PrepareRed(strat->use_buckets);
1892  }
1893  if (strat->P.p == NULL && strat->P.t_p == NULL)
1894  {
1895  red_result = 0;
1896  }
1897  else
1898  {
1899  //#if 1
1900 #ifdef DEBUGF5
1901  Print("Poly before red: ");
1902  pWrite(pHead(strat->P.p));
1903  pWrite(strat->P.sig);
1904 #endif
1905 #if SBA_PRODUCT_CRITERION
1906  if (strat->P.prod_crit) {
1907 #if SBA_PRINT_PRODUCT_CRITERION
1908  product_criterion++;
1909 #endif
1910  int pos = posInSyz(strat, strat->P.sig);
1911  enterSyz(strat->P, strat, pos);
1912  if (strat->P.lcm!=NULL)
1913  pLmFree(strat->P.lcm);
1914  red_result = 2;
1915  } else {
1916  red_result = strat->red(&strat->P,strat);
1917  }
1918 #else
1919  red_result = strat->red(&strat->P,strat);
1920 #endif
1921  }
1922  } else {
1923  /*
1924  if (strat->P.lcm != NULL)
1925  pLmFree(strat->P.lcm);
1926  */
1927  red_result = 2;
1928  }
1929  if (errorreported) break;
1930 
1931 //#if 1
1932 #ifdef DEBUGF5
1933  if (red_result != 0) {
1934  Print("Poly after red: ");
1935  pWrite(pHead(strat->P.p));
1936  pWrite(strat->P.GetLmCurrRing());
1937  pWrite(strat->P.sig);
1938  printf("%d\n",red_result);
1939  }
1940 #endif
1941 
1942  if (strat->overflow)
1943  {
1944  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
1945  }
1946 
1947  // reduction to non-zero new poly
1948  if (red_result == 1)
1949  {
1950  // get the polynomial (canonicalize bucket, make sure P.p is set)
1951  strat->P.GetP(strat->lmBin);
1952 
1953  // sig-safe computations may lead to wrong FDeg computation, thus we need
1954  // to recompute it to make sure everything is alright
1955  (strat->P).FDeg = (strat->P).pFDeg();
1956  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
1957  // but now, for entering S, T, we reset it
1958  // in the inhomogeneous case: FDeg == pFDeg
1959  if (strat->homog) strat->initEcart(&(strat->P));
1960 
1961  /* statistic */
1962  if (TEST_OPT_PROT) PrintS("s");
1963 
1964  //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1965  // in F5E we know that the last reduced element is already the
1966  // the one with highest signature
1967  int pos = strat->sl+1;
1968 
1969 #ifdef KDEBUG
1970 #if MYTEST
1971  PrintS("New S: "); pDebugPrint(strat->P.p); PrintLn();
1972 #endif /* MYTEST */
1973 #endif /* KDEBUG */
1974 
1975  // reduce the tail and normalize poly
1976  // in the ring case we cannot expect LC(f) = 1,
1977  // therefore we call pContent instead of pNorm
1978 #if SBA_TAIL_RED
1979  if (strat->sbaOrder != 2) {
1981  {
1982  strat->P.pCleardenom();
1984  {
1985  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
1986  strat->P.pCleardenom();
1987  }
1988  }
1989  else
1990  {
1991  strat->P.pNorm();
1993  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
1994  }
1995  }
1996 #endif
1997 
1998  // remove sigsafe label since it is no longer valid for the next element to
1999  // be reduced
2000  if (strat->sbaOrder == 1)
2001  {
2002  for (int jj = 0; jj<strat->tl+1; jj++)
2003  {
2004  if (pGetComp(strat->T[jj].sig) == strat->currIdx)
2005  {
2006  strat->T[jj].is_sigsafe = FALSE;
2007  }
2008  }
2009  }
2010  else
2011  {
2012  for (int jj = 0; jj<strat->tl+1; jj++)
2013  {
2014  strat->T[jj].is_sigsafe = FALSE;
2015  }
2016  }
2017 #ifdef KDEBUG
2018  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2019 #if MYTEST
2020 //#if 1
2021  PrintS("New (reduced) S: "); pDebugPrint(strat->P.p); PrintLn();
2022 #endif /* MYTEST */
2023 #endif /* KDEBUG */
2024 
2025  // min_std stuff
2026  if ((strat->P.p1==NULL) && (strat->minim>0))
2027  {
2028  if (strat->minim==1)
2029  {
2030  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2031  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2032  }
2033  else
2034  {
2035  strat->M->m[minimcnt]=strat->P.p2;
2036  strat->P.p2=NULL;
2037  }
2038  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2039  pNext(strat->M->m[minimcnt])
2040  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2041  strat->tailRing, currRing,
2042  currRing->PolyBin);
2043  minimcnt++;
2044  }
2045 
2046  // enter into S, L, and T
2047  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2048  enterT(strat->P, strat);
2049  strat->T[strat->tl].is_sigsafe = FALSE;
2050  /*
2051  printf("hier\n");
2052  pWrite(strat->P.GetLmCurrRing());
2053  pWrite(strat->P.sig);
2054  */
2055 #ifdef HAVE_RINGS
2056  if (rField_is_Ring(currRing))
2057  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2058  else
2059 #endif
2060  enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2061  // posInS only depends on the leading term
2062  strat->enterS(strat->P, pos, strat, strat->tl);
2063  if(strat->sbaOrder != 1)
2064  {
2065  BOOLEAN overwrite = FALSE;
2066  for (int tk=0; tk<strat->sl+1; tk++)
2067  {
2068  if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
2069  {
2070  //printf("TK %d / %d\n",tk,strat->sl);
2071  overwrite = FALSE;
2072  break;
2073  }
2074  }
2075  //printf("OVERWRITE %d\n",overwrite);
2076  if (overwrite)
2077  {
2078  int cmp = pGetComp(strat->P.sig);
2079  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2080  pGetExpV (strat->P.p,vv);
2081  pSetExpV (strat->P.sig, vv);
2082  pSetComp (strat->P.sig,cmp);
2083 
2084  strat->P.sevSig = pGetShortExpVector (strat->P.sig);
2085  int i;
2086  LObject Q;
2087  for(int ps=0;ps<strat->sl+1;ps++)
2088  {
2089 
2090  strat->newt = TRUE;
2091  if (strat->syzl == strat->syzmax)
2092  {
2093  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
2094  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
2095  (strat->syzmax)*sizeof(unsigned long),
2096  ((strat->syzmax)+setmaxTinc)
2097  *sizeof(unsigned long));
2098  strat->syzmax += setmaxTinc;
2099  }
2100  Q.sig = pCopy(strat->P.sig);
2101  // add LM(F->m[i]) to the signature to get a Schreyer order
2102  // without changing the underlying polynomial ring at all
2103  if (strat->sbaOrder == 0)
2104  p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
2105  // since p_Add_q() destroys all input
2106  // data we need to recreate help
2107  // each time
2108  // ----------------------------------------------------------
2109  // in the Schreyer order we always know that the multiplied
2110  // module monomial strat->P.sig gives the leading monomial of
2111  // the corresponding principal syzygy
2112  // => we do not need to compute the "real" syzygy completely
2113  poly help = p_Copy(strat->sig[ps],currRing);
2114  p_ExpVectorAdd (help,strat->P.p,currRing);
2115  Q.sig = p_Add_q(Q.sig,help,currRing);
2116  //printf("%d. SYZ ",i+1);
2117  //pWrite(strat->syz[i]);
2118  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
2119  i = posInSyz(strat, Q.sig);
2120  enterSyz(Q, strat, i);
2121  }
2122  }
2123  }
2124  // deg - idx - lp/rp
2125  // => we need to add syzygies with indices > pGetComp(strat->P.sig)
2126  if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
2127  {
2128  int cmp = pGetComp(strat->P.sig);
2129  int max_cmp = IDELEMS(F);
2130  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2131  pGetExpV (strat->P.p,vv);
2132  LObject Q;
2133  int pos;
2134  int idx = p_GetComp(strat->P.sig,currRing);
2135  //printf("++ -- adding syzygies -- ++\n");
2136  // if new element is the first one in this index
2137  if (strat->currIdx < idx) {
2138  for (int i=0; i<strat->sl; ++i) {
2139  Q.sig = p_Copy(strat->P.sig,currRing);
2140  p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
2141  poly help = p_Copy(strat->sig[i],currRing);
2142  p_ExpVectorAdd(help,strat->P.p,currRing);
2143  Q.sig = p_Add_q(Q.sig,help,currRing);
2144  //pWrite(Q.sig);
2145  pos = posInSyz(strat, Q.sig);
2146  enterSyz(Q, strat, pos);
2147  }
2148  strat->currIdx = idx;
2149  } else {
2150  // if the element is not the first one in the given index we build all
2151  // possible syzygies with elements of higher index
2152  for (int i=cmp+1; i<=max_cmp; ++i) {
2153  pos = -1;
2154  for (int j=0; j<strat->sl; ++j) {
2155  if (p_GetComp(strat->sig[j],currRing) == i) {
2156  pos = j;
2157  break;
2158  }
2159  }
2160  if (pos != -1) {
2161  Q.sig = p_One(currRing);
2162  p_SetExpV(Q.sig, vv, currRing);
2163  // F->m[i-1] corresponds to index i
2164  p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
2165  p_SetComp(Q.sig, i, currRing);
2166  poly help = p_Copy(strat->P.sig,currRing);
2167  p_ExpVectorAdd(help,strat->S[pos],currRing);
2168  Q.sig = p_Add_q(Q.sig,help,currRing);
2169  if (strat->sbaOrder == 0) {
2170  if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn) {
2171  pos = posInSyz(strat, Q.sig);
2172  enterSyz(Q, strat, pos);
2173  }
2174  } else {
2175  pos = posInSyz(strat, Q.sig);
2176  enterSyz(Q, strat, pos);
2177  }
2178  }
2179  }
2180  //printf("++ -- done adding syzygies -- ++\n");
2181  }
2182  }
2183 //#if 1
2184 #if DEBUGF50
2185  printf("---------------------------\n");
2186  Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
2187  Print("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
2188  Print("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
2189 #endif
2190  /*
2191  if (newrules)
2192  {
2193  newrules = FALSE;
2194  }
2195  */
2196 #if 0
2197  int pl=pLength(strat->P.p);
2198  if (pl==1)
2199  {
2200  //if (TEST_OPT_PROT)
2201  //PrintS("<1>");
2202  }
2203  else if (pl==2)
2204  {
2205  //if (TEST_OPT_PROT)
2206  //PrintS("<2>");
2207  }
2208 #endif
2209  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2210 // Print("[%d]",hilbeledeg);
2211  if (strat->P.lcm!=NULL)
2212 #ifdef HAVE_RINGS
2213  pLmDelete(strat->P.lcm);
2214 #else
2215  pLmFree(strat->P.lcm);
2216 #endif
2217  if (strat->sl>srmax) srmax = strat->sl;
2218  }
2219  else
2220  {
2221  // adds signature of the zero reduction to
2222  // strat->syz. This is the leading term of
2223  // syzygy and can be used in syzCriterion()
2224  // the signature is added if and only if the
2225  // pair was not detected by the rewritten criterion in strat->red = redSig
2226  if (red_result!=2) {
2227 #if SBA_PRINT_ZERO_REDUCTIONS
2228  zeroreductions++;
2229 #endif
2230  int pos = posInSyz(strat, strat->P.sig);
2231  enterSyz(strat->P, strat, pos);
2232 //#if 1
2233 #ifdef DEBUGF5
2234  Print("ADDING STUFF TO SYZ : ");
2235  //pWrite(strat->P.p);
2236  pWrite(strat->P.sig);
2237 #endif
2238  }
2239  if (strat->P.p1 == NULL && strat->minim > 0)
2240  {
2241  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2242  }
2243  }
2244 
2245 #ifdef KDEBUG
2246  memset(&(strat->P), 0, sizeof(strat->P));
2247 #endif /* KDEBUG */
2248  kTest_TS(strat);
2249  }
2250 #ifdef KDEBUG
2251 #if MYTEST
2252  PrintS("bba finish GB: currRing: "); rWrite(currRing);
2253 #endif /* MYTEST */
2254  if (TEST_OPT_DEBUG) messageSets(strat);
2255 #endif /* KDEBUG */
2256 
2257  if (TEST_OPT_SB_1)
2258  {
2259  #ifdef HAVE_RINGS
2260  if(!rField_is_Ring(currRing))
2261  #endif
2262  {
2263  int k=1;
2264  int j;
2265  while(k<=strat->sl)
2266  {
2267  j=0;
2268  loop
2269  {
2270  if (j>=k) break;
2271  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2272  j++;
2273  }
2274  k++;
2275  }
2276  }
2277  }
2278 
2279  /* complete reduction of the standard basis--------- */
2280  if (TEST_OPT_REDSB)
2281  {
2282  completeReduce(strat);
2283 #ifdef HAVE_TAIL_RING
2284  if (strat->completeReduce_retry)
2285  {
2286  // completeReduce needed larger exponents, retry
2287  // to reduce with S (instead of T)
2288  // and in currRing (instead of strat->tailRing)
2289  cleanT(strat);strat->tailRing=currRing;
2290  int i;
2291  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2292  completeReduce(strat);
2293  }
2294 #endif
2295  }
2296  else if (TEST_OPT_PROT) PrintLn();
2297 
2298 #if SBA_PRINT_SIZE_SYZ
2299  // that is correct, syzl is counting one too far
2300  size_syz = strat->syzl;
2301 #endif
2302  exitSba(strat);
2303 // if (TEST_OPT_WEIGHTM)
2304 // {
2305 // pRestoreDegProcs(pFDegOld, pLDegOld);
2306 // if (ecartWeights)
2307 // {
2308 // omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
2309 // ecartWeights=NULL;
2310 // }
2311 // }
2312  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
2313  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2314 
2315 #ifdef KDEBUG
2316 #if MYTEST
2317  PrintS("bba_end: currRing: "); rWrite(currRing);
2318 #endif /* MYTEST */
2319 #endif /* KDEBUG */
2320 #if SBA_PRINT_SIZE_G
2321  size_g_non_red = IDELEMS(strat->Shdl);
2322 #endif
2323  if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
2324  {
2325  rChangeCurrRing (currRingOld);
2326  F0 = idrMoveR (F1, sRing, currRing);
2327  strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
2328  rDelete (sRing);
2329  }
2330  id_DelDiv(strat->Shdl, currRing);
2331  idSkipZeroes(strat->Shdl);
2332  idTest(strat->Shdl);
2333 
2334 #if SBA_PRINT_SIZE_G
2335  size_g = IDELEMS(strat->Shdl);
2336 #endif
2337 #ifdef DEBUGF5
2338  printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
2339  int oo = 0;
2340  while (oo<IDELEMS(strat->Shdl))
2341  {
2342  printf(" %d. ",oo+1);
2343  pWrite(pHead(strat->Shdl->m[oo]));
2344  oo++;
2345  }
2346 #endif
2347 #if SBA_PRINT_ZERO_REDUCTIONS
2348  printf("----------------------------------------------------------\n");
2349  printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
2350  zeroreductions = 0;
2351 #endif
2352 #if SBA_PRINT_REDUCTION_STEPS
2353  printf("----------------------------------------------------------\n");
2354  printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
2355 #endif
2356 #if SBA_PRINT_OPERATIONS
2357  printf("OPERATIONS: %ld\n",sba_operations);
2358 #endif
2359 #if SBA_PRINT_REDUCTION_STEPS
2360  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2361  printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
2362 #endif
2363 #if SBA_PRINT_OPERATIONS
2364  printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
2365 #endif
2366 #if SBA_PRINT_REDUCTION_STEPS
2367  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2368  printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
2369  sba_interreduction_steps = 0;
2370  sba_reduction_steps = 0;
2371 #endif
2372 #if SBA_PRINT_OPERATIONS
2373  printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
2374  sba_interreduction_operations = 0;
2375  sba_operations = 0;
2376 #endif
2377 #if SBA_PRINT_SIZE_G
2378  printf("----------------------------------------------------------\n");
2379  printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
2380  size_g = 0;
2381  size_g_non_red = 0;
2382 #endif
2383 #if SBA_PRINT_SIZE_SYZ
2384  printf("SIZE OF SYZ: %ld\n",size_syz);
2385  printf("----------------------------------------------------------\n");
2386  size_syz = 0;
2387 #endif
2388 #if SBA_PRINT_PRODUCT_CRITERION
2389  printf("PRODUCT CRITERIA: %ld\n",product_criterion);
2390  product_criterion = 0;
2391 #endif
2392  return (strat->Shdl);
2393 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
polyset sig
Definition: kutil.h:306
#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:283
void id_DelDiv(ideal id, const ring r)
void initSbaPos(kStrategy strat)
Definition: kutil.cc:7655
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:58
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
void enterSyz(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7240
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:396
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:293
const ideal
Definition: gb_hack.h:42
void initSba(ideal F, kStrategy strat)
Definition: kstd1.cc:1334
void initSyzRules(kStrategy strat)
Definition: kutil.cc:6087
int tl
Definition: kutil.h:353
#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:85
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:338
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:8361
void pWrite(poly p)
Definition: polys.h:279
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7751
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
unsigned long currIdx
Definition: kutil.h:315
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3703
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
int minim
Definition: kutil.h:361
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:3971
char completeReduce_retry
Definition: kutil.h:398
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
BOOLEAN interpt
Definition: kutil.h:365
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:16
#define kTest_TS(A)
Definition: kutil.h:616
poly p_One(const ring r)
Definition: p_polys.cc:1318
int max_lower_index
Definition: kutil.h:316
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:7305
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
#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 ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:376
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3059
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
#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:8231
LObject P
Definition: kutil.h:300
ideal M
Definition: kutil.h:303
unsigned sbaOrder
Definition: kutil.h:314
void exitSba(kStrategy strat)
Definition: kutil.cc:7830
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
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:2551
TObject ** R
Definition: kutil.h:340
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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
short errorreported
Definition: feFopen.cc:22
#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:8176
#define BVERBOSE(a)
Definition: options.h:33
kStrategy strat
Definition: myNF.cc:319
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)
Definition: simpleideals.cc:40
static int bba_count
Definition: kstd2.cc:1334
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:491
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3597
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:4624
ring tailRing
Definition: kutil.h:343
#define TEST_OPT_SB_1
Definition: options.h:113
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:7382
char overflow
Definition: kutil.h:399
unsigned long * sevS
Definition: kutil.h:320
#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:7991
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:321
#define setmaxTinc
Definition: kutil.h:31
intvec * idSort(ideal id, BOOLEAN nolex=TRUE, const ring R=currRing)
Definition: ideals.h:187
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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:95
polyset syz
Definition: kutil.h:305
int sl
Definition: kutil.h:351
void sort(CFArray &A, int l=0)
quick sort A
TSet T
Definition: kutil.h:324
omBin lmBin
Definition: kutil.h:344
BOOLEAN use_buckets
Definition: kutil.h:377
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:96
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kstd2.cc:733
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int syzl
Definition: kutil.h:352
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define idTest(id)
Definition: ideals.h:63
ring sbaRing ( kStrategy  strat,
const ring  r = currRing,
BOOLEAN  complete = TRUE,
int  sgn = 1 
)

Definition at line 8361 of file kutil.cc.

8362 {
8363  int n = rBlocks(r); // Including trailing zero!
8364  // if sbaOrder == 1 => use (C,monomial order from r)
8365  if (strat->sbaOrder == 1)
8366  {
8367  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
8368  {
8369  return r;
8370  }
8371  ring res = rCopy0(r, TRUE, FALSE);
8372  res->order = (int *)omAlloc0((n+1)*sizeof(int));
8373  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
8374  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
8375  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
8376  res->wvhdl = wvhdl;
8377  for (int i=1; i<n; i++)
8378  {
8379  res->order[i] = r->order[i-1];
8380  res->block0[i] = r->block0[i-1];
8381  res->block1[i] = r->block1[i-1];
8382  res->wvhdl[i] = r->wvhdl[i-1];
8383  }
8384 
8385  // new 1st block
8386  res->order[0] = ringorder_C; // Prefix
8387  // removes useless secondary component order if defined in old ring
8388  for (int i=rBlocks(res); i>0; --i) {
8389  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
8390  res->order[i] = 0;
8391  }
8392  }
8393  rComplete(res, 1);
8394 #ifdef HAVE_PLURAL
8395  if (rIsPluralRing(r))
8396  {
8397  if ( nc_rComplete(r, res, false) ) // no qideal!
8398  {
8399 #ifndef SING_NDEBUG
8400  WarnS("error in nc_rComplete");
8401 #endif
8402  // cleanup?
8403 
8404  // rDelete(res);
8405  // return r;
8406 
8407  // just go on..
8408  }
8409  }
8410 #endif
8411  strat->tailRing = res;
8412  return (res);
8413  }
8414  // if sbaOrder == 3 => degree - position - ring order
8415  if (strat->sbaOrder == 3)
8416  {
8417  ring res = rCopy0(r, TRUE, FALSE);
8418  res->order = (int *)omAlloc0((n+2)*sizeof(int));
8419  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
8420  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
8421  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
8422  res->wvhdl = wvhdl;
8423  for (int i=2; i<n+2; i++)
8424  {
8425  res->order[i] = r->order[i-2];
8426  res->block0[i] = r->block0[i-2];
8427  res->block1[i] = r->block1[i-2];
8428  res->wvhdl[i] = r->wvhdl[i-2];
8429  }
8430 
8431  // new 1st block
8432  res->order[0] = ringorder_a; // Prefix
8433  res->block0[0] = 1;
8434  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
8435  for (int i=0; i<res->N; ++i)
8436  res->wvhdl[0][i] = 1;
8437  res->block1[0] = si_min(res->N, rVar(res));
8438  // new 2nd block
8439  res->order[1] = ringorder_C; // Prefix
8440  res->wvhdl[1] = NULL;
8441  // removes useless secondary component order if defined in old ring
8442  for (int i=rBlocks(res); i>1; --i) {
8443  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
8444  res->order[i] = 0;
8445  }
8446  }
8447  rComplete(res, 1);
8448 #ifdef HAVE_PLURAL
8449  if (rIsPluralRing(r))
8450  {
8451  if ( nc_rComplete(r, res, false) ) // no qideal!
8452  {
8453 #ifndef SING_NDEBUG
8454  WarnS("error in nc_rComplete");
8455 #endif
8456  // cleanup?
8457 
8458  // rDelete(res);
8459  // return r;
8460 
8461  // just go on..
8462  }
8463  }
8464 #endif
8465  strat->tailRing = res;
8466  return (res);
8467  }
8468 
8469  // not sbaOrder == 1 => use Schreyer order
8470  // this is done by a trick when initializing the signatures
8471  // in initSLSba():
8472  // Instead of using the signature 1e_i for F->m[i], we start
8473  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
8474  // Schreyer order w.r.t. the underlying monomial order.
8475  // => we do not need to change the underlying polynomial ring at all!
8476 
8477  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
8478 
8479  /*
8480  else
8481  {
8482  ring res = rCopy0(r, FALSE, FALSE);
8483  // Create 2 more blocks for prefix/suffix:
8484  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
8485  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
8486  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
8487  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
8488 
8489  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
8490  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
8491 
8492  // new 1st block
8493  int j = 0;
8494  res->order[j] = ringorder_IS; // Prefix
8495  res->block0[j] = res->block1[j] = 0;
8496  // wvhdl[j] = NULL;
8497  j++;
8498 
8499  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
8500  {
8501  res->order [j] = r->order [i];
8502  res->block0[j] = r->block0[i];
8503  res->block1[j] = r->block1[i];
8504 
8505  if (r->wvhdl[i] != NULL)
8506  {
8507  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
8508  } // else wvhdl[j] = NULL;
8509  }
8510 
8511  // new last block
8512  res->order [j] = ringorder_IS; // Suffix
8513  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
8514  // wvhdl[j] = NULL;
8515  j++;
8516 
8517  // res->order [j] = 0; // The End!
8518  res->wvhdl = wvhdl;
8519 
8520  // j == the last zero block now!
8521  assume(j == (n+1));
8522  assume(res->order[0]==ringorder_IS);
8523  assume(res->order[j-1]==ringorder_IS);
8524  assume(res->order[j]==0);
8525 
8526  if (complete)
8527  {
8528  rComplete(res, 1);
8529 
8530 #ifdef HAVE_PLURAL
8531  if (rIsPluralRing(r))
8532  {
8533  if ( nc_rComplete(r, res, false) ) // no qideal!
8534  {
8535  }
8536  }
8537  assume(rIsPluralRing(r) == rIsPluralRing(res));
8538 #endif
8539 
8540 
8541 #ifdef HAVE_PLURAL
8542  ring old_ring = r;
8543 
8544 #endif
8545 
8546  if (r->qideal!=NULL)
8547  {
8548  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
8549 
8550  assume(idRankFreeModule(res->qideal, res) == 0);
8551 
8552 #ifdef HAVE_PLURAL
8553  if( rIsPluralRing(res) )
8554  if( nc_SetupQuotient(res, r, true) )
8555  {
8556  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
8557  }
8558 
8559 #endif
8560  assume(idRankFreeModule(res->qideal, res) == 0);
8561  }
8562 
8563 #ifdef HAVE_PLURAL
8564  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
8565  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
8566  assume(rIsSCA(res) == rIsSCA(old_ring));
8567  assume(ncRingType(res) == ncRingType(old_ring));
8568 #endif
8569  }
8570  strat->tailRing = res;
8571  return res;
8572  }
8573  */
8574 
8575  assume(FALSE);
8576  return(NULL);
8577 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
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:5499
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#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:355
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
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:3371
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
unsigned sbaOrder
Definition: kutil.h:314
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#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 3597 of file kutil.cc.

3598 {
3599 #if ADIDEBUG
3600  PrintS("\nEnter superenterpairs\n");
3601  int iii = strat->Ll;
3602 #endif
3604  // enter also zero divisor * poly, if this is non zero and of smaller degree
3605  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
3606 #if ADIDEBUG
3607  if(iii==strat->Ll)
3608  {
3609  PrintS("\n enterExtendedSpoly has not changed the list L.\n");
3610  }
3611  else
3612  {
3613  PrintLn();
3614  PrintS("\n enterExtendedSpoly changed the list L:\n");
3615  for(iii=0;iii<=strat->Ll;iii++)
3616  {
3617  Print("\n L[%d]:\n",iii);
3618  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3619  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3620  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3621  }
3622  }
3623  iii = strat->Ll;
3624 #endif
3625  initenterpairs(h, k, ecart, 0, strat, atR);
3626 #if ADIDEBUG
3627  if(iii==strat->Ll)
3628  {
3629  PrintS("\n initenterpairs has not changed the list L.\n");
3630  }
3631  else
3632  {
3633  PrintS("\n initenterpairs changed the list L:\n");
3634  for(iii=0;iii<=strat->Ll;iii++)
3635  {
3636  Print("\n L[%d]:\n",iii);
3637  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3638  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3639  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3640  }
3641  }
3642  iii = strat->Ll;
3643 #endif
3644  initenterstrongPairs(h, k, ecart, 0, strat, atR);
3645 #if ADIDEBUG
3646  if(iii==strat->Ll)
3647  {
3648  PrintS("\n initenterstrongPairs has not changed the list L.\n");
3649  }
3650  else
3651  {
3652  PrintS("\n initenterstrongPairs changed the list L:\n");
3653  for(iii=0;iii<=strat->Ll;iii++)
3654  {
3655  Print("\n L[%d]:\n",iii);
3656  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3657  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3658  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3659  }
3660  }
3661  PrintS("\nEnd of superenterpairs\n");
3662 #endif
3663  clearSbatch(h, k, pos, strat);
3664 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:3573
int Ll
Definition: kutil.h:354
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2751
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3451
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:431
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:3481
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:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
ring tailRing
Definition: kutil.h:343
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
static Poly * h
Definition: janet.cc:978
BOOLEAN syzCriterion ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5071 of file kutil.cc.

5072 {
5073 //#if 1
5074 #ifdef DEBUGF5
5075  Print("syzygy criterion checks: ");
5076  pWrite(sig);
5077 #endif
5078  for (int k=0; k<strat->syzl; k++)
5079  {
5080  //printf("-%d",k);
5081 //#if 1
5082 #ifdef DEBUGF5
5083  Print("checking with: %d / %d -- \n",k,strat->syzl);
5084  pWrite(pHead(strat->syz[k]));
5085 #endif
5086  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5087  {
5088 //#if 1
5089 #ifdef DEBUGF5
5090  PrintS("DELETE!\n");
5091 #endif
5092  //printf("- T -\n\n");
5093  return TRUE;
5094  }
5095  }
5096  //printf("- F -\n\n");
5097  return FALSE;
5098 }
#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:1707
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:321
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
BOOLEAN syzCriterionInc ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5103 of file kutil.cc.

5104 {
5105 //#if 1
5106 #ifdef DEBUGF5
5107  Print("--- syzygy criterion checks: ");
5108  pWrite(sig);
5109 #endif
5110  int comp = p_GetComp(sig, currRing);
5111  int min, max;
5112  if (comp<=1)
5113  return FALSE;
5114  else
5115  {
5116  min = strat->syzIdx[comp-2];
5117  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
5118  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
5119  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
5120  if (comp == strat->currIdx)
5121  {
5122  max = strat->syzl;
5123  }
5124  else
5125  {
5126  max = strat->syzIdx[comp-1];
5127  }
5128  for (int k=min; k<max; k++)
5129  {
5130 #ifdef F5DEBUG
5131  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
5132  Print("checking with: %d -- ",k);
5133  pWrite(pHead(strat->syz[k]));
5134 #endif
5135  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5136  return TRUE;
5137  }
5138  return FALSE;
5139  }
5140 }
#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
unsigned long currIdx
Definition: kutil.h:315
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:1707
#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:321
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
intset syzIdx
Definition: kutil.h:311
long twoPow ( long  arg)

Definition at line 3063 of file kutil.cc.

3064 {
3065  return 1L << arg;
3066 }
void updateResult ( ideal  r,
ideal  Q,
kStrategy  strat 
)

Definition at line 7864 of file kutil.cc.

7865 {
7866  int l;
7867  if (strat->ak>0)
7868  {
7869  for (l=IDELEMS(r)-1;l>=0;l--)
7870  {
7871  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
7872  {
7873  pDelete(&r->m[l]); // and set it to NULL
7874  }
7875  }
7876  int q;
7877  poly p;
7878  for (l=IDELEMS(r)-1;l>=0;l--)
7879  {
7880  if ((r->m[l]!=NULL)
7881  //&& (strat->syzComp>0)
7882  //&& (pGetComp(r->m[l])<=strat->syzComp)
7883  )
7884  {
7885  for(q=IDELEMS(Q)-1; q>=0;q--)
7886  {
7887  if ((Q->m[q]!=NULL)
7888  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
7889  {
7890  if (TEST_OPT_REDSB)
7891  {
7892  p=r->m[l];
7893  r->m[l]=kNF(Q,NULL,p);
7894  pDelete(&p);
7895  }
7896  else
7897  {
7898  pDelete(&r->m[l]); // and set it to NULL
7899  }
7900  break;
7901  }
7902  }
7903  }
7904  }
7905  }
7906  else
7907  {
7908  int q;
7909  poly p;
7910  BOOLEAN reduction_found=FALSE;
7911  if (!rField_is_Ring(currRing))
7912  {
7913  for (l=IDELEMS(r)-1;l>=0;l--)
7914  {
7915  if (r->m[l]!=NULL)
7916  {
7917  for(q=IDELEMS(Q)-1; q>=0;q--)
7918  {
7919  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
7920  {
7921  if (TEST_OPT_REDSB)
7922  {
7923  p=r->m[l];
7924  r->m[l]=kNF(Q,NULL,p);
7925  pDelete(&p);
7926  reduction_found=TRUE;
7927  }
7928  else
7929  {
7930  pDelete(&r->m[l]); // and set it to NULL
7931  }
7932  break;
7933  }
7934  }
7935  }
7936  }
7937  }
7938  #ifdef HAVE_RINGS
7939  //Also need divisibility of the leading coefficients
7940  else
7941  {
7942  for (l=IDELEMS(r)-1;l>=0;l--)
7943  {
7944  if (r->m[l]!=NULL)
7945  {
7946  for(q=IDELEMS(Q)-1; q>=0;q--)
7947  {
7948  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l]))
7949  && pDivisibleBy(Q->m[q],r->m[l]))
7950  {
7951  if (TEST_OPT_REDSB)
7952  {
7953  p=r->m[l];
7954  r->m[l]=kNF(Q,NULL,p);
7955  pDelete(&p);
7956  reduction_found=TRUE;
7957  }
7958  else
7959  {
7960  pDelete(&r->m[l]); // and set it to NULL
7961  }
7962  break;
7963  }
7964  }
7965  }
7966  }
7967  }
7968  #endif
7969  if (/*TEST_OPT_REDSB &&*/ reduction_found)
7970  {
7971  for (l=IDELEMS(r)-1;l>=0;l--)
7972  {
7973  if (r->m[l]!=NULL)
7974  {
7975  for(q=IDELEMS(r)-1;q>=0;q--)
7976  {
7977  if ((l!=q)
7978  && (r->m[q]!=NULL)
7979  &&(pLmDivisibleBy(r->m[l],r->m[q])))
7980  {
7981  pDelete(&r->m[q]);
7982  }
7983  }
7984  }
7985  }
7986  }
7987  }
7988  idSkipZeroes(r);
7989 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2598
#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:356
#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
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
polyrec * poly
Definition: hilb.h:10
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#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
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 6695 of file kutil.cc.

6696 {
6697  LObject h;
6698  int i, suc=0;
6699  poly redSi=NULL;
6700  BOOLEAN change,any_change;
6701 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
6702 // for (i=0; i<=(strat->sl); i++)
6703 // {
6704 // Print("s%d:",i);
6705 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
6706 // pWrite(strat->S[i]);
6707 // }
6708 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
6709  any_change=FALSE;
6711  {
6712  while (suc != -1)
6713  {
6714  i=suc+1;
6715  while (i<=strat->sl)
6716  {
6717  change=FALSE;
6718  #ifdef HAVE_RINGS
6720  any_change = FALSE;
6721  #endif
6722  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
6723  {
6724  redSi = pHead(strat->S[i]);
6725  strat->S[i] = redBba(strat->S[i],i-1,strat);
6726  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
6727  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
6728  if (pCmp(redSi,strat->S[i])!=0)
6729  {
6730  change=TRUE;
6731  any_change=TRUE;
6732  #ifdef KDEBUG
6733  if (TEST_OPT_DEBUG)
6734  {
6735  PrintS("reduce:");
6736  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
6737  }
6738  #endif
6739  if (TEST_OPT_PROT)
6740  {
6741  if (strat->S[i]==NULL)
6742  PrintS("V");
6743  else
6744  PrintS("v");
6745  mflush();
6746  }
6747  }
6748  pLmDelete(&redSi);
6749  if (strat->S[i]==NULL)
6750  {
6751  deleteInS(i,strat);
6752  i--;
6753  }
6754  else if (change)
6755  {
6757  {
6758  if (TEST_OPT_CONTENTSB)
6759  {
6760  number n;
6761  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
6762  if (!nIsOne(n))
6763  {
6765  denom->n=nInvers(n);
6766  denom->next=DENOMINATOR_LIST;
6767  DENOMINATOR_LIST=denom;
6768  }
6769  nDelete(&n);
6770  }
6771  else
6772  {
6773  //pContent(strat->S[i]);
6774  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
6775  }
6776  }
6777  else
6778  {
6779  pNorm(strat->S[i]);
6780  }
6781  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
6782  }
6783  }
6784  i++;
6785  }
6786  if (any_change) reorderS(&suc,strat);
6787  else break;
6788  }
6789  if (toT)
6790  {
6791  for (i=0; i<=strat->sl; i++)
6792  {
6793  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
6794  {
6795  h.p = redtailBba(strat->S[i],i-1,strat);
6797  {
6798  h.pCleardenom();// also does a pContent
6799  }
6800  }
6801  else
6802  {
6803  h.p = strat->S[i];
6804  }
6805  strat->initEcart(&h);
6806  if (strat->honey)
6807  {
6808  strat->ecartS[i] = h.ecart;
6809  }
6810  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
6811  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
6812  h.sev = strat->sevS[i];
6813  /*puts the elements of S also to T*/
6814  strat->initEcart(&h);
6815  enterT(h,strat);
6816  strat->S_2_R[i] = strat->tl;
6817  }
6818  }
6819  }
6820  else
6821  {
6822  while (suc != -1)
6823  {
6824  i=suc;
6825  while (i<=strat->sl)
6826  {
6827  change=FALSE;
6828  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
6829  {
6830  redSi=pHead((strat->S)[i]);
6831  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
6832  if ((strat->S)[i]==NULL)
6833  {
6834  deleteInS(i,strat);
6835  i--;
6836  }
6837  else if (pCmp((strat->S)[i],redSi)!=0)
6838  {
6839  any_change=TRUE;
6840  h.p = strat->S[i];
6841  strat->initEcart(&h);
6842  strat->ecartS[i] = h.ecart;
6844  {
6845  if (TEST_OPT_CONTENTSB)
6846  {
6847  number n;
6848  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
6849  if (!nIsOne(n))
6850  {
6852  denom->n=nInvers(n);
6853  denom->next=DENOMINATOR_LIST;
6854  DENOMINATOR_LIST=denom;
6855  }
6856  nDelete(&n);
6857  }
6858  else
6859  {
6860  //pContent(strat->S[i]);
6861  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
6862  }
6863  }
6864  else
6865  {
6866  pNorm(strat->S[i]); // == h.p
6867  }
6868  h.sev = pGetShortExpVector(h.p);
6869  strat->sevS[i] = h.sev;
6870  }
6871  pLmDelete(&redSi);
6872  kTest(strat);
6873  }
6874  i++;
6875  }
6876 #ifdef KDEBUG
6877  kTest(strat);
6878 #endif
6879  if (any_change) reorderS(&suc,strat);
6880  else { suc=-1; break; }
6881  if (h.p!=NULL)
6882  {
6883  if (!strat->kHEdgeFound)
6884  {
6885  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
6886  }
6887  if (strat->kHEdgeFound)
6888  newHEdge(strat);
6889  }
6890  }
6891  for (i=0; i<=strat->sl; i++)
6892  {
6893  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
6894  {
6895  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
6896  strat->initEcart(&h);
6897  strat->ecartS[i] = h.ecart;
6898  h.sev = pGetShortExpVector(h.p);
6899  strat->sevS[i] = h.sev;
6900  }
6901  else
6902  {
6903  h.p = strat->S[i];
6904  h.ecart=strat->ecartS[i];
6905  h.sev = strat->sevS[i];
6906  h.length = h.pLength = pLength(h.p);
6907  }
6908  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
6909  cancelunit1(&h,&suc,strat->sl,strat);
6910  h.SetpFDeg();
6911  /*puts the elements of S also to T*/
6912  enterT(h,strat);
6913  strat->S_2_R[i] = strat->tl;
6914  }
6915  if (suc!= -1) updateS(toT,strat);
6916  }
6917 #ifdef KDEBUG
6918  kTest(strat);
6919 #endif
6920 }
denominator_list_s * denominator_list
Definition: kutil.h:63
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:6543
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:3807
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
#define TEST_OPT_CONTENTSB
Definition: options.h:121
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int tl
Definition: kutil.h:353
#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:615
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:5412
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:422
static int pLength(poly a)
Definition: p_polys.h:189
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6631
#define mflush()
Definition: reporter.h:42
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2799
void(* initEcart)(TObject *L)
Definition: kutil.h:279
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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
#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:304
#define nDelete(n)
Definition: numbers.h:16
kStrategy strat
Definition: myNF.cc:319
#define nInvers(a)
Definition: numbers.h:33
BOOLEAN kHEdgeFound
Definition: kutil.h:370
intset ecartS
Definition: kutil.h:307
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
ring tailRing
Definition: kutil.h:343
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
denominator_list next
Definition: kutil.h:65
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:6695
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6654
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8113
void wrp(poly p)
Definition: polys.h:281
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:2655
void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 9021 of file kutil.cc.

9022 {
9023  /* to use after updateS(toT=FALSE,strat) */
9024  /* fills T with shifted elt's of S */
9025  int i;
9026  LObject h;
9027  int atT = -1; // or figure out smth better
9028  strat->tl = -1; // init
9029  for (i=0; i<=strat->sl; i++)
9030  {
9031  memset(&h,0,sizeof(h));
9032  h.p = strat->S[i]; // lm in currRing, tail in TR
9033  strat->initEcart(&h);
9034  h.sev = strat->sevS[i];
9035  h.t_p = NULL;
9036  h.GetTP(); // creates correct t_p
9037  /*puts the elements of S with their shifts to T*/
9038  // int atT, int uptodeg, int lV)
9039  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
9040  // need a small check for above; we insert >=1 elements
9041  // insert this check into kTest_TS ?
9042  enterTShift(h,strat,atT,uptodeg,lV);
9043  }
9044  /* what about setting strat->tl? */
9045 }
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
int tl
Definition: kutil.h:353
void(* initEcart)(TObject *L)
Definition: kutil.h:279
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:9678
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
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_fac_debug

Definition at line 29 of file kstdfac.cc.

int strat_nr

Definition at line 28 of file kstdfac.cc.

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

Definition at line 96 of file kstd2.cc.

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

Definition at line 95 of file kstd2.cc.