Data Structures | Macros | Typedefs | Functions | Variables
kutil.h File Reference
#include <string.h>
#include <omalloc/omalloc.h>
#include <omalloc/omallocClass.h>
#include <misc/mylimits.h>
#include <kernel/polys.h>
#include <polys/operations/pShallowCopyDelete.h>
#include <kernel/structs.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/kInline.h>
#include <kernel/GBEngine/shiftgb.h>

Go to the source code of this file.

Data Structures

struct  denominator_list_s
 
class  sTObject
 
class  sLObject
 
class  skStrategy
 

Macros

#define HAVE_TAIL_RING
 
#define setmax   16
 
#define setmaxL   ((4096-12)/sizeof(LObject))
 
#define setmaxLinc   ((4096)/sizeof(LObject))
 
#define setmaxT   64
 
#define setmaxTinc   32
 
#define KINLINE
 
#define NO_KINLINE   1
 
#define ALLOW_PROD_CRIT(A)   (!(A)->no_prod_crit)
 
#define messageSets(s)   do {} while (0)
 
#define kTest(A)   (TRUE)
 
#define kTest_TS(A)   (TRUE)
 
#define kTest_T(T)   (TRUE)
 
#define kTest_S(T)   (TRUE)
 
#define kTest_L(T)   (TRUE)
 

Typedefs

typedef int * intset
 
typedef int64 wlen_type
 
typedef wlen_typewlen_set
 
typedef class sTObject TObject
 
typedef class sLObject LObject
 
typedef TObjectTSet
 
typedef LObjectLSet
 
typedef denominator_list_sdenominator_list
 

Functions

void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext=FALSE)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void cleanT (kStrategy strat)
 
static LSet initL (int nr=setmaxL)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void enterSBba (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSSba (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void initEcartPairBba (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
 
void initEcartPairMora (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
 
int posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInT0 (const TSet set, const int length, LObject &p)
 
int posInT1 (const TSet set, const int length, LObject &p)
 
int posInT2 (const TSet set, const int length, LObject &p)
 
int posInT11 (const TSet set, const int length, LObject &p)
 
int posInTSig (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
void reorderS (int *suc, kStrategy strat)
 
int posInLF5C (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLSig (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLRing (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInSyz (const kStrategy strat, const poly sig)
 
int posInL0 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11Ringls (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL13 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL15 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL17 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL10 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL110 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
KINLINE poly redtailBba (poly p, int pos, kStrategy strat, BOOLEAN normalize=FALSE)
 
KINLINE poly redtailBba_Z (poly p, int pos, kStrategy strat)
 
poly redtailBba_Z (LObject *L, int pos, kStrategy strat)
 
poly redtailBba (LObject *L, int pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailSba (LObject *L, int pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailBba (TObject *T, int pos, kStrategy strat)
 
poly redtail (poly p, int pos, kStrategy strat)
 
poly redtail (LObject *L, int pos, kStrategy strat)
 
poly redNF (poly h, int &max_ind, int nonorm, kStrategy strat)
 
int redNF0 (LObject *P, kStrategy strat)
 
poly redNFTail (poly h, const int sl, kStrategy strat)
 
int redHoney (LObject *h, kStrategy strat)
 
int redRing (LObject *h, kStrategy strat)
 
int redRiloc (LObject *h, kStrategy strat)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
poly kCreateZeroPoly (long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
 
long ind2 (long arg)
 
long ind_fact_2 (long arg)
 
long twoPow (long arg)
 
ideal createG0 ()
 
int redLazy (LObject *h, kStrategy strat)
 
int redHomog (LObject *h, kStrategy strat)
 
int redSig (LObject *h, kStrategy strat)
 
void enterpairsSig (poly h, poly hSig, int from, int k, int ec, int pos, kStrategy strat, int atR=-1)
 
void enterpairs (poly h, int k, int ec, int pos, kStrategy strat, int atR=-1)
 
void entersets (LObject h)
 
void pairs ()
 
BOOLEAN enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR=-1, bool enterTstrong=FALSE)
 
void message (int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
 
void messageStat (int hilbcount, kStrategy strat)
 
void initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
void initS (ideal F, ideal Q, kStrategy strat)
 
void initSL (ideal F, ideal Q, kStrategy strat)
 
void initSLSba (ideal F, ideal Q, kStrategy strat)
 
void initSyzRules (kStrategy strat)
 
void updateS (BOOLEAN toT, kStrategy strat)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void enterT (LObject &p, kStrategy strat, int atT=-1)
 
void enterT_strong (LObject &p, kStrategy strat, int atT=-1)
 
void cancelunit (LObject *p, BOOLEAN inNF=FALSE)
 
void HEckeTest (poly pp, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
void initHilbCrit (ideal F, ideal Q, intvec **hilb, kStrategy strat)
 
void initBuchMoraPos (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT=FALSE)
 
void kFreeStrat (kStrategy strat)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterOnePairSig (int i, poly p, poly pSig, int ecart, int isFromQ, kStrategy strat, int atR)
 
void chainCritNormal (poly p, int ecart, kStrategy strat)
 
void chainCritOpt_1 (poly, int, kStrategy strat)
 
void chainCritSig (poly p, int ecart, kStrategy strat)
 
BOOLEAN homogTest (polyset F, int Fmax)
 
BOOLEAN newHEdge (kStrategy strat)
 
BOOLEAN syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
 
KINLINE BOOLEAN arriRewDummy (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN arriRewCriterion (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN faugereRewCriterion (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
 
BOOLEAN findMinLMPair (poly sig, unsigned long not_sevSig, kStrategy strat, int start)
 
int kFindInT (poly p, TSet T, int tlength)
 returns index of p in TSet, or -1 if not found More...
 
int kFindDivisibleByInT (const kStrategy strat, const LObject *L, const int start=0)
 return -1 if no divisor is found number of first divisor in T, otherwise More...
 
int kFindDivisibleByInS (const kStrategy strat, int *max_ind, LObject *L)
 return -1 if no divisor is found number of first divisor in S, otherwise More...
 
int kFindNextDivisibleByInS (const kStrategy strat, int start, int max_ind, LObject *L)
 
TObjectkFindDivisibleByInS (kStrategy strat, int pos, LObject *L, TObject *T, long ecart=LONG_MAX)
 
KINLINE TSet initT ()
 
KINLINE TObject ** initR ()
 
KINLINE unsigned long * initsevT ()
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE BOOLEAN k_GetLeadTerms (const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
 
KINLINE void k_GetStrongLeadTerms (const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring taiRing)
 
poly kFindZeroPoly (poly input_p, ring leadRing, ring tailRing)
 
ideal bba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
ideal sba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF2 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
void initBba (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)
 
poly preIntegerCheck (ideal F, ideal Q)
 used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMon (LObject *h, kStrategy strat)
 used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void finalReduceByMon (kStrategy strat)
 used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output More...
 
BOOLEAN kStratChangeTailRing (kStrategy strat, LObject *L=NULL, TObject *T=NULL, unsigned long new_expbound=0)
 
void kStratInitChangeTailRing (kStrategy strat)
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
ring sbaRing (kStrategy strat, const ring r=currRing, BOOLEAN complete=TRUE, int sgn=1)
 
KINLINE void clearS (poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject h, kStrategy strat)
 
void enterTShift (LObject p, kStrategy strat, int atT, int uptodeg, int lV)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int uptodeg, int lV)
 
void enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
 
void initenterpairsShift (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void updateSShift (kStrategy strat, int uptodeg, int lV)
 
void initBbaShift (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 HCord
 
int(* test_PosInT )(const TSet T, const int tl, LObject &h)
 
int(* test_PosInL )(const LSet set, const int length, LObject *L, const kStrategy strat)
 

Data Structure Documentation

struct denominator_list_s

Definition at line 67 of file kutil.h.

Data Fields
number n
denominator_list next

Macro Definition Documentation

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

Definition at line 385 of file kutil.h.

#define HAVE_TAIL_RING

Definition at line 25 of file kutil.h.

#define KINLINE

Definition at line 51 of file kutil.h.

#define kTest (   A)    (TRUE)

Definition at line 619 of file kutil.h.

#define kTest_L (   T)    (TRUE)

Definition at line 623 of file kutil.h.

#define kTest_S (   T)    (TRUE)

Definition at line 622 of file kutil.h.

#define kTest_T (   T)    (TRUE)

Definition at line 621 of file kutil.h.

#define kTest_TS (   A)    (TRUE)

Definition at line 620 of file kutil.h.

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

Definition at line 508 of file kutil.h.

#define NO_KINLINE   1

Definition at line 52 of file kutil.h.

#define setmax   16

Definition at line 28 of file kutil.h.

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

Definition at line 29 of file kutil.h.

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

Definition at line 30 of file kutil.h.

#define setmaxT   64

Definition at line 32 of file kutil.h.

#define setmaxTinc   32

Definition at line 33 of file kutil.h.

Typedef Documentation

Definition at line 65 of file kutil.h.

typedef int* intset

Definition at line 55 of file kutil.h.

typedef class sLObject LObject

Definition at line 60 of file kutil.h.

typedef LObject* LSet

Definition at line 62 of file kutil.h.

typedef class sTObject TObject

Definition at line 59 of file kutil.h.

typedef TObject* TSet

Definition at line 61 of file kutil.h.

typedef wlen_type* wlen_set

Definition at line 57 of file kutil.h.

typedef int64 wlen_type

Definition at line 56 of file kutil.h.

Function Documentation

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

Definition at line 5806 of file kutil.cc.

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

Definition at line 5829 of file kutil.cc.

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

Definition at line 1172 of file kInline.h.

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

Definition at line 1466 of file kstd2.cc.

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

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

Definition at line 324 of file kutil.cc.

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

Definition at line 2451 of file kutil.cc.

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

Definition at line 2666 of file kutil.cc.

2667 {
2668  if (strat->pairtest!=NULL)
2669  {
2670  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2671  strat->pairtest=NULL;
2672  }
2673  /*
2674  *the elements of B enter L
2675  */
2676  kMergeBintoL(strat);
2677 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2405
int BOOLEAN
Definition: auxiliary.h:131
void chainCritSig ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2682 of file kutil.cc.

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

Definition at line 505 of file kutil.cc.

506 {
507  int i,j;
508  poly p;
509  assume(currRing == strat->tailRing || strat->tailRing != NULL);
510 
511  pShallowCopyDeleteProc p_shallow_copy_delete =
512  (strat->tailRing != currRing ?
514  NULL);
515 
516  for (j=0; j<=strat->tl; j++)
517  {
518  p = strat->T[j].p;
519  strat->T[j].p=NULL;
520  if (strat->T[j].max != NULL)
521  {
522  p_LmFree(strat->T[j].max, strat->tailRing);
523  }
524  i = -1;
525  loop
526  {
527  i++;
528  if (i>strat->sl)
529  {
530  if (strat->T[j].t_p != NULL)
531  {
532  p_Delete(&(strat->T[j].t_p), strat->tailRing);
533  p_LmFree(p, currRing);
534  }
535  else
536  pDelete(&p);
537  break;
538  }
539  if (p == strat->S[i])
540  {
541  if (strat->T[j].t_p != NULL)
542  {
543  assume(p_shallow_copy_delete != NULL);
544  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
545  currRing->PolyBin);
546  p_LmFree(strat->T[j].t_p, strat->tailRing);
547  }
548  break;
549  }
550  }
551  }
552  strat->tl=-1;
553 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:348
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10
KINLINE void clearS ( poly  p,
unsigned long  p_sev,
int *  at,
int *  k,
kStrategy  strat 
)

Definition at line 1145 of file kInline.h.

1147 {
1148  assume(p_sev == pGetShortExpVector(p));
1149  if (strat->noClearS) return;
1150  #if HAVE_RINGS
1152  {
1153  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1154  return;
1155  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing))
1156  return;
1157  }
1158  else
1159  {
1160  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1161  }
1162  #else
1163  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1164  #endif
1165  deleteInS((*at),strat);
1166  (*at)--;
1167  (*k)--;
1168 }
return P p
Definition: myNF.cc:203
char noClearS
Definition: kutil.h:392
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:946
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:134
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
unsigned long * sevS
Definition: kutil.h:318
void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 8801 of file kutil.cc.

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

Definition at line 3687 of file kutil.cc.

3688 {
3689  // Initialize
3690  long exp[50]; // The exponent of \hat{X} (basepoint)
3691  long cexp[50]; // The current exponent for iterating over all
3692  long ind[50]; // The power of 2 in the i-th component of exp
3693  long cind[50]; // analog for cexp
3694  long mult[50]; // How to multiply the elements of G
3695  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3696  long habsind = 0; // The abs. index of the coefficient of h
3697  long step[50]; // The last increases
3698  for (int i = 1; i <= currRing->N; i++)
3699  {
3700  exp[i] = 0;
3701  cexp[i] = exp[i];
3702  ind[i] = 0;
3703  step[i] = 500000;
3704  cind[i] = ind[i];
3705  }
3706  long bound = currRing->ch;
3707  step[1] = 500000;
3708 #ifdef OLI_DEBUG
3709  PrintS("-------------\npoly :");
3710 // wrp(p);
3711  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3712  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3713  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3714  Print("bound : %d\n", bound);
3715  Print("cind : %d\n", cabsind);
3716 #endif
3717  if (cabsind == 0)
3718  {
3719  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3720  {
3721  return idInit(1, 1);
3722  }
3723  }
3724  ideal G0 = idInit(1, 1);
3725  // Now the whole simplex
3726  do
3727  {
3728  // Build s-polynomial
3729  // 2**ind-def * mult * g - exp-def * h
3730  poly t_p;
3731  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
3732 #ifdef OLI_DEBUG
3733  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3734  Print("zPoly : ");
3735  wrp(zeroPoly);
3736  Print("\n");
3737 #endif
3738  // Add to ideal
3739  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
3740  IDELEMS(G0) += 1;
3741  G0->m[IDELEMS(G0) - 1] = zeroPoly;
3742  }
3743  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3744  idSkipZeroes(G0);
3745  return G0;
3746 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:3558
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:3492
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:649
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
void deleteHC ( poly p,
int *  e,
int *  l,
kStrategy  strat 
)

Definition at line 310 of file kutil.cc.

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

Definition at line 235 of file kutil.cc.

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

Definition at line 1053 of file kutil.cc.

1054 {
1055  if (set[j].lcm!=NULL)
1056  {
1057 #ifdef HAVE_RINGS
1058  if (pGetCoeff(set[j].lcm) != NULL)
1059  pLmDelete(set[j].lcm);
1060  else
1061 #endif
1062  pLmFree(set[j].lcm);
1063  }
1064  if (set[j].sig!=NULL)
1065  {
1066 #ifdef HAVE_RINGS
1067  if (pGetCoeff(set[j].sig) != NULL)
1068  pLmDelete(set[j].sig);
1069  else
1070 #endif
1071  pLmFree(set[j].sig);
1072  }
1073  if (set[j].p!=NULL)
1074  {
1075  if (pNext(set[j].p) == strat->tail)
1076  {
1077 #ifdef HAVE_RINGS
1078  if (pGetCoeff(set[j].p) != NULL)
1079  pLmDelete(set[j].p);
1080  else
1081 #endif
1082  pLmFree(set[j].p);
1083  /*- tail belongs to several int spolys -*/
1084  }
1085  else
1086  {
1087  // search p in T, if it is there, do not delete it
1088  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1089  {
1090  // assure that for global orderings kFindInT fails
1091  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1092  set[j].Delete();
1093  }
1094  }
1095  }
1096  if (*length > 0 && j < *length)
1097  {
1098 #ifdef ENTER_USE_MEMMOVE
1099  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1100 #else
1101  int i;
1102  for (i=j; i < (*length); i++)
1103  set[i] = set[i+1];
1104 #endif
1105  }
1106 #ifdef KDEBUG
1107  memset(&(set[*length]),0,sizeof(LObject));
1108 #endif
1109  (*length)--;
1110 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:617
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 946 of file kutil.cc.

947 {
948 #ifdef ENTER_USE_MEMMOVE
949  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
950  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
951  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
952  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
953 #else
954  int j;
955  for (j=i; j<strat->sl; j++)
956  {
957  strat->S[j] = strat->S[j+1];
958  strat->ecartS[j] = strat->ecartS[j+1];
959  strat->sevS[j] = strat->sevS[j+1];
960  strat->S_2_R[j] = strat->S_2_R[j+1];
961  }
962 #endif
963  if (strat->lenS!=NULL)
964  {
965 #ifdef ENTER_USE_MEMMOVE
966  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
967 #else
968  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
969 #endif
970  }
971  if (strat->lenSw!=NULL)
972  {
973 #ifdef ENTER_USE_MEMMOVE
974  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
975 #else
976  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
977 #endif
978  }
979  if (strat->fromQ!=NULL)
980  {
981 #ifdef ENTER_USE_MEMMOVE
982  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
983 #else
984  for (j=i; j<strat->sl; j++)
985  {
986  strat->fromQ[j] = strat->fromQ[j+1];
987  }
988 #endif
989  }
990  strat->S[strat->sl] = NULL;
991  strat->sl--;
992 }
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 998 of file kutil.cc.

999 {
1000 #ifdef ENTER_USE_MEMMOVE
1001  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1002  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1003  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1004  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1005  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1006  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1007 #else
1008  int j;
1009  for (j=i; j<strat->sl; j++)
1010  {
1011  strat->S[j] = strat->S[j+1];
1012  strat->sig[j] = strat->sig[j+1];
1013  strat->ecartS[j] = strat->ecartS[j+1];
1014  strat->sevS[j] = strat->sevS[j+1];
1015  strat->sevSig[j] = strat->sevSig[j+1];
1016  strat->S_2_R[j] = strat->S_2_R[j+1];
1017  }
1018 #endif
1019  if (strat->lenS!=NULL)
1020  {
1021 #ifdef ENTER_USE_MEMMOVE
1022  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1023 #else
1024  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1025 #endif
1026  }
1027  if (strat->lenSw!=NULL)
1028  {
1029 #ifdef ENTER_USE_MEMMOVE
1030  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1031 #else
1032  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1033 #endif
1034  }
1035  if (strat->fromQ!=NULL)
1036  {
1037 #ifdef ENTER_USE_MEMMOVE
1038  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1039 #else
1040  for (j=i; j<strat->sl; j++)
1041  {
1042  strat->fromQ[j] = strat->fromQ[j+1];
1043  }
1044 #endif
1045  }
1046  strat->S[strat->sl] = NULL;
1047  strat->sl--;
1048 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 3784 of file kutil.cc.

3785 {
3786  if (nIsOne(pGetCoeff(h))) return;
3787  number gcd;
3788  bool go = false;
3789  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
3790  {
3791  gcd = n_Ann(pGetCoeff(h),currRing->cf);
3792  go = true;
3793  }
3794  else
3795  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
3796  if (go || !nIsOne(gcd))
3797  {
3798  poly p = h->next;
3799  if (!go)
3800  {
3801  number tmp = gcd;
3802  gcd = n_Ann(gcd,currRing->cf);
3803  nDelete(&tmp);
3804  }
3805  p_Test(p,strat->tailRing);
3806  p = pp_Mult_nn(p, gcd, strat->tailRing);
3807  nDelete(&gcd);
3808 
3809  if (p != NULL)
3810  {
3811  if (TEST_OPT_PROT)
3812  {
3813  PrintS("Z");
3814  }
3815 #ifdef KDEBUG
3816  if (TEST_OPT_DEBUG)
3817  {
3818  PrintS("--- create zero spoly: ");
3819  p_wrp(h,currRing,strat->tailRing);
3820  PrintS(" ---> ");
3821  }
3822 #endif
3823  poly tmp = pInit();
3824  pSetCoeff0(tmp, pGetCoeff(p));
3825  for (int i = 1; i <= rVar(currRing); i++)
3826  {
3827  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
3828  }
3830  {
3831  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
3832  }
3833  p_Setm(tmp, currRing);
3834  p = p_LmFreeAndNext(p, strat->tailRing);
3835  pNext(tmp) = p;
3836  LObject h;
3837  h.Init();
3838  h.p = tmp;
3839  h.tailRing = strat->tailRing;
3840  int posx;
3841  if (h.p!=NULL)
3842  {
3844  {
3845  //pContent(h.p);
3846  h.pCleardenom(); // also does a pContent
3847  }
3848  else
3849  {
3850  h.pNorm();
3851  }
3852  strat->initEcart(&h);
3853  if (strat->Ll==-1)
3854  posx =0;
3855  else
3856  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
3857  h.sev = pGetShortExpVector(h.p);
3858  if (strat->tailRing != currRing)
3859  {
3860  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
3861  }
3862 #ifdef KDEBUG
3863  if (TEST_OPT_DEBUG)
3864  {
3865  p_wrp(tmp,currRing,strat->tailRing);
3866  PrintLn();
3867  }
3868 #endif
3869  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
3870  }
3871  }
3872  }
3873  nDelete(&gcd);
3874 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:685
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:927
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1115
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL ...
Definition: coeffs.h:700
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:699
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
void enterL ( LSet set,
int *  length,
int *  LSetmax,
LObject  p,
int  at 
)

Definition at line 1115 of file kutil.cc.

1116 {
1117  // this should be corrected
1118  assume(p.FDeg == p.pFDeg());
1119 
1120  if ((*length)>=0)
1121  {
1122  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1123  if (at <= (*length))
1124 #ifdef ENTER_USE_MEMMOVE
1125  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1126 #else
1127  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1128 #endif
1129  }
1130  else at = 0;
1131  (*set)[at] = p;
1132  (*length)++;
1133 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:30
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:562
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:44
void enterOnePairLift ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)

Definition at line 1841 of file kutil.cc.

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

Definition at line 10264 of file kutil.cc.

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

Definition at line 1536 of file kutil.cc.

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

Definition at line 10339 of file kutil.cc.

10340 {
10341 
10342  /* format: p,qq are in LObject form: lm in CR, tail in TR */
10343  /* for true self pairs qq ==p */
10344  /* we test both qq and p */
10346  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
10349 
10350  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
10351 
10352  // int j = 0;
10353  int j = 1;
10354 
10355  /* for such self pairs start with 1, not with 0 */
10356  if (qq == p) j=1;
10357 
10358  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
10359  /* that is create the pairs (f, s \dot g) */
10360 
10361  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
10362 
10363 #ifdef KDEBUG
10364  if (TEST_OPT_DEBUG)
10365  {
10366  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
10367  }
10368 #endif
10369 
10370  poly q;
10371 
10372  /* these vars hold for all shifts of s[i] */
10373  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
10374  int qfromQ = 0; // strat->fromQ[i];
10375 
10376  for (; j<= toInsert; j++)
10377  {
10378  // q = pLPshift(strat->S[i],j,uptodeg,lV);
10379  /* we increase shifts by one; must delete q there*/
10380  // q = qq; q = pMoveCurrTail2poly(q,strat);
10381  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
10382  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
10383  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
10384  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
10385  // pNext(q) = s; // in tailRing
10386  /* here we need to call enterOnePair with two polys ... */
10387 #ifdef KDEBUG
10388  if (TEST_OPT_DEBUG)
10389  {
10390  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
10391  }
10392 #endif
10393  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
10394  }
10395 }
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:10402
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:461
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
#define TEST_OPT_DEBUG
Definition: options.h:103
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
void enterOnePairShift ( poly  q,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  ecartq,
int  qisFromQ,
int  shiftcount,
int  ifromS,
int  uptodeg,
int  lV 
)

Definition at line 10402 of file kutil.cc.

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

Definition at line 1399 of file kutil.cc.

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

Definition at line 3988 of file kutil.cc.

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

Definition at line 10696 of file kutil.cc.

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

Definition at line 4044 of file kutil.cc.

4045 {
4046 int j=pos;
4047 
4048 #ifdef HAVE_RINGS
4050 #endif
4051 
4052 initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4053 if ( (!strat->fromT)
4054 && ((strat->syzComp==0)
4055  ||(pGetComp(h)<=strat->syzComp)))
4056 {
4057  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4058  unsigned long h_sev = pGetShortExpVector(h);
4059  loop
4060  {
4061  if (j > k) break;
4062  clearS(h,h_sev, &j,&k,strat);
4063  j++;
4064  }
4065  //Print("end clearS sl=%d\n",strat->sl);
4066 }
4067 // PrintS("end enterpairs\n");
4068 }
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3101
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void enterSBba ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 7577 of file kutil.cc.

7578 {
7579  strat->news = TRUE;
7580  /*- puts p to the standardbasis s at position at -*/
7581  if (strat->sl == IDELEMS(strat->Shdl)-1)
7582  {
7583  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7584  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7585  (IDELEMS(strat->Shdl)+setmaxTinc)
7586  *sizeof(unsigned long));
7587  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7588  IDELEMS(strat->Shdl)*sizeof(int),
7589  (IDELEMS(strat->Shdl)+setmaxTinc)
7590  *sizeof(int));
7591  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7592  IDELEMS(strat->Shdl)*sizeof(int),
7593  (IDELEMS(strat->Shdl)+setmaxTinc)
7594  *sizeof(int));
7595  if (strat->lenS!=NULL)
7596  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7597  IDELEMS(strat->Shdl)*sizeof(int),
7598  (IDELEMS(strat->Shdl)+setmaxTinc)
7599  *sizeof(int));
7600  if (strat->lenSw!=NULL)
7601  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7602  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7603  (IDELEMS(strat->Shdl)+setmaxTinc)
7604  *sizeof(wlen_type));
7605  if (strat->fromQ!=NULL)
7606  {
7607  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7608  IDELEMS(strat->Shdl)*sizeof(int),
7609  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7610  }
7611  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7612  IDELEMS(strat->Shdl)+=setmaxTinc;
7613  strat->Shdl->m=strat->S;
7614  }
7615  if (atS <= strat->sl)
7616  {
7617 #ifdef ENTER_USE_MEMMOVE
7618 // #if 0
7619  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7620  (strat->sl - atS + 1)*sizeof(poly));
7621  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7622  (strat->sl - atS + 1)*sizeof(int));
7623  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7624  (strat->sl - atS + 1)*sizeof(unsigned long));
7625  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7626  (strat->sl - atS + 1)*sizeof(int));
7627  if (strat->lenS!=NULL)
7628  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7629  (strat->sl - atS + 1)*sizeof(int));
7630  if (strat->lenSw!=NULL)
7631  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7632  (strat->sl - atS + 1)*sizeof(wlen_type));
7633 #else
7634  for (i=strat->sl+1; i>=atS+1; i--)
7635  {
7636  strat->S[i] = strat->S[i-1];
7637  strat->ecartS[i] = strat->ecartS[i-1];
7638  strat->sevS[i] = strat->sevS[i-1];
7639  strat->S_2_R[i] = strat->S_2_R[i-1];
7640  }
7641  if (strat->lenS!=NULL)
7642  for (i=strat->sl+1; i>=atS+1; i--)
7643  strat->lenS[i] = strat->lenS[i-1];
7644  if (strat->lenSw!=NULL)
7645  for (i=strat->sl+1; i>=atS+1; i--)
7646  strat->lenSw[i] = strat->lenSw[i-1];
7647 #endif
7648  }
7649  if (strat->fromQ!=NULL)
7650  {
7651 #ifdef ENTER_USE_MEMMOVE
7652  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7653  (strat->sl - atS + 1)*sizeof(int));
7654 #else
7655  for (i=strat->sl+1; i>=atS+1; i--)
7656  {
7657  strat->fromQ[i] = strat->fromQ[i-1];
7658  }
7659 #endif
7660  strat->fromQ[atS]=0;
7661  }
7662 
7663  /*- save result -*/
7664  strat->S[atS] = p.p;
7665  if (strat->honey) strat->ecartS[atS] = p.ecart;
7666  if (p.sev == 0)
7667  p.sev = pGetShortExpVector(p.p);
7668  else
7669  assume(p.sev == pGetShortExpVector(p.p));
7670  strat->sevS[atS] = p.sev;
7671  strat->ecartS[atS] = p.ecart;
7672  strat->S_2_R[atS] = atR;
7673  strat->sl++;
7674 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:367
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:390
#define TRUE
Definition: auxiliary.h:144
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
void entersets ( LObject  h)
void enterSSba ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 7680 of file kutil.cc.

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

Definition at line 8007 of file kutil.cc.

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

Definition at line 7811 of file kutil.cc.

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

Definition at line 7895 of file kutil.cc.

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

Definition at line 10803 of file kutil.cc.

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

Definition at line 8419 of file kutil.cc.

8420 {
8421  /*- release temp data -*/
8422  cleanT(strat);
8423  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8424  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8425  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8426  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8427  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8428  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8429  /*- set L: should be empty -*/
8430  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8431  /*- set B: should be empty -*/
8432  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8433  pLmDelete(&strat->tail);
8434  strat->syzComp=0;
8435 }
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:350
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:505
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
unsigned long * sevS
Definition: kutil.h:318
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59
void exitSba ( kStrategy  strat)

Definition at line 8614 of file kutil.cc.

8615 {
8616  /*- release temp data -*/
8617  cleanT(strat);
8618  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
8619  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
8620  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
8621  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
8622  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8623  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
8624  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
8625  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8626  if (strat->sbaOrder == 1)
8627  {
8628  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8629  }
8630  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
8631  /*- set L: should be empty -*/
8632  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
8633  /*- set B: should be empty -*/
8634  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
8635  /*- set sig: no need for the signatures anymore -*/
8636  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
8637  pLmDelete(&strat->tail);
8638  strat->syzComp=0;
8639 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int syzComp
Definition: kutil.h:352
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:350
unsigned sbaOrder
Definition: kutil.h:312
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:505
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
int syzidxmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59
intset syzIdx
Definition: kutil.h:309
void f5c ( kStrategy  strat,
int &  olddeg,
int &  minimcnt,
int &  hilbeledeg,
int &  hilbcount,
int &  srmax,
int &  lrmax,
int &  reduc,
ideal  Q,
intvec w,
intvec hilb 
)

Definition at line 2748 of file kstd2.cc.

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

Definition at line 5750 of file kutil.cc.

5751 {
5752  //printf("Faugere Rewritten Criterion\n");
5753 //#if 1
5754 #ifdef DEBUGF5
5755  PrintS("rewritten criterion checks: ");
5756  pWrite(sig);
5757 #endif
5758  for(int k = strat->sl; k>=start; k--)
5759  {
5760 //#if 1
5761 #ifdef DEBUGF5
5762  Print("checking with: ");
5763  pWrite(strat->sig[k]);
5764  pWrite(pHead(strat->S[k]));
5765 #endif
5766  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
5767  {
5768 //#if 1
5769 #ifdef DEBUGF5
5770  PrintS("DELETE!\n");
5771 #endif
5772  return TRUE;
5773  }
5774  //k--;
5775  }
5776 #ifdef DEBUGF5
5777  Print("ALL ELEMENTS OF S\n----------------------------------------\n");
5778  for(int kk = 0; kk<strat->sl+1; kk++)
5779  {
5780  pWrite(pHead(strat->S[kk]));
5781  }
5782  Print("------------------------------\n");
5783 #endif
5784  return FALSE;
5785 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
void PrintS(const char *s)
Definition: reporter.cc:294
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
int sl
Definition: kutil.h:346
void finalReduceByMon ( kStrategy  strat)

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

Definition at line 9294 of file kutil.cc.

9295 {
9296  if(!nCoeff_is_Ring_Z(currRing->cf))
9297  return;
9298  poly p,pp;
9299  for(int j = 0; j<=strat->sl; j++)
9300  {
9301  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
9302  {
9303  for(int i = 0; i<=strat->sl; i++)
9304  {
9305  if((i != j) && (strat->S[i] != NULL))
9306  {
9307  p = strat->S[i];
9308  if(pLmDivisibleBy(strat->S[j], p))
9309  {
9310  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
9311  p_SetCoeff(p,dummy,currRing);
9312  }
9313  pp = pNext(p);
9314  if((pp == NULL) && (nIsZero(p->coef)))
9315  {
9316  deleteInS(i, strat);
9317  }
9318  else
9319  {
9320  while(pp != NULL)
9321  {
9322  if(pLmDivisibleBy(strat->S[j], pp))
9323  {
9324  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
9325  p_SetCoeff(pp,dummy,currRing);
9326  if(nIsZero(pp->coef))
9327  {
9328  pLmDelete(&pNext(p));
9329  pp = pNext(p);
9330  }
9331  else
9332  {
9333  p = pp;
9334  pp = pNext(p);
9335  }
9336  }
9337  else
9338  {
9339  p = pp;
9340  pp = pNext(p);
9341  }
9342  }
9343  }
9344  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
9345  {
9346  if(pNext(strat->S[i]) == NULL)
9347  strat->S[i]=NULL;
9348  else
9349  strat->S[i]=pNext(strat->S[i]);
9350  }
9351  }
9352  }
9353  //idPrint(strat->Shdl);
9354  }
9355  }
9356  //idSkipZeroes(strat->Shdl);
9357 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:946
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
poly pp
Definition: myNF.cc:296
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
BOOLEAN findMinLMPair ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat,
int  start 
)
ideal freegb ( ideal  I,
int  uptodeg,
int  lVblock 
)

Definition at line 3406 of file kstd2.cc.

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

Definition at line 436 of file kutil.cc.

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

Definition at line 3339 of file kutil.cc.

3340 {
3341  long ind = 0;
3342  if (arg <= 0) return 0;
3343  while (arg%2 == 0)
3344  {
3345  arg = arg / 2;
3346  ind++;
3347  }
3348  return ind;
3349 }
long ind_fact_2 ( long  arg)

Definition at line 3351 of file kutil.cc.

3352 {
3353  long ind = 0;
3354  if (arg <= 0) return 0;
3355  if (arg%2 == 1) { arg--; }
3356  while (arg > 0)
3357  {
3358  ind += ind2(arg);
3359  arg = arg - 2;
3360  }
3361  return ind;
3362 }
long ind2(long arg)
Definition: kutil.cc:3339
void initBba ( ideal  F,
kStrategy  strat 
)

Definition at line 1388 of file kstd1.cc.

1389 {
1390  /* setting global variables ------------------- */
1391  strat->enterS = enterSBba;
1392  strat->red = redHoney;
1393  if (strat->honey)
1394  strat->red = redHoney;
1395  else if (currRing->pLexOrder && !strat->homog)
1396  strat->red = redLazy;
1397  else
1398  {
1399  strat->LazyPass *=4;
1400  strat->red = redHomog;
1401  }
1402 #ifdef HAVE_RINGS //TODO Oliver
1403  if (rField_is_Ring(currRing))
1404  {
1405  strat->red = redRing;
1406  }
1407 #endif
1408  if (currRing->pLexOrder && strat->honey)
1409  strat->initEcart = initEcartNormal;
1410  else
1411  strat->initEcart = initEcartBBA;
1412  if (strat->honey)
1414  else
1416 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1417 // {
1418 // //interred machen Aenderung
1419 // strat->pOrigFDeg=pFDeg;
1420 // strat->pOrigLDeg=pLDeg;
1421 // //h=ggetid("ecart");
1422 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1423 // //{
1424 // // ecartWeights=iv2array(IDINTVEC(h));
1425 // //}
1426 // //else
1427 // {
1428 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1429 // /*uses automatic computation of the ecartWeights to set them*/
1430 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1431 // }
1432 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1433 // if (TEST_OPT_PROT)
1434 // {
1435 // for(i=1; i<=(currRing->N); i++)
1436 // Print(" %d",ecartWeights[i]);
1437 // PrintLn();
1438 // mflush();
1439 // }
1440 // }
1441 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1154
BOOLEAN honey
Definition: kutil.h:367
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:409
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:518
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1116
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:956
BOOLEAN homog
Definition: kutil.h:362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1161
void initEcartBBA(TObject *h)
Definition: kutil.cc:1147
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
void initEcartNormal(TObject *h)
Definition: kutil.cc:1139
int LazyPass
Definition: kutil.h:351
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
void initBbaShift ( ideal  F,
kStrategy  strat 
)

Definition at line 3567 of file kstd2.cc.

3568 {
3569  /* setting global variables ------------------- */
3570  strat->enterS = enterSBba; /* remains as is, we change enterT! */
3571 
3572  strat->red = redFirstShift; /* no redHomog ! */
3573 
3574  if (currRing->pLexOrder && strat->honey)
3575  strat->initEcart = initEcartNormal;
3576  else
3577  strat->initEcart = initEcartBBA;
3578  if (strat->honey)
3580  else
3582 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
3583 // {
3584 // //interred machen Aenderung
3585 // pFDegOld=currRing->pFDeg;
3586 // pLDegOld=pLDeg;
3587 // //h=ggetid("ecart");
3588 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
3589 // //{
3590 // // ecartWeights=iv2array(IDINTVEC(h));
3591 // //}
3592 // //else
3593 // {
3594 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
3595 // /*uses automatic computation of the ecartWeights to set them*/
3596 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
3597 // }
3598 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
3599 // if (TEST_OPT_PROT)
3600 // {
3601 // for(int i=1; i<=rVar(currRing); i++)
3602 // Print(" %d",ecartWeights[i]);
3603 // PrintLn();
3604 // mflush();
3605 // }
3606 // }
3607 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1154
BOOLEAN honey
Definition: kutil.h:367
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:3440
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1161
void initEcartBBA(TObject *h)
Definition: kutil.cc:1147
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
void initEcartNormal(TObject *h)
Definition: kutil.cc:1139
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
void initBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 8338 of file kutil.cc.

8339 {
8340  strat->interpt = BTEST1(OPT_INTERRUPT);
8341  strat->kHEdge=NULL;
8343  /*- creating temp data structures------------------- -*/
8344  strat->cp = 0;
8345  strat->c3 = 0;
8346  strat->tail = pInit();
8347  /*- set s -*/
8348  strat->sl = -1;
8349  /*- set L -*/
8350  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8351  strat->Ll = -1;
8352  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8353  /*- set B -*/
8354  strat->Bmax = setmaxL;
8355  strat->Bl = -1;
8356  strat->B = initL();
8357  /*- set T -*/
8358  strat->tl = -1;
8359  strat->tmax = setmaxT;
8360  strat->T = initT();
8361  strat->R = initR();
8362  strat->sevT = initsevT();
8363  /*- init local data struct.---------------------------------------- -*/
8364  strat->P.ecart=0;
8365  strat->P.length=0;
8366  strat->P.pLength=0;
8368  {
8369  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8370  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8371  }
8372  #ifdef HAVE_RINGS
8374  {
8375  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8376  }
8377  else
8378  #endif
8379  {
8380  if(TEST_OPT_SB_1)
8381  {
8382  int i;
8383  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8384  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8385  {
8386  P->m[i-strat->newIdeal] = F->m[i];
8387  F->m[i] = NULL;
8388  }
8389  initSSpecial(F,Q,P,strat);
8390  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8391  {
8392  F->m[i] = P->m[i-strat->newIdeal];
8393  P->m[i-strat->newIdeal] = NULL;
8394  }
8395  idDelete(&P);
8396  }
8397 
8398  else
8399  {
8400  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
8401  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8402  }
8403  }
8404  strat->fromT = FALSE;
8406  if ((!TEST_OPT_SB_1)
8407  #ifdef HAVE_RINGS
8408  || (rField_is_Ring(currRing))
8409  #endif
8410  )
8411  {
8412  updateS(TRUE,strat);
8413  }
8414  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8415  strat->fromQ=NULL;
8416  assume(kTest_TS(strat));
8417 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6486
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6886
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:366
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7345
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:411
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void initBuchMoraCrit ( kStrategy  strat)

Definition at line 8092 of file kutil.cc.

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

Definition at line 8244 of file kutil.cc.

8245 {
8247  {
8248  if (strat->honey)
8249  {
8250  strat->posInL = posInL15;
8251  // ok -- here is the deal: from my experiments for Singular-2-0
8252  // I conclude that that posInT_EcartpLength is the best of
8253  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8254  // see the table at the end of this file
8255  if (TEST_OPT_OLDSTD)
8256  strat->posInT = posInT15;
8257  else
8258  strat->posInT = posInT_EcartpLength;
8259  }
8260  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8261  {
8262  strat->posInL = posInL11;
8263  strat->posInT = posInT11;
8264  }
8265  else if (TEST_OPT_INTSTRATEGY)
8266  {
8267  strat->posInL = posInL11;
8268  strat->posInT = posInT11;
8269  }
8270  else
8271  {
8272  strat->posInL = posInL0;
8273  strat->posInT = posInT0;
8274  }
8275  //if (strat->minim>0) strat->posInL =posInLSpecial;
8276  if (strat->homog)
8277  {
8278  strat->posInL = posInL110;
8279  strat->posInT = posInT110;
8280  }
8281  }
8282  else
8283  {
8284  if (strat->homog)
8285  {
8286  strat->posInL = posInL11;
8287  strat->posInT = posInT11;
8288  }
8289  else
8290  {
8291  if ((currRing->order[0]==ringorder_c)
8292  ||(currRing->order[0]==ringorder_C))
8293  {
8294  strat->posInL = posInL17_c;
8295  strat->posInT = posInT17_c;
8296  }
8297  else
8298  {
8299  strat->posInL = posInL17;
8300  strat->posInT = posInT17;
8301  }
8302  }
8303  }
8304  if (strat->minim>0) strat->posInL =posInLSpecial;
8305  // for further tests only
8306  if ((BTEST1(11)) || (BTEST1(12)))
8307  strat->posInL = posInL11;
8308  else if ((BTEST1(13)) || (BTEST1(14)))
8309  strat->posInL = posInL13;
8310  else if ((BTEST1(15)) || (BTEST1(16)))
8311  strat->posInL = posInL15;
8312  else if ((BTEST1(17)) || (BTEST1(18)))
8313  strat->posInL = posInL17;
8314  if (BTEST1(11))
8315  strat->posInT = posInT11;
8316  else if (BTEST1(13))
8317  strat->posInT = posInT13;
8318  else if (BTEST1(15))
8319  strat->posInT = posInT15;
8320  else if ((BTEST1(17)))
8321  strat->posInT = posInT17;
8322  else if ((BTEST1(19)))
8323  strat->posInT = posInT19;
8324  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8325  strat->posInT = posInT1;
8326 #ifdef HAVE_RINGS
8327  if (rField_is_Ring(currRing))
8328  {
8329  strat->posInL = posInL11Ring;
8330  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8331  strat->posInL = posInL11Ringls;
8332  strat->posInT = posInT11;
8333  }
8334 #endif
8336 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5085
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5562
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5231
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4317
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5504
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5469
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4622
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5423
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:8232
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:4375
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4744
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5143
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4909
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5610
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4680
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4508
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4866
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4809
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4583
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4554
void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 10180 of file kutil.cc.

10181 {
10182  strat->interpt = BTEST1(OPT_INTERRUPT);
10183  strat->kHEdge=NULL;
10185  /*- creating temp data structures------------------- -*/
10186  strat->cp = 0;
10187  strat->c3 = 0;
10188  strat->cv = 0;
10189  strat->tail = pInit();
10190  /*- set s -*/
10191  strat->sl = -1;
10192  /*- set L -*/
10193  strat->Lmax = setmaxL;
10194  strat->Ll = -1;
10195  strat->L = initL();
10196  /*- set B -*/
10197  strat->Bmax = setmaxL;
10198  strat->Bl = -1;
10199  strat->B = initL();
10200  /*- set T -*/
10201  strat->tl = -1;
10202  strat->tmax = setmaxT;
10203  strat->T = initT();
10204  strat->R = initR();
10205  strat->sevT = initsevT();
10206  /*- init local data struct.---------------------------------------- -*/
10207  strat->P.ecart=0;
10208  strat->P.length=0;
10210  {
10211  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10212  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10213  }
10214  #ifdef HAVE_RINGS
10216  {
10217  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10218  }
10219  #endif
10220  {
10221  if(TEST_OPT_SB_1)
10222  {
10223  int i;
10224  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10225  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10226  {
10227  P->m[i-strat->newIdeal] = F->m[i];
10228  F->m[i] = NULL;
10229  }
10230  initSSpecial(F,Q,P,strat);
10231  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10232  {
10233  F->m[i] = P->m[i-strat->newIdeal];
10234  P->m[i-strat->newIdeal] = NULL;
10235  }
10236  idDelete(&P);
10237  }
10238  else
10239  {
10240  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10241  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10242  }
10243  }
10244  strat->fromT = FALSE;
10245  if (!TEST_OPT_SB_1)
10246  {
10247  /* the only change: we do not fill the set T*/
10248  #ifdef HAVE_RINGS
10249  if(!rField_is_Ring(currRing))
10250  #endif
10251  updateS(FALSE,strat);
10252  }
10253  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10254  strat->fromQ=NULL;
10255  /* more changes: fill the set T with all the shifts of elts of S*/
10256  /* is done by other procedure */
10257 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:359
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6486
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6886
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:366
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7345
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:411
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void initEcartBBA ( TObject h)

Definition at line 1147 of file kutil.cc.

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

Definition at line 1139 of file kutil.cc.

1140 {
1141  h->FDeg = h->pFDeg();
1142  h->ecart = h->pLDeg() - h->FDeg;
1143  // h->length is set by h->pLDeg
1144  h->length=h->pLength=pLength(h->p);
1145 }
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 1154 of file kutil.cc.

1155 {
1156  Lp->FDeg = Lp->pFDeg();
1157  (*Lp).ecart = 0;
1158  (*Lp).length = 0;
1159 }
void initEcartPairMora ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1161 of file kutil.cc.

1162 {
1163  Lp->FDeg = Lp->pFDeg();
1164  (*Lp).ecart = si_max(ecartF,ecartG);
1165  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1166  (*Lp).length = 0;
1167 }
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 10730 of file kutil.cc.

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

Definition at line 8072 of file kutil.cc.

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

Definition at line 411 of file kutil.h.

412 { return (LSet)omAlloc(nr*sizeof(LObject)); }
class sLObject LObject
Definition: kutil.h:60
#define omAlloc(size)
Definition: omAllocDecl.h:210
LObject * LSet
Definition: kutil.h:62
KINLINE TObject** initR ( )

Definition at line 92 of file kInline.h.

93 {
94  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
95 }
#define setmaxT
Definition: kutil.h:32
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:59
void initS ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6383 of file kutil.cc.

6384 {
6385  int i,pos;
6386 
6387  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6388  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6389  strat->ecartS=initec(i);
6390  strat->sevS=initsevS(i);
6391  strat->S_2_R=initS_2_R(i);
6392  strat->fromQ=NULL;
6393  strat->Shdl=idInit(i,F->rank);
6394  strat->S=strat->Shdl->m;
6395  /*- put polys into S -*/
6396  if (Q!=NULL)
6397  {
6398  strat->fromQ=initec(i);
6399  memset(strat->fromQ,0,i*sizeof(int));
6400  for (i=0; i<IDELEMS(Q); i++)
6401  {
6402  if (Q->m[i]!=NULL)
6403  {
6404  LObject h;
6405  h.p = pCopy(Q->m[i]);
6407  {
6408  //pContent(h.p);
6409  h.pCleardenom(); // also does a pContent
6410  }
6411  else
6412  {
6413  h.pNorm();
6414  }
6416  {
6417  deleteHC(&h, strat);
6418  }
6419  if (h.p!=NULL)
6420  {
6421  strat->initEcart(&h);
6422  if (strat->sl==-1)
6423  pos =0;
6424  else
6425  {
6426  pos = posInS(strat,strat->sl,h.p,h.ecart);
6427  }
6428  h.sev = pGetShortExpVector(h.p);
6429  strat->enterS(h,pos,strat,-1);
6430  strat->fromQ[pos]=1;
6431  }
6432  }
6433  }
6434  }
6435  for (i=0; i<IDELEMS(F); i++)
6436  {
6437  if (F->m[i]!=NULL)
6438  {
6439  LObject h;
6440  h.p = pCopy(F->m[i]);
6442  {
6443  /*#ifdef HAVE_RINGS
6444  if (rField_is_Ring(currRing))
6445  {
6446  h.pCleardenom();
6447  }
6448  else
6449  #endif*/
6450  cancelunit(&h); /*- tries to cancel a unit -*/
6451  deleteHC(&h, strat);
6452  }
6453  if (h.p!=NULL)
6454  // do not rely on the input being a SB!
6455  {
6457  {
6458  //pContent(h.p);
6459  h.pCleardenom(); // also does a pContent
6460  }
6461  else
6462  {
6463  h.pNorm();
6464  }
6465  strat->initEcart(&h);
6466  if (strat->sl==-1)
6467  pos =0;
6468  else
6469  pos = posInS(strat,strat->sl,h.p,h.ecart);
6470  h.sev = pGetShortExpVector(h.p);
6471  strat->enterS(h,pos,strat,-1);
6472  }
6473  }
6474  }
6475  /*- test, if a unit is in F -*/
6476  if ((strat->sl>=0)
6477 #ifdef HAVE_RINGS
6478  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
6479 #endif
6480  && pIsConstant(strat->S[0]))
6481  {
6482  while (strat->sl>0) deleteInS(strat->sl,strat);
6483  }
6484 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:946
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1443 of file kstd1.cc.

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

Definition at line 8535 of file kutil.cc.

8536 {
8537  strat->interpt = BTEST1(OPT_INTERRUPT);
8538  strat->kHEdge=NULL;
8540  /*- creating temp data structures------------------- -*/
8541  strat->cp = 0;
8542  strat->c3 = 0;
8543  strat->tail = pInit();
8544  /*- set s -*/
8545  strat->sl = -1;
8546  /*- set ps -*/
8547  strat->syzl = -1;
8548  /*- set L -*/
8549  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
8550  strat->Ll = -1;
8551  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
8552  /*- set B -*/
8553  strat->Bmax = setmaxL;
8554  strat->Bl = -1;
8555  strat->B = initL();
8556  /*- set T -*/
8557  strat->tl = -1;
8558  strat->tmax = setmaxT;
8559  strat->T = initT();
8560  strat->R = initR();
8561  strat->sevT = initsevT();
8562  /*- init local data struct.---------------------------------------- -*/
8563  strat->P.ecart=0;
8564  strat->P.length=0;
8566  {
8567  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
8568  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
8569  }
8570  #ifdef HAVE_RINGS
8572  {
8573  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8574  }
8575  else
8576  #endif
8577  {
8578  if(TEST_OPT_SB_1)
8579  {
8580  int i;
8581  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
8582  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8583  {
8584  P->m[i-strat->newIdeal] = F->m[i];
8585  F->m[i] = NULL;
8586  }
8587  initSSpecialSba(F,Q,P,strat);
8588  for (i=strat->newIdeal;i<IDELEMS(F);i++)
8589  {
8590  F->m[i] = P->m[i-strat->newIdeal];
8591  P->m[i-strat->newIdeal] = NULL;
8592  }
8593  idDelete(&P);
8594  }
8595  else
8596  {
8597  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
8598  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
8599  }
8600  }
8601  strat->fromT = FALSE;
8602  if (!TEST_OPT_SB_1)
8603  {
8604  #ifdef HAVE_RINGS
8605  if(!rField_is_Ring(currRing))
8606  #endif
8607  updateS(TRUE,strat);
8608  }
8609  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
8610  //strat->fromQ=NULL;
8611  assume(kTest_TS(strat));
8612 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
int c3
Definition: kutil.h:345
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:7031
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6585
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:369
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:366
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7345
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:411
int newIdeal
Definition: kutil.h:355
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
int syzl
Definition: kutil.h:347
void initSbaCrit ( kStrategy  strat)

Definition at line 8159 of file kutil.cc.

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

Definition at line 8437 of file kutil.cc.

8438 {
8440  {
8441  if (strat->honey)
8442  {
8443  strat->posInL = posInL15;
8444  // ok -- here is the deal: from my experiments for Singular-2-0
8445  // I conclude that that posInT_EcartpLength is the best of
8446  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
8447  // see the table at the end of this file
8448  if (TEST_OPT_OLDSTD)
8449  strat->posInT = posInT15;
8450  else
8451  strat->posInT = posInT_EcartpLength;
8452  }
8453  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
8454  {
8455  strat->posInL = posInL11;
8456  strat->posInT = posInT11;
8457  }
8458  else if (TEST_OPT_INTSTRATEGY)
8459  {
8460  strat->posInL = posInL11;
8461  strat->posInT = posInT11;
8462  }
8463  else
8464  {
8465  strat->posInL = posInL0;
8466  strat->posInT = posInT0;
8467  }
8468  //if (strat->minim>0) strat->posInL =posInLSpecial;
8469  if (strat->homog)
8470  {
8471  strat->posInL = posInL110;
8472  strat->posInT = posInT110;
8473  }
8474  }
8475  else
8476  {
8477  if (strat->homog)
8478  {
8479  strat->posInL = posInL11;
8480  strat->posInT = posInT11;
8481  }
8482  else
8483  {
8484  if ((currRing->order[0]==ringorder_c)
8485  ||(currRing->order[0]==ringorder_C))
8486  {
8487  strat->posInL = posInL17_c;
8488  strat->posInT = posInT17_c;
8489  }
8490  else
8491  {
8492  strat->posInL = posInL17;
8493  strat->posInT = posInT17;
8494  }
8495  }
8496  }
8497  if (strat->minim>0) strat->posInL =posInLSpecial;
8498  // for further tests only
8499  if ((BTEST1(11)) || (BTEST1(12)))
8500  strat->posInL = posInL11;
8501  else if ((BTEST1(13)) || (BTEST1(14)))
8502  strat->posInL = posInL13;
8503  else if ((BTEST1(15)) || (BTEST1(16)))
8504  strat->posInL = posInL15;
8505  else if ((BTEST1(17)) || (BTEST1(18)))
8506  strat->posInL = posInL17;
8507  if (BTEST1(11))
8508  strat->posInT = posInT11;
8509  else if (BTEST1(13))
8510  strat->posInT = posInT13;
8511  else if (BTEST1(15))
8512  strat->posInT = posInT15;
8513  else if ((BTEST1(17)))
8514  strat->posInT = posInT17;
8515  else if ((BTEST1(19)))
8516  strat->posInT = posInT19;
8517  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
8518  strat->posInT = posInT1;
8519 #ifdef HAVE_RINGS
8520  if (rField_is_Ring(currRing))
8521  {
8522  strat->posInL = posInL11Ring;
8523  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
8524  strat->posInL = posInL11Ringls;
8525  strat->posInT = posInT11;
8526  }
8527 #endif
8528  strat->posInLDependsOnLength = FALSE;
8529  strat->posInLSba = posInLSig;
8530  //strat->posInL = posInLSig;
8531  strat->posInL = posInLF5C;
8532  //strat->posInT = posInTSig;
8533 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5085
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5562
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5231
#define FALSE
Definition: auxiliary.h:140
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4317
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5504
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5469
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:5073
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4622
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5423
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4940
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:4375
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4744
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:5143
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4909
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5610
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4680
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4508
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4866
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4809
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4583
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4554
KINLINE unsigned long* initsevT ( )

Definition at line 97 of file kInline.h.

98 {
99  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
100 }
#define setmaxT
Definition: kutil.h:32
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void initSL ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6486 of file kutil.cc.

6487 {
6488  int i,pos;
6489 
6490  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6491  else i=setmaxT;
6492  strat->ecartS=initec(i);
6493  strat->sevS=initsevS(i);
6494  strat->S_2_R=initS_2_R(i);
6495  strat->fromQ=NULL;
6496  strat->Shdl=idInit(i,F->rank);
6497  strat->S=strat->Shdl->m;
6498  /*- put polys into S -*/
6499  if (Q!=NULL)
6500  {
6501  strat->fromQ=initec(i);
6502  memset(strat->fromQ,0,i*sizeof(int));
6503  for (i=0; i<IDELEMS(Q); i++)
6504  {
6505  if (Q->m[i]!=NULL)
6506  {
6507  LObject h;
6508  h.p = pCopy(Q->m[i]);
6510  {
6511  deleteHC(&h,strat);
6512  }
6514  {
6515  //pContent(h.p);
6516  h.pCleardenom(); // also does a pContent
6517  }
6518  else
6519  {
6520  h.pNorm();
6521  }
6522  if (h.p!=NULL)
6523  {
6524  strat->initEcart(&h);
6525  if (strat->sl==-1)
6526  pos =0;
6527  else
6528  {
6529  pos = posInS(strat,strat->sl,h.p,h.ecart);
6530  }
6531  h.sev = pGetShortExpVector(h.p);
6532  strat->enterS(h,pos,strat,-1);
6533  strat->fromQ[pos]=1;
6534  }
6535  }
6536  }
6537  }
6538  for (i=0; i<IDELEMS(F); i++)
6539  {
6540  if (F->m[i]!=NULL)
6541  {
6542  LObject h;
6543  h.p = pCopy(F->m[i]);
6544  if (h.p!=NULL)
6545  {
6547  {
6548  cancelunit(&h); /*- tries to cancel a unit -*/
6549  deleteHC(&h, strat);
6550  }
6551  if (h.p!=NULL)
6552  {
6554  {
6555  //pContent(h.p);
6556  h.pCleardenom(); // also does a pContent
6557  }
6558  else
6559  {
6560  h.pNorm();
6561  }
6562  strat->initEcart(&h);
6563  if (strat->Ll==-1)
6564  pos =0;
6565  else
6566  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
6567  h.sev = pGetShortExpVector(h.p);
6568  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6569  }
6570  }
6571  }
6572  }
6573  /*- test, if a unit is in F -*/
6574 
6575  if ((strat->Ll>=0)
6576 #ifdef HAVE_RINGS
6577  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6578 #endif
6579  && pIsConstant(strat->L[strat->Ll].p))
6580  {
6581  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6582  }
6583 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1115
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1053
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSLSba ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 6585 of file kutil.cc.

6586 {
6587  int i,pos;
6588  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6589  else i=setmaxT;
6590  strat->ecartS = initec(i);
6591  strat->sevS = initsevS(i);
6592  strat->sevSig = initsevS(i);
6593  strat->S_2_R = initS_2_R(i);
6594  strat->fromQ = NULL;
6595  strat->Shdl = idInit(i,F->rank);
6596  strat->S = strat->Shdl->m;
6597  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
6598  if (strat->sbaOrder != 1)
6599  {
6600  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
6601  strat->sevSyz = initsevS(i);
6602  strat->syzmax = i;
6603  strat->syzl = 0;
6604  }
6605  /*- put polys into S -*/
6606  if (Q!=NULL)
6607  {
6608  strat->fromQ=initec(i);
6609  memset(strat->fromQ,0,i*sizeof(int));
6610  for (i=0; i<IDELEMS(Q); i++)
6611  {
6612  if (Q->m[i]!=NULL)
6613  {
6614  LObject h;
6615  h.p = pCopy(Q->m[i]);
6617  {
6618  deleteHC(&h,strat);
6619  }
6621  {
6622  //pContent(h.p);
6623  h.pCleardenom(); // also does a pContent
6624  }
6625  else
6626  {
6627  h.pNorm();
6628  }
6629  if (h.p!=NULL)
6630  {
6631  strat->initEcart(&h);
6632  if (strat->sl==-1)
6633  pos =0;
6634  else
6635  {
6636  pos = posInS(strat,strat->sl,h.p,h.ecart);
6637  }
6638  h.sev = pGetShortExpVector(h.p);
6639  strat->enterS(h,pos,strat,-1);
6640  strat->fromQ[pos]=1;
6641  }
6642  }
6643  }
6644  }
6645  for (i=0; i<IDELEMS(F); i++)
6646  {
6647  if (F->m[i]!=NULL)
6648  {
6649  LObject h;
6650  h.p = pCopy(F->m[i]);
6651  h.sig = pOne();
6652  //h.sig = pInit();
6653  //p_SetCoeff(h.sig,nInit(1),currRing);
6654  p_SetComp(h.sig,i+1,currRing);
6655  // if we are working with the Schreyer order we generate it
6656  // by multiplying the initial signatures with the leading monomial
6657  // of the corresponding initial polynomials generating the ideal
6658  // => we can keep the underlying monomial order and get a Schreyer
6659  // order without any bigger overhead
6660  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
6661  {
6662  p_ExpVectorAdd (h.sig,F->m[i],currRing);
6663  }
6664  h.sevSig = pGetShortExpVector(h.sig);
6665 #ifdef DEBUGF5
6666  pWrite(h.p);
6667  pWrite(h.sig);
6668 #endif
6669  if (h.p!=NULL)
6670  {
6672  {
6673  cancelunit(&h); /*- tries to cancel a unit -*/
6674  deleteHC(&h, strat);
6675  }
6676  if (h.p!=NULL)
6677  {
6679  {
6680  //pContent(h.p);
6681  h.pCleardenom(); // also does a pContent
6682  }
6683  else
6684  {
6685  h.pNorm();
6686  }
6687  strat->initEcart(&h);
6688  if (strat->Ll==-1)
6689  pos =0;
6690  else
6691  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
6692  h.sev = pGetShortExpVector(h.p);
6693  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6694  }
6695  }
6696  /*
6697  if (strat->sbaOrder != 1)
6698  {
6699  for(j=0;j<i;j++)
6700  {
6701  strat->syz[ctr] = pCopy(F->m[j]);
6702  p_SetCompP(strat->syz[ctr],i+1,currRing);
6703  // add LM(F->m[i]) to the signature to get a Schreyer order
6704  // without changing the underlying polynomial ring at all
6705  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
6706  // since p_Add_q() destroys all input
6707  // data we need to recreate help
6708  // each time
6709  poly help = pCopy(F->m[i]);
6710  p_SetCompP(help,j+1,currRing);
6711  pWrite(strat->syz[ctr]);
6712  pWrite(help);
6713  printf("%d\n",pLmCmp(strat->syz[ctr],help));
6714  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
6715  printf("%d. SYZ ",ctr);
6716  pWrite(strat->syz[ctr]);
6717  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
6718  ctr++;
6719  }
6720  strat->syzl = ps;
6721  }
6722  */
6723  }
6724  }
6725  /*- test, if a unit is in F -*/
6726 
6727  if ((strat->Ll>=0)
6728 #ifdef HAVE_RINGS
6729  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6730 #endif
6731  && pIsConstant(strat->L[strat->Ll].p))
6732  {
6733  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6734  }
6735 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:753
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
int syzmax
Definition: kutil.h:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:479
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
void pWrite(poly p)
Definition: polys.h:279
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1115
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:475
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1053
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1339
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:470
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:347
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSyzRules ( kStrategy  strat)

Definition at line 6737 of file kutil.cc.

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

Definition at line 81 of file kInline.h.

82 {
83  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
84  for (int i=setmaxT-1; i>=0; i--)
85  {
86  T[i].tailRing = currRing;
87  T[i].i_r = -1;
88  }
89  return T;
90 }
TObject * TSet
Definition: kutil.h:61
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxT
Definition: kutil.h:32
int i
Definition: cfEzgcd.cc:123
static jList * T
Definition: janet.cc:37
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:59
KINLINE BOOLEAN k_GetLeadTerms ( const poly  p1,
const poly  p2,
const ring  p_r,
poly m1,
poly m2,
const ring  m_r 
)

Definition at line 964 of file kInline.h.

966 {
967  p_LmCheckPolyRing(p1, p_r);
968  p_LmCheckPolyRing(p2, p_r);
969 
970  int i;
971  long x;
972  m1 = p_Init(m_r);
973  m2 = p_Init(m_r);
974 
975  for (i = p_r->N; i; i--)
976  {
977  x = p_GetExpDiff(p1, p2, i, p_r);
978  if (x > 0)
979  {
980  if (x > (long) m_r->bitmask) goto false_return;
981  p_SetExp(m2,i,x, m_r);
982  p_SetExp(m1,i,0, m_r);
983  }
984  else
985  {
986  if (-x > (long) m_r->bitmask) goto false_return;
987  p_SetExp(m1,i,-x, m_r);
988  p_SetExp(m2,i,0, m_r);
989  }
990  }
991 
992  p_Setm(m1, m_r);
993  p_Setm(m2, m_r);
994  return TRUE;
995 
996  false_return:
997  p_LmFree(m1, m_r);
998  p_LmFree(m2, m_r);
999  m1 = m2 = NULL;
1000  return FALSE;
1001 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:631
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
KINLINE void k_GetStrongLeadTerms ( const poly  p1,
const poly  p2,
const ring  leadRing,
poly m1,
poly m2,
poly lcm,
const ring  taiRing 
)

Definition at line 1007 of file kInline.h.

1009 {
1010  p_LmCheckPolyRing(p1, leadRing);
1011  p_LmCheckPolyRing(p2, leadRing);
1012 
1013  int i;
1014  int x;
1015  int e1;
1016  int e2;
1017  int s;
1018  m1 = p_Init(tailRing);
1019  m2 = p_Init(tailRing);
1020  lcm = p_Init(leadRing);
1021 
1022  for (i = leadRing->N; i>=0; i--)
1023  {
1024  e1 = p_GetExp(p1,i,leadRing);
1025  e2 = p_GetExp(p2,i,leadRing);
1026  x = e1 - e2;
1027  if (x > 0)
1028  {
1029  p_SetExp(m2,i,x, tailRing);
1030  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1031  s = e1;
1032  }
1033  else if (x<0)
1034  {
1035  p_SetExp(m1,i,-x, tailRing);
1036  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1037  s = e2;
1038  }
1039  else
1040  s = e1; // e1==e2
1041  p_SetExp(lcm,i,s, leadRing);
1042  }
1043 
1044  p_Setm(m1, tailRing);
1045  p_Setm(m2, tailRing);
1046  p_Setm(lcm, leadRing);
1047 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 905 of file kInline.h.

906 {
907 
908  poly np = p_LmInit(p, currRing, tailRing, tailBin);
909  pNext(np) = pNext(p);
910  pSetCoeff0(np, pGetCoeff(p));
911  return np;
912 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1263
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 937 of file kInline.h.

938 {
939  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
940 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 914 of file kInline.h.

915 {
916  poly np = p_LmInit(p, tailRing, currRing, lmBin);
917  pNext(np) = pNext(p);
918  pSetCoeff0(np, pGetCoeff(p));
919  return np;
920 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1263
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 942 of file kInline.h.

943 {
944  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
945 }
return P p
Definition: myNF.cc:203
KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:914
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 923 of file kInline.h.

924 {
926  p_LmFree(p, currRing);
927  return np;
928 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
polyrec * poly
Definition: hilb.h:10
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 947 of file kInline.h.

948 {
950 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:923
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  bin 
)

Definition at line 930 of file kInline.h.

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

Definition at line 952 of file kInline.h.

953 {
955 }
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:930
BOOLEAN kCheckSpolyCreation ( LObject L,
kStrategy  strat,
poly m1,
poly m2 
)

Definition at line 8994 of file kutil.cc.

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

Definition at line 9032 of file kutil.cc.

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

Definition at line 3558 of file kutil.cc.

3559 {
3560 
3561  poly zeroPoly = NULL;
3562 
3563  number tmp1;
3564  poly tmp2, tmp3;
3565 
3566  if (cabsind == -1)
3567  {
3568  cabsind = 0;
3569  for (int i = 1; i <= leadRing->N; i++)
3570  {
3571  cabsind += ind_fact_2(exp[i]);
3572  }
3573 // Print("cabsind: %d\n", cabsind);
3574  }
3575  if (cabsind < leadRing->ch)
3576  {
3577  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
3578  }
3579  else
3580  {
3581  zeroPoly = p_ISet(1, tailRing);
3582  }
3583  for (int i = 1; i <= leadRing->N; i++)
3584  {
3585  for (long j = 1; j <= exp[i]; j++)
3586  {
3587  tmp1 = nInit(j);
3588  tmp2 = p_ISet(1, tailRing);
3589  p_SetExp(tmp2, i, 1, tailRing);
3590  p_Setm(tmp2, tailRing);
3591  if (nIsZero(tmp1))
3592  { // should nowbe obsolet, test ! TODO OLIVER
3593  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
3594  }
3595  else
3596  {
3597  tmp3 = p_NSet(nCopy(tmp1), tailRing);
3598  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
3599  }
3600  }
3601  }
3602  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
3603  for (int i = 1; i <= leadRing->N; i++)
3604  {
3605  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
3606  }
3607  p_Setm(tmp2, leadRing);
3608  *t_p = zeroPoly;
3609  zeroPoly = pNext(zeroPoly);
3610  pNext(*t_p) = NULL;
3611  pNext(tmp2) = zeroPoly;
3612  return tmp2;
3613 }
#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:3366
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:3351
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
p exp[i]
Definition: DebugPrint.cc:39
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1302
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1025
void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 9907 of file kutil.cc.

9908 {
9909  PrintS("red: ");
9910  if (strat->red==redFirst) PrintS("redFirst\n");
9911  else if (strat->red==redHoney) PrintS("redHoney\n");
9912  else if (strat->red==redEcart) PrintS("redEcart\n");
9913  else if (strat->red==redHomog) PrintS("redHomog\n");
9914  else Print("%p\n",(void*)strat->red);
9915  PrintS("posInT: ");
9916  if (strat->posInT==posInT0) PrintS("posInT0\n");
9917  else if (strat->posInT==posInT1) PrintS("posInT1\n");
9918  else if (strat->posInT==posInT11) PrintS("posInT11\n");
9919  else if (strat->posInT==posInT110) PrintS("posInT110\n");
9920  else if (strat->posInT==posInT13) PrintS("posInT13\n");
9921  else if (strat->posInT==posInT15) PrintS("posInT15\n");
9922  else if (strat->posInT==posInT17) PrintS("posInT17\n");
9923  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
9924  else if (strat->posInT==posInT19) PrintS("posInT19\n");
9925  else if (strat->posInT==posInT2) PrintS("posInT2\n");
9926 #ifdef HAVE_MORE_POS_IN_T
9927  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
9928  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
9929  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
9930 #endif
9931  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
9932  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
9933  else Print("%p\n",(void*)strat->posInT);
9934  PrintS("posInL: ");
9935  if (strat->posInL==posInL0) PrintS("posInL0\n");
9936  else if (strat->posInL==posInL10) PrintS("posInL10\n");
9937  else if (strat->posInL==posInL11) PrintS("posInL11\n");
9938  else if (strat->posInL==posInL110) PrintS("posInL110\n");
9939  else if (strat->posInL==posInL13) PrintS("posInL13\n");
9940  else if (strat->posInL==posInL15) PrintS("posInL15\n");
9941  else if (strat->posInL==posInL17) PrintS("posInL17\n");
9942  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
9943  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
9944  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
9945  else Print("%p\n",(void*)strat->posInL);
9946  PrintS("enterS: ");
9947  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
9948  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
9949  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
9950  else Print("%p\n",(void*)strat->enterS);
9951  PrintS("initEcart: ");
9952  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
9953  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
9954  else Print("%p\n",(void*)strat->initEcart);
9955  PrintS("initEcartPair: ");
9956  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
9957  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
9958  else Print("%p\n",(void*)strat->initEcartPair);
9959  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
9960  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
9961  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
9962  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
9963  PrintS("chainCrit: ");
9964  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
9965  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
9966  else Print("%p\n",(void*)strat->chainCrit);
9967  Print("posInLDependsOnLength=%d\n",
9968  strat->posInLDependsOnLength);
9969  PrintS(showOption());PrintLn();
9970  PrintS("LDeg: ");
9971  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9972  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9973  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
9974  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9975  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9976  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9977  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9978  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9979  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9980  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9981  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9982  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9983  else Print("? (%lx)", (long)currRing->pLDeg);
9984  PrintS(" / ");
9985  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
9986  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
9987  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
9988  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
9989  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
9990  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
9991  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
9992  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
9993  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
9994  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
9995  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
9996  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
9997  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
9998  PrintLn();
9999  PrintS("currRing->pFDeg: ");
10000  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
10001  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
10002  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
10003  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
10004  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
10005  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
10006  else Print("? (%lx)", (long)currRing->pFDeg);
10007  PrintLn();
10008  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
10009  if(TEST_OPT_DEGBOUND)
10010  Print(" degBound: %d\n", Kstd1_deg);
10011 
10012  if( ecartWeights != NULL )
10013  {
10014  PrintS("ecartWeights: ");
10015  for (int i = rVar(currRing); i > 0; i--)
10016  Print("%hd ", ecartWeights[i]);
10017  PrintLn();
10019  }
10020 
10021 #ifndef SING_NDEBUG
10023 #endif
10024 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1154
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5085
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9873
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4432
BOOLEAN honey
Definition: kutil.h:367
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5562
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
void PrintLn()
Definition: reporter.cc:322
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4345
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
BOOLEAN noTailReduction
Definition: kutil.h:368
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4317
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2451
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5339
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5504
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5469
BOOLEAN posInLDependsOnLength
Definition: kutil.h:379
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc: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:4622
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:518
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5423
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
void rDebugPrint(ring r)
Definition: ring.cc:4035
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1116
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4375
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4744
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1161
BOOLEAN Gebauer
Definition: kutil.h:368
#define assume(x)
Definition: mod2.h:405
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1147
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2208
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4909
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5610
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:4680
BOOLEAN sugarCrit
Definition: kutil.h:367
int Kstd1_deg
Definition: kutil.cc:228
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1378
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9782
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:810
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:179
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4508
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:2666
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1037
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:613
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4866
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
BOOLEAN use_buckets
Definition: kutil.h:373
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4809
void initEcartNormal(TObject *h)
Definition: kutil.cc:1139
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:9836
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4583
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1046
int LazyDegree
Definition: kutil.h:351
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4554
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
int kFindDivisibleByInS ( const kStrategy  strat,
int *  max_ind,
LObject L 
)

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

Definition at line 202 of file kstd2.cc.

203 {
204  unsigned long not_sev = ~L->sev;
205  poly p = L->GetLmCurrRing();
206  int j = 0;
207 
208  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
209 #if 1
210  int ende;
211  if ((strat->ak>0) || currRing->pLexOrder) ende=strat->sl;
212  else ende=posInS(strat,*max_ind,p,0)+1;
213  if (ende>(*max_ind)) ende=(*max_ind);
214 #else
215  int ende=strat->sl;
216 #endif
217  (*max_ind)=ende;
218  loop
219  {
220  if (j > ende) return -1;
221 #if defined(PDEBUG) || defined(PDIV_DEBUG)
222  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
223  p, not_sev, currRing))
224  {
225 #ifdef HAVE_RINGS
227  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
228  return j;}
229  else
230 #endif
231  return j;
232  }
233 #else
234  if ( !(strat->sevS[j] & not_sev) &&
235  p_LmDivisibleBy(strat->S[j], p, currRing))
236  {
237 #ifdef HAVE_RINGS
239  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
240  return j;}
241  else
242 #endif
243  return j;
244  }
245 #endif
246  j++;
247  }
248 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int & max_ind
Definition: myNF.cc:67
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4559
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart = LONG_MAX 
)

Definition at line 5872 of file kutil.cc.

5874 {
5875  int j = 0;
5876  const unsigned long not_sev = ~L->sev;
5877  const unsigned long* sev = strat->sevS;
5878  poly p;
5879  ring r;
5880  L->GetLm(p, r);
5881 
5882  assume(~not_sev == p_GetShortExpVector(p, r));
5883 
5884  if (r == currRing)
5885  {
5886  loop
5887  {
5888  if (j > pos) return NULL;
5889 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5890  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
5891  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5892  {
5893 #ifdef HAVE_RINGS
5894  if(rField_is_Ring(r))
5895  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5896  break;}
5897  else
5898 #endif
5899  break;
5900  }
5901 #else
5902  if (!(sev[j] & not_sev) &&
5903  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
5904  p_LmDivisibleBy(strat->S[j], p, r))
5905  {
5906 #ifdef HAVE_RINGS
5907  if(rField_is_Ring(r))
5908  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r))
5909  break;}
5910  else
5911 #endif
5912  break;
5913  }
5914 
5915 #endif
5916  j++;
5917  }
5918  // if called from NF, T objects do not exist:
5919  if (strat->tl < 0 || strat->S_2_R[j] == -1)
5920  {
5921  T->Set(strat->S[j], r, strat->tailRing);
5922  return T;
5923  }
5924  else
5925  {
5926 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
5927 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
5928 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
5929  return strat->S_2_T(j);
5930  }
5931  }
5932  else
5933  {
5934  TObject* t;
5935  loop
5936  {
5937  if (j > pos) return NULL;
5938  assume(strat->S_2_R[j] != -1);
5939 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5940  t = strat->S_2_T(j);
5941  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
5942  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
5943  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5944  {
5945 #ifdef HAVE_RINGS
5946  if(rField_is_Ring(r))
5947  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5948  return t;}
5949  else
5950 #endif
5951  return t;
5952  }
5953 #else
5954  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5955  {
5956  t = strat->S_2_T(j);
5957  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
5958  if (p_LmDivisibleBy(t->t_p, p, r))
5959  {
5960 #ifdef HAVE_RINGS
5961  if(rField_is_Ring(r))
5962  {if(n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r))
5963  return t;}
5964  else
5965 #endif
5966  return t;
5967  }
5968  }
5969 #endif
5970  j++;
5971  }
5972  }
5973 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:348
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:35
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4559
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
unsigned long * sevS
Definition: kutil.h:318
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
class sTObject TObject
Definition: kutil.h:59
int kFindDivisibleByInT ( const kStrategy  strat,
const LObject L,
const int  start = 0 
)

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

Definition at line 104 of file kstd2.cc.

105 {
106  unsigned long not_sev = ~L->sev;
107  int j = start;
108 
109  const TSet T=strat->T;
110  const unsigned long* sevT=strat->sevT;
111  if (L->p!=NULL)
112  {
113  const ring r=currRing;
114  const poly p=L->p;
115 
116  pAssume(~not_sev == p_GetShortExpVector(p, r));
117 
118  loop
119  {
120  if (j > strat->tl) return -1;
121 #if defined(PDEBUG) || defined(PDIV_DEBUG)
122  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
123  {
124 #ifdef HAVE_RINGS
125  if(rField_is_Ring(r))
126  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r))
127  return j;}
128  else {
129  return j;
130  }
131 #else
132  return j;
133 #endif
134 
135  }
136 #else
137  if (!(sevT[j] & not_sev) &&
138  p_LmDivisibleBy(T[j].p, p, r))
139  {
140 #ifdef HAVE_RINGS
141  if(rField_is_Ring(r))
142  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r))
143  return j;}
144  else {
145  return j;
146  }
147 #else
148  return j;
149 #endif
150 
151  }
152 #endif
153  j++;
154  }
155  }
156  else
157  {
158  const poly p=L->t_p;
159  const ring r=strat->tailRing;
160  loop
161  {
162  if (j > strat->tl) return -1;
163 #if defined(PDEBUG) || defined(PDIV_DEBUG)
164  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
165  p, not_sev, r))
166  {
167 #ifdef HAVE_RINGS
168  if(rField_is_Ring(r))
169  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r))
170  return j;}
171  else {
172  return j;
173  }
174 #else
175  return j;
176 #endif
177 
178  }
179 #else
180  if (!(sevT[j] & not_sev) &&
181  p_LmDivisibleBy(T[j].t_p, p, r))
182  {
183 #ifdef HAVE_RINGS
184  if(rField_is_Ring(r))
185  {if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r))
186  return j;}
187  else {
188  return j;
189  }
190 #else
191  return j;
192 #endif
193 
194  }
195 #endif
196  j++;
197  }
198  }
199 }
TObject * TSet
Definition: kutil.h:61
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int tl
Definition: kutil.h:348
unsigned long * sevT
Definition: kutil.h:321
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4559
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 617 of file kutil.cc.

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

Definition at line 250 of file kstd2.cc.

251 {
252  unsigned long not_sev = ~L->sev;
253  poly p = L->GetLmCurrRing();
254  int j = start;
255 
256  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
257 #if 1
258  int ende=max_ind;
259 #else
260  int ende=strat->sl;
261 #endif
262  loop
263  {
264  if (j > ende) return -1;
265 #if defined(PDEBUG) || defined(PDIV_DEBUG)
266  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
267  p, not_sev, currRing))
268  {
269 #ifdef HAVE_RINGS
271  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
272  return j;}
273  else
274 #endif
275  return j;
276  }
277 #else
278  if ( !(strat->sevS[j] & not_sev) &&
279  p_LmDivisibleBy(strat->S[j], p, currRing))
280  {
281 #ifdef HAVE_RINGS
283  {if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing))
284  return j;}
285  else
286 #endif
287  return j;
288  }
289 #endif
290  j++;
291  }
292 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int & max_ind
Definition: myNF.cc:67
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4559
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
poly kFindZeroPoly ( poly  input_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 295 of file kstd2.cc.

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

Definition at line 2592 of file kstd2.cc.

2593 {
2594  assume(q!=NULL);
2595  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
2596 
2597 // lazy_reduce flags: can be combined by |
2598 //#define KSTD_NF_LAZY 1
2599  // do only a reduction of the leading term
2600 //#define KSTD_NF_NONORM 4
2601  // only global: avoid normalization, return a multiply of NF
2602  poly p;
2603 
2604  //if ((idIs0(F))&&(Q==NULL))
2605  // return pCopy(q); /*F=0*/
2606  //strat->ak = idRankFreeModule(F);
2607  /*- creating temp data structures------------------- -*/
2608  BITSET save1;
2609  SI_SAVE_OPT1(save1);
2611  initBuchMoraCrit(strat);
2612  strat->initEcart = initEcartBBA;
2613  strat->enterS = enterSBba;
2614 #ifndef NO_BUCKETS
2616 #endif
2617  /*- set S -*/
2618  strat->sl = -1;
2619  /*- init local data struct.---------------------------------------- -*/
2620  /*Shdl=*/initS(F,Q,strat);
2621  /*- compute------------------------------------------------------- -*/
2622  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
2623  //{
2624  // for (i=strat->sl;i>=0;i--)
2625  // pNorm(strat->S[i]);
2626  //}
2627  kTest(strat);
2628  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2629  if (BVERBOSE(23)) kDebugPrint(strat);
2630  int max_ind;
2631  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2632  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2633  {
2634  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2635  #ifdef HAVE_RINGS
2636  if (rField_is_Ring(currRing))
2637  {
2638  p = redtailBba_Z(p,max_ind,strat);
2639  }
2640  else
2641  #endif
2642  {
2644  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2645  }
2646  }
2647  /*- release temp data------------------------------- -*/
2648  assume(strat->L==NULL); /* strat->L unused */
2649  assume(strat->B==NULL); /* strat->B unused */
2650  omFree(strat->sevS);
2651  omFree(strat->ecartS);
2652  assume(strat->T==NULL);//omfree(strat->T);
2653  assume(strat->sevT==NULL);//omfree(strat->sevT);
2654  assume(strat->R==NULL);//omfree(strat->R);
2655  omfree(strat->S_2_R);
2656  omfree(strat->fromQ);
2657  idDelete(&strat->Shdl);
2658  SI_RESTORE_OPT1(save1);
2659  if (TEST_OPT_PROT) PrintLn();
2660  return p;
2661 }
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:340
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:619
unsigned long * sevT
Definition: kutil.h:321
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:17
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1320
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:55
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6383
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1147
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8092
void PrintS(const char *s)
Definition: reporter.cc:294
TObject ** R
Definition: kutil.h:338
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:373
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:9907
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
#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 2663 of file kstd2.cc.

2664 {
2665  assume(!idIs0(q));
2666  assume(!(idIs0(F)&&(Q==NULL)));
2667 // lazy_reduce flags: can be combined by |
2668 //#define KSTD_NF_LAZY 1
2669  // do only a reduction of the leading term
2670 //#define KSTD_NF_NONORM 4
2671  // only global: avoid normalization, return a multiply of NF
2672  poly p;
2673  int i;
2674  ideal res;
2675  int max_ind;
2676 
2677  //if (idIs0(q))
2678  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2679  //if ((idIs0(F))&&(Q==NULL))
2680  // return idCopy(q); /*F=0*/
2681  //strat->ak = idRankFreeModule(F);
2682  /*- creating temp data structures------------------- -*/
2683  BITSET save1;
2684  SI_SAVE_OPT1(save1);
2686  initBuchMoraCrit(strat);
2687  strat->initEcart = initEcartBBA;
2688  strat->enterS = enterSBba;
2689  /*- set S -*/
2690  strat->sl = -1;
2691 #ifndef NO_BUCKETS
2693 #endif
2694  /*- init local data struct.---------------------------------------- -*/
2695  /*Shdl=*/initS(F,Q,strat);
2696  /*- compute------------------------------------------------------- -*/
2697  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
2699  for (i=IDELEMS(q)-1; i>=0; i--)
2700  {
2701  if (q->m[i]!=NULL)
2702  {
2703  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
2704  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2705  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2706  {
2707  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2708  #ifdef HAVE_RINGS
2709  if (rField_is_Ring(currRing))
2710  {
2711  p = redtailBba_Z(p,max_ind,strat);
2712  }
2713  else
2714  #endif
2715  {
2716  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2717  }
2718  }
2719  res->m[i]=p;
2720  }
2721  //else
2722  // res->m[i]=NULL;
2723  }
2724  /*- release temp data------------------------------- -*/
2725  assume(strat->L==NULL); /* strat->L unused */
2726  assume(strat->B==NULL); /* strat->B unused */
2727  omFree(strat->sevS);
2728  omFree(strat->ecartS);
2729  assume(strat->T==NULL);//omfree(strat->T);
2730  assume(strat->sevT==NULL);//omfree(strat->sevT);
2731  assume(strat->R==NULL);//omfree(strat->R);
2732  omfree(strat->S_2_R);
2733  omfree(strat->fromQ);
2734  idDelete(&strat->Shdl);
2735  SI_RESTORE_OPT1(save1);
2736  if (TEST_OPT_PROT) PrintLn();
2737  return res;
2738 }
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:340
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
unsigned long * sevT
Definition: kutil.h:321
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:17
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1320
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:55
poly res
Definition: myNF.cc:322
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6383
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1147
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8092
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
#define OPT_INTSTRATEGY
Definition: options.h:87
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:373
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
poly ksCreateShortSpoly ( poly  p1,
poly  p2,
ring  tailRing 
)

Definition at line 566 of file kspoly.cc.

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

Definition at line 379 of file kspoly.cc.

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

Definition at line 1102 of file kInline.h.

1103 {
1104  LObject L(r);
1105  L.p1 = p1;
1106  L.p2 = p2;
1107 
1108  ksCreateSpoly(&L, spNoether);
1109  return L.GetLmCurrRing();
1110 }
class sLObject LObject
Definition: kutil.h:60
const ring r
Definition: syzextra.cc:208
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:379
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
KINLINE poly ksOldSpolyRed ( poly  p1,
poly  p2,
poly  spNoether = NULL 
)

Definition at line 1082 of file kInline.h.

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

Definition at line 1092 of file kInline.h.

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

Definition at line 1112 of file kInline.h.

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

Definition at line 38 of file kspoly.cc.

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

Definition at line 175 of file kspoly.cc.

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

Definition at line 494 of file kspoly.cc.

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

Definition at line 1055 of file kInline.h.

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

Definition at line 9361 of file kutil.cc.

9362 {
9363  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
9364  /* initial setup or extending */
9365 
9366  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
9367  if (expbound >= currRing->bitmask) return FALSE;
9368  strat->overflow=FALSE;
9369  ring new_tailRing = rModifyRing(currRing,
9370  // Hmmm .. the condition pFDeg == p_Deg
9371  // might be too strong
9372 #ifdef HAVE_RINGS
9373  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver
9374 #else
9375  (strat->homog && currRing->pFDeg == p_Deg), // omit_degree
9376 #endif
9377  (strat->ak==0), // omit_comp if the input is an ideal
9378  expbound); // exp_limit
9379 
9380  if (new_tailRing == currRing) return TRUE;
9381 
9382  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
9383  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
9384 
9385  if (currRing->pFDeg != currRing->pFDegOrig)
9386  {
9387  new_tailRing->pFDeg = currRing->pFDeg;
9388  new_tailRing->pLDeg = currRing->pLDeg;
9389  }
9390 
9391  if (TEST_OPT_PROT)
9392  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
9393  kTest_TS(strat);
9394  assume(new_tailRing != strat->tailRing);
9395  pShallowCopyDeleteProc p_shallow_copy_delete
9396  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
9397 
9398  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
9399 
9400  int i;
9401  for (i=0; i<=strat->tl; i++)
9402  {
9403  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
9404  p_shallow_copy_delete);
9405  }
9406  for (i=0; i<=strat->Ll; i++)
9407  {
9408  assume(strat->L[i].p != NULL);
9409  if (pNext(strat->L[i].p) != strat->tail)
9410  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9411  }
9412  if ((strat->P.t_p != NULL) ||
9413  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
9414  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9415 
9416  if ((L != NULL) && (L->tailRing != new_tailRing))
9417  {
9418  if (L->i_r < 0)
9419  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
9420  else
9421  {
9422  assume(L->i_r <= strat->tl);
9423  TObject* t_l = strat->R[L->i_r];
9424  assume(t_l != NULL);
9425  L->tailRing = new_tailRing;
9426  L->p = t_l->p;
9427  L->t_p = t_l->t_p;
9428  L->max = t_l->max;
9429  }
9430  }
9431 
9432  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
9433  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
9434 
9435  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
9436  if (strat->tailRing != currRing)
9437  rKillModifiedRing(strat->tailRing);
9438 
9439  strat->tailRing = new_tailRing;
9440  strat->tailBin = new_tailBin;
9441  strat->p_shallow_copy_delete
9442  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
9443 
9444  if (strat->kHEdge != NULL)
9445  {
9446  if (strat->t_kHEdge != NULL)
9447  p_LmFree(strat->t_kHEdge, strat->tailRing);
9448  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
9449  }
9450 
9451  if (strat->kNoether != NULL)
9452  {
9453  if (strat->t_kNoether != NULL)
9454  p_LmFree(strat->t_kNoether, strat->tailRing);
9456  new_tailRing);
9457  }
9458  kTest_TS(strat);
9459  if (TEST_OPT_PROT)
9460  PrintS("]");
9461  return TRUE;
9462 }
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
Definition: omBin.c:396
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:325
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2596
#define TRUE
Definition: auxiliary.h:144
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
int ak
Definition: kutil.h:351
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
BOOLEAN homog
Definition: kutil.h:362
#define kTest_TS(A)
Definition: kutil.h:620
#define assume(x)
Definition: mod2.h:405
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:327
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:52
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
omBin tailBin
Definition: kutil.h:343
char overflow
Definition: kutil.h:394
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2962
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:59
void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 9464 of file kutil.cc.

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

Definition at line 6278 of file kutil.cc.

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

Definition at line 6319 of file kutil.cc.

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

Definition at line 8924 of file kutil.cc.

8925 {
8926  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
8927  return FALSE;
8928  int i,j;
8929  poly newNoether;
8930 
8931 #if 0
8932  if (currRing->weight_all_1)
8933  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8934  else
8935  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8936 #else
8937  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8938 #endif
8939  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
8940  if (strat->tailRing != currRing)
8941  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
8942  /* compare old and new noether*/
8943  newNoether = pLmInit(strat->kHEdge);
8944  j = p_FDeg(newNoether,currRing);
8945 /* #ifdef HAVE_RINGS
8946  if (!rField_is_Ring(currRing))
8947  #endif */
8948  for (i=1; i<=(currRing->N); i++)
8949  {
8950  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
8951  }
8952  pSetm(newNoether);
8953  if (j < strat->HCord) /*- statistics -*/
8954  {
8955  if (TEST_OPT_PROT)
8956  {
8957  Print("H(%d)",j);
8958  mflush();
8959  }
8960  strat->HCord=j;
8961  #ifdef KDEBUG
8962  if (TEST_OPT_DEBUG)
8963  {
8964  Print("H(%d):",j);
8965  wrp(strat->kHEdge);
8966  PrintLn();
8967  }
8968  #endif
8969  }
8970  if (pCmp(strat->kNoether,newNoether)!=1)
8971  {
8972  pDelete(&strat->kNoether);
8973  strat->kNoether=newNoether;
8974  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
8975  if (strat->tailRing != currRing)
8976  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
8977 
8978  return TRUE;
8979  }
8980  #ifdef HAVE_RINGS
8981  if (rField_is_Ring(currRing))
8982  pLmDelete(newNoether);
8983  else
8984  #endif
8985  pLmFree(newNoether);
8986  return FALSE;
8987 }
#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:325
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:326
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:144
int ak
Definition: kutil.h:351
#define TEST_OPT_DEBUG
Definition: options.h:103
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
int HCord
Definition: kutil.h:353
#define mflush()
Definition: reporter.h:55
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
int j
Definition: myNF.cc:70
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:369
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:754
poly t_kHEdge
Definition: kutil.h:327
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
#define pDelete(p_ptr)
Definition: polys.h:157
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
void wrp(poly p)
Definition: polys.h:281
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
void pairs ( )
poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 10059 of file kutil.cc.

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

Definition at line 10028 of file kutil.cc.

10029 {
10030  /* assume: p is completely in currRing */
10031  /* produces an object with LM in curring
10032  and TAIL in tailring */
10033  if (pNext(p)!=NULL)
10034  {
10035  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
10036  }
10037  return(p);
10038 }
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 10042 of file kutil.cc.

10043 {
10044  /* assume: p has LM in curring and TAIL in tailring */
10045  /* convert it to complete currRing */
10046 
10047  /* check that LM is in currRing */
10049 
10050  if (pNext(p)!=NULL)
10051  {
10052  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
10053  }
10054  return(p);
10055 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
int posInL0 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4909 of file kutil.cc.

4911 {
4912  if (length<0) return 0;
4913 
4914  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
4915  return length+1;
4916 
4917  int i;
4918  int an = 0;
4919  int en= length;
4920  loop
4921  {
4922  if (an >= en-1)
4923  {
4924  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
4925  return an;
4926  }
4927  i=(an+en) / 2;
4928  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
4929  else en=i;
4930  /*aend. fuer lazy == in !=- machen */
4931  }
4932 }
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 1046 of file kstd1.cc.

1047 {
1048  int j,dp,dL;
1049 
1050  if (length<0) return 0;
1051  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1052  {
1053  int op= p->GetpFDeg() +p->ecart;
1054  for (j=length; j>=0; j--)
1055  {
1056  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1057  return j+1;
1058  if (dp < dL)
1059  return j+1;
1060  if ((dp == dL)
1061  && (set[j].GetpFDeg()+set[j].ecart >= op))
1062  return j+1;
1063  }
1064  }
1065  j=length;
1066  loop
1067  {
1068  if (j<0) break;
1069  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1070  j--;
1071  }
1072  return strat->posInLOld(set,j,p,strat);
1073 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int lastAxis
Definition: kutil.h:354
int j
Definition: myNF.cc:70
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:998
int posInL11 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5085 of file kutil.cc.

5104 {
5105  if (length<0) return 0;
5106 
5107  int o = p->GetpFDeg();
5108  int op = set[length].GetpFDeg();
5109 
5110  if ((op > o)
5111  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5112  return length+1;
5113  int i;
5114  int an = 0;
5115  int en= length;
5116  loop
5117  {
5118  if (an >= en-1)
5119  {
5120  op = set[an].GetpFDeg();
5121  if ((op > o)
5122  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5123  return en;
5124  return an;
5125  }
5126  i=(an+en) / 2;
5127  op = set[i].GetpFDeg();
5128  if ((op > o)
5129  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5130  an=i;
5131  else
5132  en=i;
5133  }
5134 }
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 5423 of file kutil.cc.

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

Definition at line 5143 of file kutil.cc.

5145 {
5146  if (length < 0) return 0;
5147  int an,en,i;
5148  an = 0;
5149  en = length+1;
5150  #if 0
5151  printf("\n----------------------\n");
5152  for(i=0;i<=length;i++)
5153  pWrite(set[i].p);
5154  printf("\n----------------------\n");
5155  #endif
5156  loop
5157  {
5158  if (an >= en-1)
5159  {
5160  if(an == en)
5161  return en;
5162  if (pLmCmp(set[an].p, p->p) == 1)
5163  return en;
5164  if (pLmCmp(set[an].p, p->p) == -1)
5165  return an;
5166  if (pLmCmp(set[an].p, p->p) == 0)
5167  {
5168  number lcset,lcp;
5169  lcset = pGetCoeff(set[an].p);
5170  lcp = pGetCoeff(p->p);
5171  if(!nGreaterZero(lcset))
5172  {
5173  set[an].p=p_Neg(set[an].p,currRing);
5174  if (set[an].t_p!=NULL)
5175  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
5176  lcset=pGetCoeff(set[an].p);
5177  }
5178  if(!nGreaterZero(lcp))
5179  {
5180  p->p=p_Neg(p->p,currRing);
5181  if (p->t_p!=NULL)
5182  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5183  lcp=pGetCoeff(p->p);
5184  }
5185  if(nGreater(lcset, lcp))
5186  {
5187  return en;
5188  }
5189  else
5190  {
5191  return an;
5192  }
5193  }
5194  }
5195  i=(an+en) / 2;
5196  if (pLmCmp(set[i].p, p->p) == 1)
5197  an=i;
5198  if (pLmCmp(set[i].p, p->p) == -1)
5199  en=i;
5200  if (pLmCmp(set[i].p, p->p) == 0)
5201  {
5202  number lcset,lcp;
5203  lcset = pGetCoeff(set[i].p);
5204  lcp = pGetCoeff(p->p);
5205  if(!nGreaterZero(lcset))
5206  {
5207  set[i].p=p_Neg(set[i].p,currRing);
5208  if (set[i].t_p!=NULL)
5209  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
5210  lcset=pGetCoeff(set[i].p);
5211  }
5212  if(!nGreaterZero(lcp))
5213  {
5214  p->p=p_Neg(p->p,currRing);
5215  if (p->t_p!=NULL)
5216  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5217  lcp=pGetCoeff(p->p);
5218  }
5219  if(nGreater(lcset, lcp))
5220  {
5221  an = i;
5222  }
5223  else
5224  {
5225  en = i;
5226  }
5227  }
5228  }
5229 }
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
void pWrite(poly p)
Definition: polys.h:279
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
#define nGreater(a, b)
Definition: numbers.h:28
int posInL11Ringls ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5231 of file kutil.cc.

5233 {
5234  if (length < 0) return 0;
5235  int an,en,i;
5236  an = 0;
5237  en = length+1;
5238  #if 0
5239  printf("\n----------------------\n");
5240  for(i=0;i<=length;i++)
5241  pWrite(set[i].p);
5242  printf("\n----------------------\n");
5243  #endif
5244  loop
5245  {
5246  if (an >= en-1)
5247  {
5248  if(an == en)
5249  return en;
5250  if (set[an].FDeg > p->FDeg)
5251  return en;
5252  if (set[an].FDeg < p->FDeg)
5253  return an;
5254  if (set[an].FDeg == p->FDeg)
5255  {
5256  number lcset,lcp;
5257  lcset = pGetCoeff(set[an].p);
5258  lcp = pGetCoeff(p->p);
5259  if(!nGreaterZero(lcset))
5260  {
5261  set[an].p=p_Neg(set[an].p,currRing);
5262  if (set[an].t_p!=NULL)
5263  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
5264  lcset=pGetCoeff(set[an].p);
5265  }
5266  if(!nGreaterZero(lcp))
5267  {
5268  p->p=p_Neg(p->p,currRing);
5269  if (p->t_p!=NULL)
5270  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5271  lcp=pGetCoeff(p->p);
5272  }
5273  if(nGreater(lcset, lcp))
5274  {
5275  return en;
5276  }
5277  else
5278  {
5279  return an;
5280  }
5281  }
5282  }
5283  i=(an+en) / 2;
5284  if (set[i].FDeg > p->FDeg)
5285  an=i;
5286  if (set[i].FDeg < p->FDeg)
5287  en=i;
5288  if (set[i].FDeg == p->FDeg)
5289  {
5290  number lcset,lcp;
5291  lcset = pGetCoeff(set[i].p);
5292  lcp = pGetCoeff(p->p);
5293  if(!nGreaterZero(lcset))
5294  {
5295  set[i].p=p_Neg(set[i].p,currRing);
5296  if (set[i].t_p!=NULL)
5297  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
5298  lcset=pGetCoeff(set[i].p);
5299  }
5300  if(!nGreaterZero(lcp))
5301  {
5302  p->p=p_Neg(p->p,currRing);
5303  if (p->t_p!=NULL)
5304  pSetCoeff0(p->t_p,pGetCoeff(p->p));
5305  lcp=pGetCoeff(p->p);
5306  }
5307  if(nGreater(lcset, lcp))
5308  {
5309  an = i;
5310  }
5311  else
5312  {
5313  en = i;
5314  }
5315  }
5316  }
5317 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
void pWrite(poly p)
Definition: polys.h:279
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
#define nGreater(a, b)
Definition: numbers.h:28
int posInL13 ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 5469 of file kutil.cc.

5471 {
5472  if (length<0) return 0;
5473 
5474  int o = p->GetpFDeg();
5475 
5476  if (set[length].GetpFDeg() > o)
5477  return length+1;
5478 
5479  int i;
5480  int an = 0;
5481  int en= length;
5482  loop
5483  {
5484  if (an >= en-1)
5485  {
5486  if (set[an].GetpFDeg() >= o)
5487  return en;
5488  return an;
5489  }
5490  i=(an+en) / 2;
5491  if (set[i].GetpFDeg() >= o)
5492  an=i;
5493  else
5494  en=i;
5495  }
5496 }
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 5504 of file kutil.cc.

5524 {
5525  if (length<0) return 0;
5526 
5527  int o = p->GetpFDeg() + p->ecart;
5528  int op = set[length].GetpFDeg() + set[length].ecart;
5529 
5530  if ((op > o)
5531  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5532  return length+1;
5533  int i;
5534  int an = 0;
5535  int en= length;
5536  loop
5537  {
5538  if (an >= en-1)
5539  {
5540  op = set[an].GetpFDeg() + set[an].ecart;
5541  if ((op > o)
5542  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5543  return en;
5544  return an;
5545  }
5546  i=(an+en) / 2;
5547  op = set[i].GetpFDeg() + set[i].ecart;
5548  if ((op > o)
5549  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5550  an=i;
5551  else
5552  en=i;
5553  }
5554 }
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 5562 of file kutil.cc.

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

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

Definition at line 4964 of file kutil.cc.

4966 {
4967  if (length < 0) return 0;
4968  if (set[length].FDeg > p->FDeg)
4969  return length+1;
4970  if (set[length].FDeg == p->FDeg)
4971  if(set[length].GetpLength() > p->GetpLength())
4972  return length+1;
4973  int i;
4974  int an = 0;
4975  int en= length+1;
4976  loop
4977  {
4978  if (an >= en-1)
4979  {
4980  if(an == en)
4981  return en;
4982  if (set[an].FDeg > p->FDeg)
4983  return en;
4984  if(set[an].FDeg == p->FDeg)
4985  {
4986  if(set[an].GetpLength() > p->GetpLength())
4987  {return en;}
4988  else
4989  {
4990  if(set[an].GetpLength() == p->GetpLength())
4991  {
4992  if(nGreater(set[an].p->coef, p->p->coef))
4993  {
4994  return en;
4995  }
4996  else
4997  {
4998  return an;
4999  }
5000  }
5001  else
5002  {
5003  return an;
5004  }
5005  }
5006  }
5007  else
5008  {return an;}
5009  }
5010  i=(an+en) / 2;
5011  if (set[i].FDeg > p->FDeg)
5012  an=i;
5013  else
5014  {
5015  if(set[i].FDeg == p->FDeg)
5016  {
5017  if(set[i].GetpLength() > p->GetpLength())
5018  an=i;
5019  else
5020  {
5021  if(set[i].GetpLength() == p->GetpLength())
5022  {
5023  if(nGreater(set[i].p->coef, p->p->coef))
5024  {
5025  an = i;
5026  }
5027  else
5028  {
5029  en = i;
5030  }
5031  }
5032  else
5033  {
5034  en=i;
5035  }
5036  }
5037  }
5038  else
5039  en=i;
5040  }
5041  }
5042 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28
int posInLSig ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 4940 of file kutil.cc.

4942 {
4943 if (length<0) return 0;
4944 if (pLmCmp(set[length].sig,p->sig)== currRing->OrdSgn)
4945  return length+1;
4946 
4947 int i;
4948 int an = 0;
4949 int en= length;
4950 loop
4951 {
4952  if (an >= en-1)
4953  {
4954  if (pLmCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
4955  return an;
4956  }
4957  i=(an+en) / 2;
4958  if (pLmCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
4959  else en=i;
4960  /*aend. fuer lazy == in !=- machen */
4961 }
4962 }
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 4201 of file kutil.cc.

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

Definition at line 5045 of file kutil.cc.

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

Definition at line 4306 of file kutil.cc.

4307 {
4308  return (length+1);
4309 }
int posInT1 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4317 of file kutil.cc.

4318 {
4319  if (length==-1) return 0;
4320 
4321  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
4322 
4323  int i;
4324  int an = 0;
4325  int en= length;
4326 
4327  loop
4328  {
4329  if (an >= en-1)
4330  {
4331  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
4332  return en;
4333  }
4334  i=(an+en) / 2;
4335  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
4336  else an=i;
4337  }
4338 }
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 4375 of file kutil.cc.

4393 {
4394  if (length==-1) return 0;
4395 
4396  int o = p.GetpFDeg();
4397  int op = set[length].GetpFDeg();
4398 
4399  if ((op < o)
4400  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4401  return length+1;
4402 
4403  int i;
4404  int an = 0;
4405  int en= length;
4406 
4407  loop
4408  {
4409  if (an >= en-1)
4410  {
4411  op= set[an].GetpFDeg();
4412  if ((op > o)
4413  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4414  return an;
4415  return en;
4416  }
4417  i=(an+en) / 2;
4418  op = set[i].GetpFDeg();
4419  if (( op > o)
4420  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4421  en=i;
4422  else
4423  an=i;
4424  }
4425 }
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 4508 of file kutil.cc.

4509 {
4510  p.GetpLength();
4511  if (length==-1) return 0;
4512 
4513  int o = p.GetpFDeg();
4514  int op = set[length].GetpFDeg();
4515 
4516  if (( op < o)
4517  || (( op == o) && (set[length].length<p.length))
4518  || (( op == o) && (set[length].length == p.length)
4519  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4520  return length+1;
4521 
4522  int i;
4523  int an = 0;
4524  int en= length;
4525  loop
4526  {
4527  if (an >= en-1)
4528  {
4529  op = set[an].GetpFDeg();
4530  if (( op > o)
4531  || (( op == o) && (set[an].length > p.length))
4532  || (( op == o) && (set[an].length == p.length)
4533  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4534  return an;
4535  return en;
4536  }
4537  i=(an+en) / 2;
4538  op = set[i].GetpFDeg();
4539  if (( op > o)
4540  || (( op == o) && (set[i].length > p.length))
4541  || (( op == o) && (set[i].length == p.length)
4542  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4543  en=i;
4544  else
4545  an=i;
4546  }
4547 }
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 4554 of file kutil.cc.

4555 {
4556  if (length==-1) return 0;
4557 
4558  int o = p.GetpFDeg();
4559 
4560  if (set[length].GetpFDeg() <= o)
4561  return length+1;
4562 
4563  int i;
4564  int an = 0;
4565  int en= length;
4566  loop
4567  {
4568  if (an >= en-1)
4569  {
4570  if (set[an].GetpFDeg() > o)
4571  return an;
4572  return en;
4573  }
4574  i=(an+en) / 2;
4575  if (set[i].GetpFDeg() > o)
4576  en=i;
4577  else
4578  an=i;
4579  }
4580 }
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 4622 of file kutil.cc.

4641 {
4642  if (length==-1) return 0;
4643 
4644  int o = p.GetpFDeg() + p.ecart;
4645  int op = set[length].GetpFDeg()+set[length].ecart;
4646 
4647  if ((op < o)
4648  || ((op == o)
4649  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4650  return length+1;
4651 
4652  int i;
4653  int an = 0;
4654  int en= length;
4655  loop
4656  {
4657  if (an >= en-1)
4658  {
4659  op = set[an].GetpFDeg()+set[an].ecart;
4660  if (( op > o)
4661  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4662  return an;
4663  return en;
4664  }
4665  i=(an+en) / 2;
4666  op = set[i].GetpFDeg()+set[i].ecart;
4667  if (( op > o)
4668  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4669  en=i;
4670  else
4671  an=i;
4672  }
4673 }
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 4680 of file kutil.cc.

4701 {
4702  if (length==-1) return 0;
4703 
4704  int o = p.GetpFDeg() + p.ecart;
4705  int op = set[length].GetpFDeg()+set[length].ecart;
4706 
4707  if ((op < o)
4708  || (( op == o) && (set[length].ecart > p.ecart))
4709  || (( op == o) && (set[length].ecart==p.ecart)
4710  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4711  return length+1;
4712 
4713  int i;
4714  int an = 0;
4715  int en= length;
4716  loop
4717  {
4718  if (an >= en-1)
4719  {
4720  op = set[an].GetpFDeg()+set[an].ecart;
4721  if (( op > o)
4722  || (( op == o) && (set[an].ecart < p.ecart))
4723  || (( op == o) && (set[an].ecart==p.ecart)
4724  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4725  return an;
4726  return en;
4727  }
4728  i=(an+en) / 2;
4729  op = set[i].GetpFDeg()+set[i].ecart;
4730  if ((op > o)
4731  || (( op == o) && (set[i].ecart < p.ecart))
4732  || (( op == o) && (set[i].ecart == p.ecart)
4733  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4734  en=i;
4735  else
4736  an=i;
4737  }
4738 }
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 4809 of file kutil.cc.

4810 {
4811  p.GetpLength();
4812  if (length==-1) return 0;
4813 
4814  int o = p.ecart;
4815  int op=p.GetpFDeg();
4816 
4817  if (set[length].ecart < o)
4818  return length+1;
4819  if (set[length].ecart == o)
4820  {
4821  int oo=set[length].GetpFDeg();
4822  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
4823  return length+1;
4824  }
4825 
4826  int i;
4827  int an = 0;
4828  int en= length;
4829  loop
4830  {
4831  if (an >= en-1)
4832  {
4833  if (set[an].ecart > o)
4834  return an;
4835  if (set[an].ecart == o)
4836  {
4837  int oo=set[an].GetpFDeg();
4838  if((oo > op)
4839  || ((oo==op) && (set[an].length > p.length)))
4840  return an;
4841  }
4842  return en;
4843  }
4844  i=(an+en) / 2;
4845  if (set[i].ecart > o)
4846  en=i;
4847  else if (set[i].ecart == o)
4848  {
4849  int oo=set[i].GetpFDeg();
4850  if ((oo > op)
4851  || ((oo == op) && (set[i].length > p.length)))
4852  en=i;
4853  else
4854  an=i;
4855  }
4856  else
4857  an=i;
4858  }
4859 }
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 4345 of file kutil.cc.

4346 {
4347  p.GetpLength();
4348  if (length==-1)
4349  return 0;
4350  if (set[length].length<p.length)
4351  return length+1;
4352 
4353  int i;
4354  int an = 0;
4355  int en= length;
4356 
4357  loop
4358  {
4359  if (an >= en-1)
4360  {
4361  if (set[an].length>p.length) return an;
4362  return en;
4363  }
4364  i=(an+en) / 2;
4365  if (set[i].length>p.length) en=i;
4366  else an=i;
4367  }
4368 }
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 4583 of file kutil.cc.

4584 {
4585  int ol = p.GetpLength();
4586  if (length==-1) return 0;
4587 
4588  int op=p.ecart;
4589 
4590  int oo=set[length].ecart;
4591  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
4592  return length+1;
4593 
4594  int i;
4595  int an = 0;
4596  int en= length;
4597  loop
4598  {
4599  if (an >= en-1)
4600  {
4601  int oo=set[an].ecart;
4602  if((oo > op)
4603  || ((oo==op) && (set[an].pLength > ol)))
4604  return an;
4605  return en;
4606  }
4607  i=(an+en) / 2;
4608  int oo=set[i].ecart;
4609  if ((oo > op)
4610  || ((oo == op) && (set[i].pLength > ol)))
4611  en=i;
4612  else
4613  an=i;
4614  }
4615 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123
int posInTSig ( const TSet  set,
const int  length,
LObject p 
)
void postReduceByMon ( LObject h,
kStrategy  strat 
)

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

Definition at line 9225 of file kutil.cc.

9226 {
9227  if(!nCoeff_is_Ring_Z(currRing->cf))
9228  return;
9229  poly pH = h->GetP();
9230  poly p,pp;
9231  p = pH;
9232  bool deleted = FALSE, ok = FALSE;
9233  for(int i = 0; i<=strat->sl; i++)
9234  {
9235  p = pH;
9236  if(pNext(strat->S[i]) == NULL)
9237  {
9238  //pWrite(p);
9239  //pWrite(strat->S[i]);
9240  while(ok == FALSE)
9241  {
9242  if(pLmDivisibleBy(strat->S[i], p))
9243  {
9244  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
9245  p_SetCoeff(p,dummy,currRing);
9246  }
9247  if(nIsZero(p->coef))
9248  {
9249  pLmDelete(&p);
9250  deleted = TRUE;
9251  }
9252  else
9253  {
9254  ok = TRUE;
9255  }
9256  }
9257  pp = pNext(p);
9258  while(pp != NULL)
9259  {
9260  if(pLmDivisibleBy(strat->S[i], pp))
9261  {
9262  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
9263  p_SetCoeff(pp,dummy,currRing);
9264  if(nIsZero(pp->coef))
9265  {
9266  pLmDelete(&pNext(p));
9267  pp = pNext(p);
9268  deleted = TRUE;
9269  }
9270  else
9271  {
9272  p = pp;
9273  pp = pNext(p);
9274  }
9275  }
9276  else
9277  {
9278  p = pp;
9279  pp = pNext(p);
9280  }
9281  }
9282  }
9283  }
9284  h->SetLmCurrRing();
9285  if(deleted)
9286  strat->initEcart(h);
9287 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
poly preIntegerCheck ( ideal  F,
ideal  Q 
)

used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell

Definition at line 9052 of file kutil.cc.

9053 {
9055  if(!nCoeff_is_Ring_Z(currRing->cf))
9056  return NULL;
9057  ideal F = idCopy(FOrig);
9058  idSkipZeroes(F);
9059  poly pmon;
9060  ring origR = currRing;
9061  ideal monred = idInit(1,1);
9062  for(int i=0; i<idElem(F); i++)
9063  {
9064  if(pNext(F->m[i]) == NULL)
9065  idInsertPoly(monred, F->m[i]);
9066  }
9067  int posconst = idPosConstant(F);
9068  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
9069  {
9070  pmon = pCopy(F->m[posconst]);
9071  idDelete(&F);
9072  idDelete(&monred);
9073  return pmon;
9074  }
9075  int idelemQ = 0;
9076  if(Q!=NULL)
9077  {
9078  idelemQ = IDELEMS(Q);
9079  for(int i=0; i<idelemQ; i++)
9080  {
9081  if(pNext(Q->m[i]) == NULL)
9082  idInsertPoly(monred, Q->m[i]);
9083  }
9084  idSkipZeroes(monred);
9085  posconst = idPosConstant(monred);
9086  //the constant, if found, will be from Q
9087  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
9088  {
9089  pmon = pCopy(monred->m[posconst]);
9090  idDelete(&F);
9091  idDelete(&monred);
9092  return pmon;
9093  }
9094  }
9095  ring QQ_ring = rCopy0(currRing,FALSE);
9096  nKillChar(QQ_ring->cf);
9097  QQ_ring->cf = nInitChar(n_Q, NULL);
9098  rComplete(QQ_ring,1);
9099  QQ_ring = rAssure_c_dp(QQ_ring);
9100  rChangeCurrRing(QQ_ring);
9101  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
9102  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
9103  for(int i = 0, j = 0; i<IDELEMS(F); i++)
9104  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
9105  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
9106  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
9107  ideal one = kStd(II, NULL, isNotHomog, NULL);
9108  idSkipZeroes(one);
9109  if(idIsConstant(one))
9110  {
9111  //one should be <1>
9112  for(int i = IDELEMS(II)-1; i>=0; i--)
9113  if(II->m[i] != NULL)
9114  II->m[i+1] = II->m[i];
9115  II->m[0] = pOne();
9116  ideal syz = idSyzygies(II, isNotHomog, NULL);
9117  poly integer = NULL;
9118  for(int i = IDELEMS(syz)-1;i>=0; i--)
9119  {
9120  if(pGetComp(syz->m[i]) == 1)
9121  {
9122  if(pIsConstant(syz->m[i]))
9123  {
9124  integer = pHead(syz->m[i]);
9125  pSetComp(integer, 0);
9126  break;
9127  }
9128  }
9129  }
9130  rChangeCurrRing(origR);
9131  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9132  pmon = prMapR(integer, nMap2, QQ_ring, origR);
9133  idDelete(&F);
9134  idDelete(&monred);
9135  idDelete(&II);
9136  idDelete(&one);
9137  idDelete(&syz);
9138  pDelete(&integer);
9139  rDelete(QQ_ring);
9140  return pmon;
9141  }
9142  else
9143  {
9144  if(idIs0(monred))
9145  {
9146  poly mindegmon = NULL;
9147  for(int i = 0; i<IDELEMS(one); i++)
9148  {
9149  if(pNext(one->m[i]) == NULL)
9150  {
9151  if(mindegmon == NULL)
9152  mindegmon = one->m[i];
9153  else
9154  {
9155  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
9156  mindegmon = one->m[i];
9157  }
9158  }
9159  }
9160  if(mindegmon != NULL)
9161  {
9162  for(int i = IDELEMS(II)-1; i>=0; i--)
9163  if(II->m[i] != NULL)
9164  II->m[i+1] = II->m[i];
9165  II->m[0] = mindegmon;
9166  ideal syz = idSyzygies(II, isNotHomog, NULL);
9167  bool found = FALSE;
9168  for(int i = IDELEMS(syz)-1;i>=0; i--)
9169  {
9170  if(pGetComp(syz->m[i]) == 1)
9171  {
9172  if(pIsConstant(syz->m[i]))
9173  {
9174  pSetCoeff(mindegmon, syz->m[i]->coef);
9175  found = TRUE;
9176  break;
9177  }
9178  }
9179  }
9180  idDelete(&syz);
9181  if (found == FALSE)
9182  {
9183  rChangeCurrRing(origR);
9184  idDelete(&F);
9185  idDelete(&monred);
9186  idDelete(&II);
9187  idDelete(&one);
9188  pDelete(&mindegmon);
9189  pDelete(&pmon);
9190  rDelete(QQ_ring);
9191  return NULL;
9192  }
9193  rChangeCurrRing(origR);
9194  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
9195  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
9196  idDelete(&F);
9197  idDelete(&monred);
9198  idDelete(&II);
9199  idDelete(&one);
9200  idDelete(&syz);
9201  pDelete(&mindegmon);
9202  rDelete(QQ_ring);
9203  return pmon;
9204  }
9205  else
9206  rChangeCurrRing(origR);
9207  pDelete(&mindegmon);
9208  }
9209  else
9210  rChangeCurrRing(origR);
9211  }
9212  idDelete(&F);
9213  idDelete(&monred);
9214  idDelete(&II);
9215  idDelete(&one);
9216  pDelete(&pmon);
9217  rDelete(QQ_ring);
9218  return NULL;
9219 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:42
#define FALSE
Definition: auxiliary.h:140
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:750
#define TRUE
Definition: auxiliary.h:144
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2221
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4895
#define pGetComp(p)
Component.
Definition: polys.h:37
bool found
Definition: facFactorize.cc:56
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:47
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1318
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
#define pSetComp(p, v)
Definition: polys.h:38
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:720
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:76
void rChangeCurrRing(ring r)
Definition: polys.cc:14
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:560
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
#define idIsConstant(I)
Definition: ideals.h:56
int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 3440 of file kstd2.cc.

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

Definition at line 518 of file kstd2.cc.

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

Definition at line 1116 of file kstd2.cc.

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

TEST_OPT_REDTHROUGH &&

Definition at line 956 of file kstd2.cc.

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

Definition at line 1320 of file kstd2.cc.

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

Definition at line 355 of file kstd1.cc.

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

Definition at line 409 of file kstd2.cc.

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

Definition at line 677 of file kstd2.cc.

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

Definition at line 6045 of file kutil.cc.

6046 {
6047  LObject L(p, currRing);
6048  return redtail(&L, pos, strat);
6049 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5975
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly redtail ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 5975 of file kutil.cc.

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

Definition at line 1120 of file kInline.h.

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

Definition at line 6051 of file kutil.cc.

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

Definition at line 1134 of file kInline.h.

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

Definition at line 1127 of file kInline.h.

1128 {
1129  LObject L(p, currRing, strat->tailRing);
1130  return redtailBba_Z(&L, pos, strat);
1131 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
ring tailRing
Definition: kutil.h:341
poly redtailBba_Z ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 6160 of file kutil.cc.

6162 {
6163  strat->redTailChange=FALSE;
6164  if (strat->noTailReduction) return L->GetLmCurrRing();
6165  poly h, p;
6166  p = h = L->GetLmTailRing();
6167  if ((h==NULL) || (pNext(h)==NULL))
6168  return L->GetLmCurrRing();
6169 
6170  TObject* With;
6171  // placeholder in case strat->tl < 0
6172  TObject With_s(strat->tailRing);
6173 
6174  LObject Ln(pNext(h), strat->tailRing);
6175  Ln.pLength = L->GetpLength() - 1;
6176 
6177  pNext(h) = NULL;
6178  if (L->p != NULL) pNext(L->p) = NULL;
6179  L->pLength = 1;
6180 
6181  Ln.PrepareRed(strat->use_buckets);
6182 
6183  int cnt=REDTAIL_CANONICALIZE;
6184  while(!Ln.IsNull())
6185  {
6186  loop
6187  {
6188  Ln.SetShortExpVector();
6189  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
6190  if (With == NULL) break;
6191  cnt--;
6192  if (cnt==0)
6193  {
6195  /*poly tmp=*/Ln.CanonicalizeP();
6196  }
6197  // we are in Z, do not call pNorm
6198  strat->redTailChange=TRUE;
6199  // test divisibility of coefs:
6200  poly p_Ln=Ln.GetLmCurrRing();
6201  poly p_With=With->GetLmCurrRing();
6202  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
6203  if (!nIsZero(z))
6204  {
6205  // subtract z*Ln, add z.Ln to L
6206  poly m=pHead(p_Ln);
6207  pSetCoeff(m,z);
6208  poly mm=pHead(m);
6209  pNext(h) = m;
6210  pIter(h);
6211  L->pLength++;
6212  mm=pNeg(mm);
6213  if (Ln.bucket!=NULL)
6214  {
6215  int dummy=1;
6216  kBucket_Add_q(Ln.bucket,mm,&dummy);
6217  }
6218  else
6219  {
6220  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
6221  Ln.GetP();
6222  if (Ln.p!=NULL)
6223  {
6224  Ln.p=pAdd(Ln.p,mm);
6225  if (Ln.t_p!=NULL)
6226  {
6227  pNext(Ln.t_p)=NULL;
6228  p_LmDelete(Ln.t_p,strat->tailRing);
6229  }
6230  }
6231  }
6232  }
6233  else
6234  nDelete(&z);
6235 
6236  if (ksReducePolyTail(L, With, &Ln))
6237  {
6238  // reducing the tail would violate the exp bound
6239  // set a flag and hope for a retry (in bba)
6240  strat->completeReduce_retry=TRUE;
6241  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
6242  do
6243  {
6244  pNext(h) = Ln.LmExtractAndIter();
6245  pIter(h);
6246  L->pLength++;
6247  } while (!Ln.IsNull());
6248  goto all_done;
6249  }
6250  if (Ln.IsNull()) goto all_done;
6251  With_s.Init(currRing);
6252  }
6253  pNext(h) = Ln.LmExtractAndIter();
6254  pIter(h);
6255  pNormalize(h);
6256  L->pLength++;
6257  }
6258 
6259  all_done:
6260  Ln.Delete();
6261  if (L->p != NULL) pNext(L->p) = pNext(p);
6262 
6263  if (strat->redTailChange)
6264  {
6265  L->length = 0;
6266  }
6267 
6268  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
6269  //L->Normalize(); // HANNES: should have a test
6270  kTest_L(L);
6271  return L->GetLmCurrRing();
6272 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:627
#define pAdd(p, q)
Definition: polys.h:174
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define pNeg(p)
Definition: polys.h:169
#define TRUE
Definition: auxiliary.h:144
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:393
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:623
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5872
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
BOOLEAN use_buckets
Definition: kutil.h:373
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:389
class sTObject TObject
Definition: kutil.h:59
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:636
poly redtailBbaShift ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 10846 of file kutil.cc.

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

Definition at line 845 of file kstd2.cc.

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

Definition at line 4148 of file kutil.cc.

4149 {
4150  int i,j,at,ecart, s2r;
4151  int fq=0;
4152  unsigned long sev;
4153  poly p;
4154  int new_suc=strat->sl+1;
4155  i= *suc;
4156  if (i<0) i=0;
4157 
4158  for (; i<=strat->sl; i++)
4159  {
4160  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4161  if (at != i)
4162  {
4163  if (new_suc > at) new_suc = at;
4164  p = strat->S[i];
4165  ecart = strat->ecartS[i];
4166  sev = strat->sevS[i];
4167  s2r = strat->S_2_R[i];
4168  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
4169  for (j=i; j>=at+1; j--)
4170  {
4171  strat->S[j] = strat->S[j-1];
4172  strat->ecartS[j] = strat->ecartS[j-1];
4173  strat->sevS[j] = strat->sevS[j-1];
4174  strat->S_2_R[j] = strat->S_2_R[j-1];
4175  }
4176  strat->S[at] = p;
4177  strat->ecartS[at] = ecart;
4178  strat->sevS[at] = sev;
4179  strat->S_2_R[at] = s2r;
4180  if (strat->fromQ!=NULL)
4181  {
4182  for (j=i; j>=at+1; j--)
4183  {
4184  strat->fromQ[j] = strat->fromQ[j-1];
4185  }
4186  strat->fromQ[at]=fq;
4187  }
4188  }
4189  }
4190  if (new_suc <= strat->sl) *suc=new_suc;
4191  else *suc=-1;
4192 }
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal sba ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1872 of file kstd2.cc.

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

Definition at line 9491 of file kutil.cc.

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

Definition at line 3904 of file kutil.cc.

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

Definition at line 5676 of file kutil.cc.

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

Definition at line 5708 of file kutil.cc.

5709 {
5710 //#if 1
5711 #ifdef DEBUGF5
5712  Print("--- syzygy criterion checks: ");
5713  pWrite(sig);
5714 #endif
5715  int comp = p_GetComp(sig, currRing);
5716  int min, max;
5717  if (comp<=1)
5718  return FALSE;
5719  else
5720  {
5721  min = strat->syzIdx[comp-2];
5722  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
5723  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
5724  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
5725  if (comp == strat->currIdx)
5726  {
5727  max = strat->syzl;
5728  }
5729  else
5730  {
5731  max = strat->syzIdx[comp-1];
5732  }
5733  for (int k=min; k<max; k++)
5734  {
5735 #ifdef F5DEBUG
5736  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
5737  Print("checking with: %d -- ",k);
5738  pWrite(pHead(strat->syz[k]));
5739 #endif
5740  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5741  return TRUE;
5742  }
5743  return FALSE;
5744  }
5745 }
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:140
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
int currIdx
Definition: kutil.h:313
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int max(int a, int b)
Definition: fast_mult.cc:264
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1710
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
intset syzIdx
Definition: kutil.h:309
long twoPow ( long  arg)

Definition at line 3366 of file kutil.cc.

3367 {
3368  return 1L << arg;
3369 }
void updateResult ( ideal  r,
ideal  Q,
kStrategy  strat 
)

Definition at line 8648 of file kutil.cc.

8649 {
8650  int l;
8651  if (strat->ak>0)
8652  {
8653  for (l=IDELEMS(r)-1;l>=0;l--)
8654  {
8655  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
8656  {
8657  pDelete(&r->m[l]); // and set it to NULL
8658  }
8659  }
8660  int q;
8661  poly p;
8662  for (l=IDELEMS(r)-1;l>=0;l--)
8663  {
8664  if ((r->m[l]!=NULL)
8665  //&& (strat->syzComp>0)
8666  //&& (pGetComp(r->m[l])<=strat->syzComp)
8667  )
8668  {
8669  for(q=IDELEMS(Q)-1; q>=0;q--)
8670  {
8671  if ((Q->m[q]!=NULL)
8672  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
8673  {
8674  #if HAVE_RINGS
8675  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8676  #endif
8677  {
8678  if (TEST_OPT_REDSB)
8679  {
8680  p=r->m[l];
8681  r->m[l]=kNF(Q,NULL,p);
8682  pDelete(&p);
8683  }
8684  else
8685  {
8686  pDelete(&r->m[l]); // and set it to NULL
8687  }
8688  break;
8689  }
8690  }
8691  }
8692  }
8693  }
8694  }
8695  else
8696  {
8697  int q;
8698  poly p;
8699  BOOLEAN reduction_found=FALSE;
8700  if (!rField_is_Ring(currRing))
8701  {
8702  for (l=IDELEMS(r)-1;l>=0;l--)
8703  {
8704  if (r->m[l]!=NULL)
8705  {
8706  for(q=IDELEMS(Q)-1; q>=0;q--)
8707  {
8708  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
8709  {
8710  if (TEST_OPT_REDSB)
8711  {
8712  p=r->m[l];
8713  r->m[l]=kNF(Q,NULL,p);
8714  pDelete(&p);
8715  reduction_found=TRUE;
8716  }
8717  else
8718  {
8719  pDelete(&r->m[l]); // and set it to NULL
8720  }
8721  break;
8722  }
8723  }
8724  }
8725  }
8726  }
8727  #ifdef HAVE_RINGS
8728  //Also need divisibility of the leading coefficients
8729  else
8730  {
8731  for (l=IDELEMS(r)-1;l>=0;l--)
8732  {
8733  if (r->m[l]!=NULL)
8734  {
8735  for(q=IDELEMS(Q)-1; q>=0;q--)
8736  {
8737  if(!rField_is_Ring(currRing) || n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
8738  {
8739  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
8740  {
8741  if (TEST_OPT_REDSB)
8742  {
8743  p=r->m[l];
8744  r->m[l]=kNF(Q,NULL,p);
8745  pDelete(&p);
8746  reduction_found=TRUE;
8747  }
8748  else
8749  {
8750  pDelete(&r->m[l]); // and set it to NULL
8751  }
8752  break;
8753  }
8754  }
8755  }
8756  }
8757  }
8758  }
8759  #endif
8760  if (/*TEST_OPT_REDSB &&*/ reduction_found)
8761  {
8762  for (l=IDELEMS(r)-1;l>=0;l--)
8763  {
8764  if (r->m[l]!=NULL)
8765  {
8766  for(q=IDELEMS(r)-1;q>=0;q--)
8767  {
8768  if ((l!=q)
8769  && (r->m[q]!=NULL)
8770  &&(pLmDivisibleBy(r->m[l],r->m[q]))
8771  #if HAVE_RINGS
8772  && (!rField_is_Ring(currRing) ||
8773  n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8774  #endif
8775  )
8776  {
8777  //If they are equal then take the one with the smallest length
8778  if(pLmDivisibleBy(r->m[q],r->m[l])
8779  #ifdef HAVE_RINGS
8780  && ((rField_is_Ring(currRing)
8781  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
8782  || !(rField_is_Ring(currRing)))
8783  #endif
8784  && (pLength(r->m[q]) < pLength(r->m[l]) ||
8785  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
8786  {
8787  pDelete(&r->m[l]);
8788  break;
8789  }
8790  else
8791  pDelete(&r->m[q]);
8792  }
8793  }
8794  }
8795  }
8796  }
8797  }
8798  idSkipZeroes(r);
8799 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:128
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
#define nGreaterZero(n)
Definition: numbers.h:27
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:771
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:126
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 7345 of file kutil.cc.

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

Definition at line 10152 of file kutil.cc.

10153 {
10154  /* to use after updateS(toT=FALSE,strat) */
10155  /* fills T with shifted elt's of S */
10156  int i;
10157  LObject h;
10158  int atT = -1; // or figure out smth better
10159  strat->tl = -1; // init
10160  for (i=0; i<=strat->sl; i++)
10161  {
10162  memset(&h,0,sizeof(h));
10163  h.p = strat->S[i]; // lm in currRing, tail in TR
10164  strat->initEcart(&h);
10165  h.sev = strat->sevS[i];
10166  h.t_p = NULL;
10167  h.GetTP(); // creates correct t_p
10168  /*puts the elements of S with their shifts to T*/
10169  // int atT, int uptodeg, int lV)
10170  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
10171  // need a small check for above; we insert >=1 elements
10172  // insert this check into kTest_TS ?
10173  enterTShift(h,strat,atT,uptodeg,lV);
10174  }
10175  /* what about setting strat->tl? */
10176 }
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:10803
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static Poly * h
Definition: janet.cc:978

Variable Documentation

denominator_list DENOMINATOR_LIST

Definition at line 81 of file kutil.cc.

int HCord

Definition at line 227 of file kutil.cc.

int strat_nr

Definition at line 27 of file kstdfac.cc.

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

Definition at line 99 of file kstd2.cc.

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

Definition at line 98 of file kstd2.cc.