My Project  UNKNOWN_GIT_VERSION
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   128
 
#define setmaxL   ((4096-12)/sizeof(LObject))
 
#define setmaxLinc   ((4096)/sizeof(LObject))
 
#define setmaxT   ((4096-12)/sizeof(TObject))
 
#define setmaxTinc   ((4096)/sizeof(TObject))
 
#define KINLINE
 
#define NO_KINLINE   1
 
#define ALLOW_PROD_CRIT(A)   (!(A)->no_prod_crit)
 
#define messageSets(s)   do {} while (0)
 
#define kTest(A)   (TRUE)
 
#define kTest_TS(A)   (TRUE)
 
#define kTest_T(T)   (TRUE)
 
#define kTest_S(T)   (TRUE)
 
#define kTest_L(T)   (TRUE)
 

Typedefs

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

Functions

void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext=FALSE)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void cleanT (kStrategy strat)
 
static LSet initL (int nr=setmaxL)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void enterSBba (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSSba (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void initEcartPairBba (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
 
void initEcartPairMora (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
 
int posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInSMonFirst (const kStrategy strat, const int length, const poly p)
 
int posInIdealMonFirst (const ideal F, const poly p, int start=0, int end=-1)
 
int posInT0 (const TSet set, const int length, LObject &p)
 
int posInT1 (const TSet set, const int length, LObject &p)
 
int posInT2 (const TSet set, const int length, LObject &p)
 
int posInT11 (const TSet set, const int length, LObject &p)
 
int posInTSig (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
int posInT_EcartFDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_FDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_pLength (const TSet set, const int length, LObject &p)
 
void reorderS (int *suc, kStrategy strat)
 
int posInLF5C (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLSig (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLSigRing (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLRing (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInSyz (const kStrategy strat, const poly sig)
 
int posInL0 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL11Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *L, const kStrategy strat)
 
int posInL11Ringls (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL13 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL15 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL15Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL17 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL10 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL10Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
 
int posInL110 (const LSet set, const int length, LObject *L, const kStrategy strat)
 
KINLINE poly redtailBba (poly p, int end_pos, kStrategy strat, BOOLEAN normalize=FALSE)
 
KINLINE poly redtailBbaBound (poly p, int end_pos, kStrategy strat, int bound, BOOLEAN normalize=FALSE)
 
KINLINE poly redtailBba_Z (poly p, int end_pos, kStrategy strat)
 
poly redtailBba_Z (LObject *L, int end_pos, kStrategy strat)
 
poly redtailBba (LObject *L, int end_pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailBbaBound (LObject *L, int end_pos, kStrategy strat, int bound, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailSba (LObject *L, int end_pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
 
poly redtailBba (TObject *T, int end_pos, kStrategy strat)
 
poly redtail (poly p, int end_pos, kStrategy strat)
 
poly redtail (LObject *L, int end_pos, kStrategy strat)
 
poly redNF (poly h, int &max_ind, int nonorm, kStrategy strat)
 
int redNF0 (LObject *P, kStrategy strat)
 
poly redNFTail (poly h, const int sl, kStrategy strat)
 
int redHoney (LObject *h, kStrategy strat)
 
int redRing (LObject *h, kStrategy strat)
 
int redRiloc (LObject *h, kStrategy strat)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
void superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
poly kCreateZeroPoly (long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
 
long ind2 (long arg)
 
long ind_fact_2 (long arg)
 
long twoPow (long arg)
 
ideal createG0 ()
 
int redLazy (LObject *h, kStrategy strat)
 
int redHomog (LObject *h, kStrategy strat)
 
int redSig (LObject *h, kStrategy strat)
 
int redSigRing (LObject *h, kStrategy strat)
 
void enterpairsSig (poly h, poly hSig, int from, int k, int ec, int pos, kStrategy strat, int atR=-1)
 
void enterpairs (poly h, int k, int ec, int pos, kStrategy strat, int atR=-1)
 
void entersets (LObject h)
 
void pairs ()
 
BOOLEAN sbaCheckGcdPair (LObject *h, kStrategy strat)
 
void message (int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
 
void messageStat (int hilbcount, kStrategy strat)
 
void messageStatSBA (int hilbcount, kStrategy strat)
 
void initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
void initS (ideal F, ideal Q, kStrategy strat)
 
void initSL (ideal F, ideal Q, kStrategy strat)
 
void initSLSba (ideal F, ideal Q, kStrategy strat)
 
void initSyzRules (kStrategy strat)
 
void updateS (BOOLEAN toT, kStrategy strat)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void enterT (LObject &p, kStrategy strat, int atT=-1)
 
void enterT_strong (LObject &p, kStrategy strat, int atT=-1)
 
void cancelunit (LObject *p, BOOLEAN inNF=FALSE)
 
void HEckeTest (poly pp, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
void initHilbCrit (ideal F, ideal Q, intvec **hilb, kStrategy strat)
 
void initBuchMoraPos (kStrategy strat)
 
void initBuchMoraPosRing (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT=FALSE)
 
void kFreeStrat (kStrategy strat)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void 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_T (kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart=LONG_MAX)
 
KINLINE TSet initT ()
 
KINLINE TObject ** initR ()
 
KINLINE unsigned long * initsevT ()
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE BOOLEAN k_GetLeadTerms (const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
 
KINLINE void k_GetStrongLeadTerms (const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring taiRing)
 
poly kFindZeroPoly (poly input_p, ring leadRing, ring tailRing)
 
ideal bba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
ideal sba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF2 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
poly kNF2Bound (ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
 
ideal kNF2Bound (ideal F, ideal Q, ideal q, int bound, kStrategy strat, int lazyReduce)
 
void initBba (kStrategy strat)
 
void initSba (ideal F, kStrategy strat)
 
void f5c (kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
 
int ksReducePoly (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolyBound (LObject *PR, TObject *PW, int bound, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolySig (LObject *PR, TObject *PW, long idx, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolySigRing (LObject *PR, TObject *PW, long idx, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolyTail (LObject *PR, TObject *PW, poly Current, poly spNoether=NULL)
 
KINLINE int ksReducePolyTail (LObject *PR, TObject *PW, LObject *Red)
 
void ksCreateSpoly (LObject *Pair, poly spNoether=NULL, int use_buckets=0, ring tailRing=currRing, poly m1=NULL, poly m2=NULL, TObject **R=NULL)
 
poly ksCreateShortSpoly (poly p1, poly p2, ring tailRing)
 
KINLINE poly ksOldSpolyRed (poly p1, poly p2, poly spNoether=NULL)
 
KINLINE poly ksOldSpolyRedNew (poly p1, poly p2, poly spNoether=NULL)
 
KINLINE poly ksOldCreateSpoly (poly p1, poly p2, poly spNoether=NULL, ring r=currRing)
 
KINLINE void ksOldSpolyTail (poly p1, poly q, poly q2, poly spNoether, ring r=currRing)
 
BOOLEAN kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
 
BOOLEAN kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
 
poly preIntegerCheck (ideal F, ideal Q)
 used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMon (LObject *h, kStrategy strat)
 used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMonSig (LObject *h, kStrategy strat)
 
void finalReduceByMon (kStrategy strat)
 used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output More...
 
BOOLEAN kStratChangeTailRing (kStrategy strat, LObject *L=NULL, TObject *T=NULL, unsigned long new_expbound=0)
 
void kStratInitChangeTailRing (kStrategy strat)
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
ring sbaRing (kStrategy strat, const ring r=currRing, BOOLEAN complete=TRUE, int sgn=1)
 
KINLINE void clearS (poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject h, kStrategy strat)
 
void enterTShift (LObject p, kStrategy strat, int atT, int uptodeg, int lV)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
void 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 updateSShift (kStrategy strat, int uptodeg, int lV)
 
void initBbaShift (kStrategy strat)
 
poly redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
int redFirstShift (LObject *h, kStrategy strat)
 
ideal freegb (ideal I, int uptodeg, int lVblock)
 
ideal bbaShift (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
 
static void kDeleteLcm (LObject *P)
 

Variables

denominator_list DENOMINATOR_LIST
 
int strat_nr
 
int HCord
 
int(* test_PosInT )(const TSet T, const int tl, LObject &h)
 
int(* test_PosInL )(const LSet set, const int length, LObject *L, const kStrategy strat)
 

Data Structure Documentation

◆ denominator_list_s

struct denominator_list_s

Definition at line 61 of file kutil.h.

Data Fields
number n
denominator_list next

Macro Definition Documentation

◆ ALLOW_PROD_CRIT

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

Definition at line 389 of file kutil.h.

◆ HAVE_TAIL_RING

#define HAVE_TAIL_RING

Definition at line 27 of file kutil.h.

◆ KINLINE

#define KINLINE

Definition at line 45 of file kutil.h.

◆ kTest

#define kTest (   A)    (TRUE)

Definition at line 643 of file kutil.h.

◆ kTest_L

#define kTest_L (   T)    (TRUE)

Definition at line 647 of file kutil.h.

◆ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 646 of file kutil.h.

◆ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 645 of file kutil.h.

◆ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 644 of file kutil.h.

◆ messageSets

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

Definition at line 533 of file kutil.h.

◆ NO_KINLINE

#define NO_KINLINE   1

Definition at line 46 of file kutil.h.

◆ setmax

#define setmax   128

Definition at line 29 of file kutil.h.

◆ setmaxL

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

Definition at line 30 of file kutil.h.

◆ setmaxLinc

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

Definition at line 31 of file kutil.h.

◆ setmaxT

#define setmaxT   ((4096-12)/sizeof(TObject))

Definition at line 33 of file kutil.h.

◆ setmaxTinc

#define setmaxTinc   ((4096)/sizeof(TObject))

Definition at line 34 of file kutil.h.

Typedef Documentation

◆ denominator_list

Definition at line 59 of file kutil.h.

◆ intset

typedef int* intset

Definition at line 49 of file kutil.h.

◆ LObject

typedef class sLObject LObject

Definition at line 54 of file kutil.h.

◆ LSet

typedef LObject* LSet

Definition at line 56 of file kutil.h.

◆ TObject

typedef class sTObject TObject

Definition at line 53 of file kutil.h.

◆ TSet

typedef TObject* TSet

Definition at line 55 of file kutil.h.

◆ wlen_set

typedef wlen_type* wlen_set

Definition at line 51 of file kutil.h.

◆ wlen_type

typedef int64 wlen_type

Definition at line 50 of file kutil.h.

Function Documentation

◆ arriRewCriterion()

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

Definition at line 7104 of file kutil.cc.

7105 {
7107  return FALSE;
7108  poly p1 = pOne();
7109  poly p2 = pOne();
7110  for (int ii=strat->sl; ii>start; ii--)
7111  {
7112  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7113  {
7114  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7115  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7116  if (!(pLmCmp(p1,p2) == 1))
7117  {
7118  pDelete(&p1);
7119  pDelete(&p2);
7120  return TRUE;
7121  }
7122  }
7123  }
7124  pDelete(&p1);
7125  pDelete(&p2);
7126  return FALSE;
7127 }
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:98
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
LObject P
Definition: kutil.h:293
#define pOne()
Definition: polys.h:309
polyset S
Definition: kutil.h:297
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1362

◆ arriRewCriterionPre()

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

Definition at line 7129 of file kutil.cc.

7130 {
7131  //Over Rings, there are still some changes to do: considering coeffs
7133  return FALSE;
7134  int found = -1;
7135  for (int i=strat->Bl; i>-1; i--) {
7136  if (pLmEqual(strat->B[i].sig,sig))
7137  {
7138  found = i;
7139  break;
7140  }
7141  }
7142  if (found != -1)
7143  {
7144  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7145  {
7146  deleteInL(strat->B,&strat->Bl,found,strat);
7147  }
7148  else
7149  {
7150  return TRUE;
7151  }
7152  }
7153  poly p1 = pOne();
7154  poly p2 = pOne();
7155  for (int ii=strat->sl; ii>-1; ii--)
7156  {
7157  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7158  {
7159  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7160  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7161  if (!(pLmCmp(p1,p2) == 1))
7162  {
7163  pDelete(&p1);
7164  pDelete(&p2);
7165  return TRUE;
7166  }
7167  }
7168  }
7169  pDelete(&p1);
7170  pDelete(&p2);
7171  return FALSE;
7172 }
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int Bl
Definition: kutil.h:345
#define TRUE
Definition: auxiliary.h:98
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:309
polyset S
Definition: kutil.h:297
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
LSet B
Definition: kutil.h:319
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1362
#define pLmEqual(p1, p2)
Definition: polys.h:111

◆ arriRewDummy()

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

Definition at line 1132 of file kInline.h.

1133 {
1134  return FALSE;
1135 }
#define FALSE
Definition: auxiliary.h:94

◆ bba()

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

Definition at line 1901 of file kstd2.cc.

1902 {
1903  int red_result = 1;
1904  int olddeg,reduc;
1905  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1906  BOOLEAN withT = FALSE;
1907  BITSET save;
1908  SI_SAVE_OPT1(save);
1909 
1910  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1912  initBuchMoraPosRing(strat);
1913  else
1914  initBuchMoraPos(strat);
1915  initHilbCrit(F,Q,&hilb,strat);
1916  initBba(strat);
1917  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1918  /*Shdl=*/initBuchMora(F, Q,strat);
1919  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1920  reduc = olddeg = 0;
1921 
1922 #ifndef NO_BUCKETS
1923  if (!TEST_OPT_NOT_BUCKETS)
1924  strat->use_buckets = 1;
1925 #endif
1926  // redtailBBa against T for inhomogenous input
1927  if (!TEST_OPT_OLDSTD)
1928  withT = ! strat->homog;
1929 
1930  // strat->posInT = posInT_pLength;
1931  kTest_TS(strat);
1932 
1933 #ifdef HAVE_TAIL_RING
1934  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1935  kStratInitChangeTailRing(strat);
1936 #endif
1937  if (BVERBOSE(23))
1938  {
1939  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1940  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1941  kDebugPrint(strat);
1942  }
1943 
1944 
1945 #ifdef KDEBUG
1946  //kDebugPrint(strat);
1947 #endif
1948  /* compute------------------------------------------------------- */
1949  while (strat->Ll >= 0)
1950  {
1951  #ifdef KDEBUG
1952  if (TEST_OPT_DEBUG) messageSets(strat);
1953  #endif
1954  if (siCntrlc)
1955  {
1956  while (strat->Ll >= 0)
1957  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1958  strat->noClearS=TRUE;
1959  }
1960  if (TEST_OPT_DEGBOUND
1961  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1962  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1963  {
1964  /*
1965  *stops computation if
1966  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1967  *a predefined number Kstd1_deg
1968  */
1969  while ((strat->Ll >= 0)
1970  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1971  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1972  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1973  )
1974  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1975  if (strat->Ll<0) break;
1976  else strat->noClearS=TRUE;
1977  }
1978  if (strat->Ll== 0) strat->interpt=TRUE;
1979  /* picks the last element from the lazyset L */
1980  strat->P = strat->L[strat->Ll];
1981  strat->Ll--;
1982 
1983  if (pNext(strat->P.p) == strat->tail)
1984  {
1985  // deletes the short spoly
1986  if (rField_is_Ring(currRing))
1987  pLmDelete(strat->P.p);
1988  else
1989  pLmFree(strat->P.p);
1990  strat->P.p = NULL;
1991  poly m1 = NULL, m2 = NULL;
1992 
1993  // check that spoly creation is ok
1994  while (strat->tailRing != currRing &&
1995  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1996  {
1997  assume(m1 == NULL && m2 == NULL);
1998  // if not, change to a ring where exponents are at least
1999  // large enough
2000  if (!kStratChangeTailRing(strat))
2001  {
2002  WerrorS("OVERFLOW...");
2003  break;
2004  }
2005  }
2006  // create the real one
2007  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2008  strat->tailRing, m1, m2, strat->R);
2009  }
2010  else if (strat->P.p1 == NULL)
2011  {
2012  if (strat->minim > 0)
2013  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2014  // for input polys, prepare reduction
2015  strat->P.PrepareRed(strat->use_buckets);
2016  }
2017 
2018  if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
2019  {
2020  red_result = 0;
2021  }
2022  else
2023  {
2024  if (TEST_OPT_PROT)
2025  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2026  &olddeg,&reduc,strat, red_result);
2027 
2028  /* reduction of the element chosen from L */
2029  red_result = strat->red(&strat->P,strat);
2030  if (errorreported) break;
2031  }
2032 
2033  if (strat->overflow)
2034  {
2035  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2036  }
2037 
2038  // reduction to non-zero new poly
2039  if (red_result == 1)
2040  {
2041  // get the polynomial (canonicalize bucket, make sure P.p is set)
2042  strat->P.GetP(strat->lmBin);
2043  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2044  // but now, for entering S, T, we reset it
2045  // in the inhomogeneous case: FDeg == pFDeg
2046  if (strat->homog) strat->initEcart(&(strat->P));
2047 
2048  /* statistic */
2049  if (TEST_OPT_PROT) PrintS("s");
2050 
2051  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2052 
2053  // reduce the tail and normalize poly
2054  // in the ring case we cannot expect LC(f) = 1,
2055  // therefore we call pCleardenom instead of pNorm
2056  strat->redTailChange=FALSE;
2058  {
2059  strat->P.pCleardenom();
2061  {
2062  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
2063  strat->P.pCleardenom();
2064  if (strat->redTailChange) { strat->P.t_p=NULL; }
2065  }
2066  }
2067  else
2068  {
2069  strat->P.pNorm();
2071  {
2072  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2073  if (strat->redTailChange) { strat->P.t_p=NULL; }
2074  }
2075  }
2076 
2077 #ifdef KDEBUG
2078  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2079 #endif /* KDEBUG */
2080 
2081  // min_std stuff
2082  if ((strat->P.p1==NULL) && (strat->minim>0))
2083  {
2084  if (strat->minim==1)
2085  {
2086  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2087  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2088  }
2089  else
2090  {
2091  strat->M->m[minimcnt]=strat->P.p2;
2092  strat->P.p2=NULL;
2093  }
2094  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2095  pNext(strat->M->m[minimcnt])
2096  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2097  strat->tailRing, currRing,
2098  currRing->PolyBin);
2099  minimcnt++;
2100  }
2101 
2102  // enter into S, L, and T
2103  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2104  {
2105  enterT(strat->P, strat);
2106  if (rField_is_Ring(currRing))
2107  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2108  else
2109  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2110  // posInS only depends on the leading term
2111  strat->enterS(strat->P, pos, strat, strat->tl);
2112 #if 0
2113  int pl=pLength(strat->P.p);
2114  if (pl==1)
2115  {
2116  //if (TEST_OPT_PROT)
2117  //PrintS("<1>");
2118  }
2119  else if (pl==2)
2120  {
2121  //if (TEST_OPT_PROT)
2122  //PrintS("<2>");
2123  }
2124 #endif
2125  }
2126  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2127 // Print("[%d]",hilbeledeg);
2128  kDeleteLcm(&strat->P);
2129  if (strat->s_poly!=NULL)
2130  {
2131  // the only valid entries are: strat->P.p,
2132  // strat->tailRing (read-only, keep it)
2133  // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2134  if (strat->s_poly(strat))
2135  {
2136  // we are called AFTER enterS, i.e. if we change P
2137  // we have to add it also to S/T
2138  // and add pairs
2139  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2140  enterT(strat->P, strat);
2141  if (rField_is_Ring(currRing))
2142  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2143  else
2144  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2145  strat->enterS(strat->P, pos, strat, strat->tl);
2146  }
2147  }
2148  }
2149  else if (strat->P.p1 == NULL && strat->minim > 0)
2150  {
2151  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2152  }
2153 
2154 #ifdef KDEBUG
2155  memset(&(strat->P), 0, sizeof(strat->P));
2156 #endif /* KDEBUG */
2157  kTest_TS(strat);
2158  }
2159 #ifdef KDEBUG
2160  if (TEST_OPT_DEBUG) messageSets(strat);
2161 #endif /* KDEBUG */
2162 
2163  if (TEST_OPT_SB_1)
2164  {
2165  if(!rField_is_Ring(currRing))
2166  {
2167  int k=1;
2168  int j;
2169  while(k<=strat->sl)
2170  {
2171  j=0;
2172  loop
2173  {
2174  if (j>=k) break;
2175  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2176  j++;
2177  }
2178  k++;
2179  }
2180  }
2181  }
2182  /* complete reduction of the standard basis--------- */
2183  if (TEST_OPT_REDSB)
2184  {
2185  completeReduce(strat);
2186  if (strat->completeReduce_retry)
2187  {
2188  // completeReduce needed larger exponents, retry
2189  // to reduce with S (instead of T)
2190  // and in currRing (instead of strat->tailRing)
2191 #ifdef HAVE_TAIL_RING
2192  if(currRing->bitmask>strat->tailRing->bitmask)
2193  {
2194  strat->completeReduce_retry=FALSE;
2195  cleanT(strat);strat->tailRing=currRing;
2196  int i;
2197  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2198  completeReduce(strat);
2199  }
2200  if (strat->completeReduce_retry)
2201 #endif
2202  Werror("exponent bound is %ld",currRing->bitmask);
2203  }
2204  }
2205  else if (TEST_OPT_PROT) PrintLn();
2206  /* release temp data-------------------------------- */
2207  exitBuchMora(strat);
2208  /* postprocessing for GB over ZZ --------------------*/
2209  if (!errorreported)
2210  {
2211  if(rField_is_Z(currRing))
2212  {
2213  for(int i = 0;i<=strat->sl;i++)
2214  {
2215  if(!nGreaterZero(pGetCoeff(strat->S[i])))
2216  {
2217  strat->S[i] = pNeg(strat->S[i]);
2218  }
2219  }
2220  finalReduceByMon(strat);
2221  for(int i = 0;i<IDELEMS(strat->Shdl);i++)
2222  {
2223  if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
2224  {
2225  strat->S[i] = pNeg(strat->Shdl->m[i]);
2226  }
2227  }
2228  }
2229  //else if (rField_is_Ring(currRing))
2230  // finalReduceByMon(strat);
2231  }
2232 // if (TEST_OPT_WEIGHTM)
2233 // {
2234 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2235 // if (ecartWeights)
2236 // {
2237 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2238 // ecartWeights=NULL;
2239 // }
2240 // }
2241  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
2242  SI_RESTORE_OPT1(save);
2243  /* postprocessing for GB over Q-rings ------------------*/
2244  if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
2245 
2246  idTest(strat->Shdl);
2247 
2248  return (strat->Shdl);
2249 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:112
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9721
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7745
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7786
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:9894
#define TEST_OPT_CONTENTSB
Definition: options.h:125
char interpt
Definition: kutil.h:365
#define pNeg(p)
Definition: polys.h:193
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4775
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
char noClearS
Definition: kutil.h:396
#define TEST_OPT_REDSB
Definition: options.h:103
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
#define SI_SAVE_OPT1(A)
Definition: options.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:92
void initBba(kStrategy strat)
Definition: kstd1.cc:1336
#define TEST_OPT_DEBUG
Definition: options.h:107
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:500
#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:45
#define loop
Definition: structs.h:78
#define BITSET
Definition: structs.h:18
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:9807
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:351
char use_buckets
Definition: kutil.h:377
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11172
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9291
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_TS(A)
Definition: kutil.h:644
#define nGreaterZero(n)
Definition: numbers.h:28
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9552
#define TEST_OPT_OLDSTD
Definition: options.h:121
#define assume(x)
Definition: mod2.h:390
#define messageSets(s)
Definition: kutil.h:533
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:752
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
LObject P
Definition: kutil.h:293
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
ideal M
Definition: kutil.h:296
BOOLEAN siCntrlc
Definition: options.c:14
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define IDELEMS(i)
Definition: simpleideals.h:24
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10601
#define BVERBOSE(a)
Definition: options.h:35
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:28
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
char homog
Definition: kutil.h:366
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:127
void cleanT(kStrategy strat)
Definition: kutil.cc:537
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4747
ring tailRing
Definition: kutil.h:336
#define TEST_OPT_SB_1
Definition: options.h:117
const CanonicalForm & w
Definition: facAbsFact.cc:55
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10415
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10203
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:1107
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:80
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:81
int Kstd1_deg
Definition: kutil.cc:236
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:10988
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:9970
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11619
#define idTest(id)
Definition: ideals.h:47

◆ bbaShift()

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

Definition at line 3830 of file kstd2.cc.

3831 {
3832  int red_result = 1;
3833  int olddeg,reduc;
3834  int hilbeledeg=1,hilbcount=0,minimcnt=0;
3835  BOOLEAN withT = TRUE; // very important for shifts
3836 
3837  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
3839  initBuchMoraPosRing(strat);
3840  else
3841  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
3842  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
3843  initBbaShift(strat); /* DONE */
3844  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3845  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
3846  updateSShift(strat,uptodeg,lV); /* initializes T */
3847 
3848  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
3849  reduc = olddeg = 0;
3850  strat->lV=lV;
3851 
3852 #ifndef NO_BUCKETS
3853  if (!TEST_OPT_NOT_BUCKETS)
3854  strat->use_buckets = 1;
3855 #endif
3856 
3857  // redtailBBa against T for inhomogenous input
3858  // if (!TEST_OPT_OLDSTD)
3859  // withT = ! strat->homog;
3860 
3861  // strat->posInT = posInT_pLength;
3862  kTest_TS(strat);
3863 
3864 #ifdef HAVE_TAIL_RING
3865 // kStratInitChangeTailRing(strat);
3866  strat->tailRing=currRing;
3867 #endif
3868 
3869  /* compute------------------------------------------------------- */
3870  while (strat->Ll >= 0)
3871  {
3872 #ifdef KDEBUG
3873  if (TEST_OPT_DEBUG) messageSets(strat);
3874 #endif
3875  if (strat->Ll== 0) strat->interpt=TRUE;
3876  if (TEST_OPT_DEGBOUND
3877  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3878  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
3879  {
3880  /*
3881  *stops computation if
3882  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
3883  *a predefined number Kstd1_deg
3884  */
3885  while ((strat->Ll >= 0)
3886  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
3887  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3888  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
3889  )
3890  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
3891  if (strat->Ll<0) break;
3892  else strat->noClearS=TRUE;
3893  }
3894  /* picks the last element from the lazyset L */
3895  strat->P = strat->L[strat->Ll];
3896  strat->Ll--;
3897 
3898  if (pNext(strat->P.p) == strat->tail)
3899  {
3900  // deletes the short spoly
3901  pLmFree(strat->P.p);
3902  strat->P.p = NULL;
3903  poly m1 = NULL, m2 = NULL;
3904 
3905  // check that spoly creation is ok
3906  while (strat->tailRing != currRing &&
3907  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3908  {
3909  assume(m1 == NULL && m2 == NULL);
3910  // if not, change to a ring where exponents are at least
3911  // large enough
3912  kStratChangeTailRing(strat);
3913  }
3914  // create the real one
3915  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3916  strat->tailRing, m1, m2, strat->R);
3917  }
3918  else if (strat->P.p1 == NULL)
3919  {
3920  if (strat->minim > 0)
3921  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3922  // for input polys, prepare reduction
3923  strat->P.PrepareRed(strat->use_buckets);
3924  }
3925 
3926  poly qq;
3927 
3928  /* here in the nonhomog case we shrink the new spoly */
3929 
3930  if ( ! strat->homog)
3931  {
3932  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3933  /* in the nonhomog case we have to shrink the polynomial */
3934  qq = p_Shrink(strat->P.p, lV, currRing); // direct shrink
3935  if (qq != NULL)
3936  {
3937  /* we're here if Shrink is nonzero */
3938  strat->P.p = qq;
3939  strat->P.t_p = NULL;
3940  strat->P.GetP(strat->lmBin);
3941  // update sev and length
3942  strat->initEcart(&(strat->P));
3943  strat->P.sev = pGetShortExpVector(strat->P.p);
3944 // strat->P.FDeg = strat->P.pFDeg();
3945 // strat->P.length = strat->P.pLDeg();
3946 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
3947  }
3948  else
3949  {
3950  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3951 #ifdef KDEBUG
3952  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0\n");}
3953 #endif
3954  strat->P.p = NULL;
3955  strat->P.t_p = NULL;
3956  }
3957  }
3958  /* end shrinking poly in the nonhomog case */
3959 
3960  if (strat->P.p == NULL && strat->P.t_p == NULL)
3961  {
3962  red_result = 0;
3963  }
3964  else
3965  {
3966  if (TEST_OPT_PROT)
3967  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3968  &olddeg,&reduc,strat, red_result);
3969 
3970  /* reduction of the element chosen from L */
3971  red_result = strat->red(&strat->P,strat);
3972  }
3973 
3974  // reduction to non-zero new poly
3975  if (red_result == 1)
3976  {
3977  /* statistic */
3978  if (TEST_OPT_PROT) PrintS("s");
3979 
3980  // get the polynomial (canonicalize bucket, make sure P.p is set)
3981  strat->P.GetP(strat->lmBin);
3982 
3983  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3984 
3985  // reduce the tail and normalize poly
3987  {
3988  strat->P.pCleardenom();
3990  {
3991  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3992  strat->P.pCleardenom();
3993  }
3994  }
3995  else
3996  {
3997  strat->P.pNorm();
3999  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4000  }
4001 
4002  // here we must shrink again! and optionally reduce again
4003  // or build shrink into redtailBba!
4004 
4005 #ifdef KDEBUG
4006  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4007 #endif
4008 
4009  // min_std stuff
4010  if ((strat->P.p1==NULL) && (strat->minim>0))
4011  {
4012  if (strat->minim==1)
4013  {
4014  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4015  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4016  }
4017  else
4018  {
4019  strat->M->m[minimcnt]=strat->P.p2;
4020  strat->P.p2=NULL;
4021  }
4022  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4023  pNext(strat->M->m[minimcnt])
4024  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4025  strat->tailRing, currRing,
4026  currRing->PolyBin);
4027  minimcnt++;
4028  }
4029 
4030  /* here in the nonhomog case we shrink the reduced poly AGAIN */
4031 
4032  if ( ! strat->homog)
4033  {
4034  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
4035  /* in the nonhomog case we have to shrink the polynomial */
4036  if (strat->P.p!=NULL)
4037  {
4038  qq = p_Shrink(strat->P.p, lV, currRing); // direct shrink
4039  if (qq != NULL)
4040  {
4041  /* we're here if Shrink is nonzero */
4042  strat->P.p = qq; // is not set by Delete
4043  strat->P.t_p = NULL;
4044  strat->P.GetP(strat->lmBin);
4045  // update sev and length
4046  strat->initEcart(&(strat->P));
4047  strat->P.sev = pGetShortExpVector(strat->P.p);
4048  }
4049  else
4050  {
4051  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
4052 #ifdef PDEBUG
4053  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
4054 #endif
4055  strat->P.p = NULL;
4056  strat->P.t_p = NULL;
4057  goto red_shrink2zero;
4058  }
4059  }
4060  else
4061  {
4062  qq = p_Shrink(strat->P.p, lV, currRing); // direct shrink
4063  if (qq != NULL)
4064  {
4065  /* we're here if Shrink is nonzero */
4066  strat->P.p = qq;
4067  strat->P.t_p = NULL;
4068  // update sev and length
4069  strat->initEcart(&(strat->P));
4070  strat->P.sev = pGetShortExpVector(strat->P.p);
4071  }
4072  else
4073  {
4074  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
4075 #ifdef PDEBUG
4076  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
4077 #endif
4078  strat->P.p = NULL;
4079  strat->P.t_p = NULL;
4080  goto red_shrink2zero;
4081  }
4082  }
4083  }
4084  /* end shrinking poly AGAIN in the nonhomog case */
4085 
4086 
4087  // enter into S, L, and T
4088  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4089  // enterT(strat->P, strat); // this was here before Shift stuff
4090  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
4091  // the default value for atT = -1 as in bba
4092  /* strat->P.GetP(); */
4093  // because shifts are counted with .p structure // done before, but ?
4094  int atR=strat->tl+1; // enterTShift introduces T[tl+1], T[tl+2]...
4095  // with T[tl+1]=P.p
4096  enterTShift(strat->P,strat,-1,uptodeg, lV);
4097  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR,uptodeg,lV);
4098  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
4099  // posInS only depends on the leading term
4100  strat->enterS(strat->P, pos, strat, atR);
4101 
4102  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4103 // Print("[%d]",hilbeledeg);
4104  kDeleteLcm(&strat->P);
4105  }
4106  else
4107  {
4108  red_shrink2zero:
4109  if (strat->P.p1 == NULL && strat->minim > 0)
4110  {
4111  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4112  }
4113  }
4114 #ifdef KDEBUG
4115  memset(&(strat->P), 0, sizeof(strat->P));
4116 #endif
4117  kTest_TS(strat);
4118  }
4119 #ifdef KDEBUG
4120  if (TEST_OPT_DEBUG) messageSets(strat);
4121 #endif
4122  /* complete reduction of the standard basis--------- */
4123  /* shift case: look for elt's in S such that they are divisible by elt in T */
4124  // if (TEST_OPT_SB_1)
4125  if (TEST_OPT_REDSB)
4126  {
4127  int k=0;
4128  int j=-1;
4129  while(k<=strat->sl)
4130  {
4131 // loop
4132 // {
4133 // if (j>=k) break;
4134 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
4135 // j++;
4136 // }
4137  LObject Ln (strat->S[k],currRing, strat->tailRing);
4138  Ln.SetShortExpVector();
4139  j = kFindDivisibleByInT(strat, &Ln, j+1);
4140  if (j<0) { k++; j=-1;}
4141  else
4142  {
4143  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
4144  {
4145  j = kFindDivisibleByInT(strat, &Ln, j+1);
4146  if (j<0) { k++; j=-1;}
4147  else
4148  {
4149  deleteInS(k,strat);
4150  }
4151  }
4152  else
4153  {
4154  deleteInS(k,strat);
4155  }
4156  }
4157  }
4158  }
4159 
4160  if (TEST_OPT_REDSB)
4161  { completeReduce(strat, TRUE); //shift: withT = TRUE
4162  if (strat->completeReduce_retry)
4163  {
4164  // completeReduce needed larger exponents, retry
4165  // to reduce with S (instead of T)
4166  // and in currRing (instead of strat->tailRing)
4167 #ifdef HAVE_TAIL_RING
4168  if(currRing->bitmask>strat->tailRing->bitmask)
4169  {
4170  strat->completeReduce_retry=FALSE;
4171  cleanT(strat);strat->tailRing=currRing;
4172  int i;
4173  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
4174  completeReduce(strat);
4175  }
4176  if (strat->completeReduce_retry)
4177 #endif
4178  Werror("exponent bound is %ld",currRing->bitmask);
4179  }
4180  }
4181  else if (TEST_OPT_PROT) PrintLn();
4182 
4183  /* release temp data-------------------------------- */
4184  exitBuchMora(strat);
4185 // if (TEST_OPT_WEIGHTM)
4186 // {
4187 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
4188 // if (ecartWeights)
4189 // {
4190 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
4191 // ecartWeights=NULL;
4192 // }
4193 // }
4194  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
4195  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
4196  return (strat->Shdl);
4197 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:112
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9721
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7745
class sLObject LObject
Definition: kutil.h:54
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7786
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
char interpt
Definition: kutil.h:365
char noClearS
Definition: kutil.h:396
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:103
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1069
int k
Definition: cfEzgcd.cc:92
#define TEST_OPT_DEBUG
Definition: options.h:107
#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:12492
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:9807
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
int minim
Definition: kutil.h:351
char use_buckets
Definition: kutil.h:377
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
void updateSShift(kStrategy strat, int uptodeg, int lV)
Definition: kutil.cc:11879
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12523
int lV
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_TS(A)
Definition: kutil.h:644
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9552
#define assume(x)
Definition: mod2.h:390
#define messageSets(s)
Definition: kutil.h:533
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:752
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
LObject P
Definition: kutil.h:293
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
ideal M
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:11907
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10601
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
void initBbaShift(kStrategy strat)
Definition: kstd2.cc:4360
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:28
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
char homog
Definition: kutil.h:366
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:537
ring tailRing
Definition: kutil.h:336
const CanonicalForm & w
Definition: facAbsFact.cc:55
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10415
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10203
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:337
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:86
int Kstd1_deg
Definition: kutil.cc:236
int BOOLEAN
Definition: auxiliary.h:85
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:9970
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ cancelunit()

void cancelunit ( LObject p,
BOOLEAN  inNF = FALSE 
)

Definition at line 332 of file kutil.cc.

333 {
334  number lc;
335 
336  if(rHasGlobalOrdering (currRing)) return;
337  if(TEST_OPT_CANCELUNIT) return;
338 
339  ring r = L->tailRing;
340  poly p = L->GetLmTailRing();
341  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
342 
343  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
344  lc = pGetCoeff(p);
345 #ifdef HAVE_RINGS
346  // Leading coef have to be a unit
347  // example 2x+4x2 should be simplified to 2x*(1+2x)
348  // and 2 is not a unit in Z
349  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
350 #endif
351 
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  poly h = pNext(p);
358  int i;
359 
361  {
362  loop
363  {
364  if (h==NULL)
365  {
366  p_Delete(&pNext(p), r);
367  if (!inNF)
368  {
369  number eins= nCopy(lc);
370  if (L->p != NULL)
371  {
372  pSetCoeff(L->p,eins);
373  if (L->t_p != NULL)
374  pSetCoeff0(L->t_p,eins);
375  }
376  else
377  pSetCoeff(L->t_p,eins);
378  /* p and t_p share the same coeff, if both are !=NULL */
379  /* p==NULL==t_p cannot happen here */
380  }
381  L->ecart = 0;
382  L->length = 1;
383  //if (L->pLength > 0)
384  L->pLength = 1;
385  L->max_exp = NULL;
386 
387  if (L->t_p != NULL && pNext(L->t_p) != NULL)
388  p_Delete(&pNext(L->t_p),r);
389  if (L->p != NULL && pNext(L->p) != NULL)
390  pNext(L->p) = NULL;
391  return;
392  }
393  i = rVar(r);
394  loop
395  {
396  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
397  i--;
398  if (i == 0) break; // does divide, try next monom
399  }
400  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
401  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
402  // domains), no zerodivisor test needed CAUTION
403  if (!n_DivBy(pGetCoeff(h),lc,r->cf))
404  {
405  return;
406  }
407  pIter(h);
408  }
409  }
410  else
411  {
412  loop
413  {
414  if (h==NULL)
415  {
416  p_Delete(&pNext(p), r);
417  if (!inNF)
418  {
419  number eins=nInit(1);
420  if (L->p != NULL)
421  {
422  pSetCoeff(L->p,eins);
423  if (L->t_p != NULL)
424  pSetCoeff0(L->t_p,eins);
425  }
426  else
427  pSetCoeff(L->t_p,eins);
428  /* p and t_p share the same coeff, if both are !=NULL */
429  /* p==NULL==t_p cannot happen here */
430  }
431  L->ecart = 0;
432  L->length = 1;
433  //if (L->pLength > 0)
434  L->pLength = 1;
435  L->max_exp = NULL;
436 
437  if (L->t_p != NULL && pNext(L->t_p) != NULL)
438  p_Delete(&pNext(L->t_p),r);
439  if (L->p != NULL && pNext(L->p) != NULL)
440  pNext(L->p) = NULL;
441 
442  return;
443  }
444  i = rVar(r);
445  loop
446  {
447  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
448  i--;
449  if (i == 0) break; // does divide, try next monom
450  }
451  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
452  pIter(h);
453  }
454  }
455 }
#define p_GetComp(p, r)
Definition: monomials.h:65
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
#define loop
Definition: structs.h:78
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
CanonicalForm lc(const CanonicalForm &f)
#define pIter(p)
Definition: monomials.h:38
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
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:775
int i
Definition: cfEzgcd.cc:125
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_CANCELUNIT
Definition: options.h:126
#define nCopy(n)
Definition: numbers.h:16
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
int p
Definition: cfModGcd.cc:4019
#define nInit(i)
Definition: numbers.h:25
static Poly * h
Definition: janet.cc:972
#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:1200

◆ chainCritNormal()

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

Definition at line 3140 of file kutil.cc.

3141 {
3142  int i,j,l;
3143 
3144  /*
3145  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3146  *In this case all elements in B such
3147  *that their lcm is divisible by the leading term of S[i] can be canceled
3148  */
3149  if (strat->pairtest!=NULL)
3150  {
3151  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3152  for (j=0; j<=strat->sl; j++)
3153  {
3154  if (strat->pairtest[j])
3155  {
3156  for (i=strat->Bl; i>=0; i--)
3157  {
3158  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3159  {
3160  deleteInL(strat->B,&strat->Bl,i,strat);
3161  strat->c3++;
3162  }
3163  }
3164  }
3165  }
3166  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3167  strat->pairtest=NULL;
3168  }
3169  if (strat->Gebauer || strat->fromT)
3170  {
3171  if (strat->sugarCrit)
3172  {
3173  /*
3174  *suppose L[j] == (s,r) and p/lcm(s,r)
3175  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3176  *and in case the sugar is o.k. then L[j] can be canceled
3177  */
3178  for (j=strat->Ll; j>=0; j--)
3179  {
3180  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3181  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3182  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3183  {
3184  if (strat->L[j].p == strat->tail)
3185  {
3186  deleteInL(strat->L,&strat->Ll,j,strat);
3187  strat->c3++;
3188  }
3189  }
3190  }
3191  /*
3192  *this is GEBAUER-MOELLER:
3193  *in B all elements with the same lcm except the "best"
3194  *(i.e. the last one in B with this property) will be canceled
3195  */
3196  j = strat->Bl;
3197  loop /*cannot be changed into a for !!! */
3198  {
3199  if (j <= 0) break;
3200  i = j-1;
3201  loop
3202  {
3203  if (i < 0) break;
3204  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3205  {
3206  strat->c3++;
3207  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3208  {
3209  deleteInL(strat->B,&strat->Bl,i,strat);
3210  j--;
3211  }
3212  else
3213  {
3214  deleteInL(strat->B,&strat->Bl,j,strat);
3215  break;
3216  }
3217  }
3218  i--;
3219  }
3220  j--;
3221  }
3222  }
3223  else /*sugarCrit*/
3224  {
3225  /*
3226  *suppose L[j] == (s,r) and p/lcm(s,r)
3227  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3228  *and in case the sugar is o.k. then L[j] can be canceled
3229  */
3230  for (j=strat->Ll; j>=0; j--)
3231  {
3232  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3233  {
3234  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3235  {
3236  deleteInL(strat->L,&strat->Ll,j,strat);
3237  strat->c3++;
3238  }
3239  }
3240  }
3241  /*
3242  *this is GEBAUER-MOELLER:
3243  *in B all elements with the same lcm except the "best"
3244  *(i.e. the last one in B with this property) will be canceled
3245  */
3246  j = strat->Bl;
3247  loop /*cannot be changed into a for !!! */
3248  {
3249  if (j <= 0) break;
3250  for(i=j-1; i>=0; i--)
3251  {
3252  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3253  {
3254  strat->c3++;
3255  deleteInL(strat->B,&strat->Bl,i,strat);
3256  j--;
3257  }
3258  }
3259  j--;
3260  }
3261  }
3262  /*
3263  *the elements of B enter L
3264  */
3265  kMergeBintoL(strat);
3266  }
3267  else
3268  {
3269  for (j=strat->Ll; j>=0; j--)
3270  {
3271  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3272  {
3273  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3274  {
3275  deleteInL(strat->L,&strat->Ll,j,strat);
3276  strat->c3++;
3277  }
3278  }
3279  }
3280  /*
3281  *this is our MODIFICATION of GEBAUER-MOELLER:
3282  *First the elements of B enter L,
3283  *then we fix a lcm and the "best" element in L
3284  *(i.e the last in L with this lcm and of type (s,p))
3285  *and cancel all the other elements of type (r,p) with this lcm
3286  *except the case the element (s,r) has also the same lcm
3287  *and is on the worst position with respect to (s,p) and (r,p)
3288  */
3289  /*
3290  *B enters to L/their order with respect to B is permutated for elements
3291  *B[i].p with the same leading term
3292  */
3293  kMergeBintoL(strat);
3294  j = strat->Ll;
3295  loop /*cannot be changed into a for !!! */
3296  {
3297  if (j <= 0)
3298  {
3299  /*now L[0] cannot be canceled any more and the tail can be removed*/
3300  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3301  break;
3302  }
3303  if (strat->L[j].p2 == p)
3304  {
3305  i = j-1;
3306  loop
3307  {
3308  if (i < 0) break;
3309  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3310  {
3311  /*L[i] could be canceled but we search for a better one to cancel*/
3312  strat->c3++;
3313  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3314  && (pNext(strat->L[l].p) == strat->tail)
3315  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3316  && pDivisibleBy(p,strat->L[l].lcm))
3317  {
3318  /*
3319  *"NOT equal(...)" because in case of "equal" the element L[l]
3320  *is "older" and has to be from theoretical point of view behind
3321  *L[i], but we do not want to reorder L
3322  */
3323  strat->L[i].p2 = strat->tail;
3324  /*
3325  *L[l] will be canceled, we cannot cancel L[i] later on,
3326  *so we mark it with "tail"
3327  */
3328  deleteInL(strat->L,&strat->Ll,l,strat);
3329  i--;
3330  }
3331  else
3332  {
3333  deleteInL(strat->L,&strat->Ll,i,strat);
3334  }
3335  j--;
3336  }
3337  i--;
3338  }
3339  }
3340  else if (strat->L[j].p2 == strat->tail)
3341  {
3342  /*now L[j] cannot be canceled any more and the tail can be removed*/
3343  strat->L[j].p2 = p;
3344  }
3345  j--;
3346  }
3347  }
3348 }
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:344
int c3
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:326
int Bl
Definition: kutil.h:345
#define loop
Definition: structs.h:78
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
char sugarCrit
Definition: kutil.h:371
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:668
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:20
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
polyset S
Definition: kutil.h:297
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
LSet B
Definition: kutil.h:319
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
char Gebauer
Definition: kutil.h:372
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3098
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1290
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ chainCritOpt_1()

void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 3353 of file kutil.cc.

3354 {
3355  if (strat->pairtest!=NULL)
3356  {
3357  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3358  strat->pairtest=NULL;
3359  }
3360  /*
3361  *the elements of B enter L
3362  */
3363  kMergeBintoL(strat);
3364 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:326
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:341
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3098
int BOOLEAN
Definition: auxiliary.h:85

◆ chainCritSig()

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

Definition at line 3369 of file kutil.cc.

3370 {
3371  int i,j,l;
3372  kMergeBintoLSba(strat);
3373  j = strat->Ll;
3374  loop /*cannot be changed into a for !!! */
3375  {
3376  if (j <= 0)
3377  {
3378  /*now L[0] cannot be canceled any more and the tail can be removed*/
3379  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3380  break;
3381  }
3382  if (strat->L[j].p2 == p)
3383  {
3384  i = j-1;
3385  loop
3386  {
3387  if (i < 0) break;
3388  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3389  {
3390  /*L[i] could be canceled but we search for a better one to cancel*/
3391  strat->c3++;
3392  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3393  && (pNext(strat->L[l].p) == strat->tail)
3394  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3395  && pDivisibleBy(p,strat->L[l].lcm))
3396  {
3397  /*
3398  *"NOT equal(...)" because in case of "equal" the element L[l]
3399  *is "older" and has to be from theoretical point of view behind
3400  *L[i], but we do not want to reorder L
3401  */
3402  strat->L[i].p2 = strat->tail;
3403  /*
3404  *L[l] will be canceled, we cannot cancel L[i] later on,
3405  *so we mark it with "tail"
3406  */
3407  deleteInL(strat->L,&strat->Ll,l,strat);
3408  i--;
3409  }
3410  else
3411  {
3412  deleteInL(strat->L,&strat->Ll,i,strat);
3413  }
3414  j--;
3415  }
3416  i--;
3417  }
3418  }
3419  else if (strat->L[j].p2 == strat->tail)
3420  {
3421  /*now L[j] cannot be canceled any more and the tail can be removed*/
3422  strat->L[j].p2 = p;
3423  }
3424  j--;
3425  }
3426 }
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:344
int c3
Definition: kutil.h:340
#define loop
Definition: structs.h:78
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:668
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3119
LSet L
Definition: kutil.h:318
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ cleanT()

void cleanT ( kStrategy  strat)

Definition at line 537 of file kutil.cc.

538 {
539  int i,j;
540  poly p;
541  assume(currRing == strat->tailRing || strat->tailRing != NULL);
542 
543  pShallowCopyDeleteProc p_shallow_copy_delete =
544  (strat->tailRing != currRing ?
546  NULL);
547  for (j=0; j<=strat->tl; j++)
548  {
549  p = strat->T[j].p;
550  strat->T[j].p=NULL;
551  if (strat->T[j].max_exp != NULL)
552  {
553  p_LmFree(strat->T[j].max_exp, strat->tailRing);
554  }
555  i = -1;
556  loop
557  {
558  i++;
559  if (i>strat->sl)
560  {
561  if (strat->T[j].t_p != NULL)
562  {
563  p_Delete(&(strat->T[j].t_p), strat->tailRing);
564  p_LmFree(p, currRing);
565  }
566  else
567  {
568  pDelete(&p);
569  }
570  break;
571  }
572  if (p == strat->S[i])
573  {
574  if (strat->T[j].t_p != NULL)
575  {
576  if (p_shallow_copy_delete!=NULL)
577  {
578  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
579  currRing->PolyBin);
580  }
581  p_LmFree(strat->T[j].t_p, strat->tailRing);
582  }
583  break;
584  }
585  }
586  }
587  strat->tl=-1;
588 }
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:343
#define loop
Definition: structs.h:78
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
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:45
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019

◆ clearS()

KINLINE void clearS ( poly  p,
unsigned long  p_sev,
int *  at,
int *  k,
kStrategy  strat 
)

Definition at line 1107 of file kInline.h.

1109 {
1110  assume(p_sev == pGetShortExpVector(p));
1111  if (strat->noClearS) return;
1112  #ifdef HAVE_RINGS
1114  {
1115  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1116  return;
1117  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1118  return;
1119  }
1120  else
1121  #endif
1122  {
1123  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1124  }
1125  deleteInS((*at),strat);
1126  (*at)--;
1127  (*k)--;
1128 }
char noClearS
Definition: kutil.h:396
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1069
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
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:775
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
polyset S
Definition: kutil.h:297
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 10415 of file kutil.cc.

10416 {
10417  int i;
10418  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10419  LObject L;
10420 
10421 #ifdef KDEBUG
10422  // need to set this: during tailreductions of T[i], T[i].max is out of
10423  // sync
10424  sloppy_max = TRUE;
10425 #endif
10426 
10427  strat->noTailReduction = FALSE;
10428  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10429  if (TEST_OPT_PROT)
10430  {
10431  PrintLn();
10432 // if (timerv) writeTime("standard base computed:");
10433  }
10434  if (TEST_OPT_PROT)
10435  {
10436  Print("(S:%d)",strat->sl);mflush();
10437  }
10438  for (i=strat->sl; i>=low; i--)
10439  {
10440  int end_pos=strat->sl;
10441  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10442  if (strat->ak==0) end_pos=i-1;
10443  TObject* T_j = strat->s_2_t(i);
10444  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10445  {
10446  L = *T_j;
10447  #ifdef KDEBUG
10448  if (TEST_OPT_DEBUG)
10449  {
10450  Print("test S[%d]:",i);
10451  p_wrp(L.p,currRing,strat->tailRing);
10452  PrintLn();
10453  }
10454  #endif
10456  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10457  else
10458  strat->S[i] = redtail(&L, strat->sl, strat);
10459  #ifdef KDEBUG
10460  if (TEST_OPT_DEBUG)
10461  {
10462  Print("to (tailR) S[%d]:",i);
10463  p_wrp(strat->S[i],currRing,strat->tailRing);
10464  PrintLn();
10465  }
10466  #endif
10467 
10468  if (strat->redTailChange)
10469  {
10470  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10471  if (pNext(T_j->p) != NULL)
10472  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10473  else
10474  T_j->max_exp = NULL;
10475  }
10477  T_j->pCleardenom();
10478  }
10479  else
10480  {
10481  assume(currRing == strat->tailRing);
10482  #ifdef KDEBUG
10483  if (TEST_OPT_DEBUG)
10484  {
10485  Print("test S[%d]:",i);
10486  p_wrp(strat->S[i],currRing,strat->tailRing);
10487  PrintLn();
10488  }
10489  #endif
10491  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10492  else
10493  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10495  {
10496  if (TEST_OPT_CONTENTSB)
10497  {
10498  number n;
10499  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
10500  if (!nIsOne(n))
10501  {
10503  denom->n=nInvers(n);
10504  denom->next=DENOMINATOR_LIST;
10505  DENOMINATOR_LIST=denom;
10506  }
10507  nDelete(&n);
10508  }
10509  else
10510  {
10511  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
10512  }
10513  }
10514  #ifdef KDEBUG
10515  if (TEST_OPT_DEBUG)
10516  {
10517  Print("to (-tailR) S[%d]:",i);
10518  p_wrp(strat->S[i],currRing,strat->tailRing);
10519  PrintLn();
10520  }
10521  #endif
10522  }
10523  if (TEST_OPT_PROT)
10524  PrintS("-");
10525  }
10526  if (TEST_OPT_PROT) PrintLn();
10527 #ifdef KDEBUG
10528  sloppy_max = FALSE;
10529 #endif
10530 }
denominator_list_s * denominator_list
Definition: kutil.h:59
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
#define TEST_OPT_CONTENTSB
Definition: options.h:125
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:87
int ak
Definition: kutil.h:346
#define TEST_OPT_DEBUG
Definition: options.h:107
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2891
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7321
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:297
#define nDelete(n)
Definition: numbers.h:17
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7397
#define nInvers(a)
Definition: numbers.h:34
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
ring tailRing
Definition: kutil.h:336
denominator_list next
Definition: kutil.h:61
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:341
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782
char redTailChange
Definition: kutil.h:393
class sTObject TObject
Definition: kutil.h:53
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:1130

◆ createG0()

ideal createG0 ( )

Definition at line 4405 of file kutil.cc.

4406 {
4407  // Initialize
4408  long exp[50]; // The exponent of \hat{X} (basepoint)
4409  long cexp[50]; // The current exponent for iterating over all
4410  long ind[50]; // The power of 2 in the i-th component of exp
4411  long cind[50]; // analog for cexp
4412  long mult[50]; // How to multiply the elements of G
4413  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4414  long habsind = 0; // The abs. index of the coefficient of h
4415  long step[50]; // The last increases
4416  for (int i = 1; i <= currRing->N; i++)
4417  {
4418  exp[i] = 0;
4419  cexp[i] = exp[i];
4420  ind[i] = 0;
4421  step[i] = 500000;
4422  cind[i] = ind[i];
4423  }
4424  long bound = currRing->ch;
4425  step[1] = 500000;
4426 #ifdef OLI_DEBUG
4427  PrintS("-------------\npoly :");
4428 // wrp(p);
4429  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4430  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4431  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4432  Print("bound : %d\n", bound);
4433  Print("cind : %d\n", cabsind);
4434 #endif
4435  if (cabsind == 0)
4436  {
4437  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4438  {
4439  return idInit(1, 1);
4440  }
4441  }
4442  ideal G0 = idInit(1, 1);
4443  // Now the whole simplex
4444  do
4445  {
4446  // Build s-polynomial
4447  // 2**ind-def * mult * g - exp-def * h
4448  poly t_p;
4449  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4450 #ifdef OLI_DEBUG
4451  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4452  PrintS("zPoly : ");
4453  wrp(zeroPoly);
4454  PrintLn();
4455 #endif
4456  // Add to ideal
4457  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4458  IDELEMS(G0) += 1;
4459  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4460  }
4461  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4462  idSkipZeroes(G0);
4463  return G0;
4464 }
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:80
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4276
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4210
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3647
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void wrp(poly p)
Definition: polys.h:304

◆ deleteHC() [1/2]

void deleteHC ( poly *  p,
int *  e,
int *  l,
kStrategy  strat 
)

Definition at line 318 of file kutil.cc.

319 {
320  LObject L(*p, currRing, strat->tailRing);
321 
322  deleteHC(&L, strat);
323  *p = L.p;
324  *e = L.ecart;
325  *l = L.length;
326  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
327 }
class sLObject LObject
Definition: kutil.h:54
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ deleteHC() [2/2]

void deleteHC ( LObject L,
kStrategy  strat,
BOOLEAN  fromNext = FALSE 
)

Definition at line 243 of file kutil.cc.

244 {
245  if (strat->kHEdgeFound)
246  {
247  kTest_L(L);
248  poly p1;
249  poly p = L->GetLmTailRing();
250  int l = 1;
251  kBucket_pt bucket = NULL;
252  if (L->bucket != NULL)
253  {
254  kBucketClear(L->bucket, &pNext(p), &L->pLength);
255  L->pLength++;
256  bucket = L->bucket;
257  L->bucket = NULL;
258  }
259 
260  if (!fromNext && p_Cmp(p,strat->kNoetherTail(), L->tailRing) == -1)
261  {
262  L->Delete();
263  L->Clear();
264  L->ecart = -1;
265  if (bucket != NULL) kBucketDestroy(&bucket);
266  return;
267  }
268  p1 = p;
269  while (pNext(p1)!=NULL)
270  {
271  if (p_LmCmp(pNext(p1), strat->kNoetherTail(), L->tailRing) == -1)
272  {
273  p_Delete(&pNext(p1), L->tailRing);
274  if (p1 == p)
275  {
276  if (L->t_p != NULL)
277  {
278  assume(L->p != NULL && p == L->t_p);
279  pNext(L->p) = NULL;
280  }
281  L->max_exp = NULL;
282  }
283  else if (fromNext)
284  L->max_exp = p_GetMaxExpP(pNext(L->p), L->tailRing ); // p1;
285  //if (L->pLength != 0)
286  L->pLength = l;
287  // Hmmm when called from updateT, then only
288  // reset ecart when cut
289  if (fromNext)
290  L->ecart = L->pLDeg() - L->GetpFDeg();
291  break;
292  }
293  l++;
294  pIter(p1);
295  }
296  if (! fromNext)
297  {
298  L->SetpFDeg();
299  L->ecart = L->pLDeg(strat->LDegLast) - L->GetpFDeg();
300  }
301  if (bucket != NULL)
302  {
303  if (L->pLength > 1)
304  {
305  kBucketInit(bucket, pNext(p), L->pLength - 1);
306  pNext(p) = NULL;
307  if (L->t_p != NULL) pNext(L->t_p) = NULL;
308  L->pLength = 0;
309  L->bucket = bucket;
310  }
311  else
312  kBucketDestroy(&bucket);
313  }
314  kTest_L(L);
315  }
316 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:518
char kHEdgeFound
Definition: kutil.h:370
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:490
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1653
char LDegLast
Definition: kutil.h:379
#define pIter(p)
Definition: monomials.h:38
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:213
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T)
Definition: kutil.h:647
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1498
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:93
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:1130

◆ deleteInL()

void deleteInL ( LSet  set,
int *  length,
int  j,
kStrategy  strat 
)

Definition at line 1176 of file kutil.cc.

1177 {
1178  if (set[j].lcm!=NULL)
1179  {
1180  kDeleteLcm(&set[j]);
1181  }
1182  if (set[j].sig!=NULL)
1183  {
1184 #ifdef HAVE_RINGS
1185  if (pGetCoeff(set[j].sig) != NULL)
1186  pLmDelete(set[j].sig);
1187  else
1188 #endif
1189  pLmFree(set[j].sig);
1190  }
1191  if (set[j].p!=NULL)
1192  {
1193  if (pNext(set[j].p) == strat->tail)
1194  {
1195 #ifdef HAVE_RINGS
1196  if (pGetCoeff(set[j].p) != NULL)
1197  pLmDelete(set[j].p);
1198  else
1199 #endif
1200  pLmFree(set[j].p);
1201  /*- tail belongs to several int spolys -*/
1202  }
1203  else
1204  {
1205  // search p in T, if it is there, do not delete it
1206  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1207  {
1208  // assure that for global orderings kFindInT fails
1209  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1210  set[j].Delete();
1211  }
1212  }
1213  }
1214  if (*length > 0 && j < *length)
1215  {
1216 #ifdef ENTER_USE_MEMMOVE
1217  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1218 #else
1219  int i;
1220  for (i=j; i < (*length); i++)
1221  set[i] = set[i+1];
1222 #endif
1223  }
1224 #ifdef KDEBUG
1225  memset(&(set[*length]),0,sizeof(LObject));
1226 #endif
1227  (*length)--;
1228 }
int j
Definition: facHensel.cc:105
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
class sLObject LObject
Definition: kutil.h:54
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:704
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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 p
Definition: cfModGcd.cc:4019

◆ deleteInS()

void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 1069 of file kutil.cc.

1070 {
1071 #ifdef ENTER_USE_MEMMOVE
1072  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1073  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1074  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1075  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1076 #else
1077  int j;
1078  for (j=i; j<strat->sl; j++)
1079  {
1080  strat->S[j] = strat->S[j+1];
1081  strat->ecartS[j] = strat->ecartS[j+1];
1082  strat->sevS[j] = strat->sevS[j+1];
1083  strat->S_2_R[j] = strat->S_2_R[j+1];
1084  }
1085 #endif
1086  if (strat->lenS!=NULL)
1087  {
1088 #ifdef ENTER_USE_MEMMOVE
1089  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1090 #else
1091  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1092 #endif
1093  }
1094  if (strat->lenSw!=NULL)
1095  {
1096 #ifdef ENTER_USE_MEMMOVE
1097  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1098 #else
1099  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1100 #endif
1101  }
1102  if (strat->fromQ!=NULL)
1103  {
1104 #ifdef ENTER_USE_MEMMOVE
1105  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1106 #else
1107  for (j=i; j<strat->sl; j++)
1108  {
1109  strat->fromQ[j] = strat->fromQ[j+1];
1110  }
1111 #endif
1112  }
1113  strat->S[strat->sl] = NULL;
1114  strat->sl--;
1115 }
int j
Definition: facHensel.cc:105
wlen_set lenSw
Definition: kutil.h:311
int * S_2_R
Definition: kutil.h:335
intset fromQ
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
intset lenS
Definition: kutil.h:310
intset ecartS
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:313
int sl
Definition: kutil.h:341

◆ deleteInSSba()

void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 1121 of file kutil.cc.

1122 {
1123 #ifdef ENTER_USE_MEMMOVE
1124  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1125  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1126  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1127  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1128  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1129  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1130 #else
1131  int j;
1132  for (j=i; j<strat->sl; j++)
1133  {
1134  strat->S[j] = strat->S[j+1];
1135  strat->sig[j] = strat->sig[j+1];
1136  strat->ecartS[j] = strat->ecartS[j+1];
1137  strat->sevS[j] = strat->sevS[j+1];
1138  strat->sevSig[j] = strat->sevSig[j+1];
1139  strat->S_2_R[j] = strat->S_2_R[j+1];
1140  }
1141 #endif
1142  if (strat->lenS!=NULL)
1143  {
1144 #ifdef ENTER_USE_MEMMOVE
1145  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1146 #else
1147  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1148 #endif
1149  }
1150  if (strat->lenSw!=NULL)
1151  {
1152 #ifdef ENTER_USE_MEMMOVE
1153  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1154 #else
1155  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1156 #endif
1157  }
1158  if (strat->fromQ!=NULL)
1159  {
1160 #ifdef ENTER_USE_MEMMOVE
1161  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1162 #else
1163  for (j=i; j<strat->sl; j++)
1164  {
1165  strat->fromQ[j] = strat->fromQ[j+1];
1166  }
1167 #endif
1168  }
1169  strat->S[strat->sl] = NULL;
1170  strat->sl--;
1171 }
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
int j
Definition: facHensel.cc:105
wlen_set lenSw
Definition: kutil.h:311
int * S_2_R
Definition: kutil.h:335
intset fromQ
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
intset lenS
Definition: kutil.h:310
intset ecartS
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:313
int sl
Definition: kutil.h:341

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4520 of file kutil.cc.

4521 {
4522  if (nIsOne(pGetCoeff(h))) return;
4523  number gcd;
4524  bool go = false;
4525  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4526  {
4527  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4528  go = true;
4529  }
4530  else
4531  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4532  if (go || !nIsOne(gcd))
4533  {
4534  poly p = h->next;
4535  if (!go)
4536  {
4537  number tmp = gcd;
4538  gcd = n_Ann(gcd,currRing->cf);
4539  nDelete(&tmp);
4540  }
4541  p_Test(p,strat->tailRing);
4542  p = __pp_Mult_nn(p, gcd, strat->tailRing);
4543  nDelete(&gcd);
4544 
4545  if (p != NULL)
4546  {
4547  if (TEST_OPT_PROT)
4548  {
4549  PrintS("Z");
4550  }
4551 #ifdef KDEBUG
4552  if (TEST_OPT_DEBUG)
4553  {
4554  PrintS("--- create zero spoly: ");
4555  p_wrp(h,currRing,strat->tailRing);
4556  PrintS(" ---> ");
4557  }
4558 #endif
4559  poly tmp = pInit();
4560  pSetCoeff0(tmp, pGetCoeff(p));
4561  for (int i = 1; i <= rVar(currRing); i++)
4562  {
4563  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4564  }
4566  {
4567  p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
4568  }
4569  p_Setm(tmp, currRing);
4570  p = p_LmFreeAndNext(p, strat->tailRing);
4571  pNext(tmp) = p;
4572  LObject Lp;
4573  Lp.Init();
4574  Lp.p = tmp;
4575  Lp.tailRing = strat->tailRing;
4576  int posx;
4577  if (Lp.p!=NULL)
4578  {
4579  strat->initEcart(&Lp);
4580  if (strat->Ll==-1)
4581  posx =0;
4582  else
4583  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4584  Lp.sev = pGetShortExpVector(Lp.p);
4585  if (strat->tailRing != currRing)
4586  {
4587  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4588  }
4589 #ifdef KDEBUG
4590  if (TEST_OPT_DEBUG)
4591  {
4592  p_wrp(tmp,currRing,strat->tailRing);
4593  PrintLn();
4594  }
4595 #endif
4596  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4597  }
4598  }
4599  }
4600  nDelete(&gcd);
4601 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
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:686
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define pSetExp(p, i, v)
Definition: polys.h:42
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
#define nIsOne(n)
Definition: numbers.h:26
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
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:701
void(* initEcart)(TObject *L)
Definition: kutil.h:271
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
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:775
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:959
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:704
#define nDelete(n)
Definition: numbers.h:17
#define p_Test(p, r)
Definition: p_polys.h:164
#define rRing_has_Comp(r)
Definition: monomials.h:267
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define pSetCoeff0(p, n)
Definition: monomials.h:60
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ enterExtendedSpolySig()

void enterExtendedSpolySig ( poly  h,
poly  hSig,
kStrategy  strat 
)

Definition at line 4603 of file kutil.cc.

4604 {
4605  if (nIsOne(pGetCoeff(h))) return;
4606  number gcd;
4607  bool go = false;
4608  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4609  {
4610  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4611  go = true;
4612  }
4613  else
4614  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4615  if (go || !nIsOne(gcd))
4616  {
4617  poly p = h->next;
4618  if (!go)
4619  {
4620  number tmp = gcd;
4621  gcd = n_Ann(gcd,currRing->cf);
4622  nDelete(&tmp);
4623  }
4624  p_Test(p,strat->tailRing);
4625  p = __pp_Mult_nn(p, gcd, strat->tailRing);
4626 
4627  if (p != NULL)
4628  {
4629  if (TEST_OPT_PROT)
4630  {
4631  PrintS("Z");
4632  }
4633 #ifdef KDEBUG
4634  if (TEST_OPT_DEBUG)
4635  {
4636  PrintS("--- create zero spoly: ");
4637  p_wrp(h,currRing,strat->tailRing);
4638  PrintS(" ---> ");
4639  }
4640 #endif
4641  poly tmp = pInit();
4642  pSetCoeff0(tmp, pGetCoeff(p));
4643  for (int i = 1; i <= rVar(currRing); i++)
4644  {
4645  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4646  }
4648  {
4649  p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
4650  }
4651  p_Setm(tmp, currRing);
4652  p = p_LmFreeAndNext(p, strat->tailRing);
4653  pNext(tmp) = p;
4654  LObject Lp;
4655  Lp.Init();
4656  Lp.p = tmp;
4657  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4658  #if EXT_POLY_NEW
4659  Lp.sig = __pp_Mult_nn(hSig, gcd, currRing);
4660  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4661  {
4662  strat->sigdrop = TRUE;
4663  //Try to reduce it as far as we can via redRing
4664  int red_result = redRing(&Lp,strat);
4665  if(red_result == 0)
4666  {
4667  // Cancel the sigdrop
4668  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4669  strat->sigdrop = FALSE;
4670  return;
4671  }
4672  else
4673  {
4674  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4675  #if 1
4676  strat->enterS(Lp,0,strat,strat->tl);
4677  #endif
4678  return;
4679  }
4680 
4681  }
4682  #else
4683  Lp.sig = pOne();
4684  if(strat->Ll >= 0)
4685  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4686  else
4687  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4688  #endif
4689  Lp.tailRing = strat->tailRing;
4690  int posx;
4691  if (Lp.p!=NULL)
4692  {
4693  strat->initEcart(&Lp);
4694  if (strat->Ll==-1)
4695  posx =0;
4696  else
4697  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4698  Lp.sev = pGetShortExpVector(Lp.p);
4699  if (strat->tailRing != currRing)
4700  {
4701  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4702  }
4703 #ifdef KDEBUG
4704  if (TEST_OPT_DEBUG)
4705  {
4706  p_wrp(tmp,currRing,strat->tailRing);
4707  PrintLn();
4708  }
4709 #endif
4710  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4711  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4712  }
4713  }
4714  nDelete(&gcd);
4715  }
4716  nDelete(&gcd);
4717 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
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:686
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:438
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:353
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:273
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pGetComp(p)
Component.
Definition: polys.h:37
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL
Definition: coeffs.h:701
void(* initEcart)(TObject *L)
Definition: kutil.h:271
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
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:775
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
LObject P
Definition: kutil.h:293
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:959
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:309
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:704
#define nDelete(n)
Definition: numbers.h:17
#define p_Test(p, r)
Definition: p_polys.h:164
#define rRing_has_Comp(r)
Definition: monomials.h:267
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
LSet L
Definition: kutil.h:318
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define pSetCoeff0(p, n)
Definition: monomials.h:60
int sl
Definition: kutil.h:341
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ enterL()

void enterL ( LSet set,
int *  length,
int *  LSetmax,
LObject  p,
int  at 
)

Definition at line 1233 of file kutil.cc.

1234 {
1235  // this should be corrected
1236  assume(p.FDeg == p.pFDeg());
1237 
1238  if ((*length)>=0)
1239  {
1240  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1241  if (at <= (*length))
1242 #ifdef ENTER_USE_MEMMOVE
1243  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1244 #else
1245  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1246 #endif
1247  }
1248  else at = 0;
1249  (*set)[at] = p;
1250  (*length)++;
1251 }
class sLObject LObject
Definition: kutil.h:54
#define setmaxLinc
Definition: kutil.h:31
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:649
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:51

◆ enterOnePairNormal()

void enterOnePairNormal ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR 
)

Definition at line 1877 of file kutil.cc.

1878 {
1879  assume(i<=strat->sl);
1880 
1881  int l,j,compare;
1882  LObject Lp;
1883  Lp.i_r = -1;
1884 
1885 #ifdef KDEBUG
1886  Lp.ecart=0; Lp.length=0;
1887 #endif
1888  /*- computes the lcm(s[i],p) -*/
1889  Lp.lcm = pInit();
1890 
1891 #ifndef HAVE_RATGRING
1892  pLcm(p,strat->S[i],Lp.lcm);
1893 #elif defined(HAVE_RATGRING)
1894  if (rIsRatGRing(currRing))
1895  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1896  else
1897  pLcm(p,strat->S[i],Lp.lcm);
1898 #endif
1899  pSetm(Lp.lcm);
1900 
1901 
1902  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1903  {
1904  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1905  && pHasNotCF(p,strat->S[i]))
1906  {
1907  /*
1908  *the product criterion has applied for (s,p),
1909  *i.e. lcm(s,p)=product of the leading terms of s and p.
1910  *Suppose (s,r) is in L and the leading term
1911  *of p divides lcm(s,r)
1912  *(==> the leading term of p divides the leading term of r)
1913  *but the leading term of s does not divide the leading term of r
1914  *(notice that tis condition is automatically satisfied if r is still
1915  *in S), then (s,r) can be cancelled.
1916  *This should be done here because the
1917  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1918  *
1919  *Moreover, skipping (s,r) holds also for the noncommutative case.
1920  */
1921  strat->cp++;
1922  pLmFree(Lp.lcm);
1923  return;
1924  }
1925  else
1926  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1927  if (strat->fromT && (strat->ecartS[i]>ecart))
1928  {
1929  pLmFree(Lp.lcm);
1930  return;
1931  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1932  }
1933  /*
1934  *the set B collects the pairs of type (S[j],p)
1935  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1936  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1937  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1938  */
1939  {
1940  j = strat->Bl;
1941  loop
1942  {
1943  if (j < 0) break;
1944  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1945  if ((compare==1)
1946  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1947  {
1948  strat->c3++;
1949  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1950  {
1951  pLmFree(Lp.lcm);
1952  return;
1953  }
1954  break;
1955  }
1956  else
1957  if ((compare ==-1)
1958  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1959  {
1960  deleteInL(strat->B,&strat->Bl,j,strat);
1961  strat->c3++;
1962  }
1963  j--;
1964  }
1965  }
1966  }
1967  else /*sugarcrit*/
1968  {
1969  if (ALLOW_PROD_CRIT(strat))
1970  {
1971  // if currRing->nc_type!=quasi (or skew)
1972  // TODO: enable productCrit for super commutative algebras...
1973  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1974  pHasNotCF(p,strat->S[i]))
1975  {
1976  /*
1977  *the product criterion has applied for (s,p),
1978  *i.e. lcm(s,p)=product of the leading terms of s and p.
1979  *Suppose (s,r) is in L and the leading term
1980  *of p devides lcm(s,r)
1981  *(==> the leading term of p devides the leading term of r)
1982  *but the leading term of s does not devide the leading term of r
1983  *(notice that tis condition is automatically satisfied if r is still
1984  *in S), then (s,r) can be canceled.
1985  *This should be done here because the
1986  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1987  */
1988  strat->cp++;
1989  pLmFree(Lp.lcm);
1990  return;
1991  }
1992  if (strat->fromT && (strat->ecartS[i]>ecart))
1993  {
1994  pLmFree(Lp.lcm);
1995  return;
1996  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1997  }
1998  /*
1999  *the set B collects the pairs of type (S[j],p)
2000  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2001  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2002  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2003  */
2004  for(j = strat->Bl;j>=0;j--)
2005  {
2006  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2007  if (compare==1)
2008  {
2009  strat->c3++;
2010  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2011  {
2012  pLmFree(Lp.lcm);
2013  return;
2014  }
2015  break;
2016  }
2017  else
2018  if (compare ==-1)
2019  {
2020  deleteInL(strat->B,&strat->Bl,j,strat);
2021  strat->c3++;
2022  }
2023  }
2024  }
2025  }
2026  /*
2027  *the pair (S[i],p) enters B if the spoly != 0
2028  */
2029  /*- compute the short s-polynomial -*/
2030  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2031  pNorm(p);
2032 
2033  if ((strat->S[i]==NULL) || (p==NULL))
2034  return;
2035 
2036  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2037  Lp.p=NULL;
2038  else
2039  {
2040  #ifdef HAVE_PLURAL
2041  if ( rIsPluralRing(currRing) )
2042  {
2043  if(pHasNotCF(p, strat->S[i]))
2044  {
2045  if(ncRingType(currRing) == nc_lie)
2046  {
2047  // generalized prod-crit for lie-type
2048  strat->cp++;
2049  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2050  }
2051  else
2052  if( ALLOW_PROD_CRIT(strat) )
2053  {
2054  // product criterion for homogeneous case in SCA
2055  strat->cp++;
2056  Lp.p = NULL;
2057  }
2058  else
2059  {
2060  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2061  nc_CreateShortSpoly(strat->S[i], p, currRing);
2062  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2063  pNext(Lp.p) = strat->tail; // !!!
2064  }
2065  }
2066  else
2067  {
2068  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2069  nc_CreateShortSpoly(strat->S[i], p, currRing);
2070 
2071  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2072  pNext(Lp.p) = strat->tail; // !!!
2073  }
2074  }
2075  else
2076  #endif
2077  {
2079  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2080  }
2081  }
2082  if (Lp.p == NULL)
2083  {
2084  /*- the case that the s-poly is 0 -*/
2085  if (strat->pairtest==NULL) initPairtest(strat);
2086  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2087  strat->pairtest[strat->sl+1] = TRUE;
2088  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2089  /*
2090  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2091  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2092  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2093  *term of p devides the lcm(s,r)
2094  *(this canceling should be done here because
2095  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2096  *the first case is handeled in chainCrit
2097  */
2098  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2099  }
2100  else
2101  {
2102  /*- the pair (S[i],p) enters B -*/
2103  Lp.p1 = strat->S[i];
2104  Lp.p2 = p;
2105 
2106  if (
2108 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2109  )
2110  {
2111  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2112  pNext(Lp.p) = strat->tail; // !!!
2113  }
2114 
2115  if (atR >= 0)
2116  {
2117  Lp.i_r1 = strat->S_2_R[i];
2118  Lp.i_r2 = atR;
2119  }
2120  else
2121  {
2122  Lp.i_r1 = -1;
2123  Lp.i_r2 = -1;
2124  }
2125  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2126 
2128  {
2129  if (!rIsPluralRing(currRing)
2131  && (Lp.p->coef!=NULL))
2132  nDelete(&(Lp.p->coef));
2133  }
2134 
2135  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2136  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2137  }
2138 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
int j
Definition: facHensel.cc:105
#define pSetm(p)
Definition: polys.h:265
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:335
int c3
Definition: kutil.h:340
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:419
static int pDivComp(poly p, poly q)
Definition: kutil.cc:186
BOOLEAN * pairtest
Definition: kutil.h:326
int Bl
Definition: kutil.h:345
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:257
#define pLcm(a, b, m)
Definition: polys.h:289
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:998
int Bmax
Definition: kutil.h:345
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
char sugarCrit
Definition: kutil.h:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
intset fromQ
Definition: kutil.h:312
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
polyset S
Definition: kutil.h:297
#define nDelete(n)
Definition: numbers.h:17
int cp
Definition: kutil.h:340
intset ecartS
Definition: kutil.h:300
void initPairtest(kStrategy strat)
Definition: kutil.cc:659
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
ring tailRing
Definition: kutil.h:336
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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:159
int sl
Definition: kutil.h:341
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:389
int p
Definition: cfModGcd.cc:4019
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1290
int l
Definition: cfEzgcd.cc:93
Definition: nc.h:18
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ enterOnePairSelfShifts()

void enterOnePairSelfShifts ( poly  qq,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 12062 of file kutil.cc.

12063 {
12064 
12065  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12066  /* for true self pairs qq ==p */
12067  /* we test both qq and p */
12069  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12072 
12073  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12074 
12075  // int j = 0;
12076  int j = 1;
12077 
12078  /* for such self pairs start with 1, not with 0 */
12079  if (qq == p) j=1;
12080 
12081  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12082  /* that is create the pairs (f, s \dot g) */
12083 
12084  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12085 
12086 #ifdef KDEBUG
12087  //if (TEST_OPT_DEBUG)
12088  //{
12089  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12090  //}
12091 #endif
12092 
12093  poly q;
12094 
12095  /* these vars hold for all shifts of s[i] */
12096  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12097  int qfromQ = 0; // strat->fromQ[i];
12098 
12099  for (; j<= toInsert; j++)
12100  {
12101  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12102  /* we increase shifts by one; must delete q there*/
12103  // q = qq; q = pMoveCurrTail2poly(q,strat);
12104  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12105  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12106  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12107  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12108  // pNext(q) = s; // in tailRing
12109  /* here we need to call enterOnePair with two polys ... */
12110 #ifdef KDEBUG
12111  //if (TEST_OPT_DEBUG)
12112  //{
12113  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12114  //}
12115 #endif
12116  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12117  }
12118 }
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:12125
int j
Definition: facHensel.cc:105
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:321
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
#define assume(x)
Definition: mod2.h:390
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:42
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:102
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ enterOnePairShift()

void enterOnePairShift ( poly  q,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  ecartq,
int  qisFromQ,
int  shiftcount,
int  ifromS,
int  uptodeg,
int  lV 
)

Definition at line 12125 of file kutil.cc.

12126 {
12127 
12128  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12129 
12130  /* check this Formats: */
12132  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12135 
12136 #ifdef KDEBUG
12137 // if (TEST_OPT_DEBUG)
12138 // {
12139 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12140 // wrp(q); // wrp(pHead(q));
12141 // PrintS(", p = ");
12142 // wrp(p); //wrp(pHead(p));
12143 // PrintLn();
12144 // }
12145 #endif
12146 
12147  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12148 
12149  int qfromQ = qisFromQ;
12150 
12151  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12152 
12153  int l,j,compare;
12154  LObject Lp;
12155  Lp.i_r = -1;
12156 
12157 #ifdef KDEBUG
12158  Lp.ecart=0; Lp.length=0;
12159 #endif
12160  /*- computes the lcm(s[i],p) -*/
12161  Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation
12162 
12163  /* apply the V criterion */
12164  if (!isInV(Lp.lcm, lV))
12165  {
12166 #ifdef KDEBUG
12167  if (TEST_OPT_DEBUG)
12168  {
12169  PrintS("V crit applied to q = ");
12170  wrp(q); // wrp(pHead(q));
12171  PrintS(", p = ");
12172  wrp(p); //wrp(pHead(p));
12173  PrintLn();
12174  }
12175 #endif
12176  pLmFree(Lp.lcm);
12177  /* + counter for applying the V criterion */
12178  strat->cv++;
12179  return;
12180  }
12181 
12182  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12183  {
12184  if((!((ecartq>0)&&(ecart>0)))
12185  && pHasNotCF(p,q))
12186  {
12187  /*
12188  *the product criterion has applied for (s,p),
12189  *i.e. lcm(s,p)=product of the leading terms of s and p.
12190  *Suppose (s,r) is in L and the leading term
12191  *of p divides lcm(s,r)
12192  *(==> the leading term of p divides the leading term of r)
12193  *but the leading term of s does not divide the leading term of r
12194  *(notice that this condition is automatically satisfied if r is still
12195  *in S), then (s,r) can be cancelled.
12196  *This should be done here because the
12197  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12198  *
12199  *Moreover, skipping (s,r) holds also for the noncommutative case.
12200  */
12201  strat->cp++;
12202  pLmFree(Lp.lcm);
12203  return;
12204  }
12205  else
12206  Lp.ecart = si_max(ecart,ecartq);
12207  if (strat->fromT && (ecartq>ecart))
12208  {
12209  pLmFree(Lp.lcm);
12210  return;
12211  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12212  }
12213  /*
12214  *the set B collects the pairs of type (S[j],p)
12215  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12216  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12217  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12218  */
12219  {
12220  j = strat->Bl;
12221  loop
12222  {
12223  if (j < 0) break;
12224  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12225  if ((compare==1)
12226  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12227  {
12228  strat->c3++;
12229  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12230  {
12231  pLmFree(Lp.lcm);
12232  return;
12233  }
12234  break;
12235  }
12236  else
12237  if ((compare ==-1)
12238  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12239  {
12240  deleteInL(strat->B,&strat->Bl,j,strat);
12241  strat->c3++;
12242  }
12243  j--;
12244  }
12245  }
12246  }
12247  else /*sugarcrit*/
12248  {
12249  if (ALLOW_PROD_CRIT(strat))
12250  {
12251  // if currRing->nc_type!=quasi (or skew)
12252  // TODO: enable productCrit for super commutative algebras...
12253  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12254  pHasNotCF(p,q))
12255  {
12256  /*
12257  *the product criterion has applied for (s,p),
12258  *i.e. lcm(s,p)=product of the leading terms of s and p.
12259  *Suppose (s,r) is in L and the leading term
12260  *of p devides lcm(s,r)
12261  *(==> the leading term of p devides the leading term of r)
12262  *but the leading term of s does not devide the leading term of r
12263  *(notice that tis condition is automatically satisfied if r is still
12264  *in S), then (s,r) can be canceled.
12265  *This should be done here because the
12266  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12267  */
12268  strat->cp++;
12269  pLmFree(Lp.lcm);
12270  return;
12271  }
12272  if (strat->fromT && (ecartq>ecart))
12273  {
12274  pLmFree(Lp.lcm);
12275  return;
12276  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12277  }
12278  /*
12279  *the set B collects the pairs of type (S[j],p)
12280  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12281  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12282  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12283  */
12284  for(j = strat->Bl;j>=0;j--)
12285  {
12286  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12287  if (compare==1)
12288  {
12289  strat->c3++;
12290  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12291  {
12292  pLmFree(Lp.lcm);
12293  return;
12294  }
12295  break;
12296  }
12297  else
12298  if (compare ==-1)
12299  {
12300  deleteInL(strat->B,&strat->Bl,j,strat);
12301  strat->c3++;
12302  }
12303  }
12304  }
12305  }
12306  /*
12307  *the pair (S[i],p) enters B if the spoly != 0
12308  */
12309  /*- compute the short s-polynomial -*/
12310  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12311  pNorm(p);
12312  if ((q==NULL) || (p==NULL))
12313  return;
12314  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12315  Lp.p=NULL;
12316  else
12317  {
12318 // if ( rIsPluralRing(currRing) )
12319 // {
12320 // if(pHasNotCF(p, q))
12321 // {
12322 // if(ncRingType(currRing) == nc_lie)
12323 // {
12324 // // generalized prod-crit for lie-type
12325 // strat->cp++;
12326 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12327 // }
12328 // else
12329 // if( ALLOW_PROD_CRIT(strat) )
12330 // {
12331 // // product criterion for homogeneous case in SCA
12332 // strat->cp++;
12333 // Lp.p = NULL;
12334 // }
12335 // else
12336 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12337 // }
12338 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12339 // }
12340 // else
12341 // {
12342 
12343  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12344  /* p is already in this form, so convert q */
12345  // q = pMove2CurrTail(q, strat);
12346  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12347  // }
12348  }
12349  if (Lp.p == NULL)
12350  {
12351  /*- the case that the s-poly is 0 -*/
12352  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12353 // if (strat->pairtest==NULL) initPairtest(strat);
12354 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12355 // strat->pairtest[strat->sl+1] = TRUE;
12356 // new: visual check how often this happens: ! for the debug situation
12357 #ifdef KDEBUG
12358  Print("!");
12359  //if (TEST_OPT_DEBUG){Print("!");} // option teach
12360 #endif /* KDEBUG */
12361  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12362  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12363  /*
12364  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12365  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12366  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12367  *term of p devides the lcm(s,r)
12368  *(this canceling should be done here because
12369  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12370  *the first case is handeled in chainCrit
12371  */
12372  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12373  }
12374  else
12375  {
12376  /*- the pair (S[i],p) enters B -*/
12377  /* both of them should have their LM in currRing and TAIL in tailring */
12378  Lp.p1 = q; // already in the needed form
12379  Lp.p2 = p; // already in the needed form
12380 
12381  if ( !rIsPluralRing(currRing) )
12382  pNext(Lp.p) = strat->tail;
12383 
12384  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12385  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12386  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12387  {
12388  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12389  Lp.i_r2 = atR;
12390  }
12391  else
12392  {
12393  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12394  Lp.i_r1 = -1;
12395  Lp.i_r2 = -1;
12396  }
12397  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12398 
12400  {
12401  if (!rIsPluralRing(currRing)
12403  && (Lp.p->coef!=NULL))
12404  nDelete(&(Lp.p->coef));
12405  }
12406 
12407  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12408  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12409  }
12410 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:54
int c3
Definition: kutil.h:340
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:704
static int pDivComp(poly p, poly q)
Definition: kutil.cc:186
int cv
Definition: kutil.h:363
int Bl
Definition: kutil.h:345
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1602
#define pHasNotCF(p1, p2)
Definition: polys.h:257
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:998
int Bmax
Definition: kutil.h:345
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
char sugarCrit
Definition: kutil.h:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
intset fromQ
Definition: kutil.h:312
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
void PrintS(const char *s)
Definition: reporter.cc:284
int isInV(poly p, int lV)
Definition: shiftgb.cc:238
poly tail
Definition: kutil.h:327
#define nDelete(n)
Definition: numbers.h:17
int cp
Definition: kutil.h:340
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:102
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
ring tailRing
Definition: kutil.h:336
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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:389
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:304
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1290
int l
Definition: cfEzgcd.cc:93

◆ enterpairs()

void enterpairs ( poly  h,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4775 of file kutil.cc.

4776 {
4777  int j=pos;
4778 
4780  initenterpairs(h,k,ecart,0,strat, atR);
4781  if ( (!strat->fromT)
4782  && ((strat->syzComp==0)
4783  ||(pGetComp(h)<=strat->syzComp)))
4784  {
4785  unsigned long h_sev = pGetShortExpVector(h);
4786  loop
4787  {
4788  if (j > k) break;
4789  clearS(h,h_sev, &j,&k,strat);
4790  j++;
4791  }
4792  }
4793 }
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:347
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3717
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
#define pGetComp(p)
Component.
Definition: polys.h:37
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1107
static Poly * h
Definition: janet.cc:972

◆ enterpairsShift()

void enterpairsShift ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 12492 of file kutil.cc.

12493 {
12494  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12495  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12496  int j=pos;
12497 
12499  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12500  if ( (!strat->fromT)
12501  && ((strat->syzComp==0)
12502  ||(pGetComp(h)<=strat->syzComp)))
12503  {
12504  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12505  unsigned long h_sev = pGetShortExpVector(h);
12506  loop
12507  {
12508  if (j > k) break;
12509  clearS(h,h_sev, &j,&k,strat);
12510  j++;
12511  }
12512  //Print("end clearS sl=%d\n",strat->sl);
12513  }
12514  // PrintS("end enterpairs\n");
12515 }
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:347
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
#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:12419
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1107
static Poly * h
Definition: janet.cc:972

◆ enterpairsSig()

void enterpairsSig ( poly  h,
poly  hSig,
int  from,
int  k,
int  ec,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4801 of file kutil.cc.

4802 {
4803  int j=pos;
4805  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4806  if ( (!strat->fromT)
4807  && ((strat->syzComp==0)
4808  ||(pGetComp(h)<=strat->syzComp)))
4809  {
4810  unsigned long h_sev = pGetShortExpVector(h);
4811  loop
4812  {
4813  if (j > k) break;
4814  clearS(h,h_sev, &j,&k,strat);
4815  j++;
4816  }
4817  }
4818 }
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:347
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3782
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
#define pGetComp(p)
Component.
Definition: polys.h:37
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1107
static Poly * h
Definition: janet.cc:972

◆ enterSBba()

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

Definition at line 9050 of file kutil.cc.

9051 {
9052  strat->news = TRUE;
9053  /*- puts p to the standardbasis s at position at -*/
9054  if (strat->sl == IDELEMS(strat->Shdl)-1)
9055  {
9056  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9057  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9058  (IDELEMS(strat->Shdl)+setmaxTinc)
9059  *sizeof(unsigned long));
9060  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9061  IDELEMS(strat->Shdl)*sizeof(int),
9062  (IDELEMS(strat->Shdl)+setmaxTinc)
9063  *sizeof(int));
9064  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9065  IDELEMS(strat->Shdl)*sizeof(int),
9066  (IDELEMS(strat->Shdl)+setmaxTinc)
9067  *sizeof(int));
9068  if (strat->lenS!=NULL)
9069  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9070  IDELEMS(strat->Shdl)*sizeof(int),
9071  (IDELEMS(strat->Shdl)+setmaxTinc)
9072  *sizeof(int));
9073  if (strat->lenSw!=NULL)
9074  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9075  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9076  (IDELEMS(strat->Shdl)+setmaxTinc)
9077  *sizeof(wlen_type));
9078  if (strat->fromQ!=NULL)
9079  {
9080  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9081  IDELEMS(strat->Shdl)*sizeof(int),
9082  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9083  }
9084  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9085  IDELEMS(strat->Shdl)+=setmaxTinc;
9086  strat->Shdl->m=strat->S;
9087  }
9088  if (atS <= strat->sl)
9089  {
9090 #ifdef ENTER_USE_MEMMOVE
9091  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9092  (strat->sl - atS + 1)*sizeof(poly));
9093  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9094  (strat->sl - atS + 1)*sizeof(int));
9095  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9096  (strat->sl - atS + 1)*sizeof(unsigned long));
9097  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9098  (strat->sl - atS + 1)*sizeof(int));
9099  if (strat->lenS!=NULL)
9100  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9101  (strat->sl - atS + 1)*sizeof(int));
9102  if (strat->lenSw!=NULL)
9103  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9104  (strat->sl - atS + 1)*sizeof(wlen_type));
9105 #else
9106  for (i=strat->sl+1; i>=atS+1; i--)
9107  {
9108  strat->S[i] = strat->S[i-1];
9109  strat->ecartS[i] = strat->ecartS[i-1];
9110  strat->sevS[i] = strat->sevS[i-1];
9111  strat->S_2_R[i] = strat->S_2_R[i-1];
9112  }
9113  if (strat->lenS!=NULL)
9114  for (i=strat->sl+1; i>=atS+1; i--)
9115  strat->lenS[i] = strat->lenS[i-1];
9116  if (strat->lenSw!=NULL)
9117  for (i=strat->sl+1; i>=atS+1; i--)
9118  strat->lenSw[i] = strat->lenSw[i-1];
9119 #endif
9120  }
9121  if (strat->fromQ!=NULL)
9122  {
9123 #ifdef ENTER_USE_MEMMOVE
9124  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9125  (strat->sl - atS + 1)*sizeof(int));
9126 #else
9127  for (i=strat->sl+1; i>=atS+1; i--)
9128  {
9129  strat->fromQ[i] = strat->fromQ[i-1];
9130  }
9131 #endif
9132  strat->fromQ[atS]=0;
9133  }
9134 
9135  /*- save result -*/
9136  poly pp=p.p;
9137  strat->S[atS] = pp;
9138  if (strat->honey) strat->ecartS[atS] = p.ecart;
9139  if (p.sev == 0)
9140  p.sev = pGetShortExpVector(pp);
9141  else
9142  assume(p.sev == pGetShortExpVector(pp));
9143  strat->sevS[atS] = p.sev;
9144  strat->ecartS[atS] = p.ecart;
9145  strat->S_2_R[atS] = atR;
9146  strat->sl++;
9147 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
wlen_set lenSw
Definition: kutil.h:311
int * S_2_R
Definition: kutil.h:335
char news
Definition: kutil.h:394
#define TRUE
Definition: auxiliary.h:98
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:312
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:310
intset ecartS
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3647
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:313
char honey
Definition: kutil.h:371
#define setmaxTinc
Definition: kutil.h:34
int * intset
Definition: kutil.h:49
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294

◆ entersets()

void entersets ( LObject  h)

◆ enterSSba()

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

Definition at line 9153 of file kutil.cc.

9154 {
9155  strat->news = TRUE;
9156  /*- puts p to the standardbasis s at position at -*/
9157  if (strat->sl == IDELEMS(strat->Shdl)-1)
9158  {
9159  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9160  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9161  (IDELEMS(strat->Shdl)+setmax)
9162  *sizeof(unsigned long));
9163  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9164  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9165  (IDELEMS(strat->Shdl)+setmax)
9166  *sizeof(unsigned long));
9167  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9168  IDELEMS(strat->Shdl)*sizeof(int),
9169  (IDELEMS(strat->Shdl)+setmax)
9170  *sizeof(int));
9171  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9172  IDELEMS(strat->Shdl)*sizeof(int),
9173  (IDELEMS(strat->Shdl)+setmax)
9174  *sizeof(int));
9175  if (strat->lenS!=NULL)
9176  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9177  IDELEMS(strat->Shdl)*sizeof(int),
9178  (IDELEMS(strat->Shdl)+setmax)
9179  *sizeof(int));
9180  if (strat->lenSw!=NULL)
9181  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9182  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9183  (IDELEMS(strat->Shdl)+setmax)
9184  *sizeof(wlen_type));
9185  if (strat->fromQ!=NULL)
9186  {
9187  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9188  IDELEMS(strat->Shdl)*sizeof(int),
9189  (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
9190  }
9191  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
9192  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmax);
9193  IDELEMS(strat->Shdl)+=setmax;
9194  strat->Shdl->m=strat->S;
9195  }
9196  // in a signature-based algorithm the following situation will never
9197  // appear due to the fact that the critical pairs are already sorted
9198  // by increasing signature.
9199  // True. However, in the case of integers we need to put the element
9200  // that caused the signature drop on the first position
9201  if (atS <= strat->sl)
9202  {
9203 #ifdef ENTER_USE_MEMMOVE
9204  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9205  (strat->sl - atS + 1)*sizeof(poly));
9206  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9207  (strat->sl - atS + 1)*sizeof(poly));
9208  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9209  (strat->sl - atS + 1)*sizeof(unsigned long));
9210  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9211  (strat->sl - atS + 1)*sizeof(int));
9212  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9213  (strat->sl - atS + 1)*sizeof(unsigned long));
9214  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9215  (strat->sl - atS + 1)*sizeof(int));
9216  if (strat->lenS!=NULL)
9217  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9218  (strat->sl - atS + 1)*sizeof(int));
9219  if (strat->lenSw!=NULL)
9220  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9221  (strat->sl - atS + 1)*sizeof(wlen_type));
9222 #else
9223  for (i=strat->sl+1; i>=atS+1; i--)
9224  {
9225  strat->S[i] = strat->S[i-1];
9226  strat->ecartS[i] = strat->ecartS[i-1];
9227  strat->sevS[i] = strat->sevS[i-1];
9228  strat->S_2_R[i] = strat->S_2_R[i-1];
9229  strat->sig[i] = strat->sig[i-1];
9230  strat->sevSig[i] = strat->sevSig[i-1];
9231  }
9232  if (strat->lenS!=NULL)
9233  for (i=strat->sl+1; i>=atS+1; i--)
9234  strat->lenS[i] = strat->lenS[i-1];
9235  if (strat->lenSw!=NULL)
9236  for (i=strat->sl+1; i>=atS+1; i--)
9237  strat->lenSw[i] = strat->lenSw[i-1];
9238 #endif
9239  }
9240  if (strat->fromQ!=NULL)
9241  {
9242 #ifdef ENTER_USE_MEMMOVE
9243  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9244  (strat->sl - atS + 1)*sizeof(int));
9245 #else
9246  for (i=strat->sl+1; i>=atS+1; i--)
9247  {
9248  strat->fromQ[i] = strat->fromQ[i-1];
9249  }
9250 #endif
9251  strat->fromQ[atS]=0;
9252  }
9253 
9254  /*- save result -*/
9255  strat->S[atS] = p.p;
9256  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9257  if (strat->honey) strat->ecartS[atS] = p.ecart;
9258  if (p.sev == 0)
9259  p.sev = pGetShortExpVector(p.p);
9260  else
9261  assume(p.sev == pGetShortExpVector(p.p));
9262  strat->sevS[atS] = p.sev;
9263  // during the interreduction process of a signature-based algorithm we do not
9264  // compute the signature at this point, but when the whole interreduction
9265  // process finishes, i.e. f5c terminates!
9266  if (p.sig != NULL)
9267  {
9268  if (p.sevSig == 0)
9269  p.sevSig = pGetShortExpVector(p.sig);
9270  else
9271  assume(p.sevSig == pGetShortExpVector(p.sig));
9272  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9273  }
9274  strat->ecartS[atS] = p.ecart;
9275  strat->S_2_R[atS] = atR;
9276  strat->sl++;
9277 #ifdef DEBUGF5
9278  int k;
9279  Print("--- LIST S: %d ---\n",strat->sl);
9280  for(k=0;k<=strat->sl;k++)
9281  {
9282  pWrite(strat->sig[k]);
9283  }
9284  PrintS("--- LIST S END ---\n");
9285 #endif
9286 }
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:80
wlen_set lenSw
Definition: kutil.h:311
int * S_2_R
Definition: kutil.h:335
char news
Definition: kutil.h:394
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:29
void pWrite(poly p)
Definition: polys.h:302
int k
Definition: cfEzgcd.cc:92
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:312
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:310
intset ecartS
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3647
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:313
char honey
Definition: kutil.h:371
int * intset
Definition: kutil.h:49
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294

◆ enterSyz()

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

Definition at line 9474 of file kutil.cc.

9475 {
9476  int i;
9477  strat->newt = TRUE;
9478  if (strat->syzl == strat->syzmax-1)
9479  {
9480  pEnlargeSet(&strat->syz,strat->syzmax,setmax);
9481  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9482  (strat->syzmax)*sizeof(unsigned long),
9483  ((strat->syzmax)+setmax)
9484  *sizeof(unsigned long));
9485  strat->syzmax += setmax;
9486  }
9487  if (atT < strat->syzl)
9488  {
9489 #ifdef ENTER_USE_MEMMOVE
9490  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9491  (strat->syzl-atT+1)*sizeof(poly));
9492  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9493  (strat->syzl-atT+1)*sizeof(unsigned long));
9494 #endif
9495  for (i=strat->syzl; i>=atT+1; i--)
9496  {
9497 #ifndef ENTER_USE_MEMMOVE
9498  strat->syz[i] = strat->syz[i-1];
9499  strat->sevSyz[i] = strat->sevSyz[i-1];
9500 #endif
9501  }
9502  }
9503  //i = strat->syzl;
9504  i = atT;
9505  //Makes sure the syz saves just the signature
9506  #ifdef HAVE_RINGS
9508  pNext(p.sig) = NULL;
9509  #endif
9510  strat->syz[atT] = p.sig;
9511  strat->sevSyz[atT] = p.sevSig;
9512  strat->syzl++;
9513 #if F5DEBUG
9514  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9515  pWrite(strat->syz[atT]);
9516 #endif
9517  // recheck pairs in strat->L with new rule and delete correspondingly
9518  int cc = strat->Ll;
9519  while (cc>-1)
9520  {
9521  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9522  //printf("\npLmShDivBy(syz,L) = %i\nn_DivBy(L,syz) = %i\n pLtCmp(L,syz) = %i",p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],strat->L[cc].sig, ~strat->L[cc].sevSig, currRing), n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing), pLtCmp(strat->L[cc].sig,strat->syz[atT])==1);
9523  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9524  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9525  #ifdef HAVE_RINGS
9526  &&((!rField_is_Ring(currRing))
9527  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9528  #endif
9529  )
9530  {
9531  //printf("\nYES!\n");
9532  deleteInL(strat->L,&strat->Ll,cc,strat);
9533  }
9534  cc--;
9535  }
9536 //#if 1
9537 #ifdef DEBUGF5
9538  PrintS("--- Syzygies ---\n");
9539  Print("syzl %d\n",strat->syzl);
9540  Print("syzmax %d\n",strat->syzmax);
9541  PrintS("--------------------------------\n");
9542  for(i=0;i<=strat->syzl-1;i++)
9543  {
9544  Print("%d - ",i);
9545  pWrite(strat->syz[i]);
9546  }
9547  PrintS("--------------------------------\n");
9548 #endif
9549 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:80
int syzmax
Definition: kutil.h:342
int Ll
Definition: kutil.h:344
char newt
Definition: kutil.h:395
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:29
void pWrite(poly p)
Definition: polys.h:302
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3647
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
unsigned long * sevSyz
Definition: kutil.h:314
polyset syz
Definition: kutil.h:298
int p
Definition: cfModGcd.cc:4019
int syzl
Definition: kutil.h:342

◆ enterT()

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

Definition at line 9291 of file kutil.cc.

9292 {
9293  int i;
9294 
9295  pp_Test(p.p, currRing, p.tailRing);
9296  assume(strat->tailRing == p.tailRing);
9297  // redMoraNF complains about this -- but, we don't really
9298  // neeed this so far
9299  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9300  assume(p.FDeg == p.pFDeg());
9301  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9302 
9303 #ifdef KDEBUG
9304  // do not put an LObject twice into T:
9305  for(i=strat->tl;i>=0;i--)
9306  {
9307  if (p.p==strat->T[i].p)
9308  {
9309  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9310  return;
9311  }
9312  }
9313 #endif
9314 
9315 #ifdef HAVE_TAIL_RING
9316  if (currRing!=strat->tailRing)
9317  {
9318  p.t_p=p.GetLmTailRing();
9319  }
9320 #endif
9321  strat->newt = TRUE;
9322  if (atT < 0)
9323  atT = strat->posInT(strat->T, strat->tl, p);
9324  if (strat->tl == strat->tmax-1)
9325  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9326  if (atT <= strat->tl)
9327  {
9328 #ifdef ENTER_USE_MEMMOVE
9329  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9330  (strat->tl-atT+1)*sizeof(TObject));
9331  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9332  (strat->tl-atT+1)*sizeof(unsigned long));
9333 #endif
9334  for (i=strat->tl+1; i>=atT+1; i--)
9335  {
9336 #ifndef ENTER_USE_MEMMOVE
9337  strat->T[i] = strat->T[i-1];
9338  strat->sevT[i] = strat->sevT[i-1];
9339 #endif
9340  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9341  }
9342  }
9343 
9344  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9345  {
9347  (strat->tailRing != NULL ?
9348  strat->tailRing : currRing),
9349  strat->tailBin);
9350  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9351  }
9352  strat->T[atT] = (TObject) p;
9353  //printf("\nenterT: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9354 
9355  if (pNext(p.p) != NULL)
9356  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9357  else
9358  strat->T[atT].max_exp = NULL;
9359 
9360  strat->tl++;
9361  strat->R[strat->tl] = &(strat->T[atT]);
9362  strat->T[atT].i_r = strat->tl;
9363  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9364  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9365  kTest_T(&(strat->T[atT]));
9366 }
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
char newt
Definition: kutil.h:395
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
unsigned long * sevT
Definition: kutil.h:316
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:516
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:166
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:885
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:333
static unsigned pLength(poly a)
Definition: p_polys.h:193
int tmax
Definition: kutil.h:343
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
omBin tailBin
Definition: kutil.h:338
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define setmaxTinc
Definition: kutil.h:34
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:645
class sTObject TObject
Definition: kutil.h:53
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:1130

◆ enterT_strong()

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

Definition at line 9372 of file kutil.cc.

9373 {
9375  int i;
9376 
9377  pp_Test(p.p, currRing, p.tailRing);
9378  assume(strat->tailRing == p.tailRing);
9379  // redMoraNF complains about this -- but, we don't really
9380  // neeed this so far
9381  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9382  assume(p.FDeg == p.pFDeg());
9383  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9384 
9385 #ifdef KDEBUG
9386  // do not put an LObject twice into T:
9387  for(i=strat->tl;i>=0;i--)
9388  {
9389  if (p.p==strat->T[i].p)
9390  {
9391  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9392  return;
9393  }
9394  }
9395 #endif
9396 
9397 #ifdef HAVE_TAIL_RING
9398  if (currRing!=strat->tailRing)
9399  {
9400  p.t_p=p.GetLmTailRing();
9401  }
9402 #endif
9403  strat->newt = TRUE;
9404  if (atT < 0)
9405  atT = strat->posInT(strat->T, strat->tl, p);
9406  if (strat->tl == strat->tmax-1)
9407  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9408  if (atT <= strat->tl)
9409  {
9410 #ifdef ENTER_USE_MEMMOVE
9411  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9412  (strat->tl-atT+1)*sizeof(TObject));
9413  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9414  (strat->tl-atT+1)*sizeof(unsigned long));
9415 #endif
9416  for (i=strat->tl+1; i>=atT+1; i--)
9417  {
9418 #ifndef ENTER_USE_MEMMOVE
9419  strat->T[i] = strat->T[i-1];
9420  strat->sevT[i] = strat->sevT[i-1];
9421 #endif
9422  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9423  }
9424  }
9425 
9426  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9427  {
9429  (strat->tailRing != NULL ?
9430  strat->tailRing : currRing),
9431  strat->tailBin);
9432  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9433  }
9434  strat->T[atT] = (TObject) p;
9435  //printf("\nenterT_strong: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9436 
9437  if (pNext(p.p) != NULL)
9438  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9439  else
9440  strat->T[atT].max_exp = NULL;
9441 
9442  strat->tl++;
9443  strat->R[strat->tl] = &(strat->T[atT]);
9444  strat->T[atT].i_r = strat->tl;
9445  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9446  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9447  #if 1
9449  && !n_IsUnit(p.p->coef, currRing->cf))
9450  {
9451  for(i=strat->tl;i>=0;i--)
9452  {
9453  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9454  {
9455  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9456  }
9457  }
9458  }
9459  /*
9460  printf("\nThis is T:\n");
9461  for(i=strat->tl;i>=0;i--)
9462  {
9463  pWrite(strat->T[i].p);
9464  }
9465  //getchar();*/
9466  #endif
9467  kTest_T(&(strat->T[atT]));
9468 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
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:515
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
char newt
Definition: kutil.h:395
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
unsigned long * sevT
Definition: kutil.h:316
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:516
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:166
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:885
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:333
static unsigned pLength(poly a)
Definition: p_polys.h:193
int tmax
Definition: kutil.h:343
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1496
ring tailRing
Definition: kutil.h:336
omBin tailBin
Definition: kutil.h:338
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define setmaxTinc
Definition: kutil.h:34
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:645
class sTObject TObject
Definition: kutil.h:53
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:1130

◆ enterTShift()

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

Definition at line 12523 of file kutil.cc.

12524 {
12525  /* determine how many elements we have to insert */
12526  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12527  /* hence, a total number of elt's to add is: */
12528  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12529 
12530  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12531 
12532 #ifdef PDEBUG
12533  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12534 #endif
12535  int i;
12536 
12537  if (atT < 0)
12538  atT = strat->posInT(strat->T, strat->tl, p);
12539 
12540  /* can call enterT in a sequence, e.g. */
12541 
12542  /* shift0 = it's our model for further shifts */
12543  enterT(p,strat,atT);
12544  LObject qq;
12545  for (i=1; i<=toInsert; i++) // toIns - 1?
12546  {
12547  qq = p; //qq.Copy();
12548  qq.t_p=NULL;
12549  qq.max_exp = NULL;
12550  if (p.p!=NULL)
12551  qq.p = p_LPshift(p_Copy(p.p,currRing), i, uptodeg, lV, currRing); // direct shift
12552  qq.GetTP();
12553  // update q.sev
12554  qq.sev = pGetShortExpVector(qq.p);
12555  #ifdef KTEST
12556  kTest_T(&qq, strat->tailRing, -1, 'L');
12557  #endif
12558  /* enter it into T, first el't is with the shift 0 */
12559  // compute the position for qq
12560  atT = strat->posInT(strat->T, strat->tl, qq);
12561  enterT(qq,strat,atT);
12562  }
12563 /* Q: what to do with this one in the orig enterT ? */
12564 /* strat->R[strat->tl] = &(strat->T[atT]); */
12565 /* Solution: it is done by enterT each time separately */
12566 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:321
class sLObject LObject
Definition: kutil.h:54
int tl
Definition: kutil.h:343
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9291
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....
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:645

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 9970 of file kutil.cc.

9971 {
9972  /*- release temp data -*/
9973  cleanT(strat);
9974  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
9975  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
9976  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
9977  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
9978  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
9979  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
9980  /*- set L: should be empty -*/
9981  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
9982  /*- set B: should be empty -*/
9983  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
9984  pLmFree(&strat->tail);
9985  strat->syzComp=0;
9986 }
int syzComp
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:335
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
unsigned long * sevT
Definition: kutil.h:316
void * ADDRESS
Definition: auxiliary.h:133
int Bmax
Definition: kutil.h:345
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:343
intset ecartS
Definition: kutil.h:300
LSet L
Definition: kutil.h:318
void cleanT(kStrategy strat)
Definition: kutil.cc:537
LSet B
Definition: kutil.h:319
int Lmax
Definition: kutil.h:344
unsigned long * sevS
Definition: kutil.h:313
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:317
ideal Shdl
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:53

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10163 of file kutil.cc.

10164 {
10165  /*- release temp data -*/
10167  cleanTSbaRing(strat);
10168  else
10169  cleanT(strat);
10170  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10171  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10172  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10173  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10174  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10175  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10176  if(strat->syzmax>0)
10177  {
10178  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10179  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10180  if (strat->sbaOrder == 1)
10181  {
10182  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10183  }
10184  }
10185  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10186  /*- set L: should be empty -*/
10187  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10188  /*- set B: should be empty -*/
10189  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10190  /*- set sig: no need for the signatures anymore -*/
10191  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10192  pLmDelete(&strat->tail);
10193  strat->syzComp=0;
10194 }
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
int syzComp
Definition: kutil.h:347
int syzmax
Definition: kutil.h:342
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:335
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void cleanTSbaRing(kStrategy strat)
Definition: kutil.cc:590
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:316
void * ADDRESS
Definition: auxiliary.h:133
int Bmax
Definition: kutil.h:345
unsigned sbaOrder
Definition: kutil.h:307
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:343
intset ecartS
Definition: kutil.h:300
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
void cleanT(kStrategy strat)
Definition: kutil.cc:537
LSet B
Definition: kutil.h:319
int Lmax
Definition: kutil.h:344
int syzidxmax
Definition: kutil.h:342
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
unsigned long * sevSyz
Definition: kutil.h:314
polyset syz
Definition: kutil.h:298
TSet T
Definition: kutil.h:317
ideal Shdl
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:53
intset syzIdx
Definition: kutil.h:304

◆ f5c()

void f5c ( kStrategy  strat,
int &  olddeg,
int &  minimcnt,
int &  hilbeledeg,
int &  hilbcount,
int &  srmax,
int &  lrmax,
int &  reduc,
ideal  Q,
intvec w,
intvec hilb 
)

Definition at line 3515 of file kstd2.cc.

3518 {
3519  int Ll_old, red_result = 1;
3520  int pos = 0;
3521  hilbeledeg=1;
3522  hilbcount=0;
3523  minimcnt=0;
3524  srmax = 0; // strat->sl is 0 at this point
3525  reduc = olddeg = lrmax = 0;
3526  // we cannot use strat->T anymore
3527  //cleanT(strat);
3528  //strat->tl = -1;
3529  Ll_old = strat->Ll;
3530  while (strat->tl >= 0)
3531  {
3532  if(!strat->T[strat->tl].is_redundant)
3533  {
3534  LObject h;
3535  h.p = strat->T[strat->tl].p;
3536  h.tailRing = strat->T[strat->tl].tailRing;
3537  h.t_p = strat->T[strat->tl].t_p;
3538  if (h.p!=NULL)
3539  {
3540  if (currRing->OrdSgn==-1)
3541  {
3542  cancelunit(&h);
3543  deleteHC(&h, strat);
3544  }
3545  if (h.p!=NULL)
3546  {
3548  {
3549  h.pCleardenom(); // also does remove Content
3550  }
3551  else
3552  {
3553  h.pNorm();
3554  }
3555  strat->initEcart(&h);
3557  pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
3558  else
3559  pos = strat->Ll+1;
3560  h.sev = pGetShortExpVector(h.p);
3561  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
3562  }
3563  }
3564  }
3565  strat->tl--;
3566  }
3567  strat->sl = -1;
3568 #if 0
3569 //#ifdef HAVE_TAIL_RING
3570  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
3571  kStratInitChangeTailRing(strat);
3572 #endif
3573  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
3574  //strat->sl = -1;
3575  /* picks the last element from the lazyset L */
3576  while (strat->Ll>Ll_old)
3577  {
3578  strat->P = strat->L[strat->Ll];
3579  strat->Ll--;
3580 //#if 1
3581 #ifdef DEBUGF5
3582  PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3583  PrintS("-------------------------------------------------\n");
3584  pWrite(pHead(strat->P.p));
3585  pWrite(pHead(strat->P.p1));
3586  pWrite(pHead(strat->P.p2));
3587  printf("%d\n",strat->tl);
3588  PrintS("-------------------------------------------------\n");
3589 #endif
3590  if (pNext(strat->P.p) == strat->tail)
3591  {
3592  // deletes the short spoly
3593  if (rField_is_Ring(currRing))
3594  pLmDelete(strat->P.p);
3595  else
3596  pLmFree(strat->P.p);
3597 
3598  // TODO: needs some masking
3599  // TODO: masking needs to vanish once the signature
3600  // sutff is completely implemented
3601  strat->P.p = NULL;
3602  poly m1 = NULL, m2 = NULL;
3603 
3604  // check that spoly creation is ok
3605  while (strat->tailRing != currRing &&
3606  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3607  {
3608  assume(m1 == NULL && m2 == NULL);
3609  // if not, change to a ring where exponents are at least
3610  // large enough
3611  if (!kStratChangeTailRing(strat))
3612  {
3613  WerrorS("OVERFLOW...");
3614  break;
3615  }
3616  }
3617  // create the real one
3618  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3619  strat->tailRing, m1, m2, strat->R);
3620  }
3621  else if (strat->P.p1 == NULL)
3622  {
3623  if (strat->minim > 0)
3624  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3625  // for input polys, prepare reduction
3626  if(!rField_is_Ring(currRing))
3627  strat->P.PrepareRed(strat->use_buckets);
3628  }
3629 
3630  if (strat->P.p == NULL && strat->P.t_p == NULL)
3631  {
3632  red_result = 0;
3633  }
3634  else
3635  {
3636  if (TEST_OPT_PROT)
3637  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3638  &olddeg,&reduc,strat, red_result);
3639 
3640 #ifdef DEBUGF5
3641  PrintS("Poly before red: ");
3642  pWrite(strat->P.p);
3643 #endif
3644  /* complete reduction of the element chosen from L */
3645  red_result = strat->red2(&strat->P,strat);
3646  if (errorreported) break;
3647  }
3648 
3649  if (strat->overflow)
3650  {
3651  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
3652  }
3653 
3654  // reduction to non-zero new poly
3655  if (red_result == 1)
3656  {
3657  // get the polynomial (canonicalize bucket, make sure P.p is set)
3658  strat->P.GetP(strat->lmBin);
3659  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
3660  // but now, for entering S, T, we reset it
3661  // in the inhomogeneous case: FDeg == pFDeg
3662  if (strat->homog) strat->initEcart(&(strat->P));
3663 
3664  /* statistic */
3665  if (TEST_OPT_PROT) PrintS("s");
3666  int pos;
3667  #if 1
3668  if(!rField_is_Ring(currRing))
3669  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3670  else
3671  pos = posInSMonFirst(strat,strat->sl,strat->P.p);
3672  #else
3673  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3674  #endif
3675  // reduce the tail and normalize poly
3676  // in the ring case we cannot expect LC(f) = 1,
3677  // therefore we call pCleardenom instead of pNorm
3678 #if F5CTAILRED
3679  BOOLEAN withT = TRUE;
3681  {
3682  strat->P.pCleardenom();
3684  {
3685  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3686  strat->P.pCleardenom();
3687  }
3688  }
3689  else
3690  {
3691  strat->P.pNorm();
3693  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3694  }
3695 #endif
3696 #ifdef KDEBUG
3697  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3698 #endif /* KDEBUG */
3699 
3700  // min_std stuff
3701  if ((strat->P.p1==NULL) && (strat->minim>0))
3702  {
3703  if (strat->minim==1)
3704  {
3705  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3706  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3707  }
3708  else
3709  {
3710  strat->M->m[minimcnt]=strat->P.p2;
3711  strat->P.p2=NULL;
3712  }
3713  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3714  pNext(strat->M->m[minimcnt])
3715  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3716  strat->tailRing, currRing,
3717  currRing->PolyBin);
3718  minimcnt++;
3719  }
3720 
3721  // enter into S, L, and T
3722  // here we need to recompute new signatures, but those are trivial ones
3723  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3724  {
3725  enterT(strat->P, strat);
3726  // posInS only depends on the leading term
3727  strat->enterS(strat->P, pos, strat, strat->tl);
3728 //#if 1
3729 #ifdef DEBUGF5
3730  PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
3731  pWrite(pHead(strat->S[strat->sl]));
3732  pWrite(strat->sig[strat->sl]);
3733 #endif
3734  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3735  }
3736  // Print("[%d]",hilbeledeg);
3737  kDeleteLcm(&strat->P);
3738  if (strat->sl>srmax) srmax = strat->sl;
3739  }
3740  else
3741  {
3742  // adds signature of the zero reduction to
3743  // strat->syz. This is the leading term of
3744  // syzygy and can be used in syzCriterion()
3745  // the signature is added if and only if the
3746  // pair was not detected by the rewritten criterion in strat->red = redSig
3747  if (strat->P.p1 == NULL && strat->minim > 0)
3748  {
3749  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3750  }
3751  }
3752 
3753 #ifdef KDEBUG
3754  memset(&(strat->P), 0, sizeof(strat->P));
3755 #endif /* KDEBUG */
3756  }
3757  int cc = 0;
3758  while (cc<strat->tl+1)
3759  {
3760  strat->T[cc].sig = pOne();
3761  p_SetComp(strat->T[cc].sig,cc+1,currRing);
3762  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
3763  strat->sig[cc] = strat->T[cc].sig;
3764  strat->sevSig[cc] = strat->T[cc].sevSig;
3765  strat->T[cc].is_sigsafe = TRUE;
3766  cc++;
3767  }
3768  strat->max_lower_index = strat->tl;
3769  // set current signature index of upcoming iteration step
3770  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
3771  // the corresponding syzygy rules correctly
3772  strat->currIdx = cc+1;
3773  for (int cd=strat->Ll; cd>=0; cd--)
3774  {
3775  p_SetComp(strat->L[cd].sig,cc+1,currRing);
3776  cc++;
3777  }
3778  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
3779  strat->Shdl->m[cc] = NULL;
3780  #if 0
3781  printf("\nAfter f5c sorting\n");
3782  for(int i=0;i<=strat->sl;i++)
3783  pWrite(pHead(strat->S[i]));
3784  getchar();
3785  #endif
3786 //#if 1
3787 #if DEBUGF5
3788  PrintS("------------------- STRAT S ---------------------\n");
3789  cc = 0;
3790  while (cc<strat->tl+1)
3791  {
3792  pWrite(pHead(strat->S[cc]));
3793  pWrite(strat->sig[cc]);
3794  printf("- - - - - -\n");
3795  cc++;
3796  }
3797  PrintS("-------------------------------------------------\n");
3798  PrintS("------------------- STRAT T ---------------------\n");
3799  cc = 0;
3800  while (cc<strat->tl+1)
3801  {
3802  pWrite(pHead(strat->T[cc].p));
3803  pWrite(strat->T[cc].sig);
3804  printf("- - - - - -\n");
3805  cc++;
3806  }
3807  PrintS("-------------------------------------------------\n");
3808  PrintS("------------------- STRAT L ---------------------\n");
3809  cc = 0;
3810  while (cc<strat->Ll+1)
3811  {
3812  pWrite(pHead(strat->L[cc].p));
3813  pWrite(pHead(strat->L[cc].p1));
3814  pWrite(pHead(strat->L[cc].p2));
3815  pWrite(strat->L[cc].sig);
3816  printf("- - - - - -\n");
3817  cc++;
3818  }
3819  PrintS("-------------------------------------------------\n");
3820  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
3821 #endif
3822 
3823 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
Definition: kutil.cc:5052
void PrintLn()
Definition: reporter.cc:310
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7745
CanonicalForm cd(bCommonDen(FF))
Definition: cfModGcd.cc:4030
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6315
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int tl
Definition: kutil.h:343
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:103
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
void pWrite(poly p)
Definition: polys.h:302
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define Q
Definition: sirandom.c:25
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:351
char use_buckets
Definition: kutil.h:377
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11172
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9291
void(* initEcart)(TObject *L)
Definition: kutil.h:271
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:752
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
LObject P
Definition: kutil.h:293
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:327
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define pOne()
Definition: polys.h:309
TObject ** R
Definition: kutil.h:333
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10601
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:28
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:127
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
const CanonicalForm & w
Definition: facAbsFact.cc:55
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
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:341
TSet T
Definition: kutil.h:317
static Poly * h
Definition: janet.cc:972
int BOOLEAN
Definition: auxiliary.h:85

◆ faugereRewCriterion()

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

Definition at line 7045 of file kutil.cc.

7046 {
7047  //printf("Faugere Rewritten Criterion\n");
7049  return FALSE;
7050 //#if 1
7051 #ifdef DEBUGF5
7052  PrintS("rewritten criterion checks: ");
7053  pWrite(sig);
7054 #endif
7055  for(int k = strat->sl; k>=start; k--)
7056  {
7057 //#if 1
7058 #ifdef DEBUGF5
7059  PrintS("checking with: ");
7060  pWrite(strat->sig[k]);
7061  pWrite(pHead(strat->S[k]));
7062 #endif
7063  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7064  {
7065 //#if 1
7066 #ifdef DEBUGF5
7067  PrintS("DELETE!\n");
7068 #endif
7069  strat->nrrewcrit++;
7070  return TRUE;
7071  }
7072  //k--;
7073  }
7074 #ifdef DEBUGF5
7075  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7076  for(int kk = 0; kk<strat->sl+1; kk++)
7077  {
7078  pWrite(pHead(strat->S[kk]));
7079  }
7080  PrintS("------------------------------\n");
7081 #endif
7082  return FALSE;
7083 }
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:302
int k
Definition: cfEzgcd.cc:92
int nrrewcrit
Definition: kutil.h:355
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
polyset S
Definition: kutil.h:297
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341

◆ finalReduceByMon()

void finalReduceByMon ( kStrategy  strat)

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

Definition at line 10988 of file kutil.cc.

10989 {
10990  assume(strat->tl<0); /* can only be called with no elements in T:
10991  i.e. after exitBuchMora */
10992  /* do not use strat->S, strat->sl as they may be out of sync*/
10993  if(!nCoeff_is_Z(currRing->cf))
10994  return;
10995  poly p,pp;
10996  for(int j = 0; j<IDELEMS(strat->Shdl); j++)
10997  {
10998  if((strat->Shdl->m[j]!=NULL)&&(pNext(strat->Shdl->m[j]) == NULL))
10999  {
11000  for(int i = 0; i<IDELEMS(strat->Shdl); i++)
11001  {
11002  if((i != j) && (strat->Shdl->m[i] != NULL))
11003  {
11004  p = strat->Shdl->m[i];
11005  while((p!=NULL) && pLmDivisibleBy(strat->Shdl->m[j], p))
11006  {
11007  number dummy = n_IntMod(p->coef, strat->Shdl->m[j]->coef, currRing->cf);
11008  if (!nEqual(dummy,p->coef))
11009  {
11010  if (nIsZero(dummy))
11011  {
11012  nDelete(&dummy);
11013  pLmDelete(&strat->Shdl->m[i]);
11014  p=strat->Shdl->m[i];
11015  }
11016  else
11017  {
11018  p_SetCoeff(p,dummy,currRing);
11019  break;
11020  }
11021  }
11022  else
11023  {
11024  nDelete(&dummy);
11025  break;
11026  }
11027  }
11028  if (p!=NULL)
11029  {
11030  pp = pNext(p);
11031  while(pp != NULL)
11032  {
11033  if(pLmDivisibleBy(strat->Shdl->m[j], pp))
11034  {
11035  number dummy = n_IntMod(pp->coef, strat->Shdl->m[j]->coef, currRing->cf);
11036  if (!nEqual(dummy,pp->coef))
11037  {
11038  p_SetCoeff(pp,dummy,currRing);
11039  if(nIsZero(pp->coef))
11040  {
11041  pLmDelete(&pNext(p));
11042  pp = pNext(p);
11043  }
11044  else
11045  {
11046  p = pp;
11047  pp = pNext(p);
11048  }
11049  }
11050  else
11051  {
11052  nDelete(&dummy);
11053  p = pp;
11054  pp = pNext(p);
11055  }
11056  }
11057  else
11058  {
11059  p = pp;
11060  pp = pNext(p);
11061  }
11062  }
11063  }
11064  }
11065  }
11066  //idPrint(strat->Shdl);
11067  }
11068  }
11069  idSkipZeroes(strat->Shdl);
11070 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:343
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define nEqual(n1, n2)
Definition: numbers.h:21
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define nDelete(n)
Definition: numbers.h:17
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294

◆ findMinLMPair()

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

◆ freegb()

ideal freegb ( ideal  I,
int  uptodeg,
int  lVblock 
)

Definition at line 4200 of file kstd2.cc.

4201 {
4202  /* todo main call */
4203 
4204  /* assume: ring is prepared, ideal is copied into shifted ring */
4205  /* uptodeg and lVblock are correct - test them! */
4206 
4207  /* check whether the ideal is in V */
4208 
4209 // if (0)
4210  if (! ideal_isInV(I,lVblock) )
4211  {
4212  WerrorS("The input ideal contains incorrectly encoded elements! ");
4213  return(NULL);
4214  }
4215 
4216  // kStrategy strat = new skStrategy;
4217  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
4218  /* at the moment:
4219 - no quotient (check)
4220 - no *w, no *hilb
4221  */
4222  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
4223  int newIdeal, intvec *vw) */
4224  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
4225  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
4226  idSkipZeroes(RS);
4227  return(RS);
4228 }
int ideal_isInV(ideal I, int lV)
Definition: shiftgb.cc:305
void WerrorS(const char *s)
Definition: feFopen.cc:24
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, int uptodeg, int lV)
Definition: kstd1.cc:2564
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:10

◆ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 467 of file kutil.cc.

468 {
469  int j,/*k,*/p;
470 
471  strat->kHEdgeFound=FALSE;
472  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
473  {
474  return;
475  }
476  if (strat->ak > 1) /*we are in the module case*/
477  {
478  return; // until ....
479  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
480  // return FALSE;
481  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
482  // return FALSE;
483  }
484  // k = 0;
485  p=pIsPurePower(pp);
486  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(pp),currRing->cf))) return;
487  if (p!=0) strat->NotUsedAxis[p] = FALSE;
488  /*- the leading term of pp is a power of the p-th variable -*/
489  for (j=(currRing->N);j>0; j--)
490  {
491  if (strat->NotUsedAxis[j])
492  {
493  return;
494  }
495  }
496  strat->kHEdgeFound=TRUE;
497 }
#define pIsPurePower(p)
Definition: polys.h:243
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:370
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:515
#define FALSE
Definition: auxiliary.h:94
BOOLEAN * NotUsedAxis
Definition: kutil.h:325
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:346
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ homogTest()

BOOLEAN homogTest ( polyset  F,
int  Fmax 
)

◆ ind2()

long ind2 ( long  arg)

Definition at line 4060 of file kutil.cc.

4061 {
4062  long ind = 0;
4063  if (arg <= 0) return 0;
4064  while (arg%2 == 0)
4065  {
4066  arg = arg / 2;
4067  ind++;
4068  }
4069  return ind;
4070 }

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4072 of file kutil.cc.

4073 {
4074  long ind = 0;
4075  if (arg <= 0) return 0;
4076  if (arg%2 == 1) { arg--; }
4077  while (arg > 0)
4078  {
4079  ind += ind2(arg);
4080  arg = arg - 2;
4081  }
4082  return ind;
4083 }
long ind2(long arg)
Definition: kutil.cc:4060

◆ initBba()

void initBba ( kStrategy  strat)

Definition at line 1336 of file kstd1.cc.

1337 {
1338  /* setting global variables ------------------- */
1339  strat->enterS = enterSBba;
1340  strat->red = redHoney;
1341  if (strat->honey)
1342  strat->red = redHoney;
1343  else if (currRing->pLexOrder && !strat->homog)
1344  strat->red = redLazy;
1345  else
1346  {
1347  strat->LazyPass *=4;
1348  strat->red = redHomog;
1349  }
1350  if (rField_is_Ring(currRing))
1351  {
1352  strat->red = redRing;
1353  }
1354  if (currRing->pLexOrder && strat->honey)
1355  strat->initEcart = initEcartNormal;
1356  else
1357  strat->initEcart = initEcartBBA;
1358  if (strat->honey)
1360  else
1362 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1363 // {
1364 // //interred machen Aenderung
1365 // strat->pOrigFDeg=pFDeg;
1366 // strat->pOrigLDeg=pLDeg;
1367 // //h=ggetid("ecart");
1368 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1369 // //{
1370 // // ecartWeights=iv2array(IDINTVEC(h));
1371 // //}
1372 // //else
1373 // {
1374 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1375 // /*uses automatic computation of the ecartWeights to set them*/
1376 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1377 // }
1378 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1379 // if (TEST_OPT_PROT)
1380 // {
1381 // for(i=1; i<=(currRing->N); i++)
1382 // Print(" %d",ecartWeights[i]);
1383 // PrintLn();
1384 // mflush();
1385 // }
1386 // }
1387 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1272
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:438
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:269
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:545
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1387
void(* initEcart)(TObject *L)
Definition: kutil.h:271
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1242
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1279
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
char homog
Definition: kutil.h:366
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
void initEcartNormal(TObject *h)
Definition: kutil.cc:1257
int LazyPass
Definition: kutil.h:346
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050

◆ initBbaShift()

void initBbaShift ( kStrategy  strat)

Definition at line 4360 of file kstd2.cc.

4361 {
4362  /* setting global variables ------------------- */
4363  strat->enterS = enterSBba; /* remains as is, we change enterT! */
4364 
4365  strat->red = redFirstShift; /* no redHomog ! */
4366 
4367  if (currRing->pLexOrder && strat->honey)
4368  strat->initEcart = initEcartNormal;
4369  else
4370  strat->initEcart = initEcartBBA;
4371  if (strat->honey)
4373  else
4375 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
4376 // {
4377 // //interred machen Aenderung
4378 // pFDegOld=currRing->pFDeg;
4379 // pLDegOld=pLDeg;
4380 // //h=ggetid("ecart");
4381 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
4382 // //{
4383 // // ecartWeights=iv2array(IDINTVEC(h));
4384 // //}
4385 // //else
4386 // {
4387 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
4388 // /*uses automatic computation of the ecartWeights to set them*/
4389 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
4390 // }
4391 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
4392 // if (TEST_OPT_PROT)
4393 // {
4394 // for(int i=1; i<=rVar(currRing); i++)
4395 // Print(" %d",ecartWeights[i]);
4396 // PrintLn();
4397 // mflush();
4398 // }
4399 // }
4400 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1272
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:269
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:4234
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1279
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
void initEcartNormal(TObject *h)
Definition: kutil.cc:1257
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050

◆ initBuchMora()

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

Definition at line 9894 of file kutil.cc.

9895 {
9896  strat->interpt = BTEST1(OPT_INTERRUPT);
9897  strat->kHEdge=NULL;
9899  /*- creating temp data structures------------------- -*/
9900  strat->cp = 0;
9901  strat->c3 = 0;
9902  strat->tail = pInit();
9903  /*- set s -*/
9904  strat->sl = -1;
9905  /*- set L -*/
9906  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
9907  strat->Ll = -1;
9908  strat->L = initL(strat->Lmax);
9909  /*- set B -*/
9910  strat->Bmax = setmaxL;
9911  strat->Bl = -1;
9912  strat->B = initL();
9913  /*- set T -*/
9914  strat->tl = -1;
9915  strat->tmax = setmaxT;
9916  strat->T = initT();
9917  strat->R = initR();
9918  strat->sevT = initsevT();
9919  /*- init local data struct.---------------------------------------- -*/
9920  strat->P.ecart=0;
9921  strat->P.length=0;
9922  strat->P.pLength=0;
9924  {
9925  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
9926  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
9927  }
9929  {
9930  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
9931  }
9932  else
9933  {
9934  if(TEST_OPT_SB_1)
9935  {
9936  int i;
9937  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
9938  for (i=strat->newIdeal;i<IDELEMS(F);i++)
9939  {
9940  P->m[i-strat->newIdeal] = F->m[i];
9941  F->m[i] = NULL;
9942  }
9943  initSSpecial(F,Q,P,strat);
9944  for (i=strat->newIdeal;i<IDELEMS(F);i++)
9945  {
9946  F->m[i] = P->m[i-strat->newIdeal];
9947  P->m[i-strat->newIdeal] = NULL;
9948  }
9949  idDelete(&P);
9950  }
9951  else
9952  {
9953  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
9954  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
9955  }
9956  }
9957  strat->fromT = FALSE;
9959  if ((!TEST_OPT_SB_1)
9960  || (rField_is_Ring(currRing))
9961  )
9962  {
9963  updateS(TRUE,strat);
9964  }
9965  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
9966  strat->fromQ=NULL;
9967  assume(kTest_TS(strat));
9968 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_REDTAIL
Definition: options.h:115
KINLINE TObject ** initR()
Definition: kInline.h:92
char fromT
Definition: kutil.h:373
char kHEdgeFound
Definition: kutil.h:370
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:320
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:340
char interpt
Definition: kutil.h:365
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:321
int tl
Definition: kutil.h:343
int Bl
Definition: kutil.h:345
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7958
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:316
int ak
Definition: kutil.h:346
#define setmaxLinc
Definition: kutil.h:31
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:345
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8360
#define setmaxT
Definition: kutil.h:33
#define kTest_TS(A)
Definition: kutil.h:644
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:312
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:293
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:343
int cp
Definition: kutil.h:340
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
int Lmax
Definition: kutil.h:344
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_SB_1
Definition: options.h:117
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8823
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
static LSet initL(int nr=setmaxL)
Definition: kutil.h:415
int newIdeal
Definition: kutil.h:350
ideal Shdl
Definition: kutil.h:294
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9570 of file kutil.cc.

9571 {
9573  strat->chainCrit=chainCritNormal;
9574  if (TEST_OPT_SB_1)
9575  strat->chainCrit=chainCritOpt_1;
9576 #ifdef HAVE_RINGS
9577  if (rField_is_Ring(currRing))
9578  {
9580  strat->chainCrit=chainCritRing;
9581  }
9582 #endif
9583 #ifdef HAVE_RATGRING
9584  if (rIsRatGRing(currRing))
9585  {
9586  strat->chainCrit=chainCritPart;
9587  /* enterOnePairNormal get rational part in it */
9588  }
9589 #endif
9590  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9591  && (!rIsPluralRing(currRing)))
9593 
9594  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9595  strat->Gebauer = strat->homog || strat->sugarCrit;
9596  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9597  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9598  strat->pairtest = NULL;
9599  /* alway use tailreduction, except:
9600  * - in local rings, - in lex order case, -in ring over extensions */
9602  //if(rHasMixedOrdering(currRing)==2)
9603  //{
9604  // strat->noTailReduction =TRUE;
9605  //}
9606 
9607 #ifdef HAVE_PLURAL
9608  // and r is plural_ring
9609  // hence this holds for r a rational_plural_ring
9610  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9611  { //or it has non-quasi-comm type... later
9612  strat->sugarCrit = FALSE;
9613  strat->Gebauer = FALSE;
9614  strat->honey = FALSE;
9615  }
9616 #endif
9617 
9618  // Coefficient ring?
9619  if (rField_is_Ring(currRing))
9620  {
9621  strat->sugarCrit = FALSE;
9622  strat->Gebauer = FALSE ;
9623  strat->honey = FALSE;
9624  }
9625  #ifdef KDEBUG
9626  if (TEST_OPT_DEBUG)
9627  {
9628  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9629  else PrintS("ideal/module is not homogeneous\n");
9630  }
9631  #endif
9632 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3140
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2158
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:419
BOOLEAN * pairtest
Definition: kutil.h:326
#define TEST_OPT_DEBUG
Definition: options.h:107
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1299
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1877
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:281
char sugarCrit
Definition: kutil.h:371
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3905
#define TEST_OPT_NOT_SUGAR
Definition: options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
void PrintS(const char *s)
Definition: reporter.cc:284
#define TEST_OPT_SUGARCRIT
Definition: options.h:106
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:366
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:282
char z2homog
Definition: kutil.h:368
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:127
#define TEST_OPT_SB_1
Definition: options.h:117
static bool rIsSCA(const ring r)
Definition: nc.h:190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3353
char Gebauer
Definition: kutil.h:372
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3428

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9721 of file kutil.cc.

9722 {
9724  {
9725  if (strat->honey)
9726  {
9727  strat->posInL = posInL15;
9728  // ok -- here is the deal: from my experiments for Singular-2-0
9729  // I conclude that that posInT_EcartpLength is the best of
9730  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9731  // see the table at the end of this file
9732  if (TEST_OPT_OLDSTD)
9733  strat->posInT = posInT15;
9734  else
9735  strat->posInT = posInT_EcartpLength;
9736  }
9737  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9738  {
9739  strat->posInL = posInL11;
9740  strat->posInT = posInT11;
9741  }
9742  else if (TEST_OPT_INTSTRATEGY)
9743  {
9744  strat->posInL = posInL11;
9745  strat->posInT = posInT11;
9746  }
9747  else
9748  {
9749  strat->posInL = posInL0;
9750  strat->posInT = posInT0;
9751  }
9752  //if (strat->minim>0) strat->posInL =posInLSpecial;
9753  if (strat->homog)
9754  {
9755  strat->posInL = posInL110;
9756  strat->posInT = posInT110;
9757  }
9758  }
9759  else
9760  {
9761  if (strat->homog)
9762  {
9763  strat->posInL = posInL11;
9764  strat->posInT = posInT11;
9765  }
9766  else
9767  {
9768  if ((currRing->order[0]==ringorder_c)
9769  ||(currRing->order[0]==ringorder_C))
9770  {
9771  strat->posInL = posInL17_c;
9772  strat->posInT = posInT17_c;
9773  }
9774  else
9775  {
9776  strat->posInL = posInL17;
9777  strat->posInT = posInT17;
9778  }
9779  }
9780  }
9781  if (strat->minim>0) strat->posInL =posInLSpecial;
9782  // for further tests only
9783  if ((BTEST1(11)) || (BTEST1(12)))
9784  strat->posInL = posInL11;
9785  else if ((BTEST1(13)) || (BTEST1(14)))
9786  strat->posInL = posInL13;
9787  else if ((BTEST1(15)) || (BTEST1(16)))
9788  strat->posInL = posInL15;
9789  else if ((BTEST1(17)) || (BTEST1(18)))
9790  strat->posInL = posInL17;
9791  if (BTEST1(11))
9792  strat->posInT = posInT11;
9793  else if (BTEST1(13))
9794  strat->posInT = posInT13;
9795  else if (BTEST1(15))
9796  strat->posInT = posInT15;
9797  else if ((BTEST1(17)))
9798  strat->posInT = posInT17;
9799  else if ((BTEST1(19)))
9800  strat->posInT = posInT19;
9801  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
9802  strat->posInT = posInT1;
9804 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6239
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6736
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5184
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6660
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6625
#define BTEST1(a)
Definition: options.h:34
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5552
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6537
int minim
Definition: kutil.h:351
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5173
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9705
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5242
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5754
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5981
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6830
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5647
char homog
Definition: kutil.h:366
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5395
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5938
char posInLDependsOnLength
Definition: kutil.h:383
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5881
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5513
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5484

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 9807 of file kutil.cc.

9808 {
9810  {
9811  if (strat->honey)
9812  {
9813  strat->posInL = posInL15Ring;
9814  // ok -- here is the deal: from my experiments for Singular-2-0
9815  // I conclude that that posInT_EcartpLength is the best of
9816  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9817  // see the table at the end of this file
9818  if (TEST_OPT_OLDSTD)
9819  strat->posInT = posInT15Ring;
9820  else
9821  strat->posInT = posInT_EcartpLength;
9822  }
9823  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9824  {
9825  strat->posInL = posInL11Ring;
9826  strat->posInT = posInT11;
9827  }
9828  else if (TEST_OPT_INTSTRATEGY)
9829  {
9830  strat->posInL = posInL11Ring;
9831  strat->posInT = posInT11;
9832  }
9833  else
9834  {
9835  strat->posInL = posInL0Ring;
9836  strat->posInT = posInT0;
9837  }
9838  //if (strat->minim>0) strat->posInL =posInLSpecial;
9839  if (strat->homog)
9840  {
9841  strat->posInL = posInL110Ring;
9842  strat->posInT = posInT110Ring;
9843  }
9844  }
9845  else
9846  {
9847  if (strat->homog)
9848  {
9849  //printf("\nHere 3\n");
9850  strat->posInL = posInL11Ring;
9851  strat->posInT = posInT11Ring;
9852  }
9853  else
9854  {
9855  if ((currRing->order[0]==ringorder_c)
9856  ||(currRing->order[0]==ringorder_C))
9857  {
9858  strat->posInL = posInL17_cRing;
9859  strat->posInT = posInT17_cRing;
9860  }
9861  else
9862  {
9863  strat->posInL = posInL11Ringls;
9864  strat->posInT = posInT17Ring;
9865  }
9866  }
9867  }
9868  if (strat->minim>0) strat->posInL =posInLSpecial;
9869  // for further tests only
9870  if ((BTEST1(11)) || (BTEST1(12)))
9871  strat->posInL = posInL11Ring;
9872  else if ((BTEST1(13)) || (BTEST1(14)))
9873  strat->posInL = posInL13;
9874  else if ((BTEST1(15)) || (BTEST1(16)))
9875  strat->posInL = posInL15Ring;
9876  else if ((BTEST1(17)) || (BTEST1(18)))
9877  strat->posInL = posInL17Ring;
9878  if (BTEST1(11))
9879  strat->posInT = posInT11Ring;
9880  else if (BTEST1(13))
9881  strat->posInT = posInT13;
9882  else if (BTEST1(15))
9883  strat->posInT = posInT15Ring;
9884  else if ((BTEST1(17)))
9885  strat->posInT = posInT17Ring;
9886  else if ((BTEST1(19)))
9887  strat->posInT = posInT19;
9888  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
9889  strat->posInT = posInT1;
9891 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6281
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6351
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6695
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5184
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6780
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6625
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6578
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5606
#define BTEST1(a)
Definition: options.h:34
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6894
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
int minim
Definition: kutil.h:351
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5173
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9705
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5242
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5278
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5708
char homog
Definition: kutil.h:366
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5437
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6007
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5938
char posInLDependsOnLength
Definition: kutil.h:383
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5881
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5513
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5815
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5484

◆ initBuchMoraShift()

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

Definition at line 11907 of file kutil.cc.

11908 {
11909  strat->interpt = BTEST1(OPT_INTERRUPT);
11910  strat->kHEdge=NULL;
11912  /*- creating temp data structures------------------- -*/
11913  strat->cp = 0;
11914  strat->c3 = 0;
11915  strat->cv = 0;
11916  strat->tail = pInit();
11917  /*- set s -*/
11918  strat->sl = -1;
11919  /*- set L -*/
11920  strat->Lmax = setmaxL;
11921  strat->Ll = -1;
11922  strat->L = initL();
11923  /*- set B -*/
11924  strat->Bmax = setmaxL;
11925  strat->Bl = -1;
11926  strat->B = initL();
11927  /*- set T -*/
11928  strat->tl = -1;
11929  strat->tmax = setmaxT;
11930  strat->T = initT();
11931  strat->R = initR();
11932  strat->sevT = initsevT();
11933  /*- init local data struct.---------------------------------------- -*/
11934  strat->P.ecart=0;
11935  strat->P.length=0;
11937  {
11938  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
11939  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
11940  }
11942  {
11943  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
11944  }
11945  {
11946  if(TEST_OPT_SB_1)
11947  {
11948  int i;
11949  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
11950  for (i=strat->newIdeal;i<IDELEMS(F);i++)
11951  {
11952  P->m[i-strat->newIdeal] = F->m[i];
11953  F->m[i] = NULL;
11954  }
11955  initSSpecial(F,Q,P,strat);
11956  for (i=strat->newIdeal;i<IDELEMS(F);i++)
11957  {
11958  F->m[i] = P->m[i-strat->newIdeal];
11959  P->m[i-strat->newIdeal] = NULL;
11960  }
11961  idDelete(&P);
11962  }
11963  else
11964  {
11965  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
11966  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
11967  }
11968  }
11969  strat->fromT = FALSE;
11970  if (!TEST_OPT_SB_1)
11971  {
11972  /* the only change: we do not fill the set T*/
11973  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
11974  }
11975  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
11976  strat->fromQ=NULL;
11977  /* more changes: fill the set T with all the shifts of elts of S*/
11978  /* is done by other procedure */
11979 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
KINLINE TObject ** initR()
Definition: kInline.h:92
char fromT
Definition: kutil.h:373
char kHEdgeFound
Definition: kutil.h:370
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:320
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:340
char interpt
Definition: kutil.h:365
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:363
poly kNoether
Definition: kutil.h:321
int tl
Definition: kutil.h:343
int Bl
Definition: kutil.h:345
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7958
#define BTEST1(a)
Definition: options.h:34
unsigned long * sevT
Definition: kutil.h:316
int ak
Definition: kutil.h:346
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:345
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8360
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:312
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:293
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:343
int cp
Definition: kutil.h:340
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
int Lmax
Definition: kutil.h:344
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_SB_1
Definition: options.h:117
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8823
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
static LSet initL(int nr=setmaxL)
Definition: kutil.h:415
int newIdeal
Definition: kutil.h:350
ideal Shdl
Definition: kutil.h:294
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initEcartBBA()

void initEcartBBA ( TObject h)

Definition at line 1265 of file kutil.cc.

1266 {
1267  h->FDeg = h->pFDeg();
1268  (*h).ecart = 0;
1269  h->length=h->pLength=pLength(h->p);
1270 }
static unsigned pLength(poly a)
Definition: p_polys.h:193
static Poly * h
Definition: janet.cc:972

◆ initEcartNormal()

void initEcartNormal ( TObject h)

Definition at line 1257 of file kutil.cc.

1258 {
1259  h->FDeg = h->pFDeg();
1260  h->ecart = h->pLDeg() - h->FDeg;
1261  // h->length is set by h->pLDeg
1262  h->length=h->pLength=pLength(h->p);
1263 }
static unsigned pLength(poly a)
Definition: p_polys.h:193
static Poly * h
Definition: janet.cc:972

◆ initEcartPairBba()

void initEcartPairBba ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1272 of file kutil.cc.

1273 {
1274  Lp->FDeg = Lp->pFDeg();
1275  (*Lp).ecart = 0;
1276  (*Lp).length = 0;
1277 }

◆ initEcartPairMora()

void initEcartPairMora ( LObject Lp,
poly  f,
poly  g,
int  ecartF,
int  ecartG 
)

Definition at line 1279 of file kutil.cc.

1280 {
1281  Lp->FDeg = Lp->pFDeg();
1282  (*Lp).ecart = si_max(ecartF,ecartG);
1283  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1284  (*Lp).length = 0;
1285 }
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:381
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ initHilbCrit()

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

Definition at line 9552 of file kutil.cc.

9553 {
9554 
9555  //if the ordering is local, then hilb criterion
9556  //can be used also if the ideal is not homogenous
9558  {
9560  *hilb=NULL;
9561  else
9562  return;
9563  }
9564  if (strat->homog!=isHomog)
9565  {
9566  *hilb=NULL;
9567  }
9568 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
#define FALSE
Definition: auxiliary.h:94
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
char homog
Definition: kutil.h:366
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ initL()

static LSet initL ( int  nr = setmaxL)
inlinestatic

Definition at line 415 of file kutil.h.

416 { return (LSet)omAlloc(nr*sizeof(LObject)); }
class sLObject LObject
Definition: kutil.h:54
#define omAlloc(size)
Definition: omAllocDecl.h:210
LObject * LSet
Definition: kutil.h:56

◆ initR()

KINLINE TObject** initR ( )

Definition at line 92 of file kInline.h.

93 {
94  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
95 }
#define setmaxT
Definition: kutil.h:33
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:53

◆ initS()

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

Definition at line 7864 of file kutil.cc.

7865 {
7866  int i,pos;
7867 
7868  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7869  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7870  strat->ecartS=initec(i);
7871  strat->sevS=initsevS(i);
7872  strat->S_2_R=initS_2_R(i);
7873  strat->fromQ=NULL;
7874  strat->Shdl=idInit(i,F->rank);
7875  strat->S=strat->Shdl->m;
7876  /*- put polys into S -*/
7877  if (Q!=NULL)
7878  {
7879  strat->fromQ=initec(i);
7880  memset(strat->fromQ,0,i*sizeof(int));
7881  for (i=0; i<IDELEMS(Q); i++)
7882  {
7883  if (Q->m[i]!=NULL)
7884  {
7885  LObject h;
7886  h.p = pCopy(Q->m[i]);
7888  {
7889  h.pCleardenom(); // also does remove Content
7890  }
7891  else
7892  {
7893  h.pNorm();
7894  }
7896  {
7897  deleteHC(&h, strat);
7898  }
7899  if (h.p!=NULL)
7900  {
7901  strat->initEcart(&h);
7902  if (strat->sl==-1)
7903  pos =0;
7904  else
7905  {
7906  pos = posInS(strat,strat->sl,h.p,h.ecart);
7907  }
7908  h.sev = pGetShortExpVector(h.p);
7909  strat->enterS(h,pos,strat,-1);
7910  strat->fromQ[pos]=1;
7911  }
7912  }
7913  }
7914  }
7915  for (i=0; i<IDELEMS(F); i++)
7916  {
7917  if (F->m[i]!=NULL)
7918  {
7919  LObject h;
7920  h.p = pCopy(F->m[i]);
7922  {
7923  cancelunit(&h); /*- tries to cancel a unit -*/
7924  deleteHC(&h, strat);
7925  }
7926  if (h.p!=NULL)
7927  // do not rely on the input being a SB!
7928  {
7930  {
7931  h.pCleardenom(); // also does remove Content
7932  }
7933  else
7934  {
7935  h.pNorm();
7936  }
7937  strat->initEcart(&h);
7938  if (strat->sl==-1)
7939  pos =0;
7940  else
7941  pos = posInS(strat,strat->sl,h.p,h.ecart);
7942  h.sev = pGetShortExpVector(h.p);
7943  strat->enterS(h,pos,strat,-1);
7944  }
7945  }
7946  }
7947  /*- test, if a unit is in F -*/
7948  if ((strat->sl>=0)
7949 #ifdef HAVE_RINGS
7950  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
7951 #endif
7952  && pIsConstant(strat->S[0]))
7953  {
7954  while (strat->sl>0) deleteInS(strat->sl,strat);
7955  }
7956 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
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:515
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:511
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:335
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1069
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:507
void(* initEcart)(TObject *L)
Definition: kutil.h:271
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
intset fromQ
Definition: kutil.h:312
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:300
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:502
int sl
Definition: kutil.h:341
ideal Shdl
Definition: kutil.h:294
static Poly * h
Definition: janet.cc:972
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSba()

void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1389 of file kstd1.cc.

1390 {
1391  int i;
1392  //idhdl h;
1393  /* setting global variables ------------------- */
1394  strat->enterS = enterSSba;
1395  strat->red2 = redHoney;
1396  if (strat->honey)
1397  strat->red2 = redHoney;
1398  else if (currRing->pLexOrder && !strat->homog)
1399  strat->red2 = redLazy;
1400  else
1401  {
1402  strat->LazyPass *=4;
1403  strat->red2 = redHomog;
1404  }
1405  if (rField_is_Ring(currRing))
1406  {
1408  {strat->red2 = redRiloc;}
1409  else
1410  {strat->red2 = redRing;}
1411  }
1412  if (currRing->pLexOrder && strat->honey)
1413  strat->initEcart = initEcartNormal;
1414  else
1415  strat->initEcart = initEcartBBA;
1416  if (strat->honey)
1418  else
1420  //strat->kIdeal = NULL;
1421  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1422  //else strat->kIdeal->rtyp=MODUL_CMD;
1423  //strat->kIdeal->data=(void *)strat->Shdl;
1424  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1425  {
1426  //interred machen Aenderung
1427  strat->pOrigFDeg = currRing->pFDeg;
1428  strat->pOrigLDeg = currRing->pLDeg;
1429  //h=ggetid("ecart");
1430  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1431  //{
1432  // ecartWeights=iv2array(IDINTVEC(h));
1433  //}
1434  //else
1435  {
1436  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1437  /*uses automatic computation of the ecartWeights to set them*/
1439  }
1441  if (TEST_OPT_PROT)
1442  {
1443  for(i=1; i<=(currRing->N); i++)
1444  Print(" %d",ecartWeights[i]);
1445  PrintLn();
1446  mflush();
1447  }
1448  }
1449  // for sig-safe reductions in signature-based
1450  // standard basis computations
1452  strat->red = redSigRing;
1453  else
1454  strat->red = redSig;
1455  //strat->sbaOrder = 1;
1456  strat->currIdx = 1;
1457 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1272
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9153
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:438
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#define TEST_OPT_PROT
Definition: options.h:102
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:188
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:223
short * ecartWeights
Definition: weight0.c:28
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:705
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:269
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:545
int currIdx
Definition: kutil.h:308
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1387
pFDegProc pOrigFDeg
Definition: kutil.h:287
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:344
void(* initEcart)(TObject *L)
Definition: kutil.h:271
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1242
pLDegProc pOrigLDeg
Definition: kutil.h:288
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1279
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
int i
Definition: cfEzgcd.cc:125
int redSigRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:872
#define IDELEMS(i)
Definition: simpleideals.h:24
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3600
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:366
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:253
void initEcartNormal(TObject *h)
Definition: kutil.cc:1257
int LazyPass
Definition: kutil.h:346
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:270

◆ initSbaBuchMora()

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

Definition at line 10090 of file kutil.cc.

10091 {
10092  strat->interpt = BTEST1(OPT_INTERRUPT);
10093  strat->kHEdge=NULL;
10095  /*- creating temp data structures------------------- -*/
10096  strat->cp = 0;
10097  strat->c3 = 0;
10098  strat->tail = pInit();
10099  /*- set s -*/
10100  strat->sl = -1;
10101  /*- set ps -*/
10102  strat->syzl = -1;
10103  /*- set L -*/
10104  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10105  strat->Ll = -1;
10106  strat->L = initL(strat->Lmax);
10107  /*- set B -*/
10108  strat->Bmax = setmaxL;
10109  strat->Bl = -1;
10110  strat->B = initL();
10111  /*- set T -*/
10112  strat->tl = -1;
10113  strat->tmax = setmaxT;
10114  strat->T = initT();
10115  strat->R = initR();
10116  strat->sevT = initsevT();
10117  /*- init local data struct.---------------------------------------- -*/
10118  strat->P.ecart=0;
10119  strat->P.length=0;
10121  {
10122  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10123  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10124  }
10126  {
10127  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10128  }
10129  else
10130  {
10131  if(TEST_OPT_SB_1)
10132  {
10133  int i;
10134  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10135  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10136  {
10137  P->m[i-strat->newIdeal] = F->m[i];
10138  F->m[i] = NULL;
10139  }
10140  initSSpecialSba(F,Q,P,strat);
10141  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10142  {
10143  F->m[i] = P->m[i-strat->newIdeal];
10144  P->m[i-strat->newIdeal] = NULL;
10145  }
10146  idDelete(&P);
10147  }
10148  else
10149  {
10150  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10151  }
10152  }
10153  strat->fromT = FALSE;
10154  if (!TEST_OPT_SB_1)
10155  {
10156  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10157  }
10158  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10159  //strat->fromQ=NULL;
10160  assume(kTest_TS(strat));
10161 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
KINLINE TObject ** initR()
Definition: kInline.h:92
char fromT
Definition: kutil.h:373
char kHEdgeFound
Definition: kutil.h:370
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:320
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:340
char interpt
Definition: kutil.h:365
poly kNoether
Definition: kutil.h:321
int tl
Definition: kutil.h:343
int Bl
Definition: kutil.h:345
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8504
unsigned long * sevT
Definition: kutil.h:316
int ak
Definition: kutil.h:346
#define setmaxLinc
Definition: kutil.h:31
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8055
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:345
#define setmaxT
Definition: kutil.h:33
#define kTest_TS(A)
Definition: kutil.h:644
#define assume(x)
Definition: mod2.h:390
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:293
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:343
int cp
Definition: kutil.h:340
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
int Lmax
Definition: kutil.h:344
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_SB_1
Definition: options.h:117
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8823
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
static LSet initL(int nr=setmaxL)
Definition: kutil.h:415
int newIdeal
Definition: kutil.h:350
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:342

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9634 of file kutil.cc.

9635 {
9636  //strat->enterOnePair=enterOnePairNormal;
9638  //strat->chainCrit=chainCritNormal;
9639  strat->chainCrit = chainCritSig;
9640  /******************************************
9641  * rewCrit1 and rewCrit2 are already set in
9642  * kSba() in kstd1.cc
9643  *****************************************/
9644  //strat->rewCrit1 = faugereRewCriterion;
9645  if (strat->sbaOrder == 1)
9646  {
9647  strat->syzCrit = syzCriterionInc;
9648  }
9649  else
9650  {
9651  strat->syzCrit = syzCriterion;
9652  }
9653 #ifdef HAVE_RINGS
9654  if (rField_is_Ring(currRing))
9655  {
9657  strat->chainCrit=chainCritRing;
9658  }
9659 #endif
9660 #ifdef HAVE_RATGRING
9661  if (rIsRatGRing(currRing))
9662  {
9663  strat->chainCrit=chainCritPart;
9664  /* enterOnePairNormal get rational part in it */
9665  }
9666 #endif
9667 
9668  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9669  strat->Gebauer = strat->homog || strat->sugarCrit;
9670  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9671  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9672  strat->pairtest = NULL;
9673  /* alway use tailreduction, except:
9674  * - in local rings, - in lex order case, -in ring over extensions */
9677 
9678 #ifdef HAVE_PLURAL
9679  // and r is plural_ring
9680  // hence this holds for r a rational_plural_ring
9681  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9682  { //or it has non-quasi-comm type... later
9683  strat->sugarCrit = FALSE;
9684  strat->Gebauer = FALSE;
9685  strat->honey = FALSE;
9686  }
9687 #endif
9688 
9689  // Coefficient ring?
9690  if (rField_is_Ring(currRing))
9691  {
9692  strat->sugarCrit = FALSE;
9693  strat->Gebauer = FALSE ;
9694  strat->honey = FALSE;
9695  }
9696  #ifdef KDEBUG
9697  if (TEST_OPT_DEBUG)
9698  {
9699  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9700  else PrintS("ideal/module is not homogeneous\n");
9701  }
9702  #endif
9703 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:419
BOOLEAN * pairtest
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:107
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1299
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3369
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1877
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:283
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:281
char sugarCrit
Definition: kutil.h:371
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3905
#define TEST_OPT_NOT_SUGAR
Definition: options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
unsigned sbaOrder
Definition: kutil.h:307
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:6961
#define TEST_OPT_SUGARCRIT
Definition: options.h:106
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:6996
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:366
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:282
char z2homog
Definition: kutil.h:368
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
char Gebauer
Definition: kutil.h:372
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3428

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 9988 of file kutil.cc.

9989 {
9991  {
9992  if (strat->honey)
9993  {
9994  strat->posInL = posInL15;
9995  // ok -- here is the deal: from my experiments for Singular-2-0
9996  // I conclude that that posInT_EcartpLength is the best of
9997  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9998  // see the table at the end of this file
9999  if (TEST_OPT_OLDSTD)
10000  strat->posInT = posInT15;
10001  else
10002  strat->posInT = posInT_EcartpLength;
10003  }
10004  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10005  {
10006  strat->posInL = posInL11;
10007  strat->posInT = posInT11;
10008  }
10009  else if (TEST_OPT_INTSTRATEGY)
10010  {
10011  strat->posInL = posInL11;
10012  strat->posInT = posInT11;
10013  }
10014  else
10015  {
10016  strat->posInL = posInL0;
10017  strat->posInT = posInT0;
10018  }
10019  //if (strat->minim>0) strat->posInL =posInLSpecial;
10020  if (strat->homog)
10021  {
10022  strat->posInL = posInL110;
10023  strat->posInT = posInT110;
10024  }
10025  }
10026  else
10027  {
10028  if (strat->homog)
10029  {
10030  strat->posInL = posInL11;
10031  strat->posInT = posInT11;
10032  }
10033  else
10034  {
10035  if ((currRing->order[0]==ringorder_c)
10036  ||(currRing->order[0]==ringorder_C))
10037  {
10038  strat->posInL = posInL17_c;
10039  strat->posInT = posInT17_c;
10040  }
10041  else
10042  {
10043  strat->posInL = posInL17;
10044  strat->posInT = posInT17;
10045  }
10046  }
10047  }
10048  if (strat->minim>0) strat->posInL =posInLSpecial;
10049  // for further tests only
10050  if ((BTEST1(11)) || (BTEST1(12)))
10051  strat->posInL = posInL11;
10052  else if ((BTEST1(13)) || (BTEST1(14)))
10053  strat->posInL = posInL13;
10054  else if ((BTEST1(15)) || (BTEST1(16)))
10055  strat->posInL = posInL15;
10056  else if ((BTEST1(17)) || (BTEST1(18)))
10057  strat->posInL = posInL17;
10058  if (BTEST1(11))
10059  strat->posInT = posInT11;
10060  else if (BTEST1(13))
10061  strat->posInT = posInT13;
10062  else if (BTEST1(15))
10063  strat->posInT = posInT15;
10064  else if ((BTEST1(17)))
10065  strat->posInT = posInT17;
10066  else if ((BTEST1(19)))
10067  strat->posInT = posInT19;
10068  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10069  strat->posInT = posInT1;
10070  if (rField_is_Ring(currRing))
10071  {
10072  strat->posInL = posInL11Ring;
10073  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10074  strat->posInL = posInL11Ringls;
10075  strat->posInT = posInT11;
10076  }
10077  strat->posInLDependsOnLength = FALSE;
10078  strat->posInLSba = posInLSig;
10079  //strat->posInL = posInLSig;
10080  strat->posInL = posInLF5C;
10081  /*
10082  if (rField_is_Ring(currRing))
10083  {
10084  strat->posInLSba = posInLSigRing;
10085  strat->posInL = posInL11Ring;
10086  }*/
10087  //strat->posInT = posInTSig;
10088 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6239
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6736
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6281
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6351
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5184
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6660
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6625
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:273
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6227
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5552
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6537
int minim
Definition: kutil.h:351
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5173
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6039
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5242
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5754
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5981
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6830
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5647
char homog
Definition: kutil.h:366
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5395
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5938
char posInLDependsOnLength
Definition: kutil.h:383
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5881
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5513
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5484

◆ initsevT()

KINLINE unsigned long* initsevT ( )

Definition at line 97 of file kInline.h.

98 {
99  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
100 }
#define setmaxT
Definition: kutil.h:33
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSL()

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

Definition at line 7958 of file kutil.cc.

7959 {
7960  int i,pos;
7961 
7962  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7963  else i=setmaxT;
7964  strat->ecartS=initec(i);
7965  strat->sevS=initsevS(i);
7966  strat->S_2_R=initS_2_R(i);
7967  strat->fromQ=NULL;
7968  strat->Shdl=idInit(i,F->rank);
7969  strat->S=strat->Shdl->m;
7970  /*- put polys into S -*/
7971  if (Q!=NULL)
7972  {
7973  strat->fromQ=initec(i);
7974  memset(strat->fromQ,0,i*sizeof(int));
7975  for (i=0; i<IDELEMS(Q); i++)
7976  {
7977  if (Q->m[i]!=NULL)
7978  {
7979  LObject h;
7980  h.p = pCopy(Q->m[i]);
7982  {
7983  deleteHC(&h,strat);
7984  }
7986  {
7987  h.pCleardenom(); // also does remove Content
7988  }
7989  else
7990  {
7991  h.pNorm();
7992  }
7993  if (h.p!=NULL)
7994  {
7995  strat->initEcart(&h);
7996  if (strat->sl==-1)
7997  pos =0;
7998  else
7999  {
8000  pos = posInS(strat,strat->sl,h.p,h.ecart);
8001  }
8002  h.sev = pGetShortExpVector(h.p);
8003  strat->enterS(h,pos,strat,-1);
8004  strat->fromQ[pos]=1;
8005  }
8006  }
8007  }
8008  }
8009  for (i=0; i<IDELEMS(F); i++)
8010  {
8011  if (F->m[i]!=NULL)
8012  {
8013  LObject h;
8014  h.p = pCopy(F->m[i]);
8015  if (h.p!=NULL)
8016  {
8018  {
8019  cancelunit(&h); /*- tries to cancel a unit -*/
8020  deleteHC(&h, strat);
8021  }
8022  if (h.p!=NULL)
8023  {
8025  {
8026  h.pCleardenom(); // also does remove Content
8027  }
8028  else
8029  {
8030  h.pNorm();
8031  }
8032  strat->initEcart(&h);
8033  if (strat->Ll==-1)
8034  pos =0;
8035  else
8036  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8037  h.sev = pGetShortExpVector(h.p);
8038  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8039  }
8040  }
8041  }
8042  }
8043  /*- test, if a unit is in F -*/
8044 
8045  if ((strat->Ll>=0)
8046 #ifdef HAVE_RINGS
8047  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8048 #endif
8049  && pIsConstant(strat->L[strat->Ll].p))
8050  {
8051  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8052  }
8053 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
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:515
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:511
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:344
int * S_2_R
Definition: kutil.h:335
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#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:45
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:507
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
void(* initEcart)(TObject *L)
Definition: kutil.h:271
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:312
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:300
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:502
int sl
Definition: kutil.h:341
ideal Shdl
Definition: kutil.h:294
static Poly * h
Definition: janet.cc:972
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSLSba()

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

Definition at line 8055 of file kutil.cc.

8056 {
8057  int i,pos;
8058  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8059  else i=setmaxT;
8060  strat->ecartS = initec(i);
8061  strat->sevS = initsevS(i);
8062  strat->sevSig = initsevS(i);
8063  strat->S_2_R = initS_2_R(i);
8064  strat->fromQ = NULL;
8065  strat->Shdl = idInit(i,F->rank);
8066  strat->S = strat->Shdl->m;
8067  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8068  if (strat->sbaOrder != 1)
8069  {
8070  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8071  strat->sevSyz = initsevS(i);
8072  strat->syzmax = i;
8073  strat->syzl = 0;
8074  }
8075  /*- put polys into S -*/
8076  if (Q!=NULL)
8077  {
8078  strat->fromQ=initec(i);
8079  memset(strat->fromQ,0,i*sizeof(int));
8080  for (i=0; i<IDELEMS(Q); i++)
8081  {
8082  if (Q->m[i]!=NULL)
8083  {
8084  LObject h;
8085  h.p = pCopy(Q->m[i]);
8087  {
8088  deleteHC(&h,strat);
8089  }
8091  {
8092  h.pCleardenom(); // also does remove Content
8093  }
8094  else
8095  {
8096  h.pNorm();
8097  }
8098  if (h.p!=NULL)
8099  {
8100  strat->initEcart(&h);
8101  if (strat->sl==-1)
8102  pos =0;
8103  else
8104  {
8105  pos = posInS(strat,strat->sl,h.p,h.ecart);
8106  }
8107  h.sev = pGetShortExpVector(h.p);
8108  strat->enterS(h,pos,strat,-1);
8109  strat->fromQ[pos]=1;
8110  }
8111  }
8112  }
8113  }
8114  for (i=0; i<IDELEMS(F); i++)
8115  {
8116  if (F->m[i]!=NULL)
8117  {
8118  LObject h;
8119  h.p = pCopy(F->m[i]);
8120  h.sig = pOne();
8121  //h.sig = pInit();
8122  //p_SetCoeff(h.sig,nInit(1),currRing);
8123  p_SetComp(h.sig,i+1,currRing);
8124  // if we are working with the Schreyer order we generate it
8125  // by multiplying the initial signatures with the leading monomial
8126  // of the corresponding initial polynomials generating the ideal
8127  // => we can keep the underlying monomial order and get a Schreyer
8128  // order without any bigger overhead
8129  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8130  {
8131  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8132  }
8133  h.sevSig = pGetShortExpVector(h.sig);
8134 #ifdef DEBUGF5
8135  pWrite(h.p);
8136  pWrite(h.sig);
8137 #endif
8138  if (h.p!=NULL)
8139  {
8141  {
8142  cancelunit(&h); /*- tries to cancel a unit -*/
8143  deleteHC(&h, strat);
8144  }
8145  if (h.p!=NULL)
8146  {
8148  {
8149  h.pCleardenom(); // also does remove Content
8150  }
8151  else
8152  {
8153  h.pNorm();
8154  }
8155  strat->initEcart(&h);
8156  if (strat->Ll==-1)
8157  pos =0;
8158  else
8159  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8160  h.sev = pGetShortExpVector(h.p);
8161  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8162  }
8163  }
8164  /*
8165  if (strat->sbaOrder != 1)
8166  {
8167  for(j=0;j<i;j++)
8168  {
8169  strat->syz[ctr] = pCopy(F->m[j]);
8170  p_SetCompP(strat->syz[ctr],i+1,currRing);
8171  // add LM(F->m[i]) to the signature to get a Schreyer order
8172  // without changing the underlying polynomial ring at all
8173  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8174  // since p_Add_q() destroys all input
8175  // data we need to recreate help
8176  // each time
8177  poly help = pCopy(F->m[i]);
8178  p_SetCompP(help,j+1,currRing);
8179  pWrite(strat->syz[ctr]);
8180  pWrite(help);
8181  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8182  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8183  printf("%d. SYZ ",ctr);
8184  pWrite(strat->syz[ctr]);
8185  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8186  ctr++;
8187  }
8188  strat->syzl = ps;
8189  }
8190  */
8191  }
8192  }
8193  /*- test, if a unit is in F -*/
8194 
8195  if ((strat->Ll>=0)
8196 #ifdef HAVE_RINGS
8197  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8198 #endif
8199  && pIsConstant(strat->L[strat->Ll].p))
8200  {
8201  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8202  }
8203 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
unsigned long * sevSig
Definition: kutil.h:315
polyset sig
Definition: kutil.h:299
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:515
int syzmax
Definition: kutil.h:342
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:511
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:344
int * S_2_R
Definition: kutil.h:335
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:273
void pWrite(poly p)
Definition: polys.h:302
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#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:45
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:507
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
void(* initEcart)(TObject *L)
Definition: kutil.h:271
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:312
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:233
unsigned sbaOrder
Definition: kutil.h:307
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
#define pOne()
Definition: polys.h:309
polyset S
Definition: kutil.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:300
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
unsigned long * sevSyz
Definition: kutil.h:314
#define setmaxTinc
Definition: kutil.h:34
polyset syz
Definition: kutil.h:298
static intset initec(const int maxnr)
Definition: kutil.cc:502
int sl
Definition: kutil.h:341
ideal Shdl
Definition: kutil.h:294
static Poly * h
Definition: janet.cc:972
int syzl
Definition: kutil.h:342
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8205 of file kutil.cc.

8206 {
8207  if( strat->S[0] )
8208  {
8209  if( strat->S[1] && !rField_is_Ring(currRing))
8210  {
8211  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8212  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8213  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8214  }
8215  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8216  /************************************************************
8217  * computing the length of the syzygy array needed
8218  ***********************************************************/
8219  for(i=1; i<=strat->sl; i++)
8220  {
8221  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8222  {
8223  ps += i;
8224  }
8225  }
8226  ps += strat->sl+1;
8227  //comp = pGetComp (strat->P.sig);
8228  comp = strat->currIdx;
8229  strat->syzIdx = initec(comp);
8230  strat->sevSyz = initsevS(ps);
8231  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8232  strat->syzmax = ps;
8233  strat->syzl = 0;
8234  strat->syzidxmax = comp;
8235 #if defined(DEBUGF5) || defined(DEBUGF51)
8236  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8237 #endif
8238  i = 1;
8239  j = 0;
8240  /************************************************************
8241  * generating the leading terms of the principal syzygies
8242  ***********************************************************/
8243  while (i <= strat->sl)
8244  {
8245  /**********************************************************
8246  * principal syzygies start with component index 2
8247  * the array syzIdx starts with index 0
8248  * => the rules for a signature with component comp start
8249  * at strat->syz[strat->syzIdx[comp-2]] !
8250  *********************************************************/
8251  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8252  {
8253  comp = pGetComp(strat->sig[i]);
8254  comp_old = pGetComp(strat->sig[i-1]);
8255  diff = comp - comp_old - 1;
8256  // diff should be zero, but sometimes also the initial generating
8257  // elements of the input ideal reduce to zero. then there is an
8258  // index-gap between the signatures. for these inbetween signatures we
8259  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8260  // in the following.
8261  // doing this, we keep the relation "j = comp - 2" alive, which makes
8262  // jumps way easier when checking criteria
8263  while (diff>0)
8264  {
8265  strat->syzIdx[j] = 0;
8266  diff--;
8267  j++;
8268  }
8269  strat->syzIdx[j] = ctr;
8270  j++;
8271  LObject Q;
8272  int pos;
8273  for (k = 0; k<i; k++)
8274  {
8275  Q.sig = pOne();
8277  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8278  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8279  p_SetCompP (Q.sig, comp, currRing);
8280  poly q = p_One(currRing);
8283  p_ExpVectorCopy(q,strat->S[i],currRing);
8284  q = p_Neg (q, currRing);
8285  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8286  Q.sig = p_Add_q (Q.sig, q, currRing);
8287  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8288  pos = posInSyz(strat, Q.sig);
8289  enterSyz(Q, strat, pos);
8290  ctr++;
8291  }
8292  }
8293  i++;
8294  }
8295  /**************************************************************
8296  * add syzygies for upcoming first element of new iteration step
8297  **************************************************************/
8298  comp = strat->currIdx;
8299  comp_old = pGetComp(strat->sig[i-1]);
8300  diff = comp - comp_old - 1;
8301  // diff should be zero, but sometimes also the initial generating
8302  // elements of the input ideal reduce to zero. then there is an
8303  // index-gap between the signatures. for these inbetween signatures we
8304  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8305  // in the following.
8306  // doing this, we keep the relation "j = comp - 2" alive, which makes
8307  // jumps way easier when checking criteria
8308  while (diff>0)
8309  {
8310  strat->syzIdx[j] = 0;
8311  diff--;
8312  j++;
8313  }
8314  strat->syzIdx[j] = ctr;
8315  LObject Q;
8316  int pos;
8317  for (k = 0; k<strat->sl+1; k++)
8318  {
8319  Q.sig = pOne();
8321  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8322  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8323  p_SetCompP (Q.sig, comp, currRing);
8324  poly q = p_One(currRing);
8326  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8327  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8328  q = p_Neg (q, currRing);
8329  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8330  Q.sig = p_Add_q (Q.sig, q, currRing);
8331  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8332  pos = posInSyz(strat, Q.sig);
8333  enterSyz(Q, strat, pos);
8334  ctr++;
8335  }
8336 //#if 1
8337 #ifdef DEBUGF5
8338  PrintS("Principal syzygies:\n");
8339  Print("syzl %d\n",strat->syzl);
8340  Print("syzmax %d\n",strat->syzmax);
8341  Print("ps %d\n",ps);
8342  PrintS("--------------------------------\n");
8343  for(i=0;i<=strat->syzl-1;i++)
8344  {
8345  Print("%d - ",i);
8346  pWrite(strat->syz[i]);
8347  }
8348  for(i=0;i<strat->currIdx;i++)
8349  {
8350  Print("%d - %d\n",i,strat->syzIdx[i]);
8351  }
8352  PrintS("--------------------------------\n");
8353 #endif
8354  }
8355 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
polyset sig
Definition: kutil.h:299
int j
Definition: facHensel.cc:105
static gmp_float * diff
Definition: mpr_complex.cc:46
#define Print
Definition: emacs.cc:80
int syzmax
Definition: kutil.h:342
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:344
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:302
int k
Definition: cfEzgcd.cc:92
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:507
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
int currIdx
Definition: kutil.h:308
#define pGetComp(p)
Component.
Definition: polys.h:37
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:255
poly p_One(const ring r)
Definition: p_polys.cc:1305
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1250
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:309
polyset S
Definition: kutil.h:297
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4679
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6199
int syzidxmax
Definition: kutil.h:342
#define nCopy(n)
Definition: numbers.h:16
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
unsigned long * sevSyz
Definition: kutil.h:314
#define p_GetCoeff(p, r)
Definition: monomials.h:51
polyset syz
Definition: kutil.h:298
static intset initec(const int maxnr)
Definition: kutil.cc:502
int sl
Definition: kutil.h:341
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
int syzl
Definition: kutil.h:342
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9474
intset syzIdx
Definition: kutil.h:304

◆ initT()

KINLINE TSet initT ( )

Definition at line 81 of file kInline.h.

82 {
83  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
84  for (int i=setmaxT-1; i>=0; i--)
85  {
86  T[i].tailRing = currRing;
87  T[i].i_r = -1;
88  }
89  return T;
90 }
TObject * TSet
Definition: kutil.h:55
#define setmaxT
Definition: kutil.h:33
int i
Definition: cfEzgcd.cc:125
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static jList * T
Definition: janet.cc:31
#define omAlloc0(size)
Definition: omAllocDecl.h:211
class sTObject TObject
Definition: kutil.h:53

◆ k_GetLeadTerms()

KINLINE BOOLEAN k_GetLeadTerms ( const poly  p1,
const poly  p2,
const ring  p_r,
poly &  m1,
poly &  m2,
const ring  m_r 
)

Definition at line 931 of file kInline.h.

933 {
934  p_LmCheckPolyRing(p1, p_r);
935  p_LmCheckPolyRing(p2, p_r);
936 
937  int i;
938  long x;
939  m1 = p_Init(m_r,m_r->PolyBin);
940  m2 = p_Init(m_r,m_r->PolyBin);
941 
942  for (i = p_r->N; i; i--)
943  {
944  x = p_GetExpDiff(p1, p2, i, p_r);
945  if (x > 0)
946  {
947  if (x > (long) m_r->bitmask) goto false_return;
948  p_SetExp(m2,i,x, m_r);
949  p_SetExp(m1,i,0, m_r);
950  }
951  else
952  {
953  if (-x > (long) m_r->bitmask) goto false_return;
954  p_SetExp(m1,i,-x, m_r);
955  p_SetExp(m2,i,0, m_r);
956  }
957  }
958 
959  p_Setm(m1, m_r);
960  p_Setm(m2, m_r);
961  return TRUE;
962 
963  false_return:
964  p_LmFree(m1, m_r);
965  p_LmFree(m2, m_r);
966  m1 = m2 = NULL;
967  return FALSE;
968 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:636
int i
Definition: cfEzgcd.cc:125
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ k_GetStrongLeadTerms()

KINLINE void k_GetStrongLeadTerms ( const poly  p1,
const poly  p2,
const ring  leadRing,
poly &  m1,
poly &  m2,
poly &  lcm,
const ring  taiRing 
)

Definition at line 974 of file kInline.h.

976 {
977  p_LmCheckPolyRing(p1, leadRing);
978  p_LmCheckPolyRing(p2, leadRing);
979 
980  int i;
981  int x;
982  int e1;
983  int e2;
984  int s;
985  m1 = p_Init(tailRing,tailRing->PolyBin);
986  m2 = p_Init(tailRing,tailRing->PolyBin);
987  lcm = p_Init(leadRing,leadRing->PolyBin);
988 
989  for (i = leadRing->N; i>=0; i--)
990  {
991  e1 = p_GetExp(p1,i,leadRing);
992  e2 = p_GetExp(p2,i,leadRing);
993  x = e1 - e2;
994  if (x > 0)
995  {
996  p_SetExp(m2,i,x, tailRing);
997  //p_SetExp(m1,i,0, tailRing); // done by p_Init
998  s = e1;
999  }
1000  else if (x<0)
1001  {
1002  p_SetExp(m1,i,-x, tailRing);
1003  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1004  s = e2;
1005  }
1006  else
1007  s = e1; // e1==e2
1008  p_SetExp(lcm,i,s, leadRing);
1009  }
1010 
1011  p_Setm(m1, tailRing);
1012  p_Setm(m2, tailRing);
1013  p_Setm(lcm, leadRing);
1014 }
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:709
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ k_LmInit_currRing_2_tailRing() [1/2]

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

Definition at line 872 of file kInline.h.

873 {
874 
875  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
876  pNext(t_p) = pNext(p);
877  pSetCoeff0(t_p, pGetCoeff(p));
878  return t_p;
879 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
#define pSetCoeff0(p, n)
Definition: monomials.h:60
int p
Definition: cfModGcd.cc:4019

◆ k_LmInit_currRing_2_tailRing() [2/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 904 of file kInline.h.

905 {
906  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
907 }
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
int p
Definition: cfModGcd.cc:4019

◆ k_LmInit_tailRing_2_currRing() [1/2]

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

Definition at line 881 of file kInline.h.

882 {
883  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
884  pNext(p) = pNext(t_p);
885  pSetCoeff0(p, pGetCoeff(t_p));
886  return p;
887 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
#define pSetCoeff0(p, n)
Definition: monomials.h:60
int p
Definition: cfModGcd.cc:4019

◆ k_LmInit_tailRing_2_currRing() [2/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 909 of file kInline.h.

910 {
911  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
912 }
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:881
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

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

Definition at line 890 of file kInline.h.

891 {
892  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
893  p_LmFree(p, currRing);
894  return np;
895 }
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 914 of file kInline.h.

915 {
916  return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
917 }
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:890
int p
Definition: cfModGcd.cc:4019

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

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

Definition at line 897 of file kInline.h.

898 {
899  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
900  p_LmFree(p, tailRing);
901  return np;
902 }
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:881
int p
Definition: cfModGcd.cc:4019

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 919 of file kInline.h.

920 {
921  return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
922 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:897

◆ kCheckSpolyCreation()

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

Definition at line 10601 of file kutil.cc.

10602 {
10603  if (strat->overflow) return FALSE;
10604  assume(L->p1 != NULL && L->p2 != NULL);
10605  // shift changes: from 0 to -1
10606  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10607  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10608  assume(strat->tailRing != currRing);
10609 
10610  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10611  return FALSE;
10612  // shift changes: extra case inserted
10613  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10614  {
10615  return TRUE;
10616  }
10617  poly p1_max=NULL;
10618  if (L->i_r1>=0) p1_max = (strat->R[L->i_r1])->max_exp;
10619  poly p2_max=NULL;
10620  if (L->i_r2>=0) p2_max = (strat->R[L->i_r2])->max_exp;
10621 
10622  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10623  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10624  {
10625  p_LmFree(m1, strat->tailRing);
10626  p_LmFree(m2, strat->tailRing);
10627  m1 = NULL;
10628  m2 = NULL;
10629  return FALSE;
10630  }
10631  return TRUE;
10632 }
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:931
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1964
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
#define assume(x)
Definition: mod2.h:390
TObject ** R
Definition: kutil.h:333
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
char overflow
Definition: kutil.h:398
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ kCheckStrongCreation()

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

Definition at line 10641 of file kutil.cc.

10642 {
10643  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10644  //assume(strat->tailRing != currRing);
10645 
10646  poly p1_max = (strat->R[atR])->max_exp;
10647  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10648 
10649  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10650  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10651  {
10652  return FALSE;
10653  }
10654  return TRUE;
10655 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:335
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1964
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:390
TObject ** R
Definition: kutil.h:333
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336

◆ kCreateZeroPoly()

poly kCreateZeroPoly ( long  exp[],
long  cabsind,
poly *  t_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 4276 of file kutil.cc.

4277 {
4278 
4279  poly zeroPoly = NULL;
4280 
4281  number tmp1;
4282  poly tmp2, tmp3;
4283 
4284  if (cabsind == -1)
4285  {
4286  cabsind = 0;
4287  for (int i = 1; i <= leadRing->N; i++)
4288  {
4289  cabsind += ind_fact_2(exp[i]);
4290  }
4291 // Print("cabsind: %d\n", cabsind);
4292  }
4293  if (cabsind < leadRing->ch)
4294  {
4295  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4296  }
4297  else
4298  {
4299  zeroPoly = p_ISet(1, tailRing);
4300  }
4301  for (int i = 1; i <= leadRing->N; i++)
4302  {
4303  for (long j = 1; j <= exp[i]; j++)
4304  {
4305  tmp1 = nInit(j);
4306  tmp2 = p_ISet(1, tailRing);
4307  p_SetExp(tmp2, i, 1, tailRing);
4308  p_Setm(tmp2, tailRing);
4309  if (nIsZero(tmp1))
4310  { // should nowbe obsolet, test ! TODO OLIVER
4311  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4312  }
4313  else
4314  {
4315  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4316  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4317  }
4318  }
4319  }
4320  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4321  for (int i = 1; i <= leadRing->N; i++)
4322  {
4323  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4324  }
4325  p_Setm(tmp2, leadRing);
4326  *t_p = zeroPoly;
4327  zeroPoly = pNext(zeroPoly);
4328  pNext(*t_p) = NULL;
4329  pNext(tmp2) = zeroPoly;
4330  return tmp2;
4331 }
int j
Definition: facHensel.cc:105
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
#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:1435
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
long twoPow(long arg)
Definition: kutil.cc:4087
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
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 @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:4072
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:16
#define pNext(p)
Definition: monomials.h:37
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
#define nInit(i)
Definition: numbers.h:25
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1289
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 11619 of file kutil.cc.

11620 {
11621  PrintS("red: ");
11622  if (strat->red==redFirst) PrintS("redFirst\n");
11623  else if (strat->red==redHoney) PrintS("redHoney\n");
11624  else if (strat->red==redEcart) PrintS("redEcart\n");
11625  else if (strat->red==redHomog) PrintS("redHomog\n");
11626  else Print("%p\n",(void*)strat->red);
11627  PrintS("posInT: ");
11628  if (strat->posInT==posInT0) PrintS("posInT0\n");
11629  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11630  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11631  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11632  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11633  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11634  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11635  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11636  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11637  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11638  #ifdef HAVE_RINGS
11639  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11640  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11641  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11642  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11643  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11644  #endif
11645 #ifdef HAVE_MORE_POS_IN_T
11646  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11647  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11648  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11649 #endif
11650  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11651  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11652  else Print("%p\n",(void*)strat->posInT);
11653  PrintS("posInL: ");
11654  if (strat->posInL==posInL0) PrintS("posInL0\n");
11655  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11656  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11657  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11658  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11659  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11660  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11661  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11662  #ifdef HAVE_RINGS
11663  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11664  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11665  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11666  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11667  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11668  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11669  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11670  #endif
11671  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11672  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11673  else Print("%p\n",(void*)strat->posInL);
11674  PrintS("enterS: ");
11675  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11676  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11677  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11678  else Print("%p\n",(void*)strat->enterS);
11679  PrintS("initEcart: ");
11680  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11681  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11682  else Print("%p\n",(void*)strat->initEcart);
11683  PrintS("initEcartPair: ");
11684  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11685  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11686  else Print("%p\n",(void*)strat->initEcartPair);
11687  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11688  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11689  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11690  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11691  PrintS("chainCrit: ");
11692  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11693  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11694  else Print("%p\n",(void*)strat->chainCrit);
11695  Print("posInLDependsOnLength=%d\n",
11696  strat->posInLDependsOnLength);
11697  PrintS(showOption());PrintLn();
11698  PrintS("LDeg: ");
11699  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11700  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11701  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11702  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11703  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11704  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11705  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11706  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11707  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11708  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11709  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11710  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11711  else Print("? (%lx)", (long)currRing->pLDeg);
11712  PrintS(" / ");
11713  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11714  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11715  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11716  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11717  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11718  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11719  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11720  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11721  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11722  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11723  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11724  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11725  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11726  PrintLn();
11727  PrintS("currRing->pFDeg: ");
11728  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11729  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11730  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11731  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11732  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11733  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11734  else Print("? (%lx)", (long)currRing->pFDeg);
11735  PrintLn();
11736  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11737  if(TEST_OPT_DEGBOUND)
11738  Print(" degBound: %d\n", Kstd1_deg);
11739 
11740  if( ecartWeights != NULL )
11741  {
11742  PrintS("ecartWeights: ");
11743  for (int i = rVar(currRing); i > 0; i--)
11744  Print("%hd ", ecartWeights[i]);
11745  PrintLn();
11747  }
11748 
11749 #ifndef SING_NDEBUG
11751 #endif
11752 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1272
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6239
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11585
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5319
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6736
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1272
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5212
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:347
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:833
#define TEST_OPT_DEGBOUND
Definition: options.h:112
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6281
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6351
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:997
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6695
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:869
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5184
char noTailReduction
Definition: kutil.h:372
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:223
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3140
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6453
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6780
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6660
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6625
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6578
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5606
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:762
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
int ak
Definition: kutil.h:346
char * showOption()
Definition: misc_ip.cc:728
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:902
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6894
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5552
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:269
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:545
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6537
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5173
char use_buckets
Definition: kutil.h:377
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:933
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1387
void(* initEcart)(TObject *L)
Definition: kutil.h:271
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5242
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5754
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
char sugarCrit
Definition: kutil.h:371
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5278
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1279
#define assume(x)
Definition: mod2.h:390
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:588
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5708
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:731
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2074
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5981
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6830
void rDebugPrint(const ring r)
Definition: ring.cc:4016
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5647
int Kstd1_deg
Definition: kutil.cc:236
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1326
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11494
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:366
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:282
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:803
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:967
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:168
ring tailRing
Definition: kutil.h:336
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5395
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5437
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3353
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:253
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1030
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:530
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5938
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1060
char posInLDependsOnLength
Definition: kutil.h:383
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:605
char Gebauer
Definition: kutil.h:372
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5881
void initEcartNormal(TObject *h)
Definition: kutil.cc:1257
int LazyPass
Definition: kutil.h:346
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11548
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5513
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1008
int LazyDegree
Definition: kutil.h:346
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5815
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5484
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050

◆ kDeleteLcm()

static void kDeleteLcm ( LObject P)
inlinestatic

Definition at line 844 of file kutil.h.

845 {
846  if (P->lcm!=NULL)
847  {
848  #ifdef HAVE_RINGS
850  pLmDelete(P->lcm);
851  else
852  #endif
853  pLmFree(P->lcm);
854  P->lcm=NULL;
855  }
856 }
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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

◆ kFindDivisibleByInS()

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

197 {
198  unsigned long not_sev = ~L->sev;
199  poly p = L->GetLmCurrRing();
200  int j = 0;
201 
202  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
203 
205 #if 1
206  int ende;
207  if (is_Ring
208  || (strat->ak>0)
209  || currRing->pLexOrder)
210  ende=strat->sl;
211  else
212  {
213  ende=posInS(strat,*max_ind,p,0)+1;
214  if (ende>(*max_ind)) ende=(*max_ind);
215  }
216 #else
217  int ende=strat->sl;
218 #endif
219  if(is_Ring)
220  {
221  loop
222  {
223  if (j > ende) return -1;
224 #if defined(PDEBUG) || defined(PDIV_DEBUG)
225  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
226  p, not_sev, currRing))
227  {
228  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
229  return j;
230  }
231 #else
232  if ( !(strat->sevS[j] & not_sev) &&
233  p_LmDivisibleBy(strat->S[j], p, currRing))
234  {
235  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
236  return j;
237  }
238 #endif
239  j++;
240  }
241  }
242  else
243  {
244  loop
245  {
246  if (j > ende) return -1;
247 #if defined(PDEBUG) || defined(PDIV_DEBUG)
248  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
249  p, not_sev, currRing))
250  {
251  return j;
252  }
253 #else
254  if ( !(strat->sevS[j] & not_sev) &&
255  p_LmDivisibleBy(strat->S[j], p, currRing))
256  {
257  return j;
258  }
259 #endif
260  j++;
261  }
262  }
263 }
int j
Definition: facHensel.cc:105
#define pAssume(cond)
Definition: monomials.h:91
int ak
Definition: kutil.h:346
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
polyset S
Definition: kutil.h:297
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1821
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4679
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85

◆ kFindDivisibleByInS_T()

TObject* kFindDivisibleByInS_T ( kStrategy  strat,
int  end_pos,
LObject L,
TObject T,
long  ecart = LONG_MAX 
)

Definition at line 7179 of file kutil.cc.

7180 {
7181  int j = 0;
7182  const unsigned long not_sev = ~L->sev;
7183  const unsigned long* sev = strat->sevS;
7184  poly p;
7185  ring r;
7186  L->GetLm(p, r);
7187 
7188  assume(~not_sev == p_GetShortExpVector(p, r));
7189 
7190  if (r == currRing)
7191  {
7192  if(!rField_is_Ring(r))
7193  {
7194  loop
7195  {
7196  if (j > end_pos) return NULL;
7197  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7198  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7199  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7200  {
7201  break;
7202  }
7203  #else
7204  if (!(sev[j] & not_sev) &&
7205  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7206  p_LmDivisibleBy(strat->S[j], p, r))
7207  {
7208  break;
7209  }
7210  #endif
7211  j++;
7212  }
7213  }
7214  #ifdef HAVE_RINGS
7215  else
7216  {
7217  loop
7218  {
7219  if (j > end_pos) return NULL;
7220  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7221  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7222  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7223  {
7224  break;
7225  }
7226  #else
7227  if (!(sev[j] & not_sev) &&
7228  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7229  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7230  {
7231  break;
7232  }
7233  #endif
7234  j++;
7235  }
7236  }
7237  #endif
7238  // if called from NF, T objects do not exist:
7239  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7240  {
7241  T->Set(strat->S[j], r, strat->tailRing);
7242  assume(T->GetpLength()==pLength(T->p != __null ? T->p : T->t_p));
7243  return T;
7244  }
7245  else
7246  {
7247 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7248 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7249 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7250  return strat->S_2_T(j);
7251  }
7252  }
7253  else
7254  {
7255  TObject* t;
7256  if(!rField_is_Ring(r))
7257  {
7258  loop
7259  {
7260  if (j > end_pos) return NULL;
7261  assume(strat->S_2_R[j] != -1);
7262  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7263  t = strat->S_2_T(j);
7264  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7265  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7266  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7267  {
7268  t->pLength=pLength(t->t_p);
7269  return t;
7270  }
7271  #else
7272  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7273  {
7274  t = strat->S_2_T(j);
7275  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7276  if (p_LmDivisibleBy(t->t_p, p, r))
7277  {
7278  t->pLength=pLength(t->t_p);
7279  return t;
7280  }
7281  }
7282  #endif
7283  j++;
7284  }
7285  }
7286  #ifdef HAVE_RINGS
7287  else
7288  {
7289  loop
7290  {
7291  if (j > end_pos) return NULL;
7292  assume(strat->S_2_R[j] != -1);
7293  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7294  t = strat->S_2_T(j);
7295  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7296  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7297  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7298  {
7299  t->pLength=pLength(t->t_p);
7300  return t;
7301  }
7302  #else
7303  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7304  {
7305  t = strat->S_2_T(j);
7306  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7307  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7308  {
7309  t->pLength=pLength(t->t_p);
7310  return t;
7311  }
7312  }
7313  #endif
7314  j++;
7315  }
7316  }
7317  #endif
7318  }
7319 }
int j
Definition: facHensel.cc:105
int * S_2_R
Definition: kutil.h:335
int tl
Definition: kutil.h:343
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:35
#define assume(x)
Definition: mod2.h:390
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
static unsigned pLength(poly a)
Definition: p_polys.h:193
polyset S
Definition: kutil.h:297
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1821
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4679
intset ecartS
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:31
class sTObject TObject
Definition: kutil.h:53

◆ kFindDivisibleByInT()

int kFindDivisibleByInT ( const kStrategy  strat,
const LObject L,
const int  start = 0 
)

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

Definition at line 86 of file kstd2.cc.

87 {
88  unsigned long not_sev = ~L->sev;
89  int j = start;
90 
91  const TSet T=strat->T;
92  const unsigned long* sevT=strat->sevT;
93  const ring r=currRing;
94  const BOOLEAN is_Ring=rField_is_Ring(r);
95  if (L->p!=NULL)
96  {
97  const poly p=L->p;
98 
99  pAssume(~not_sev == p_GetShortExpVector(p, r));
100 
101  if(is_Ring)
102  {
103  loop
104  {
105  if (j > strat->tl) return -1;
106 #if defined(PDEBUG) || defined(PDIV_DEBUG)
107  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
108  {
109  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
110  return j;
111  }
112 #else
113  if (!(sevT[j] & not_sev) &&
114  p_LmDivisibleBy(T[j].p, p, r))
115  {
116  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
117  return j;
118  }
119 #endif
120  j++;
121  }
122  }
123  else
124  {
125  loop
126  {
127  if (j > strat->tl) return -1;
128 #if defined(PDEBUG) || defined(PDIV_DEBUG)
129  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
130  {
131  return j;
132  }
133 #else
134  if (!(sevT[j] & not_sev) &&
135  p_LmDivisibleBy(T[j].p, p, r))
136  {
137  return j;
138  }
139 #endif
140  j++;
141  }
142  }
143  }
144  else
145  {
146  const poly p=L->t_p;
147  const ring r=strat->tailRing;
148  if(is_Ring)
149  {
150  loop
151  {
152  if (j > strat->tl) return -1;
153 #if defined(PDEBUG) || defined(PDIV_DEBUG)
154  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
155  p, not_sev, r))
156  {
157  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
158  return j;
159  }
160 #else
161  if (!(sevT[j] & not_sev) &&
162  p_LmDivisibleBy(T[j].t_p, p, r))
163  {
164  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
165  return j;
166  }
167 #endif
168  j++;
169  }
170  }
171  else
172  {
173  loop
174  {
175  if (j > strat->tl) return -1;
176 #if defined(PDEBUG) || defined(PDIV_DEBUG)
177  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
178  p, not_sev, r))
179  {
180  return j;
181  }
182 #else
183  if (!(sevT[j] & not_sev) &&
184  p_LmDivisibleBy(T[j].t_p, p, r))
185  {
186  return j;
187  }
188 #endif
189  j++;
190  }
191  }
192  }
193 }
int j
Definition: facHensel.cc:105
TObject * TSet
Definition: kutil.h:55
#define pAssume(cond)
Definition: monomials.h:91
int tl
Definition: kutil.h:343
unsigned long * sevT
Definition: kutil.h:316
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1821
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4679
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:31
int BOOLEAN
Definition: auxiliary.h:85

◆ kFindInT()

int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 704 of file kutil.cc.

705 {
706  int i;
707 
708  for (i=0; i<=tlength; i++)
709  {
710  if (T[i].p == p) return i;
711  }
712  return -1;
713 }
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:31

◆ kFindNextDivisibleByInS()

int kFindNextDivisibleByInS ( const kStrategy  strat,
int  start,
int  max_ind,
LObject L 
)

Definition at line 265 of file kstd2.cc.

266 {
267  unsigned long not_sev = ~L->sev;
268  poly p = L->GetLmCurrRing();
269  int j = start;
270 
271  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
272 #if 1
273  int ende=max_ind;
274 #else
275  int ende=strat->sl;
276 #endif
278  {
279  loop
280  {
281  if (j > ende) return -1;
282 #if defined(PDEBUG) || defined(PDIV_DEBUG)
283  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
284  p, not_sev, currRing))
285  {
286  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
287  return j;
288  }
289 #else
290  if ( !(strat->sevS[j] & not_sev) &&
291  p_LmDivisibleBy(strat->S[j], p, currRing))
292  {
293  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
294  return j;
295  }
296 #endif
297  j++;
298  }
299  }
300  else
301  {
302  loop
303  {
304  if (j > ende) return -1;
305 #if defined(PDEBUG) || defined(PDIV_DEBUG)
306  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
307  p, not_sev, currRing))
308  {
309  return j;
310  }
311 #else
312  if ( !(strat->sevS[j] & not_sev) &&
313  p_LmDivisibleBy(strat->S[j], p, currRing))
314  {
315  return j;
316  }
317 #endif
318  j++;
319  }
320  }
321 }
int j
Definition: facHensel.cc:105
#define pAssume(cond)
Definition: monomials.h:91
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
polyset S
Definition: kutil.h:297
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1821
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4679
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019

◆ kFindZeroPoly()

poly kFindZeroPoly ( poly  input_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 324 of file kstd2.cc.

325 {
326  // m = currRing->ch
327 
328  if (input_p == NULL) return NULL;
329 
330  poly p = input_p;
331  poly zeroPoly = NULL;
332  unsigned long a = (unsigned long) pGetCoeff(p);
333 
334  int k_ind2 = 0;
335  int a_ind2 = ind2(a);
336 
337  // unsigned long k = 1;
338  // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
339  for (int i = 1; i <= leadRing->N; i++)
340  {
341  k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
342  }
343 
344  a = (unsigned long) pGetCoeff(p);
345 
346  number tmp1;
347  poly tmp2, tmp3;
348  poly lead_mult = p_ISet(1, tailRing);
349  if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
350  {
351  int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
352  int s_exp;
353  zeroPoly = p_ISet(a, tailRing);
354  for (int i = 1; i <= leadRing->N; i++)
355  {
356  s_exp = p_GetExp(p, i,leadRing);
357  if (s_exp % 2 != 0)
358  {
359  s_exp = s_exp - 1;
360  }
361  while ( (0 < ind2(s_exp)) && (ind2(s_exp) <= too_much) )
362  {
363  too_much = too_much - ind2(s_exp);
364  s_exp = s_exp - 2;
365  }
366  p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
367  for (int j = 1; j <= s_exp; j++)
368  {
369  tmp1 = nInit(j);
370  tmp2 = p_ISet(1, tailRing);
371  p_SetExp(tmp2, i, 1, tailRing);
372  p_Setm(tmp2, tailRing);
373  if (nIsZero(tmp1))
374  { // should nowbe obsolet, test ! TODO OLIVER
375  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
376  }
377  else
378  {
379  tmp3 = p_NSet(nCopy(tmp1), tailRing);
380  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
381  }
382  }
383  }
384  p_Setm(lead_mult, tailRing);
385  zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
386  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
387  for (int i = 1; i <= leadRing->N; i++)
388  {
389  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
390  }
391  p_Setm(tmp2, leadRing);
392  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
393  pNext(tmp2) = zeroPoly;
394  return tmp2;
395  }
396 /* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
397  if (1 == 0 && alpha_k <= a)
398  { // Temporarly disabled, reducing coefficients not compatible with std TODO Oliver
399  zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
400  for (int i = 1; i <= leadRing->N; i++)
401  {
402  for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
403  {
404  tmp1 = nInit(j);
405  tmp2 = p_ISet(1, tailRing);
406  p_SetExp(tmp2, i, 1, tailRing);
407  p_Setm(tmp2, tailRing);
408  if (nIsZero(tmp1))
409  {
410  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
411  }
412  else
413  {
414  tmp3 = p_ISet((unsigned long) tmp1, tailRing);
415  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
416  }
417  }
418  }
419  tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
420  for (int i = 1; i <= leadRing->N; i++)
421  {
422  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
423  }
424  p_Setm(tmp2, leadRing);
425  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
426  pNext(tmp2) = zeroPoly;
427  return tmp2;
428  } */
429  return NULL;
430 }
int j
Definition: facHensel.cc:105
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:726
#define pSetExp(p, i, v)
Definition: polys.h:42
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:998
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1435
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
int i
Definition: cfEzgcd.cc:125
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 @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:4072
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:16
#define pNext(p)
Definition: monomials.h:37
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
long ind2(long arg)
Definition: kutil.cc:4060
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
#define nInit(i)
Definition: numbers.h:25
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1289
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051

◆ kFreeStrat()

void kFreeStrat ( kStrategy  strat)

◆ kNF2() [1/2]

poly kNF2 ( ideal  F,
ideal  Q,
poly  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3218 of file kstd2.cc.

3219 {
3220  assume(q!=NULL);
3221  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3222 
3223 // lazy_reduce flags: can be combined by |
3224 //#define KSTD_NF_LAZY 1
3225  // do only a reduction of the leading term
3226 //#define KSTD_NF_NONORM 4
3227  // only global: avoid normalization, return a multiply of NF
3228  poly p;
3229 
3230  //if ((idIs0(F))&&(Q==NULL))
3231  // return pCopy(q); /*F=0*/
3232  //strat->ak = idRankFreeModule(F);
3233  /*- creating temp data structures------------------- -*/
3234  BITSET save1;
3235  SI_SAVE_OPT1(save1);
3237  initBuchMoraCrit(strat);
3238  strat->initEcart = initEcartBBA;
3239  strat->enterS = enterSBba;
3240 #ifndef NO_BUCKETS
3242 #endif
3243  /*- set S -*/
3244  strat->sl = -1;
3245  /*- init local data struct.---------------------------------------- -*/
3246  /*Shdl=*/initS(F,Q,strat);
3247  /*- compute------------------------------------------------------- -*/
3248  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3249  //{
3250  // for (i=strat->sl;i>=0;i--)
3251  // pNorm(strat->S[i]);
3252  //}
3253  kTest(strat);
3254  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3255  if (BVERBOSE(23)) kDebugPrint(strat);
3256  int max_ind;
3257  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3258  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3259  {
3260  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3261  if (rField_is_Ring(currRing))
3262  {
3263  p = redtailBba_Z(p,max_ind,strat);
3264  }
3265  else
3266  {
3268  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3269  }
3270  }
3271  /*- release temp data------------------------------- -*/
3272  assume(strat->L==NULL); /* strat->L unused */
3273  assume(strat->B==NULL); /* strat->B unused */
3274  omFree(strat->sevS);
3275  omFree(strat->ecartS);
3276  assume(strat->T==NULL);//omfree(strat->T);
3277  assume(strat->sevT==NULL);//omfree(strat->sevT);
3278  assume(strat->R==NULL);//omfree(strat->R);
3279  omfree(strat->S_2_R);
3280  omfree(strat->fromQ);
3281  idDelete(&strat->Shdl);
3282  SI_RESTORE_OPT1(save1);
3283  if (TEST_OPT_PROT) PrintLn();
3284  return p;
3285 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1100
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:102
int * S_2_R
Definition: kutil.h:335
#define kTest(A)
Definition: kutil.h:643
unsigned long * sevT
Definition: kutil.h:316
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:377
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1589
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
#define mflush()
Definition: reporter.h:57
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:90
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
intset fromQ
Definition: kutil.h:312
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:333
#define OPT_INTSTRATEGY
Definition: options.h:91
#define BVERBOSE(a)
Definition: options.h:35
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:300
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11619
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ kNF2() [2/2]

ideal kNF2 ( ideal  F,
ideal  Q,
ideal  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3357 of file kstd2.cc.

3358 {
3359  assume(!idIs0(q));
3360  assume(!(idIs0(F)&&(Q==NULL)));
3361 // lazy_reduce flags: can be combined by |
3362 //#define KSTD_NF_LAZY 1
3363  // do only a reduction of the leading term
3364 //#define KSTD_NF_NONORM 4
3365  // only global: avoid normalization, return a multiply of NF
3366  poly p;
3367  int i;
3368  ideal res;
3369  int max_ind;
3370 
3371  //if (idIs0(q))
3372  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3373  //if ((idIs0(F))&&(Q==NULL))
3374  // return idCopy(q); /*F=0*/
3375  //strat->ak = idRankFreeModule(F);
3376  /*- creating temp data structures------------------- -*/
3377  BITSET save1;
3378  SI_SAVE_OPT1(save1);
3380  initBuchMoraCrit(strat);
3381  strat->initEcart = initEcartBBA;
3382  strat->enterS = enterSBba;
3383  /*- set S -*/
3384  strat->sl = -1;
3385 #ifndef NO_BUCKETS
3387 #endif
3388  /*- init local data struct.---------------------------------------- -*/
3389  /*Shdl=*/initS(F,Q,strat);
3390  /*- compute------------------------------------------------------- -*/
3391  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3393  for (i=IDELEMS(q)-1; i>=0; i--)
3394  {
3395  if (q->m[i]!=NULL)
3396  {
3397  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3398  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3399  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3400  {
3401  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3402  if (rField_is_Ring(currRing))
3403  {
3404  p = redtailBba_Z(p,max_ind,strat);
3405  }
3406  else
3407  {
3408  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3409  }
3410  }
3411  res->m[i]=p;
3412  }
3413  //else
3414  // res->m[i]=NULL;
3415  }
3416  /*- release temp data------------------------------- -*/
3417  assume(strat->L==NULL); /* strat->L unused */
3418  assume(strat->B==NULL); /* strat->B unused */
3419  omFree(strat->sevS);
3420  omFree(strat->ecartS);
3421  assume(strat->T==NULL);//omfree(strat->T);
3422  assume(strat->sevT==NULL);//omfree(strat->sevT);
3423  assume(strat->R==NULL);//omfree(strat->R);
3424  omfree(strat->S_2_R);
3425  omfree(strat->fromQ);
3426  idDelete(&strat->Shdl);
3427  SI_RESTORE_OPT1(save1);
3428  if (TEST_OPT_PROT) PrintLn();
3429  return res;
3430 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1100
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:102
int * S_2_R
Definition: kutil.h:335
unsigned long * sevT
Definition: kutil.h:316
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:377
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1589
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
#define mflush()
Definition: reporter.h:57
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
#define KSTD_NF_LAZY
Definition: kstd1.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
#define OPT_REDTAIL
Definition: options.h:90
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
intset fromQ
Definition: kutil.h:312
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
#define OPT_INTSTRATEGY
Definition: options.h:91
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:300
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ kNF2Bound() [1/2]

poly kNF2Bound ( ideal  F,
ideal  Q,
poly  q,
int  bound,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3287 of file kstd2.cc.

3288 {
3289  assume(q!=NULL);
3290  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3291 
3292 // lazy_reduce flags: can be combined by |
3293 //#define KSTD_NF_LAZY 1
3294  // do only a reduction of the leading term
3295 //#define KSTD_NF_NONORM 4
3296  // only global: avoid normalization, return a multiply of NF
3297  poly p;
3298 
3299  //if ((idIs0(F))&&(Q==NULL))
3300  // return pCopy(q); /*F=0*/
3301  //strat->ak = idRankFreeModule(F);
3302  /*- creating temp data structures------------------- -*/
3303  BITSET save1;
3304  SI_SAVE_OPT1(save1);
3306  initBuchMoraCrit(strat);
3307  strat->initEcart = initEcartBBA;
3308  strat->enterS = enterSBba;
3309 #ifndef NO_BUCKETS
3311 #endif
3312  /*- set S -*/
3313  strat->sl = -1;
3314  /*- init local data struct.---------------------------------------- -*/
3315  /*Shdl=*/initS(F,Q,strat);
3316  /*- compute------------------------------------------------------- -*/
3317  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3318  //{
3319  // for (i=strat->sl;i>=0;i--)
3320  // pNorm(strat->S[i]);
3321  //}
3322  kTest(strat);
3323  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3324  if (BVERBOSE(23)) kDebugPrint(strat);
3325  int max_ind;
3326  p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3327  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3328  {
3329  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3330  if (rField_is_Ring(currRing))
3331  {
3332  p = redtailBba_Z(p,max_ind,strat);
3333  }
3334  else
3335  {
3337  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3338  //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3339  }
3340  }
3341  /*- release temp data------------------------------- -*/
3342  assume(strat->L==NULL); /* strat->L unused */
3343  assume(strat->B==NULL); /* strat->B unused */
3344  omFree(strat->sevS);
3345  omFree(strat->ecartS);
3346  assume(strat->T==NULL);//omfree(strat->T);
3347  assume(strat->sevT==NULL);//omfree(strat->sevT);
3348  assume(strat->R==NULL);//omfree(strat->R);
3349  omfree(strat->S_2_R);
3350  omfree(strat->fromQ);
3351  idDelete(&strat->Shdl);
3352  SI_RESTORE_OPT1(save1);
3353  if (TEST_OPT_PROT) PrintLn();
3354  return p;
3355 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1100
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:102
int * S_2_R
Definition: kutil.h:335
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition: kstd2.cc:1745
#define kTest(A)
Definition: kutil.h:643
unsigned long * sevT
Definition: kutil.h:316
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:377
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
#define mflush()
Definition: reporter.h:57
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1093
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:90
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
intset fromQ
Definition: kutil.h:312
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:333
#define OPT_INTSTRATEGY
Definition: options.h:91
#define BVERBOSE(a)
Definition: options.h:35
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:300
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11619
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ kNF2Bound() [2/2]

ideal kNF2Bound ( ideal  F,
ideal  Q,
ideal  q,
int  bound,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 3432 of file kstd2.cc.

3433 {
3434  assume(!idIs0(q));
3435  assume(!(idIs0(F)&&(Q==NULL)));
3436 // lazy_reduce flags: can be combined by |
3437 //#define KSTD_NF_LAZY 1
3438  // do only a reduction of the leading term
3439 //#define KSTD_NF_NONORM 4
3440  // only global: avoid normalization, return a multiply of NF
3441  poly p;
3442  int i;
3443  ideal res;
3444  int max_ind;
3445 
3446  //if (idIs0(q))
3447  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3448  //if ((idIs0(F))&&(Q==NULL))
3449  // return idCopy(q); /*F=0*/
3450  //strat->ak = idRankFreeModule(F);
3451  /*- creating temp data structures------------------- -*/
3452  BITSET save1;
3453  SI_SAVE_OPT1(save1);
3455  initBuchMoraCrit(strat);
3456  strat->initEcart = initEcartBBA;
3457  strat->enterS = enterSBba;
3458  /*- set S -*/
3459  strat->sl = -1;
3460 #ifndef NO_BUCKETS
3462 #endif
3463  /*- init local data struct.---------------------------------------- -*/
3464  /*Shdl=*/initS(F,Q,strat);
3465  /*- compute------------------------------------------------------- -*/
3466  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3468  for (i=IDELEMS(q)-1; i>=0; i--)
3469  {
3470  if (q->m[i]!=NULL)
3471  {
3472  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3473  p = redNFBound(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3474  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3475  {
3476  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3477  if (rField_is_Ring(currRing))
3478  {
3479  p = redtailBba_Z(p,max_ind,strat);
3480  }
3481  else
3482  {
3483  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3484  }
3485  }
3486  res->m[i]=p;
3487  }
3488  //else
3489  // res->m[i]=NULL;
3490  }
3491  /*- release temp data------------------------------- -*/
3492  assume(strat->L==NULL); /* strat->L unused */
3493  assume(strat->B==NULL); /* strat->B unused */
3494  omFree(strat->sevS);
3495  omFree(strat->ecartS);
3496  assume(strat->T==NULL);//omfree(strat->T);
3497  assume(strat->sevT==NULL);//omfree(strat->sevT);
3498  assume(strat->R==NULL);//omfree(strat->R);
3499  omfree(strat->S_2_R);
3500  omfree(strat->fromQ);
3501  idDelete(&strat->Shdl);
3502  SI_RESTORE_OPT1(save1);
3503  if (TEST_OPT_PROT) PrintLn();
3504  return res;
3505 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1100
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:102
int * S_2_R
Definition: kutil.h:335
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition: kstd2.cc:1745
unsigned long * sevT
Definition: kutil.h:316
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:377
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
#define mflush()
Definition: reporter.h:57
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1093
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
#define KSTD_NF_LAZY
Definition: kstd1.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
#define OPT_REDTAIL
Definition: options.h:90
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
intset fromQ
Definition: kutil.h:312
void initEcartBBA(TObject *h)
Definition: kutil.cc:1265
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:333
#define IDELEMS(i)
Definition: simpleideals.h:24
#define OPT_INTSTRATEGY
Definition: options.h:91
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:300
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:319
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:294
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ ksCreateShortSpoly()

poly ksCreateShortSpoly ( poly  p1,
poly  p2,
ring  tailRing 
)

Definition at line 998 of file kspoly.cc.

999 {
1000  poly a1 = pNext(p1), a2 = pNext(p2);
1001  long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
1002  long c;
1003  poly m1,m2;
1004  number t1 = NULL,t2 = NULL;
1005  int cm,i;
1006  BOOLEAN equal;
1007 
1008 #ifdef HAVE_RINGS
1009  BOOLEAN is_Ring=rField_is_Ring(currRing);
1010  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
1011  if (is_Ring)
1012  {
1013  ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
1014  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1015  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1016  while (a1 != NULL && nIsZero(t2))
1017  {
1018  pIter(a1);
1019  nDelete(&t2);
1020  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1021  }
1022  while (a2 != NULL && nIsZero(t1))
1023  {
1024  pIter(a2);
1025  nDelete(&t1);
1026  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1027  }
1028  }
1029 #endif
1030 
1031  if (a1==NULL)
1032  {
1033  if(a2!=NULL)
1034  {
1035  m2=p_Init(currRing);
1036 x2:
1037  for (i = (currRing->N); i; i--)
1038  {
1039  c = p_GetExpDiff(p1, p2,i, currRing);
1040  if (c>0)
1041  {
1042  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
1043  }
1044  else
1045  {
1046  p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
1047  }
1048  }
1049  if ((c1==c2)||(c2!=0))
1050  {
1051  p_SetComp(m2,p_GetComp(a2,tailRing), currRing);
1052  }
1053  else
1054  {
1055  p_SetComp(m2,c1,currRing);
1056  }
1057  p_Setm(m2, currRing);
1058 #ifdef HAVE_RINGS
1059  if (is_Ring)
1060  {
1061  nDelete(&lc1);
1062  nDelete(&lc2);
1063  nDelete(&t2);
1064  pSetCoeff0(m2, t1);
1065  }
1066 #endif
1067  return m2;
1068  }
1069  else
1070  {
1071 #ifdef HAVE_RINGS
1072  if (is_Ring)
1073  {
1074  nDelete(&lc1);
1075  nDelete(&lc2);
1076  nDelete(&t1);
1077  nDelete(&t2);
1078  }
1079 #endif
1080  return NULL;
1081  }
1082  }
1083  if (a2==NULL)
1084  {
1085  m1=p_Init(currRing);
1086 x1:
1087  for (i = (currRing->N); i; i--)
1088  {
1089  c = p_GetExpDiff(p2, p1,i,currRing);
1090  if (c>0)
1091  {
1092  p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
1093  }
1094  else
1095  {
1096  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1097  }
1098  }
1099  if ((c1==c2)||(c1!=0))
1100  {
1101  p_SetComp(m1,p_GetComp(a1,tailRing),currRing);
1102  }
1103  else
1104  {
1105  p_SetComp(m1,c2,currRing);
1106  }
1107  p_Setm(m1, currRing);
1108 #ifdef HAVE_RINGS
1109  if (is_Ring)
1110  {
1111  pSetCoeff0(m1, t2);
1112  nDelete(&lc1);
1113  nDelete(&lc2);
1114  nDelete(&t1);
1115  }
1116 #endif
1117  return m1;
1118  }
1119  m1 = p_Init(currRing);
1120  m2 = p_Init(currRing);
1121  loop
1122  {
1123  for (i = (currRing->N); i; i--)
1124  {
1125  c = p_GetExpDiff(p1, p2,i,currRing);
1126  if (c > 0)
1127  {
1128  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
1129  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1130  }
1131  else
1132  {
1133  p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
1134  p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
1135  }
1136  }
1137  if(c1==c2)
1138  {
1139  p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
1140  p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
1141  }
1142  else
1143  {
1144  if(c1!=0)
1145  {
1146  p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
1147  p_SetComp(m2,c1, currRing);
1148  }
1149  else
1150  {
1151  p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
1152  p_SetComp(m1,c2, currRing);
1153  }
1154  }
1155  p_Setm(m1,currRing);
1156  p_Setm(m2,currRing);
1157  cm = p_LmCmp(m1, m2,currRing);
1158  if (cm!=0)
1159  {
1160  if(cm==1)
1161  {
1162  p_LmFree(m2,currRing);
1163 #ifdef HAVE_RINGS
1164  if (is_Ring)
1165  {
1166  pSetCoeff0(m1, t2);
1167  nDelete(&lc1);
1168  nDelete(&lc2);
1169  nDelete(&t1);
1170  }
1171 #endif
1172  return m1;
1173  }
1174  else
1175  {
1176  p_LmFree(m1,currRing);
1177 #ifdef HAVE_RINGS
1178  if (is_Ring)
1179  {
1180  pSetCoeff0(m2, t1);
1181  nDelete(&lc1);
1182  nDelete(&lc2);
1183  nDelete(&t2);
1184  }
1185 #endif
1186  return m2;
1187  }
1188  }
1189 #ifdef HAVE_RINGS
1190  if (is_Ring)
1191  {
1192  equal = nEqual(t1,t2);
1193  }
1194  else
1195 #endif
1196  {
1197  t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
1198  t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
1199  equal = nEqual(t1,t2);
1200  nDelete(&t2);
1201  nDelete(&t1);
1202  }
1203  if (!equal)
1204  {
1205  p_LmFree(m2,currRing);
1206 #ifdef HAVE_RINGS
1207  if (is_Ring)
1208  {
1209  pSetCoeff0(m1, nSub(t1, t2));
1210  nDelete(&lc1);
1211  nDelete(&lc2);
1212  nDelete(&t1);
1213  nDelete(&t2);
1214  }
1215 #endif
1216  return m1;
1217  }
1218  pIter(a1);
1219  pIter(a2);
1220 #ifdef HAVE_RINGS
1221  if (is_Ring)
1222  {
1223  if (a2 != NULL)
1224  {
1225  nDelete(&t1);
1226  t1 = nMult(pGetCoeff(a2),lc1);
1227  }
1228  if (a1 != NULL)
1229  {
1230  nDelete(&t2);
1231  t2 = nMult(pGetCoeff(a1),lc2);
1232  }
1233  while ((a1 != NULL) && nIsZero(t2))
1234  {
1235  pIter(a1);
1236  if (a1 != NULL)
1237  {
1238  nDelete(&t2);
1239  t2 = nMult(pGetCoeff(a1),lc2);
1240  }
1241  }
1242  while ((a2 != NULL) && nIsZero(t1))
1243  {
1244  pIter(a2);
1245  if (a2 != NULL)
1246  {
1247  nDelete(&t1);
1248  t1 = nMult(pGetCoeff(a2),lc1);
1249  }
1250  }
1251  }
1252 #endif
1253  if (a2==NULL)
1254  {
1255  p_LmFree(m2,currRing);
1256  if (a1==NULL)
1257  {
1258 #ifdef HAVE_RINGS
1259  if (is_Ring)
1260  {
1261  nDelete(&lc1);
1262  nDelete(&lc2);
1263  nDelete(&t1);
1264  nDelete(&t2);
1265  }
1266 #endif
1267  p_LmFree(m1,currRing);
1268  return NULL;
1269  }
1270  goto x1;
1271  }
1272  if (a1==NULL)
1273  {
1274  p_LmFree(m1,currRing);
1275  goto x2;
1276  }
1277  }
1278 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
#define p_GetComp(p, r)
Definition: monomials.h:65
int ksCheckCoeff(number *a, number *b)
#define nEqual(n1, n2)
Definition: numbers.h:21
#define loop
Definition: structs.h:78
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
#define pIter(p)
Definition: monomials.h:38
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:636
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 @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define nMult(n1, n2)
Definition: numbers.h:18
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1498
#define nSub(n1, n2)
Definition: numbers.h:23
int i
Definition: cfEzgcd.cc:125
#define nDelete(n)
Definition: numbers.h:17
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
#define nIsZero(n)
Definition: numbers.h:20
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
#define pSetCoeff0(p, n)
Definition: monomials.h:60
int BOOLEAN
Definition: auxiliary.h:85
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257

◆ ksCreateSpoly()

void ksCreateSpoly ( LObject Pair,
poly  spNoether = NULL,
int  use_buckets = 0,
ring  tailRing = currRing,
poly  m1 = NULL,
poly  m2 = NULL,
TObject **  R = NULL 
)

Definition at line 752 of file kspoly.cc.

755 {
756 #ifdef KDEBUG
757  create_count++;
758 #endif
759  kTest_L(Pair);
760  poly p1 = Pair->p1;
761  poly p2 = Pair->p2;
762  Pair->tailRing = tailRing;
763 
764  assume(p1 != NULL);
765  assume(p2 != NULL);
766  assume(tailRing != NULL);
767 
768  poly a1 = pNext(p1), a2 = pNext(p2);
769  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
770  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
771  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
772 
773  int l1=0, l2=0;
774 
775  if (currRing->pCompIndex >= 0)
776  {
777  if (__p_GetComp(p1, currRing)!=__p_GetComp(p2, currRing))
778  {
779  if (__p_GetComp(p1, currRing)==0)
780  {
781  co=1;
782  p_SetCompP(p1,__p_GetComp(p2, currRing), currRing, tailRing);
783  }
784  else
785  {
786  co=2;
787  p_SetCompP(p2, __p_GetComp(p1, currRing), currRing, tailRing);
788  }
789  }
790  }
791 
792  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
793  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
794  if (m1 == NULL)
795  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
796 
797  pSetCoeff0(m1, lc2);
798  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
799 
800  if (R != NULL)
801  {
802  if (Pair->i_r1 == -1)
803  {
804  l1 = pLength(p1) - 1;
805  }
806  else
807  {
808  l1 = (R[Pair->i_r1])->GetpLength() - 1;
809  }
810  if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
811  {
812  l2 = pLength(p2) - 1;
813  }
814  else
815  {
816  l2 = (R[Pair->i_r2])->GetpLength() - 1;
817  }
818  }
819 
820  // get m2 * a2
821  if (spNoether != NULL)
822  {
823  l2 = -1;
824  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
825  assume(l2 == pLength(a2));
826  }
827  else
828  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
829 #ifdef HAVE_RINGS
830  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
831 #endif
832 
833  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
834 
835  // get m2*a2 - m1*a1
836  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
837 
838  // Clean-up time
839  Pair->LmDeleteAndIter();
840  p_LmDelete(m1, tailRing);
841 
842  if (co != 0)
843  {
844  if (co==1)
845  {
846  p_SetCompP(p1,0, currRing, tailRing);
847  }
848  else
849  {
850  p_SetCompP(p2,0, currRing, tailRing);
851  }
852  }
853 
854  // the following is commented out: shrinking
855 #ifdef HAVE_SHIFTBBA_NONEXISTENT
856  if (currRing->isLPring)
857  {
858  // assume? h->p in currRing
859  Pair->GetP();
860  poly qq = p_Shrink(Pair->p, currRing->isLPring, currRing);
861  Pair->Clear(); // does the right things
862  Pair->p = qq;
863  Pair->t_p = NULL;
864  Pair->SetShortExpVector();
865  }
866 #endif
867 
868 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
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:931
int ksCheckCoeff(number *a, number *b)
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:478
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:255
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T)
Definition: kutil.h:647
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define NULL
Definition: omList.c:10
int create_count
Definition: kspoly.cc:25
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712

◆ ksOldCreateSpoly()

KINLINE poly ksOldCreateSpoly ( poly  p1,
poly  p2,
poly  spNoether = NULL,
ring  r = currRing 
)

Definition at line 1069 of file kInline.h.

1070 {
1071  LObject L(r);
1072  L.p1 = p1;
1073  L.p2 = p2;
1074 
1075  ksCreateSpoly(&L, spNoether);
1076  return L.GetLmCurrRing();
1077 }
class sLObject LObject
Definition: kutil.h:54
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:752

◆ ksOldSpolyRed()

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

Definition at line 1049 of file kInline.h.

1050 {
1051  LObject L(p2);
1052  TObject T(p1);
1053 
1054  ksReducePoly(&L, &T, spNoether);
1055 
1056  return L.GetLmCurrRing();
1057 }
class sLObject LObject
Definition: kutil.h:54
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
static jList * T
Definition: janet.cc:31
class sTObject TObject
Definition: kutil.h:53

◆ ksOldSpolyRedNew()

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

Definition at line 1059 of file kInline.h.

1060 {
1061  LObject L(p_Copy(p2, currRing));
1062  TObject T(p1);
1063 
1064  ksReducePoly(&L, &T, spNoether);
1065 
1066  return L.GetLmCurrRing();
1067 }
class sLObject LObject
Definition: kutil.h:54
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static jList * T
Definition: janet.cc:31
class sTObject TObject
Definition: kutil.h:53

◆ ksOldSpolyTail()

KINLINE void ksOldSpolyTail ( poly  p1,
poly  q,
poly  q2,
poly  spNoether,
ring  r = currRing 
)

Definition at line 1079 of file kInline.h.

1080 {
1081  LObject L(q, currRing, r);
1082  TObject T(p1, currRing, r);
1083 
1084  ksReducePolyTail(&L, &T, q2, spNoether);
1085 }
class sLObject LObject
Definition: kutil.h:54
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static jList * T
Definition: janet.cc:31
class sTObject TObject
Definition: kutil.h:53

◆ ksReducePoly()

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

Definition at line 41 of file kspoly.cc.

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

◆ ksReducePolyBound()

int ksReducePolyBound ( LObject PR,
TObject PW,
int  bound,
poly  spNoether = NULL,
number *  coef = NULL,
kStrategy  strat = NULL 
)

Definition at line 165 of file kspoly.cc.

171 {
172 #ifdef KDEBUG
173  red_count++;
174 #ifdef TEST_OPT_DEBUG_RED
175  if (TEST_OPT_DEBUG)
176  {
177  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
178  PW->wrp();
179  //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
180  //pWrite(PR->p);
181  }
182 #endif
183 #endif
184  int ret = 0;
185  ring tailRing = PR->tailRing;
186  kTest_L(PR);
187  kTest_T(PW);
188 
189  poly p1 = PR->GetLmTailRing(); // p2 | p1
190  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
191  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
192  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
193  p_CheckPolyRing(p1, tailRing);
194  p_CheckPolyRing(p2, tailRing);
195 
196  pAssume1(p2 != NULL && p1 != NULL &&
197  p_DivisibleBy(p2, p1, tailRing));
198 
199  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
200  (p_GetComp(p2, tailRing) == 0 &&
201  p_MaxComp(pNext(p2),tailRing) == 0));
202 
203 #ifdef HAVE_PLURAL
204  if (rIsPluralRing(currRing))
205  {
206  // for the time being: we know currRing==strat->tailRing
207  // no exp-bound checking needed
208  // (only needed if exp-bound(tailring)<exp-b(currRing))
209  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
210  else
211  {
212  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
213  assume(_p != NULL);
214  nc_PolyPolyRed(_p, p2,coef, currRing);
215  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
216  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
217  }
218  return 0;
219  }
220 #endif
221 
222  if (t2==NULL) // Divisor is just one term, therefore it will
223  { // just cancel the leading term
224  PR->LmDeleteAndIter();
225  if (coef != NULL) *coef = n_Init(1, tailRing);
226  return 0;
227  }
228 
229  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
230 
231  if (tailRing != currRing)
232  {
233  // check that reduction does not violate exp bound
234  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
235  {
236  // undo changes of lm
237  p_ExpVectorAdd(lm, p2, tailRing);
238  if (strat == NULL) return 2;
239  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
240  tailRing = strat->tailRing;
241  p1 = PR->GetLmTailRing();
242  p2 = PW->GetLmTailRing();
243  t2 = pNext(p2);
244  lm = p1;
245  p_ExpVectorSub(lm, p2, tailRing);
246  ret = 1;
247  }
248  }
249 
250  // take care of coef buisness
251  if (! n_IsOne(pGetCoeff(p2), tailRing))
252  {
253  number bn = pGetCoeff(lm);
254  number an = pGetCoeff(p2);
255  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
256  p_SetCoeff(lm, bn, tailRing);
257  if ((ct == 0) || (ct == 2))
258  PR->Tail_Mult_nn(an);
259  if (coef != NULL) *coef = an;
260  else n_Delete(&an, tailRing);
261  }
262  else
263  {
264  if (coef != NULL) *coef = n_Init(1, tailRing);
265  }
266 
267 
268  // and finally,
269  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
270  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
271  PR->LmDeleteAndIter();
272 
273  // the following is commented out: shrinking
274 #ifdef HAVE_SHIFTBBA_NONEXISTENT
275  if ( (currRing->isLPring) && (!strat->homog) )
276  {
277  // assume? h->p in currRing
278  PR->GetP();
279  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
280  PR->Clear(); // does the right things
281  PR->p = qq;
282  PR->t_p = NULL;
283  PR->SetShortExpVector();
284  }
285 #endif
286 
287 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
288  if (TEST_OPT_DEBUG)
289  {
290  Print(" to: "); PR->wrp(); Print("\n");
291  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
292  }
293 #endif
294  return ret;
295 }
#define Print
Definition: emacs.cc:80
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2230
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:65
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1964
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:538
int ksCheckCoeff(number *a, number *b)
#define TEST_OPT_DEBUG
Definition: options.h:107
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
#define kTest_L(T)
Definition: kutil.h:647
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1830
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
int red_count
Definition: kspoly.cc:24
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1377
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
static unsigned pLength(poly a)
Definition: p_polys.h:193
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
char homog
Definition: kutil.h:366
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:645
#define pAssume1(cond)
Definition: monomials.h:172
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:293

◆ ksReducePolySig()

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

Definition at line 304 of file kspoly.cc.

310 {
311 #ifdef KDEBUG
312  red_count++;
313 #ifdef TEST_OPT_DEBUG_RED
314  if (TEST_OPT_DEBUG)
315  {
316  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
317  PW->wrp();
318  }
319 #endif
320 #endif
321  int ret = 0;
322  ring tailRing = PR->tailRing;
323  kTest_L(PR);
324  kTest_T(PW);
325 
326  // signature-based stuff:
327  // checking for sig-safeness first
328  // NOTE: This has to be done in the current ring
329  //
330  /**********************************************
331  *
332  * TODO:
333  * --------------------------------------------
334  * if strat->sbaOrder == 1
335  * Since we are subdividing lower index and
336  * current index reductions it is enough to
337  * look at the polynomial part of the signature
338  * for a check. This should speed-up checking
339  * a lot!
340  * if !strat->sbaOrder == 0
341  * We are not subdividing lower and current index
342  * due to the fact that we are using the induced
343  * Schreyer order
344  *
345  * nevertheless, this different behaviour is
346  * taken care of by is_sigsafe
347  * => one reduction procedure can be used for
348  * both, the incremental and the non-incremental
349  * attempt!
350  * --------------------------------------------
351  *
352  *********************************************/
353  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
354  if (!PW->is_sigsafe)
355  {
356  poly sigMult = pCopy(PW->sig); // copy signature of reducer
357 //#if 1
358 #ifdef DEBUGF5
359  printf("IN KSREDUCEPOLYSIG: \n");
360  pWrite(pHead(f1));
361  pWrite(pHead(f2));
362  pWrite(sigMult);
363  printf("--------------\n");
364 #endif
365  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
366 //#if 1
367 #ifdef DEBUGF5
368  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
369  pWrite(pHead(f1));
370  pWrite(pHead(f2));
371  pWrite(sigMult);
372  pWrite(PR->sig);
373  printf("--------------\n");
374 #endif
375  int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
376  // now we can delete the copied polynomial data used for checking for
377  // sig-safeness of the reduction step
378 //#if 1
379 #ifdef DEBUGF5
380  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
381 
382 #endif
383  //pDelete(&f1);
384  pDelete(&sigMult);
385  // go on with the computations only if the signature of p2 is greater than the
386  // signature of fm*p1
387  if(sigSafe != 1)
388  {
389  PR->is_redundant = TRUE;
390  return 3;
391  }
392  //PW->is_sigsafe = TRUE;
393  }
394  PR->is_redundant = FALSE;
395  poly p1 = PR->GetLmTailRing(); // p2 | p1
396  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
397  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
398  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
399  p_CheckPolyRing(p1, tailRing);
400  p_CheckPolyRing(p2, tailRing);
401 
402  pAssume1(p2 != NULL && p1 != NULL &&
403  p_DivisibleBy(p2, p1, tailRing));
404 
405  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
406  (p_GetComp(p2, tailRing) == 0 &&
407  p_MaxComp(pNext(p2),tailRing) == 0));
408 
409 #ifdef HAVE_PLURAL
410  if (rIsPluralRing(currRing))
411  {
412  // for the time being: we know currRing==strat->tailRing
413  // no exp-bound checking needed
414  // (only needed if exp-bound(tailring)<exp-b(currRing))
415  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
416  else
417  {
418  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
419  assume(_p != NULL);
420  nc_PolyPolyRed(_p, p2, coef, currRing);
421  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
422  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
423  }
424  return 0;
425  }
426 #endif
427 
428  if (t2==NULL) // Divisor is just one term, therefore it will
429  { // just cancel the leading term
430  PR->LmDeleteAndIter();
431  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
432  return 0;
433  }
434 
435  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
436 
437  if (tailRing != currRing)
438  {
439  // check that reduction does not violate exp bound
440  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
441  {
442  // undo changes of lm
443  p_ExpVectorAdd(lm, p2, tailRing);
444  if (strat == NULL) return 2;
445  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
446  tailRing = strat->tailRing;
447  p1 = PR->GetLmTailRing();
448  p2 = PW->GetLmTailRing();
449  t2 = pNext(p2);
450  lm = p1;
451  p_ExpVectorSub(lm, p2, tailRing);
452  ret = 1;
453  }
454  }
455 
456  // take care of coef buisness
457  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
458  {
459  number bn = pGetCoeff(lm);
460  number an = pGetCoeff(p2);
461  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
462  p_SetCoeff(lm, bn, tailRing);
463  if ((ct == 0) || (ct == 2))
464  PR->Tail_Mult_nn(an);
465  if (coef != NULL) *coef = an;
466  else n_Delete(&an, tailRing->cf);
467  }
468  else
469  {
470  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
471  }
472 
473 
474  // and finally,
475  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
476  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
477  PR->LmDeleteAndIter();
478 
479  // the following is commented out: shrinking
480 #ifdef HAVE_SHIFTBBA_NONEXISTENT
481  if ( (currRing->isLPring) && (!strat->homog) )
482  {
483  // assume? h->p in currRing
484  PR->GetP();
485  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
486  PR->Clear(); // does the right things
487  PR->p = qq;
488  PR->t_p = NULL;
489  PR->SetShortExpVector();
490  }
491 #endif
492 
493 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
494  if (TEST_OPT_DEBUG)
495  {
496  Print(" to: "); PR->wrp(); Print("\n");
497  }
498 #endif
499  return ret;
500 }
#define Print
Definition: emacs.cc:80
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2230
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:65
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1964
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:538
int ksCheckCoeff(number *a, number *b)
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:302
#define TEST_OPT_DEBUG
Definition: options.h:107
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
#define kTest_L(T)
Definition: kutil.h:647
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1830
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1498
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
int red_count
Definition: kspoly.cc:24
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1377
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
char homog
Definition: kutil.h:366
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:645
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1393
#define pAssume1(cond)
Definition: monomials.h:172
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:293
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ ksReducePolySigRing()

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

Definition at line 502 of file kspoly.cc.

508 {
509 #ifdef KDEBUG
510  red_count++;
511 #ifdef TEST_OPT_DEBUG_RED
512  if (TEST_OPT_DEBUG)
513  {
514  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
515  PW->wrp();
516  }
517 #endif
518 #endif
519  int ret = 0;
520  ring tailRing = PR->tailRing;
521  kTest_L(PR);
522  kTest_T(PW);
523 
524  // signature-based stuff:
525  // checking for sig-safeness first
526  // NOTE: This has to be done in the current ring
527  //
528  /**********************************************
529  *
530  * TODO:
531  * --------------------------------------------
532  * if strat->sbaOrder == 1
533  * Since we are subdividing lower index and
534  * current index reductions it is enough to
535  * look at the polynomial part of the signature
536  * for a check. This should speed-up checking
537  * a lot!
538  * if !strat->sbaOrder == 0
539  * We are not subdividing lower and current index
540  * due to the fact that we are using the induced
541  * Schreyer order
542  *
543  * nevertheless, this different behaviour is
544  * taken care of by is_sigsafe
545  * => one reduction procedure can be used for
546  * both, the incremental and the non-incremental
547  * attempt!
548  * --------------------------------------------
549  *
550  *********************************************/
551  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
552  if (!PW->is_sigsafe)
553  {
554  poly sigMult = pCopy(PW->sig); // copy signature of reducer
555 //#if 1
556 #ifdef DEBUGF5
557  printf("IN KSREDUCEPOLYSIG: \n");
558  pWrite(pHead(f1));
559  pWrite(pHead(f2));
560  pWrite(sigMult);
561  printf("--------------\n");
562 #endif
563  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
564  //I have also to set the leading coeficient for sigMult (in the case of rings)
566  {
567  pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
568  if(nIsZero(pGetCoeff(sigMult)))
569  {
570  sigMult = NULL;
571  }
572  }
573 //#if 1
574 #ifdef DEBUGF5
575  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
576  pWrite(pHead(f1));
577  pWrite(pHead(f2));
578  pWrite(sigMult);
579  pWrite(PR->sig);
580  printf("--------------\n");
581 #endif
582  int sigSafe;
584  sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
585  // now we can delete the copied polynomial data used for checking for
586  // sig-safeness of the reduction step
587 //#if 1
588 #ifdef DEBUGF5
589  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
590 
591 #endif
593  {
594  // Set the sig
595  poly origsig = pCopy(PR->sig);
596  if(sigMult != NULL)
597  PR->sig = pHead(pSub(PR->sig, sigMult));
598  //The sigs have the same lm, have to substract
599  //It may happen that now the signature is 0 (drop)
600  if(PR->sig == NULL)
601  {
602  strat->sigdrop=TRUE;
603  }
604  else
605  {
606  if(pLtCmp(PR->sig,origsig) == 1)
607  {
608  // do not allow this reduction - it will increase it's signature
609  // and the partially standard basis is just till the old sig, not the new one
610  PR->is_redundant = TRUE;
611  pDelete(&PR->sig);
612  PR->sig = origsig;
613  strat->blockred++;
614  return 3;
615  }
616  if(pLtCmp(PR->sig,origsig) == -1)
617  {
618  strat->sigdrop=TRUE;
619  }
620  }
621  pDelete(&origsig);
622  }
623  //pDelete(&f1);
624  // go on with the computations only if the signature of p2 is greater than the
625  // signature of fm*p1
626  if(sigSafe != 1 && !rField_is_Ring(currRing))
627  {
628  PR->is_redundant = TRUE;
629  return 3;
630  }
631  //PW->is_sigsafe = TRUE;
632  }
633  PR->is_redundant = FALSE;
634  poly p1 = PR->GetLmTailRing(); // p2 | p1
635  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
636  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
637  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
638  p_CheckPolyRing(p1, tailRing);
639  p_CheckPolyRing(p2, tailRing);
640 
641  pAssume1(p2 != NULL && p1 != NULL &&
642  p_DivisibleBy(p2, p1, tailRing));
643 
644  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
645  (p_GetComp(p2, tailRing) == 0 &&
646  p_MaxComp(pNext(p2),tailRing) == 0));
647 
648 #ifdef HAVE_PLURAL
649  if (rIsPluralRing(currRing))
650  {
651  // for the time being: we know currRing==strat->tailRing
652  // no exp-bound checking needed
653  // (only needed if exp-bound(tailring)<exp-b(currRing))
654  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
655  else
656  {
657  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
658  assume(_p != NULL);
659  nc_PolyPolyRed(_p, p2, coef, currRing);
660  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
661  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
662  }
663  return 0;
664  }
665 #endif
666 
667  if (t2==NULL) // Divisor is just one term, therefore it will
668  { // just cancel the leading term
669  PR->LmDeleteAndIter();
670  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
671  return 0;
672  }
673 
674  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
675 
676  if (tailRing != currRing)
677  {
678  // check that reduction does not violate exp bound
679  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
680  {
681  // undo changes of lm
682  p_ExpVectorAdd(lm, p2, tailRing);
683  if (strat == NULL) return 2;
684  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
685  tailRing = strat->tailRing;
686  p1 = PR->GetLmTailRing();
687  p2 = PW->GetLmTailRing();
688  t2 = pNext(p2);
689  lm = p1;
690  p_ExpVectorSub(lm, p2, tailRing);
691  ret = 1;
692  }
693  }
694  // take care of coef buisness
696  {
697  p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
698  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
699  }
700  else
701  {
702  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
703  {
704  number bn = pGetCoeff(lm);
705  number an = pGetCoeff(p2);
706  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
707  p_SetCoeff(lm, bn, tailRing);
708  if (((ct == 0) || (ct == 2)))
709  PR->Tail_Mult_nn(an);
710  if (coef != NULL) *coef = an;
711  else n_Delete(&an, tailRing->cf);
712  }
713  else
714  {
715  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
716  }
717  }
718 
719  // and finally,
720  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
721  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
722  PR->LmDeleteAndIter();
723 
724  // the following is commented out: shrinking
725 #ifdef HAVE_SHIFTBBA_NONEXISTENT
726  if ( (currRing->isLPring) && (!strat->homog) )
727  {
728  // assume? h->p in currRing
729  PR->GetP();
730  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
731  PR->Clear(); // does the right things
732  PR->p = qq;
733  PR->t_p = NULL;
734  PR->SetShortExpVector();
735  }
736 #endif
737 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
738  if (TEST_OPT_DEBUG)
739  {
740  Print(" to: "); PR->wrp(); Print("\n");
741  }
742 #endif
743  return ret;
744 }
#define Print
Definition: emacs.cc:80
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2230
bool sigdrop
Definition: kutil.h:353
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:65
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1964
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:538
int ksCheckCoeff(number *a, number *b)
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:302
#define TEST_OPT_DEBUG
Definition: options.h:107
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
#define pSub(a, b)
Definition: polys.h:281
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
#define nMult(n1, n2)
Definition: numbers.h:18
#define kTest_L(T)
Definition: kutil.h:647
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1830
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1498
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
int red_count
Definition: kspoly.cc:24
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1377
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
#define nDiv(a, b)
Definition: numbers.h:33
char homog
Definition: kutil.h:366
#define nIsZero(n)
Definition: numbers.h:20
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
int blockred
Definition: kutil.h:358
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:645
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1393
#define pAssume1(cond)
Definition: monomials.h:172
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:293
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ ksReducePolyTail() [1/2]

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

Definition at line 870 of file kspoly.cc.

871 {
872  BOOLEAN ret;
873  number coef;
874  poly Lp = PR->GetLmCurrRing();
875  poly Save = PW->GetLmCurrRing();
876 
877  kTest_L(PR);
878  kTest_T(PW);
879  pAssume(pIsMonomOf(Lp, Current));
880 
881  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
882  assume(PR->bucket == NULL);
883 
884  LObject Red(pNext(Current), PR->tailRing);
885  TObject With(PW, Lp == Save);
886 
887  pAssume(!pHaveCommonMonoms(Red.p, With.p));
888  ret = ksReducePoly(&Red, &With, spNoether, &coef);
889 
890  if (!ret)
891  {
892  if (! n_IsOne(coef, currRing->cf))
893  {
894  pNext(Current) = NULL;
895  if (Current == PR->p && PR->t_p != NULL)
896  pNext(PR->t_p) = NULL;
897  PR->Mult_nn(coef);
898  }
899 
900  n_Delete(&coef, currRing->cf);
901  pNext(Current) = Red.GetLmTailRing();
902  if (Current == PR->p && PR->t_p != NULL)
903  pNext(PR->t_p) = pNext(Current);
904  }
905 
906  if (Lp == Save)
907  With.Delete();
908 
909  // the following is commented out: shrinking
910 #ifdef HAVE_SHIFTBBA_NONEXISTENT
911  if (currRing->isLPring)
912  {
913  // assume? h->p in currRing
914  PR->GetP();
915  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
916  PR->Clear(); // does the right things
917  PR->p = qq;
918  PR->t_p = NULL;
919  PR->SetShortExpVector();
920  }
921 #endif
922 
923  return ret;
924 }
class sLObject LObject
Definition: kutil.h:54
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define pAssume(cond)
Definition: monomials.h:91
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
BOOLEAN pHaveCommonMonoms(poly p, poly q)
Definition: pDebug.cc:175
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:165
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T)
Definition: kutil.h:647
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:645
int BOOLEAN
Definition: auxiliary.h:85
class sTObject TObject
Definition: kutil.h:53

◆ ksReducePolyTail() [2/2]

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

Definition at line 1022 of file kInline.h.

1023 {
1024  BOOLEAN ret;
1025  number coef;
1026 
1027  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1028  Red->HeadNormalize();
1029  ret = ksReducePoly(Red, PW, NULL, &coef);
1030 
1031  if (!ret)
1032  {
1033  if (! n_IsOne(coef, currRing->cf))
1034  {
1035  PR->Mult_nn(coef);
1036  // HANNES: mark for Normalize
1037  }
1038  n_Delete(&coef, currRing->cf);
1039  }
1040  return ret;
1041 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int BOOLEAN
Definition: auxiliary.h:85

◆ kStratChangeTailRing()

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

Definition at line 11073 of file kutil.cc.

11074 {
11075  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11076  /* initial setup or extending */
11077 
11078  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11079  if (expbound >= currRing->bitmask) return FALSE;
11080  strat->overflow=FALSE;
11081  ring new_tailRing = rModifyRing(currRing,
11082  // Hmmm .. the condition pFDeg == p_Deg
11083  // might be too strong
11084  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11085  (strat->ak==0), // omit_comp if the input is an ideal
11086  expbound); // exp_limit
11087 
11088  if (new_tailRing == currRing) return TRUE;
11089 
11090  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11091  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11092 
11093  if (currRing->pFDeg != currRing->pFDegOrig)
11094  {
11095  new_tailRing->pFDeg = currRing->pFDeg;
11096  new_tailRing->pLDeg = currRing->pLDeg;
11097  }
11098 
11099  if (TEST_OPT_PROT)
11100  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11101  kTest_TS(strat);
11102  assume(new_tailRing != strat->tailRing);
11103  pShallowCopyDeleteProc p_shallow_copy_delete
11104  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11105 
11106  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11107 
11108  int i;
11109  for (i=0; i<=strat->tl; i++)
11110  {
11111  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11112  p_shallow_copy_delete);
11113  }
11114  for (i=0; i<=strat->Ll; i++)
11115  {
11116  assume(strat->L[i].p != NULL);
11117  if (pNext(strat->L[i].p) != strat->tail)
11118  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11119  }
11120  if ((strat->P.t_p != NULL) ||
11121  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11122  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11123 
11124  if ((L != NULL) && (L->tailRing != new_tailRing))
11125  {
11126  if (L->i_r < 0)
11127  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11128  else
11129  {
11130  assume(L->i_r <= strat->tl);
11131  TObject* t_l = strat->R[L->i_r];
11132  assume(t_l != NULL);
11133  L->tailRing = new_tailRing;
11134  L->p = t_l->p;
11135  L->t_p = t_l->t_p;
11136  L->max_exp = t_l->max_exp;
11137  }
11138  }
11139 
11140  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11141  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11142 
11143  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11144  if (strat->tailRing != currRing)
11145  rKillModifiedRing(strat->tailRing);
11146 
11147  strat->tailRing = new_tailRing;
11148  strat->tailBin = new_tailBin;
11149  strat->p_shallow_copy_delete
11150  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11151 
11152  if (strat->kHEdge != NULL)
11153  {
11154  if (strat->t_kHEdge != NULL)
11155  p_LmFree(strat->t_kHEdge, strat->tailRing);
11156  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11157  }
11158 
11159  if (strat->kNoether != NULL)
11160  {
11161  if (strat->t_kNoether != NULL)
11162  p_LmFree(strat->t_kNoether, strat->tailRing);
11164  new_tailRing);
11165  }
11166  kTest_TS(strat);
11167  if (TEST_OPT_PROT)
11168  PrintS("]");
11169  return TRUE;
11170 }
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
Definition: omBin.c:396
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:80
poly kHEdge
Definition: kutil.h:320
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:290
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:321
int tl
Definition: kutil.h:343
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2613
#define TRUE
Definition: auxiliary.h:98
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:331
int ak
Definition: kutil.h:346
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
#define kTest_TS(A)
Definition: kutil.h:644
#define assume(x)
Definition: mod2.h:390
LObject P
Definition: kutil.h:293
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:327
TObject ** R
Definition: kutil.h:333
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:322
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:45
char homog
Definition: kutil.h:366
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
poly t_kNoether
Definition: kutil.h:324
omBin tailBin
Definition: kutil.h:338
char overflow
Definition: kutil.h:398
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void rKillModifiedRing(ring r)
Definition: ring.cc:2973
TSet T
Definition: kutil.h:317
static jList * T
Definition: janet.cc:31
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:289
class sTObject TObject
Definition: kutil.h:53

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11172 of file kutil.cc.

11173 {
11174  unsigned long l = 0;
11175  int i;
11176  long e;
11177 
11178  assume(strat->tailRing == currRing);
11179 
11180  for (i=0; i<= strat->Ll; i++)
11181  {
11182  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11183  }
11184  for (i=0; i<=strat->tl; i++)
11185  {
11186  // Hmm ... this we could do in one Step
11187  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11188  }
11189  if (rField_is_Ring(currRing))
11190  {
11191  l *= 2;
11192  }
11193  e = p_GetMaxExp(l, currRing);
11194  if (e <= 1) e = 2;
11195 
11196  kStratChangeTailRing(strat, NULL, NULL, e);
11197 }
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:1167
int Ll
Definition: kutil.h:344
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:748
int tl
Definition: kutil.h:343
#define assume(x)
Definition: mod2.h:390
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
int i
Definition: cfEzgcd.cc:125
LSet L
Definition: kutil.h:318
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
int l
Definition: cfEzgcd.cc:93

◆ message()

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

Definition at line 7745 of file kutil.cc.

7746 {
7747  if (i != *olddeg)
7748  {
7749  Print("%d",i);
7750  *olddeg = i;
7751  }
7752  if (TEST_OPT_OLDSTD)
7753  {
7754  if (strat->Ll != *reduc)
7755  {
7756  if (strat->Ll != *reduc-1)
7757  Print("(%d)",strat->Ll+1);
7758  else
7759  PrintS("-");
7760  *reduc = strat->Ll;
7761  }
7762  else
7763  PrintS(".");
7764  mflush();
7765  }
7766  else
7767  {
7768  if (red_result == 0)
7769  PrintS("-");
7770  else if (red_result < 0)
7771  PrintS(".");
7772  if ((red_result > 0) || ((strat->Ll % 100)==99))
7773  {
7774  if (strat->Ll != *reduc && strat->Ll > 0)
7775  {
7776  Print("(%d)",strat->Ll+1);
7777  *reduc = strat->Ll;
7778  }
7779  }
7780  }
7781 }
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:344
#define mflush()
Definition: reporter.h:57
#define TEST_OPT_OLDSTD
Definition: options.h:121
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284

◆ messageStat()

void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7786 of file kutil.cc.

7787 {
7788  //PrintS("\nUsage/Allocation of temporary storage:\n");
7789  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7790  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7791  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7792  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7793  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7794  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7795  /*mflush();*/
7796 }
#define Print
Definition: emacs.cc:80
int c3
Definition: kutil.h:340
int cv
Definition: kutil.h:363
int cp
Definition: kutil.h:340

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7798 of file kutil.cc.

7799 {
7800  //PrintS("\nUsage/Allocation of temporary storage:\n");
7801  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7802  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7803  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
7804  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7805  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7806  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7807  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7808  /*mflush();*/
7809 }
#define Print
Definition: emacs.cc:80
int cv
Definition: kutil.h:363
int nrsyzcrit
Definition: kutil.h:354
int nrrewcrit
Definition: kutil.h:355

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10537 of file kutil.cc.

10538 {
10539  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10540  return FALSE;
10541  int i,j;
10542  poly newNoether;
10543 
10544 #if 0
10545  if (currRing->weight_all_1)
10546  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10547  else
10548  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10549 #else
10550  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10551 #endif
10552  if (strat->kHEdge==NULL) return FALSE;
10553  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10554  if (strat->tailRing != currRing)
10555  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10556  /* compare old and new noether*/
10557  newNoether = pLmInit(strat->kHEdge);
10558  pSetCoeff0(newNoether,nInit(1));
10559  j = p_FDeg(newNoether,currRing);
10560  for (i=1; i<=(currRing->N); i++)
10561  {
10562  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10563  }
10564  pSetm(newNoether);
10565  if (j < strat->HCord) /*- statistics -*/
10566  {
10567  if (TEST_OPT_PROT)
10568  {
10569  Print("H(%d)",j);
10570  mflush();
10571  }
10572  strat->HCord=j;
10573  #ifdef KDEBUG
10574  if (TEST_OPT_DEBUG)
10575  {
10576  Print("H(%d):",j);
10577  wrp(strat->kHEdge);
10578  PrintLn();
10579  }
10580  #endif
10581  }
10582  if (pCmp(strat->kNoether,newNoether)!=1)
10583  {
10584  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
10585  strat->kNoether=newNoether;
10586  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10587  if (strat->tailRing != currRing)
10588  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10589 
10590  return TRUE;
10591  }
10592  pLmDelete(newNoether);
10593  return FALSE;
10594 }
int j
Definition: facHensel.cc:105
#define pSetm(p)
Definition: polys.h:265
int HCord
Definition: kutil.cc:235
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
poly kHEdge
Definition: kutil.h:320
#define TEST_OPT_PROT
Definition: options.h:102
#define FALSE
Definition: auxiliary.h:94
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:321
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:98
int ak
Definition: kutil.h:346
#define TEST_OPT_DEBUG
Definition: options.h:107
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
int HCord
Definition: kutil.h:348
#define mflush()
Definition: reporter.h:57
#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:872
#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:381
int i
Definition: cfEzgcd.cc:125
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
poly t_kHEdge
Definition: kutil.h:322
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
poly t_kNoether
Definition: kutil.h:324
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
void wrp(poly p)
Definition: polys.h:304
ideal Shdl
Definition: kutil.h:294
#define nInit(i)
Definition: numbers.h:25

◆ pairs()

void pairs ( )

◆ pCopyL2p()

poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 11786 of file kutil.cc.

11787 {
11788  /* restores a poly in currRing from LObject */
11789  LObject h = H;
11790  h.Copy();
11791  poly p;
11792  if (h.p == NULL)
11793  {
11794  if (h.t_p != NULL)
11795  {
11796  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11797  return(p);
11798  }
11799  else
11800  {
11801  /* h.tp == NULL -> the object is NULL */
11802  return(NULL);
11803  }
11804  }
11805  /* we're here if h.p != NULL */
11806  if (h.t_p == NULL)
11807  {
11808  /* then h.p is the whole poly in currRing */
11809  p = h.p;
11810  return(p);
11811  }
11812  /* we're here if h.p != NULL and h.t_p != NULL */
11813  // clean h.p, get poly from t_p
11814  pNext(h.p)=NULL;
11815  pLmDelete(&h.p);
11816  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
11817  /* dest. ring: */ currRing);
11818  // no need to clean h: we re-used the polys
11819  return(p);
11820 }
class sLObject LObject
Definition: kutil.h:54
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 11755 of file kutil.cc.

11756 {
11757  /* assume: p is completely in currRing */
11758  /* produces an object with LM in curring
11759  and TAIL in tailring */
11760  if (pNext(p)!=NULL)
11761  {
11762  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11763  }
11764  return(p);
11765 }
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 11769 of file kutil.cc.

11770 {
11771  /* assume: p has LM in curring and TAIL in tailring */
11772  /* convert it to complete currRing */
11773 
11774  /* check that LM is in currRing */
11776 
11777  if (pNext(p)!=NULL)
11778  {
11779  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11780  }
11781  return(p);
11782 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInIdealMonFirst()

int posInIdealMonFirst ( const ideal  F,
const poly  p,
int  start = 0,
int  end = -1 
)

Definition at line 5129 of file kutil.cc.

5130 {
5131  if(end < 0 || end >= IDELEMS(F))
5132  end = IDELEMS(F);
5133  if (end<0) return 0;
5134  if(pNext(p) == NULL) return start;
5135  polyset set=F->m;
5136  int o = p_Deg(p,currRing);
5137  int op;
5138  int i;
5139  int an = start;
5140  for(i=start;i<end;i++)
5141  if(set[i] != NULL && pNext(set[i]) == NULL)
5142  an++;
5143  if(an == end-1)
5144  return end;
5145  int en= end;
5146  loop
5147  {
5148  if(an>=en)
5149  return en;
5150  if (an == en-1)
5151  {
5152  op = p_Deg(set[an],currRing);
5153  if ((op < o)
5154  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5155  return en;
5156  return an;
5157  }
5158  i=(an+en) / 2;
5159  op = p_Deg(set[i],currRing);
5160  if ((op < o)
5161  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5162  an=i;
5163  else
5164  en=i;
5165  }
5166 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:78
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInL0()

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

Definition at line 5981 of file kutil.cc.

5983 {
5984  if (length<0) return 0;
5985 
5986  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
5987  return length+1;
5988 
5989  int i;
5990  int an = 0;
5991  int en= length;
5992  loop
5993  {
5994  if (an >= en-1)
5995  {
5996  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
5997  return an;
5998  }
5999  i=(an+en) / 2;
6000  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6001  else en=i;
6002  /*aend. fuer lazy == in !=- machen */
6003  }
6004 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInL10()

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

Definition at line 1008 of file kstd1.cc.

1009 {
1010  int j,dp,dL;
1011 
1012  if (length<0) return 0;
1013  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1014  {
1015  int op= p->GetpFDeg() +p->ecart;
1016  for (j=length; j>=0; j--)
1017  {
1018  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1019  return j+1;
1020  if (dp < dL)
1021  return j+1;
1022  if ((dp == dL)
1023  && (set[j].GetpFDeg()+set[j].ecart >= op))
1024  return j+1;
1025  }
1026  }
1027  j=length;
1028  loop
1029  {
1030  if (j<0) break;
1031  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1032  j--;
1033  }
1034  return strat->posInLOld(set,j,p,strat);
1035 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:78
int lastAxis
Definition: kutil.h:349
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:279
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:960
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL10Ring()

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

◆ posInL11()

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

Definition at line 6239 of file kutil.cc.

6241 {
6242  if (length<0) return 0;
6243 
6244  int o = p->GetpFDeg();
6245  int op = set[length].GetpFDeg();
6246 
6247  if ((op > o)
6248  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6249  return length+1;
6250  int i;
6251  int an = 0;
6252  int en= length;
6253  loop
6254  {
6255  if (an >= en-1)
6256  {
6257  op = set[an].GetpFDeg();
6258  if ((op > o)
6259  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6260  return en;
6261  return an;
6262  }
6263  i=(an+en) / 2;
6264  op = set[i].GetpFDeg();
6265  if ((op > o)
6266  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6267  an=i;
6268  else
6269  en=i;
6270  }
6271 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInL110()

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

Definition at line 6537 of file kutil.cc.

6539 {
6540  if (length<0) return 0;
6541 
6542  int o = p->GetpFDeg();
6543  int op = set[length].GetpFDeg();
6544 
6545  if ((op > o)
6546  || ((op == o) && (set[length].length >p->length))
6547  || ((op == o) && (set[length].length <= p->length)
6548  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6549  return length+1;
6550  int i;
6551  int an = 0;
6552  int en= length;
6553  loop
6554  {
6555  if (an >= en-1)
6556  {
6557  op = set[an].GetpFDeg();
6558  if ((op > o)
6559  || ((op == o) && (set[an].length >p->length))
6560  || ((op == o) && (set[an].length <=p->length)
6561  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6562  return en;
6563  return an;
6564  }
6565  i=(an+en) / 2;
6566  op = set[i].GetpFDeg();
6567  if ((op > o)
6568  || ((op == o) && (set[i].length > p->length))
6569  || ((op == o) && (set[i].length <= p->length)
6570  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6571  an=i;
6572  else
6573  en=i;
6574  }
6575 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInL11Ring()

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

Definition at line 6281 of file kutil.cc.

6283 {
6284  if (length<0) return 0;
6285 
6286  int o = p->GetpFDeg();
6287  int op = set[length].GetpFDeg();
6288 
6289  if ((op > o)
6290  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6291  return length+1;
6292  int i;
6293  int an = 0;
6294  int en= length;
6295  loop
6296  {
6297  if (an >= en-1)
6298  {
6299  op = set[an].GetpFDeg();
6300  if ((op > o)
6301  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6302  return en;
6303  return an;
6304  }
6305  i=(an+en) / 2;
6306  op = set[i].GetpFDeg();
6307  if ((op > o)
6308  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6309  an=i;
6310  else
6311  en=i;
6312  }
6313 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL11Ringls()

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

Definition at line 6351 of file kutil.cc.

6353 {
6354  if (length < 0) return 0;
6355  int an,en,i;
6356  an = 0;
6357  en = length+1;
6358  loop
6359  {
6360  if (an >= en-1)
6361  {
6362  if(an == en)
6363  return en;
6364  if (set[an].FDeg > p->FDeg)
6365  return en;
6366  if (set[an].FDeg < p->FDeg)
6367  return an;
6368  if (set[an].FDeg == p->FDeg)
6369  {
6370  number lcset,lcp;
6371  lcset = pGetCoeff(set[an].p);
6372  lcp = pGetCoeff(p->p);
6373  if(!nGreaterZero(lcset))
6374  {
6375  set[an].p=p_Neg(set[an].p,currRing);
6376  if (set[an].t_p!=NULL)
6377  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6378  lcset=pGetCoeff(set[an].p);
6379  }
6380  if(!nGreaterZero(lcp))
6381  {
6382  p->p=p_Neg(p->p,currRing);
6383  if (p->t_p!=NULL)
6384  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6385  lcp=pGetCoeff(p->p);
6386  }
6387  if(nGreater(lcset, lcp))
6388  {
6389  return en;
6390  }
6391  else
6392  {
6393  return an;
6394  }
6395  }
6396  }
6397  i=(an+en) / 2;
6398  if (set[i].FDeg > p->FDeg)
6399  an=i;
6400  if (set[i].FDeg < p->FDeg)
6401  en=i;
6402  if (set[i].FDeg == p->FDeg)
6403  {
6404  number lcset,lcp;
6405  lcset = pGetCoeff(set[i].p);
6406  lcp = pGetCoeff(p->p);
6407  if(!nGreaterZero(lcset))
6408  {
6409  set[i].p=p_Neg(set[i].p,currRing);
6410  if (set[i].t_p!=NULL)
6411  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6412  lcset=pGetCoeff(set[i].p);
6413  }
6414  if(!nGreaterZero(lcp))
6415  {
6416  p->p=p_Neg(p->p,currRing);
6417  if (p->t_p!=NULL)
6418  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6419  lcp=pGetCoeff(p->p);
6420  }
6421  if(nGreater(lcset, lcp))
6422  {
6423  an = i;
6424  }
6425  else
6426  {
6427  en = i;
6428  }
6429  }
6430  }
6431 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
#define nGreaterZero(n)
Definition: numbers.h:28
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
int p
Definition: cfModGcd.cc:4019
#define nGreater(a, b)
Definition: numbers.h:29

◆ posInL13()

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

Definition at line 6625 of file kutil.cc.

6627 {
6628  if (length<0) return 0;
6629 
6630  int o = p->GetpFDeg();
6631 
6632  if (set[length].GetpFDeg() > o)
6633  return length+1;
6634 
6635  int i;
6636  int an = 0;
6637  int en= length;
6638  loop
6639  {
6640  if (an >= en-1)
6641  {
6642  if (set[an].GetpFDeg() >= o)
6643  return en;
6644  return an;
6645  }
6646  i=(an+en) / 2;
6647  if (set[i].GetpFDeg() >= o)
6648  an=i;
6649  else
6650  en=i;
6651  }
6652 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL15()

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

Definition at line 6660 of file kutil.cc.

6662 {
6663  if (length<0) return 0;
6664 
6665  int o = p->GetpFDeg() + p->ecart;
6666  int op = set[length].GetpFDeg() + set[length].ecart;
6667 
6668  if ((op > o)
6669  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6670  return length+1;
6671  int i;
6672  int an = 0;
6673  int en= length;
6674  loop
6675  {
6676  if (an >= en-1)
6677  {
6678  op = set[an].GetpFDeg() + set[an].ecart;
6679  if ((op > o)
6680  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6681  return en;
6682  return an;
6683  }
6684  i=(an+en) / 2;
6685  op = set[i].GetpFDeg() + set[i].ecart;
6686  if ((op > o)
6687  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6688  an=i;
6689  else
6690  en=i;
6691  }
6692 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInL15Ring()

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

Definition at line 6695 of file kutil.cc.

6697 {
6698  if (length<0) return 0;
6699 
6700  int o = p->GetpFDeg() + p->ecart;
6701  int op = set[length].GetpFDeg() + set[length].ecart;
6702 
6703  if ((op > o)
6704  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6705  return length+1;
6706  int i;
6707  int an = 0;
6708  int en= length;
6709  loop
6710  {
6711  if (an >= en-1)
6712  {
6713  op = set[an].GetpFDeg() + set[an].ecart;
6714  if ((op > o)
6715  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6716  return en;
6717  return an;
6718  }
6719  i=(an+en) / 2;
6720  op = set[i].GetpFDeg() + set[i].ecart;
6721  if ((op > o)
6722  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6723  an=i;
6724  else
6725  en=i;
6726  }
6727 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInL17()

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

Definition at line 6736 of file kutil.cc.

6738 {
6739  if (length<0) return 0;
6740 
6741  int o = p->GetpFDeg() + p->ecart;
6742 
6743  if ((set[length].GetpFDeg() + set[length].ecart > o)
6744  || ((set[length].GetpFDeg() + set[length].ecart == o)
6745  && (set[length].ecart > p->ecart))
6746  || ((set[length].GetpFDeg() + set[length].ecart == o)
6747  && (set[length].ecart == p->ecart)
6748  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6749  return length+1;
6750  int i;
6751  int an = 0;
6752  int en= length;
6753  loop
6754  {
6755  if (an >= en-1)
6756  {
6757  if ((set[an].GetpFDeg() + set[an].ecart > o)
6758  || ((set[an].GetpFDeg() + set[an].ecart == o)
6759  && (set[an].ecart > p->ecart))
6760  || ((set[an].GetpFDeg() + set[an].ecart == o)
6761  && (set[an].ecart == p->ecart)
6762  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6763  return en;
6764  return an;
6765  }
6766  i=(an+en) / 2;
6767  if ((set[i].GetpFDeg() + set[i].ecart > o)
6768  || ((set[i].GetpFDeg() + set[i].ecart == o)
6769  && (set[i].ecart > p->ecart))
6770  || ((set[i].GetpFDeg() +set[i].ecart == o)
6771  && (set[i].ecart == p->ecart)
6772  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6773  an=i;
6774  else
6775  en=i;
6776  }
6777 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInLF5C()

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

Definition at line 6227 of file kutil.cc.

6229 {
6230  return strat->Ll+1;
6231 }
int Ll
Definition: kutil.h:344

◆ posInLF5CRing()

int posInLF5CRing ( const LSet  set,
int  start,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 6315 of file kutil.cc.

6317 {
6318  if (length<0) return 0;
6319  if(start == (length +1)) return (length+1);
6320  int o = p->GetpFDeg();
6321  int op = set[length].GetpFDeg();
6322 
6323  if ((op > o)
6324  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6325  return length+1;
6326  int i;
6327  int an = start;
6328  int en= length;
6329  loop
6330  {
6331  if (an >= en-1)
6332  {
6333  op = set[an].GetpFDeg();
6334  if ((op > o)
6335  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6336  return en;
6337  return an;
6338  }
6339  i=(an+en) / 2;
6340  op = set[i].GetpFDeg();
6341  if ((op > o)
6342  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6343  an=i;
6344  else
6345  en=i;
6346  }
6347 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInLRing()

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

Definition at line 6126 of file kutil.cc.

6128 {
6129  if (length < 0) return 0;
6130  if (set[length].FDeg > p->FDeg)
6131  return length+1;
6132  if (set[length].FDeg == p->FDeg)
6133  if(set[length].GetpLength() > p->GetpLength())
6134  return length+1;
6135  int i;
6136  int an = 0;
6137  int en= length+1;
6138  loop
6139  {
6140  if (an >= en-1)
6141  {
6142  if(an == en)
6143  return en;
6144  if (set[an].FDeg > p->FDeg)
6145  return en;
6146  if(set[an].FDeg == p->FDeg)
6147  {
6148  if(set[an].GetpLength() > p->GetpLength())
6149  return en;
6150  else
6151  {
6152  if(set[an].GetpLength() == p->GetpLength())
6153  {
6154  if(nGreater(set[an].p->coef, p->p->coef))
6155  return en;
6156  else
6157  return an;
6158  }
6159  else
6160  {
6161  return an;
6162  }
6163  }
6164  }
6165  else
6166  return an;
6167  }
6168  i=(an+en) / 2;
6169  if (set[i].FDeg > p->FDeg)
6170  an=i;
6171  else
6172  {
6173  if(set[i].FDeg == p->FDeg)
6174  {
6175  if(set[i].GetpLength() > p->GetpLength())
6176  an=i;
6177  else
6178  {
6179  if(set[i].GetpLength() == p->GetpLength())
6180  {
6181  if(nGreater(set[i].p->coef, p->p->coef))
6182  an = i;
6183  else
6184  en = i;
6185  }
6186  else
6187  {
6188  en=i;
6189  }
6190  }
6191  }
6192  else
6193  en=i;
6194  }
6195  }
6196 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019
#define nGreater(a, b)
Definition: numbers.h:29

◆ posInLSig()

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

Definition at line 6039 of file kutil.cc.

6041 {
6042  if (length<0) return 0;
6043  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6044  return length+1;
6045 
6046  int i;
6047  int an = 0;
6048  int en= length;
6049  loop
6050  {
6051  if (an >= en-1)
6052  {
6053  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6054  return an;
6055  }
6056  i=(an+en) / 2;
6057  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6058  else en=i;
6059  /*aend. fuer lazy == in !=- machen */
6060  }
6061 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInLSigRing()

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

Definition at line 6063 of file kutil.cc.

6065 {
6066  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6067  if (length<0) return 0;
6068  if (pLtCmp(set[length].sig,p->sig)== 1)
6069  return length+1;
6070 
6071  int an,en,i;
6072  an = 0;
6073  en = length+1;
6074  int cmp;
6075  loop
6076  {
6077  if (an >= en-1)
6078  {
6079  if(an == en)
6080  return en;
6081  cmp = pLtCmp(set[an].sig,p->sig);
6082  if (cmp == 1)
6083  return en;
6084  if (cmp == -1)
6085  return an;
6086  if (cmp == 0)
6087  {
6088  if (set[an].FDeg > p->FDeg)
6089  return en;
6090  if (set[an].FDeg < p->FDeg)
6091  return an;
6092  if (set[an].FDeg == p->FDeg)
6093  {
6094  cmp = pLtCmp(set[an].p,p->p);
6095  if(cmp == 1)
6096  return en;
6097  else
6098  return an;
6099  }
6100  }
6101  }
6102  i=(an+en) / 2;
6103  cmp = pLtCmp(set[i].sig,p->sig);
6104  if (cmp == 1)
6105  an = i;
6106  if (cmp == -1)
6107  en = i;
6108  if (cmp == 0)
6109  {
6110  if (set[i].FDeg > p->FDeg)
6111  an = i;
6112  if (set[i].FDeg < p->FDeg)
6113  en = i;
6114  if (set[i].FDeg == p->FDeg)
6115  {
6116  cmp = pLtCmp(set[i].p,p->p);
6117  if(cmp == 1)
6118  an = i;
6119  else
6120  en = i;
6121  }
6122  }
6123  }
6124 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:78
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInS()

int posInS ( const kStrategy  strat,
const int  length,
const poly  p,
const int  ecart_p 
)

Definition at line 4951 of file kutil.cc.

4953 {
4954  if(length==-1) return 0;
4955  polyset set=strat->S;
4956  int i;
4957  int an = 0;
4958  int en = length;
4959  int cmp_int = currRing->OrdSgn;
4961 #ifdef HAVE_PLURAL
4962  && (currRing->real_var_start==0)
4963 #endif
4964 #if 0
4965  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
4966 #endif
4967  )
4968  {
4969  int o=p_Deg(p,currRing);
4970  int oo=p_Deg(set[length],currRing);
4971 
4972  if ((oo<o)
4973  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
4974  return length+1;
4975 
4976  loop
4977  {
4978  if (an >= en-1)
4979  {
4980  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
4981  {
4982  return an;
4983  }
4984  return en;
4985  }
4986  i=(an+en) / 2;
4987  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
4988  else an=i;
4989  }
4990  }
4991  else
4992  {
4993  if (rField_is_Ring(currRing))
4994  {
4995  if (pLmCmp(set[length],p)== -cmp_int)
4996  return length+1;
4997  int cmp;
4998  loop
4999  {
5000  if (an >= en-1)
5001  {
5002  cmp = pLmCmp(set[an],p);
5003  if (cmp == cmp_int) return an;
5004  if (cmp == -cmp_int) return en;
5005  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5006  return an;
5007  }
5008  i = (an+en) / 2;
5009  cmp = pLmCmp(set[i],p);
5010  if (cmp == cmp_int) en = i;
5011  else if (cmp == -cmp_int) an = i;
5012  else
5013  {
5014  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5015  else en = i;
5016  }
5017  }
5018  }
5019  else
5020  if (pLmCmp(set[length],p)== -cmp_int)
5021  return length+1;
5022 
5023  loop
5024  {
5025  if (an >= en-1)
5026  {
5027  if (pLmCmp(set[an],p) == cmp_int) return an;
5028  if (pLmCmp(set[an],p) == -cmp_int) return en;
5029  if ((cmp_int!=1)
5030  && ((strat->ecartS[an])>ecart_p))
5031  return an;
5032  return en;
5033  }
5034  i=(an+en) / 2;
5035  if (pLmCmp(set[i],p) == cmp_int) en=i;
5036  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5037  else
5038  {
5039  if ((cmp_int!=1)
5040  &&((strat->ecartS[i])<ecart_p))
5041  en=i;
5042  else
5043  an=i;
5044  }
5045  }
5046  }
5047 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int ak
Definition: kutil.h:346
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
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:775
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
intset ecartS
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInSMonFirst()

int posInSMonFirst ( const kStrategy  strat,
const int  length,
const poly  p 
)

Definition at line 5052 of file kutil.cc.

5053 {
5054  if (length<0) return 0;
5055  polyset set=strat->S;
5056  if(pNext(p) == NULL)
5057  {
5058  int mon = 0;
5059  for(int i = 0;i<=length;i++)
5060  {
5061  if(set[i] != NULL && pNext(set[i]) == NULL)
5062  mon++;
5063  }
5064  int o = p_Deg(p,currRing);
5065  int op = p_Deg(set[mon],currRing);
5066 
5067  if ((op < o)
5068  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5069  return length+1;
5070  int i;
5071  int an = 0;
5072  int en= mon;
5073  loop
5074  {
5075  if (an >= en-1)
5076  {
5077  op = p_Deg(set[an],currRing);
5078  if ((op < o)
5079  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5080  return en;
5081  return an;
5082  }
5083  i=(an+en) / 2;
5084  op = p_Deg(set[i],currRing);
5085  if ((op < o)
5086  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5087  an=i;
5088  else
5089  en=i;
5090  }
5091  }
5092  else /*if(pNext(p) != NULL)*/
5093  {
5094  int o = p_Deg(p,currRing);
5095  int op = p_Deg(set[length],currRing);
5096 
5097  if ((op < o)
5098  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5099  return length+1;
5100  int i;
5101  int an = 0;
5102  for(i=0;i<=length;i++)
5103  if(set[i] != NULL && pNext(set[i]) == NULL)
5104  an++;
5105  int en= length;
5106  loop
5107  {
5108  if (an >= en-1)
5109  {
5110  op = p_Deg(set[an],currRing);
5111  if ((op < o)
5112  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5113  return en;
5114  return an;
5115  }
5116  i=(an+en) / 2;
5117  op = p_Deg(set[i],currRing);
5118  if ((op < o)
5119  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5120  an=i;
5121  else
5122  en=i;
5123  }
5124  }
5125 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:78
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
#define NULL
Definition: omList.c:10
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInSyz()

int posInSyz ( const kStrategy  strat,
const poly  sig 
)

Definition at line 6199 of file kutil.cc.

6200 {
6201  if (strat->syzl==0) return 0;
6202  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6203  return strat->syzl;
6204  int i;
6205  int an = 0;
6206  int en= strat->syzl-1;
6207  loop
6208  {
6209  if (an >= en-1)
6210  {
6211  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6212  return an;
6213  }
6214  i=(an+en) / 2;
6215  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6216  else en=i;
6217  /*aend. fuer lazy == in !=- machen */
6218  }
6219 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
polyset syz
Definition: kutil.h:298
int syzl
Definition: kutil.h:342

◆ posInT0()

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

Definition at line 5173 of file kutil.cc.

5174 {
5175  return (length+1);
5176 }
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263

◆ posInT1()

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

Definition at line 5184 of file kutil.cc.

5185 {
5186  if (length==-1) return 0;
5187 
5188  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5189 
5190  int i;
5191  int an = 0;
5192  int en= length;
5193 
5194  loop
5195  {
5196  if (an >= en-1)
5197  {
5198  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5199  return en;
5200  }
5201  i=(an+en) / 2;
5202  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5203  else an=i;
5204  }
5205 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInT11()

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

Definition at line 5242 of file kutil.cc.

5243 {
5244  if (length==-1) return 0;
5245 
5246  int o = p.GetpFDeg();
5247  int op = set[length].GetpFDeg();
5248 
5249  if ((op < o)
5250  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5251  return length+1;
5252 
5253  int i;
5254  int an = 0;
5255  int en= length;
5256 
5257  loop
5258  {
5259  if (an >= en-1)
5260  {
5261  op= set[an].GetpFDeg();
5262  if ((op > o)
5263  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5264  return an;
5265  return en;
5266  }
5267  i=(an+en) / 2;
5268  op = set[i].GetpFDeg();
5269  if (( op > o)
5270  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5271  en=i;
5272  else
5273  an=i;
5274  }
5275 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInT110()

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

Definition at line 5395 of file kutil.cc.

5396 {
5397  p.GetpLength();
5398  if (length==-1) return 0;
5399 
5400  int o = p.GetpFDeg();
5401  int op = set[length].GetpFDeg();
5402 
5403  if (( op < o)
5404  || (( op == o) && (set[length].length<p.length))
5405  || (( op == o) && (set[length].length == p.length)
5406  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5407  return length+1;
5408 
5409  int i;
5410  int an = 0;
5411  int en= length;
5412  loop
5413  {
5414  if (an >= en-1)
5415  {
5416  op = set[an].GetpFDeg();
5417  if (( op > o)
5418  || (( op == o) && (set[an].length > p.length))
5419  || (( op == o) && (set[an].length == p.length)
5420  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5421  return an;
5422  return en;
5423  }
5424  i=(an+en) / 2;
5425  op = set[i].GetpFDeg();
5426  if (( op > o)
5427  || (( op == o) && (set[i].length > p.length))
5428  || (( op == o) && (set[i].length == p.length)
5429  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5430  en=i;
5431  else
5432  an=i;
5433  }
5434 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInT13()

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

Definition at line 5484 of file kutil.cc.

5485 {
5486  if (length==-1) return 0;
5487 
5488  int o = p.GetpFDeg();
5489 
5490  if (set[length].GetpFDeg() <= o)
5491  return length+1;
5492 
5493  int i;
5494  int an = 0;
5495  int en= length;
5496  loop
5497  {
5498  if (an >= en-1)
5499  {
5500  if (set[an].GetpFDeg() > o)
5501  return an;
5502  return en;
5503  }
5504  i=(an+en) / 2;
5505  if (set[i].GetpFDeg() > o)
5506  en=i;
5507  else
5508  an=i;
5509  }
5510 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT15()

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

Definition at line 5552 of file kutil.cc.

5571 {
5572  if (length==-1) return 0;
5573 
5574  int o = p.GetpFDeg() + p.ecart;
5575  int op = set[length].GetpFDeg()+set[length].ecart;
5576 
5577  if ((op < o)
5578  || ((op == o)
5579  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5580  return length+1;
5581 
5582  int i;
5583  int an = 0;
5584  int en= length;
5585  loop
5586  {
5587  if (an >= en-1)
5588  {
5589  op = set[an].GetpFDeg()+set[an].ecart;
5590  if (( op > o)
5591  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5592  return an;
5593  return en;
5594  }
5595  i=(an+en) / 2;
5596  op = set[i].GetpFDeg()+set[i].ecart;
5597  if (( op > o)
5598  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5599  en=i;
5600  else
5601  an=i;
5602  }
5603 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInT17()

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

Definition at line 5647 of file kutil.cc.

5668 {
5669  if (length==-1) return 0;
5670 
5671  int o = p.GetpFDeg() + p.ecart;
5672  int op = set[length].GetpFDeg()+set[length].ecart;
5673 
5674  if ((op < o)
5675  || (( op == o) && (set[length].ecart > p.ecart))
5676  || (( op == o) && (set[length].ecart==p.ecart)
5677  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5678  return length+1;
5679 
5680  int i;
5681  int an = 0;
5682  int en= length;
5683  loop
5684  {
5685  if (an >= en-1)
5686  {
5687  op = set[an].GetpFDeg()+set[an].ecart;
5688  if (( op > o)
5689  || (( op == o) && (set[an].ecart < p.ecart))
5690  || (( op == o) && (set[an].ecart==p.ecart)
5691  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5692  return an;
5693  return en;
5694  }
5695  i=(an+en) / 2;
5696  op = set[i].GetpFDeg()+set[i].ecart;
5697  if ((op > o)
5698  || (( op == o) && (set[i].ecart < p.ecart))
5699  || (( op == o) && (set[i].ecart == p.ecart)
5700  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5701  en=i;
5702  else
5703  an=i;
5704  }
5705 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInT17_c()

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

Definition at line 5754 of file kutil.cc.

5755 {
5756  if (length==-1) return 0;
5757 
5758  int cc = (-1+2*currRing->order[0]==ringorder_c);
5759  /* cc==1 for (c,..), cc==-1 for (C,..) */
5760  int o = p.GetpFDeg() + p.ecart;
5761  int c = pGetComp(p.p)*cc;
5762 
5763  if (pGetComp(set[length].p)*cc < c)
5764  return length+1;
5765  if (pGetComp(set[length].p)*cc == c)
5766  {
5767  int op = set[length].GetpFDeg()+set[length].ecart;
5768  if ((op < o)
5769  || ((op == o) && (set[length].ecart > p.ecart))
5770  || ((op == o) && (set[length].ecart==p.ecart)
5771  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5772  return length+1;
5773  }
5774 
5775  int i;
5776  int an = 0;
5777  int en= length;
5778  loop
5779  {
5780  if (an >= en-1)
5781  {
5782  if (pGetComp(set[an].p)*cc < c)
5783  return en;
5784  if (pGetComp(set[an].p)*cc == c)
5785  {
5786  int op = set[an].GetpFDeg()+set[an].ecart;
5787  if ((op > o)
5788  || ((op == o) && (set[an].ecart < p.ecart))
5789  || ((op == o) && (set[an].ecart==p.ecart)
5790  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5791  return an;
5792  }
5793  return en;
5794  }
5795  i=(an+en) / 2;
5796  if (pGetComp(set[i].p)*cc > c)
5797  en=i;
5798  else if (pGetComp(set[i].p)*cc == c)
5799  {
5800  int op = set[i].GetpFDeg()+set[i].ecart;
5801  if ((op > o)
5802  || ((op == o) && (set[i].ecart < p.ecart))
5803  || ((op == o) && (set[i].ecart == p.ecart)
5804  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5805  en=i;
5806  else
5807  an=i;
5808  }
5809  else
5810  an=i;
5811  }
5812 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define loop
Definition: structs.h:78
#define pGetComp(p)
Component.
Definition: polys.h:37
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ posInT19()

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

Definition at line 5881 of file kutil.cc.

5882 {
5883  p.GetpLength();
5884  if (length==-1) return 0;
5885 
5886  int o = p.ecart;
5887  int op=p.GetpFDeg();
5888 
5889  if (set[length].ecart < o)
5890  return length+1;
5891  if (set[length].ecart == o)
5892  {
5893  int oo=set[length].GetpFDeg();
5894  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
5895  return length+1;
5896  }
5897 
5898  int i;
5899  int an = 0;
5900  int en= length;
5901  loop
5902  {
5903  if (an >= en-1)
5904  {
5905  if (set[an].ecart > o)
5906  return an;
5907  if (set[an].ecart == o)
5908  {
5909  int oo=set[an].GetpFDeg();
5910  if((oo > op)
5911  || ((oo==op) && (set[an].length > p.length)))
5912  return an;
5913  }
5914  return en;
5915  }
5916  i=(an+en) / 2;
5917  if (set[i].ecart > o)
5918  en=i;
5919  else if (set[i].ecart == o)
5920  {
5921  int oo=set[i].GetpFDeg();
5922  if ((oo > op)
5923  || ((oo == op) && (set[i].length > p.length)))
5924  en=i;
5925  else
5926  an=i;
5927  }
5928  else
5929  an=i;
5930  }
5931 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT2()

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

Definition at line 5212 of file kutil.cc.

5213 {
5214  p.GetpLength();
5215  if (length==-1)
5216  return 0;
5217  if (set[length].length<p.length)
5218  return length+1;
5219 
5220  int i;
5221  int an = 0;
5222  int en= length;
5223 
5224  loop
5225  {
5226  if (an >= en-1)
5227  {
5228  if (set[an].length>p.length) return an;
5229  return en;
5230  }
5231  i=(an+en) / 2;
5232  if (set[i].length>p.length) en=i;
5233  else an=i;
5234  }
5235 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_EcartFDegpLength()

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

Definition at line 11494 of file kutil.cc.

11495 {
11496 
11497  if (length==-1) return 0;
11498 
11499  int o = p.ecart;
11500  int op=p.GetpFDeg();
11501  int ol = p.GetpLength();
11502 
11503  if (set[length].ecart < o)
11504  return length+1;
11505  if (set[length].ecart == o)
11506  {
11507  int oo=set[length].GetpFDeg();
11508  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11509  return length+1;
11510  }
11511 
11512  int i;
11513  int an = 0;
11514  int en= length;
11515  loop
11516  {
11517  if (an >= en-1)
11518  {
11519  if (set[an].ecart > o)
11520  return an;
11521  if (set[an].ecart == o)
11522  {
11523  int oo=set[an].GetpFDeg();
11524  if((oo > op)
11525  || ((oo==op) && (set[an].pLength > ol)))
11526  return an;
11527  }
11528  return en;
11529  }
11530  i=(an+en) / 2;
11531  if (set[i].ecart > o)
11532  en=i;
11533  else if (set[i].ecart == o)
11534  {
11535  int oo=set[i].GetpFDeg();
11536  if ((oo > op)
11537  || ((oo == op) && (set[i].pLength > ol)))
11538  en=i;
11539  else
11540  an=i;
11541  }
11542  else
11543  an=i;
11544  }
11545 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:193
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_EcartpLength()

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

Definition at line 5513 of file kutil.cc.

5514 {
5515  int ol = p.GetpLength();
5516  if (length==-1) return 0;
5517 
5518  int op=p.ecart;
5519 
5520  int oo=set[length].ecart;
5521  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5522  return length+1;
5523 
5524  int i;
5525  int an = 0;
5526  int en= length;
5527  loop
5528  {
5529  if (an >= en-1)
5530  {
5531  int oo=set[an].ecart;
5532  if((oo > op)
5533  || ((oo==op) && (set[an].pLength > ol)))
5534  return an;
5535  return en;
5536  }
5537  i=(an+en) / 2;
5538  int oo=set[i].ecart;
5539  if ((oo > op)
5540  || ((oo == op) && (set[i].pLength > ol)))
5541  en=i;
5542  else
5543  an=i;
5544  }
5545 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:193
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_FDegpLength()

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

Definition at line 11548 of file kutil.cc.

11549 {
11550 
11551  if (length==-1) return 0;
11552 
11553  int op=p.GetpFDeg();
11554  int ol = p.GetpLength();
11555 
11556  int oo=set[length].GetpFDeg();
11557  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11558  return length+1;
11559 
11560  int i;
11561  int an = 0;
11562  int en= length;
11563  loop
11564  {
11565  if (an >= en-1)
11566  {
11567  int oo=set[an].GetpFDeg();
11568  if((oo > op)
11569  || ((oo==op) && (set[an].pLength > ol)))
11570  return an;
11571  return en;
11572  }
11573  i=(an+en) / 2;
11574  int oo=set[i].GetpFDeg();
11575  if ((oo > op)
11576  || ((oo == op) && (set[i].pLength > ol)))
11577  en=i;
11578  else
11579  an=i;
11580  }
11581 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:193
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInT_pLength()

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

Definition at line 11585 of file kutil.cc.

11586 {
11587  int ol = p.GetpLength();
11588  if (length==-1)
11589  return 0;
11590  if (set[length].length<p.length)
11591  return length+1;
11592 
11593  int i;
11594  int an = 0;
11595  int en= length;
11596 
11597  loop
11598  {
11599  if (an >= en-1)
11600  {
11601  if (set[an].pLength>ol) return an;
11602  return en;
11603  }
11604  i=(an+en) / 2;
11605  if (set[i].pLength>ol) en=i;
11606  else an=i;
11607  }
11608 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:193
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ posInTSig()

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

◆ postReduceByMon()

void postReduceByMon ( LObject h,
kStrategy  strat 
)

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

Definition at line 10831 of file kutil.cc.

10832 {
10833  if(!nCoeff_is_Z(currRing->cf))
10834  return;
10835  poly pH = h->GetP();
10836  poly p,pp;
10837  p = pH;
10838  bool deleted = FALSE, ok = FALSE;
10839  for(int i = 0; i<=strat->sl; i++)
10840  {
10841  p = pH;
10842  if(pNext(strat->S[i]) == NULL)
10843  {
10844  //pWrite(p);
10845  //pWrite(strat->S[i]);
10846  while(ok == FALSE && p != NULL)
10847  {
10848  if(pLmDivisibleBy(strat->S[i], p))
10849  {
10850  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
10851  p_SetCoeff(p,dummy,currRing);
10852  }
10853  if(nIsZero(p->coef))
10854  {
10855  pLmDelete(&p);
10856  h->p = p;
10857  deleted = TRUE;
10858  }
10859  else
10860  {
10861  ok = TRUE;
10862  }
10863  }
10864  if (p!=NULL)
10865  {
10866  pp = pNext(p);
10867  while(pp != NULL)
10868  {
10869  if(pLmDivisibleBy(strat->S[i], pp))
10870  {
10871  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
10872  p_SetCoeff(pp,dummy,currRing);
10873  if(nIsZero(pp->coef))
10874  {
10875  pLmDelete(&pNext(p));
10876  pp = pNext(p);
10877  deleted = TRUE;
10878  }
10879  else
10880  {
10881  p = pp;
10882  pp = pNext(p);
10883  }
10884  }
10885  else
10886  {
10887  p = pp;
10888  pp = pNext(p);
10889  }
10890  }
10891  }
10892  }
10893  }
10894  h->SetLmCurrRing();
10895  if((deleted)&&(h->p!=NULL))
10896  strat->initEcart(h);
10897 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628
#define FALSE
Definition: auxiliary.h:94
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
void(* initEcart)(TObject *L)
Definition: kutil.h:271
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 10899 of file kutil.cc.

10900 {
10901  if(!nCoeff_is_Z(currRing->cf))
10902  return;
10903  poly hSig = h->sig;
10904  poly pH = h->GetP();
10905  poly p,pp;
10906  p = pH;
10907  bool deleted = FALSE, ok = FALSE;
10908  for(int i = 0; i<=strat->sl; i++)
10909  {
10910  p = pH;
10911  if(pNext(strat->S[i]) == NULL)
10912  {
10913  while(ok == FALSE && p!=NULL)
10914  {
10915  if(pLmDivisibleBy(strat->S[i], p))
10916  {
10917  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
10918  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
10919  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
10920  {
10921  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
10922  p_SetCoeff(p,dummy,currRing);
10923  }
10924  pDelete(&sigMult);
10925  }
10926  if(nIsZero(p->coef))
10927  {
10928  pLmDelete(&p);
10929  h->p = p;
10930  deleted = TRUE;
10931  }
10932  else
10933  {
10934  ok = TRUE;
10935  }
10936  }
10937  if(p == NULL)
10938  return;
10939  pp = pNext(p);
10940  while(pp != NULL)
10941  {
10942  if(pLmDivisibleBy(strat->S[i], pp))
10943  {
10944  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
10945  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
10946  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
10947  {
10948  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
10949  p_SetCoeff(pp,dummy,currRing);
10950  if(nIsZero(pp->coef))
10951  {
10952  pLmDelete(&pNext(p));
10953  pp = pNext(p);
10954  deleted = TRUE;
10955  }
10956  else
10957  {
10958  p = pp;
10959  pp = pNext(p);
10960  }
10961  }
10962  else
10963  {
10964  p = pp;
10965  pp = pNext(p);
10966  }
10967  pDelete(&sigMult);
10968  }
10969  else
10970  {
10971  p = pp;
10972  pp = pNext(p);
10973  }
10974  }
10975  }
10976  }
10977  h->SetLmCurrRing();
10978  if(deleted)
10979  strat->initEcart(h);
10980 
10981 }
polyset sig
Definition: kutil.h:299
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628
#define FALSE
Definition: auxiliary.h:94
#define ppMult_mm(p, m)
Definition: polys.h:196
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
void(* initEcart)(TObject *L)
Definition: kutil.h:271
#define pDivideM(a, b)
Definition: polys.h:288
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
#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:297
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ preIntegerCheck()

poly preIntegerCheck ( ideal  F,
ideal  Q 
)

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

Definition at line 10664 of file kutil.cc.

10665 {
10666  if(!nCoeff_is_Z(currRing->cf))
10667  return NULL;
10668  ideal F = idCopy(Forig);
10669  idSkipZeroes(F);
10670  poly pmon;
10671  ring origR = currRing;
10672  ideal monred = idInit(1,1);
10673  for(int i=0; i<idElem(F); i++)
10674  {
10675  if(pNext(F->m[i]) == NULL)
10676  idInsertPoly(monred, pCopy(F->m[i]));
10677  }
10678  int posconst = idPosConstant(F);
10679  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10680  {
10681  idDelete(&F);
10682  idDelete(&monred);
10683  return NULL;
10684  }
10685  int idelemQ = 0;
10686  if(Q!=NULL)
10687  {
10688  idelemQ = IDELEMS(Q);
10689  for(int i=0; i<idelemQ; i++)
10690  {
10691  if(pNext(Q->m[i]) == NULL)
10692  idInsertPoly(monred, pCopy(Q->m[i]));
10693  }
10694  idSkipZeroes(monred);
10695  posconst = idPosConstant(monred);
10696  //the constant, if found, will be from Q
10697  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10698  {
10699  pmon = pCopy(monred->m[posconst]);
10700  idDelete(&F);
10701  idDelete(&monred);
10702  return pmon;
10703  }
10704  }
10705  ring QQ_ring = rCopy0(currRing,FALSE);
10706  nKillChar(QQ_ring->cf);
10707  QQ_ring->cf = nInitChar(n_Q, NULL);
10708  rComplete(QQ_ring,1);
10709  QQ_ring = rAssure_c_dp(QQ_ring);
10710  rChangeCurrRing(QQ_ring);
10711  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10712  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10713  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10714  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10715  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10716  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10717  ideal one = kStd(II, NULL, isNotHomog, NULL);
10718  idSkipZeroes(one);
10719  if(idIsConstant(one))
10720  {
10721  //one should be <1>
10722  for(int i = IDELEMS(II)-1; i>=0; i--)
10723  if(II->m[i] != NULL)
10724  II->m[i+1] = II->m[i];
10725  II->m[0] = pOne();
10726  ideal syz = idSyzygies(II, isNotHomog, NULL);
10727  poly integer = NULL;
10728  for(int i = IDELEMS(syz)-1;i>=0; i--)
10729  {
10730  if(pGetComp(syz->m[i]) == 1)
10731  {
10732  pSetComp(syz->m[i],0);
10733  if(pIsConstant(pHead(syz->m[i])))
10734  {
10735  integer = pHead(syz->m[i]);
10736  break;
10737  }
10738  }
10739  }
10740  rChangeCurrRing(origR);
10741  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10742  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10743  idDelete(&monred);
10744  idDelete(&F);
10745  id_Delete(&II,QQ_ring);
10746  id_Delete(&one,QQ_ring);
10747  id_Delete(&syz,QQ_ring);
10748  p_Delete(&integer,QQ_ring);
10749  rDelete(QQ_ring);
10750  return pmon;
10751  }
10752  else
10753  {
10754  if(idIs0(monred))
10755  {
10756  poly mindegmon = NULL;
10757  for(int i = 0; i<IDELEMS(one); i++)
10758  {
10759  if(pNext(one->m[i]) == NULL)
10760  {
10761  if(mindegmon == NULL)
10762  mindegmon = pCopy(one->m[i]);
10763  else
10764  {
10765  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10766  mindegmon = pCopy(one->m[i]);
10767  }
10768  }
10769  }
10770  if(mindegmon != NULL)
10771  {
10772  for(int i = IDELEMS(II)-1; i>=0; i--)
10773  if(II->m[i] != NULL)
10774  II->m[i+1] = II->m[i];
10775  II->m[0] = pCopy(mindegmon);
10776  ideal syz = idSyzygies(II, isNotHomog, NULL);
10777  bool found = FALSE;
10778  for(int i = IDELEMS(syz)-1;i>=0; i--)
10779  {
10780  if(pGetComp(syz->m[i]) == 1)
10781  {
10782  pSetComp(syz->m[i],0);
10783  if(pIsConstant(pHead(syz->m[i])))
10784  {
10785  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10786  found = TRUE;
10787  break;
10788  }
10789  }
10790  }
10791  id_Delete(&syz,QQ_ring);
10792  if (found == FALSE)
10793  {
10794  rChangeCurrRing(origR);
10795  idDelete(&monred);
10796  idDelete(&F);
10797  id_Delete(&II,QQ_ring);
10798  id_Delete(&one,QQ_ring);
10799  rDelete(QQ_ring);
10800  return NULL;
10801  }
10802  rChangeCurrRing(origR);
10803  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10804  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
10805  idDelete(&monred);
10806  idDelete(&F);
10807  id_Delete(&II,QQ_ring);
10808  id_Delete(&one,QQ_ring);
10809  id_Delete(&syz,QQ_ring);
10810  rDelete(QQ_ring);
10811  return pmon;
10812  }
10813  }
10814  }
10815  rChangeCurrRing(origR);
10816  idDelete(&monred);
10817  idDelete(&F);
10818  id_Delete(&II,QQ_ring);
10819  id_Delete(&one,QQ_ring);
10820  rDelete(QQ_ring);
10821  return NULL;
10822 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
int j
Definition: facHensel.cc:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
rational (GMP) numbers
Definition: coeffs.h:31
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:98
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:2087
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4895
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
#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:46
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
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:3369
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1340
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
#define pSetComp(p, v)
Definition: polys.h:38
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:309
#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:721
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rChangeCurrRing(ring r)
Definition: polys.cc:15
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:730
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:437
#define nCopy(n)
Definition: numbers.h:16
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int idElem(const ideal F)
count non-zero elements
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:511
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:350
#define idIsConstant(I)
Definition: ideals.h:40

◆ redFirstShift()

int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 4234 of file kstd2.cc.

4235 {
4236  if (h->IsNull()) return 0;
4237 
4238  int at, reddeg,d;
4239  int pass = 0;
4240  int j = 0;
4241 
4242  if (! strat->homog)
4243  {
4244  d = h->GetpFDeg() + h->ecart;
4245  reddeg = strat->LazyDegree+d;
4246  }
4247  h->SetShortExpVector();
4248  loop
4249  {
4250  j = kFindDivisibleByInT(strat, h);
4251  if (j < 0)
4252  {
4253  h->SetDegStuffReturnLDeg(strat->LDegLast);
4254  return 1;
4255  }
4256 
4257  if (!TEST_OPT_INTSTRATEGY)
4258  strat->T[j].pNorm();
4259 #ifdef KDEBUG
4260  if (TEST_OPT_DEBUG)
4261  {
4262  PrintS("reduce ");
4263  h->wrp();
4264  PrintS(" with ");
4265  strat->T[j].wrp();
4266  }
4267 #endif
4268  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
4269  if (!h->IsNull())
4270  {
4271  poly qq=p_Shrink(h->GetP(),strat->lV,currRing);
4272  h->p=qq;
4273  h->t_p=NULL;
4274  }
4275 
4276 #ifdef KDEBUG
4277  if (TEST_OPT_DEBUG)
4278  {
4279  PrintS("\nto ");
4280  wrp(h->p);
4281  PrintLn();
4282  }
4283 #endif
4284  if (h->IsNull())
4285  {
4286  kDeleteLcm(h);
4287  h->Clear();
4288  return 0;
4289  }
4290  h->SetShortExpVector();
4291 
4292 #if 0
4293  if ((strat->syzComp!=0) && !strat->honey)
4294  {
4295  if ((strat->syzComp>0) &&
4296  (h->Comp() > strat->syzComp))
4297  {
4298  assume(h->MinComp() > strat->syzComp);
4299 #ifdef KDEBUG
4300  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
4301 #endif
4302  if (strat->homog)
4303  h->SetDegStuffReturnLDeg(strat->LDegLast);
4304  return -2;
4305  }
4306  }
4307 #endif
4308  if (!strat->homog)
4309  {
4310  if (!TEST_OPT_OLDSTD && strat->honey)
4311  {
4312  h->SetpFDeg();
4313  if (strat->T[j].ecart <= h->ecart)
4314  h->ecart = d - h->GetpFDeg();
4315  else
4316  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
4317 
4318  d = h->GetpFDeg() + h->ecart;
4319  }
4320  else
4321  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
4322  /*- try to reduce the s-polynomial -*/
4323  pass++;
4324  /*
4325  *test whether the polynomial should go to the lazyset L
4326  *-if the degree jumps
4327  *-if the number of pre-defined reductions jumps
4328  */
4329  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
4330  && ((d >= reddeg) || (pass > strat->LazyPass)))
4331  {
4332  h->SetLmCurrRing();
4333  if (strat->posInLDependsOnLength)
4334  h->SetLength(strat->length_pLength);
4335  at = strat->posInL(strat->L,strat->Ll,h,strat);
4336  if (at <= strat->Ll)
4337  {
4338  //int dummy=strat->sl;
4339  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
4340  //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
4341  if (kFindDivisibleByInT(strat, h) < 0)
4342  return 1;
4343  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
4344 #ifdef KDEBUG
4345  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
4346 #endif
4347  h->Clear();
4348  return -1;
4349  }
4350  }
4351  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
4352  {
4353  reddeg = d+1;
4354  Print(".%d",d);mflush();
4355  }
4356  }
4357  }
4358 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:347
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
char LDegLast
Definition: kutil.h:379
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
char length_pLength
Definition: kutil.h:381
#define mflush()
Definition: reporter.h:57
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
int lV
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define TEST_OPT_OLDSTD
Definition: options.h:121
#define assume(x)
Definition: mod2.h:390
void PrintS(const char *s)
Definition: reporter.cc:284
char homog
Definition: kutil.h:366
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
TSet T
Definition: kutil.h:317
char posInLDependsOnLength
Definition: kutil.h:383
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:86
void wrp(poly p)
Definition: polys.h:304
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int LazyDegree
Definition: kutil.h:346

◆ redHomog()

int redHomog ( LObject h,
kStrategy  strat 
)

Definition at line 545 of file kstd2.cc.

546 {
547  if (strat->tl<0) return 1;
548  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
549  assume(h->FDeg == h->pFDeg());
550 
551  poly h_p;
552  int i,j,at,pass, ii;
553  unsigned long not_sev;
554  // long reddeg,d;
555 
556  pass = j = 0;
557  // d = reddeg = h->GetpFDeg();
558  h->SetShortExpVector();
559  int li;
560  h_p = h->GetLmTailRing();
561  not_sev = ~ h->sev;
562  loop
563  {
564  j = kFindDivisibleByInT(strat, h);
565  if (j < 0) return 1;
566 
567  li = strat->T[j].pLength;
568  if (li<=0) li=strat->T[j].GetpLength();
569  ii = j;
570  /*
571  * the polynomial to reduce with (up to the moment) is;
572  * pi with length li
573  */
574  i = j;
575 #if 1
576  if (TEST_OPT_LENGTH)
577  loop
578  {
579  /*- search the shortest possible with respect to length -*/
580  i++;
581  if (i > strat->tl)
582  break;
583  if (li==1)
584  break;
585  if ((strat->T[i].pLength < li)
586  &&
587  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
588  h_p, not_sev, strat->tailRing))
589  {
590  /*
591  * the polynomial to reduce with is now;
592  */
593  li = strat->T[i].pLength;
594  if (li<=0) li=strat->T[i].GetpLength();
595  ii = i;
596  }
597  }
598 #endif
599 
600  /*
601  * end of search: have to reduce with pi
602  */
603 #ifdef KDEBUG
604  if (TEST_OPT_DEBUG)
605  {
606  PrintS("red:");
607  h->wrp();
608  PrintS(" with ");
609  strat->T[ii].wrp();
610  }
611 #endif
612  assume(strat->fromT == FALSE);
613 
614  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
615 #if SBA_PRINT_REDUCTION_STEPS
616  sba_interreduction_steps++;
617 #endif
618 #if SBA_PRINT_OPERATIONS
619  sba_interreduction_operations += pLength(strat->T[ii].p);
620 #endif
621 
622 #ifdef KDEBUG
623  if (TEST_OPT_DEBUG)
624  {
625  PrintS("\nto ");
626  h->wrp();
627  PrintLn();
628  }
629 #endif
630 
631  h_p = h->GetLmTailRing();
632  if (h_p == NULL)
633  {
634  kDeleteLcm(h);
635  return 0;
636  }
637  h->SetShortExpVector();
638  not_sev = ~ h->sev;
639  /*
640  * try to reduce the s-polynomial h
641  *test first whether h should go to the lazyset L
642  *-if the degree jumps
643  *-if the number of pre-defined reductions jumps
644  */
645  pass++;
646  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
647  {
648  h->SetLmCurrRing();
649  at = strat->posInL(strat->L,strat->Ll,h,strat);
650  if (at <= strat->Ll)
651  {
652  int dummy=strat->sl;
653  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
654  return 1;
655  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
656 #ifdef KDEBUG
657  if (TEST_OPT_DEBUG)
658  Print(" lazy: -> L%d\n",at);
659 #endif
660  h->Clear();
661  return -1;
662  }
663  }
664  }
665 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
int tl
Definition: kutil.h:343
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
unsigned long * sevT
Definition: kutil.h:316
#define TEST_OPT_LENGTH
Definition: options.h:128
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
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:196
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
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:86
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972

◆ redHoney()

int redHoney ( LObject h,
kStrategy  strat 
)

Definition at line 1387 of file kstd2.cc.

1388 {
1389  if (strat->tl<0) return 1;
1390  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1391  assume(h->FDeg == h->pFDeg());
1392  poly h_p;
1393  int i,j,at,pass,ei, ii, h_d;
1394  unsigned long not_sev;
1395  long reddeg,d;
1396 
1397  pass = j = 0;
1398  d = reddeg = h->GetpFDeg() + h->ecart;
1399  h->SetShortExpVector();
1400  int li;
1401  h_p = h->GetLmTailRing();
1402  not_sev = ~ h->sev;
1403 
1404  h->PrepareRed(strat->use_buckets);
1405  loop
1406  {
1407  j=kFindDivisibleByInT(strat, h);
1408  if (j < 0) return 1;
1409 
1410  ei = strat->T[j].ecart;
1411  li = strat->T[j].pLength;
1412  if (li<=0) li=strat->T[j].GetpLength();
1413  ii = j;
1414  /*
1415  * the polynomial to reduce with (up to the moment) is;
1416  * pi with ecart ei (T[ii])
1417  */
1418  i = j;
1419  if (TEST_OPT_LENGTH)
1420  loop
1421  {
1422  /*- takes the first possible with respect to ecart -*/
1423  i++;
1424  if (i > strat->tl)
1425  break;
1426  //if (ei < h->ecart)
1427  // break;
1428  if (li==1)
1429  break;
1430  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1431  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1432  &&
1433  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1434  h_p, not_sev, strat->tailRing))
1435  {
1436  /*
1437  * the polynomial to reduce with is now;
1438  */
1439  ei = strat->T[i].ecart;
1440  li = strat->T[i].pLength;
1441  if (li<=0) li=strat->T[i].GetpLength();
1442  ii = i;
1443  }
1444  }
1445 
1446  /*
1447  * end of search: have to reduce with pi
1448  */
1449  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1450  {
1451  h->GetTP(); // clears bucket
1452  h->SetLmCurrRing();
1453  /*
1454  * It is not possible to reduce h with smaller ecart;
1455  * if possible h goes to the lazy-set L,i.e
1456  * if its position in L would be not the last one
1457  */
1458  if (strat->Ll >= 0) /* L is not empty */
1459  {
1460  at = strat->posInL(strat->L,strat->Ll,h,strat);
1461  if(at <= strat->Ll)
1462  /*- h will not become the next element to reduce -*/
1463  {
1464  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1465 #ifdef KDEBUG
1466  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1467 #endif
1468  h->Clear();
1469  return -1;
1470  }
1471  }
1472  }
1473 #ifdef KDEBUG
1474  if (TEST_OPT_DEBUG)
1475  {
1476  PrintS("red:");
1477  h->wrp();
1478  Print("\nwith T[%d]:",ii);
1479  strat->T[ii].wrp();
1480  }
1481 #endif
1482  assume(strat->fromT == FALSE);
1483 
1484  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),NULL,strat);
1485 #if SBA_PRINT_REDUCTION_STEPS
1486  sba_interreduction_steps++;
1487 #endif
1488 #if SBA_PRINT_OPERATIONS
1489  sba_interreduction_operations += pLength(strat->T[ii].p);
1490 #endif
1491 #ifdef KDEBUG
1492  if (TEST_OPT_DEBUG)
1493  {
1494  PrintS("\nto:");
1495  h->wrp();
1496  PrintLn();
1497  }
1498 #endif
1499  if(h->IsNull())
1500  {
1501  kDeleteLcm(h);
1502  h->Clear();
1503  return 0;
1504  }
1505  if (TEST_OPT_IDLIFT)
1506  {
1507  if (h->p!=NULL)
1508  {
1509  if(p_GetComp(h->p,currRing)>strat->syzComp)
1510  {
1511  h->Delete();
1512  return 0;
1513  }
1514  }
1515  else if (h->t_p!=NULL)
1516  {
1517  if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1518  {
1519  h->Delete();
1520  return 0;
1521  }
1522  }
1523  }
1524  h->SetShortExpVector();
1525  not_sev = ~ h->sev;
1526  h_d = h->SetpFDeg();
1527  /* compute the ecart */
1528  if (ei <= h->ecart)
1529  h->ecart = d-h_d;
1530  else
1531  h->ecart = d-h_d+ei-h->ecart;
1532 
1533  /*
1534  * try to reduce the s-polynomial h
1535  *test first whether h should go to the lazyset L
1536  *-if the degree jumps
1537  *-if the number of pre-defined reductions jumps
1538  */
1539  pass++;
1540  d = h_d + h->ecart;
1541  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1542  {
1543  h->GetTP(); // clear bucket
1544  h->SetLmCurrRing();
1545  at = strat->posInL(strat->L,strat->Ll,h,strat);
1546  if (at <= strat->Ll)
1547  {
1548  int dummy=strat->sl;
1549  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1550  return 1;
1551  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1552 #ifdef KDEBUG
1553  if (TEST_OPT_DEBUG)
1554  Print(" degree jumped: -> L%d\n",at);
1555 #endif
1556  h->Clear();
1557  return -1;
1558  }
1559  }
1560  else if (d > reddeg)
1561  {
1562  if (d>=(long)strat->tailRing->bitmask)
1563  {
1564  if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
1565  {
1566  strat->overflow=TRUE;
1567  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1568  h->GetP();
1569  at = strat->posInL(strat->L,strat->Ll,h,strat);
1570  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1571  h->Clear();
1572  return -1;
1573  }
1574  }
1575  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1576  {
1577  //h->wrp(); Print("<%d>\n",h->GetpLength());
1578  reddeg = d;
1579  Print(".%ld",d); mflush();
1580  }
1581  }
1582  }
1583 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:347
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:65
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
unsigned long * sevT
Definition: kutil.h:316
#define TEST_OPT_LENGTH
Definition: options.h:128
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
char use_buckets
Definition: kutil.h:377
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
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:196
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:127
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
char overflow
Definition: kutil.h:398
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
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:86
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ redLazy()

int redLazy ( LObject h,
kStrategy  strat 
)

TEST_OPT_REDTHROUGH &&

Definition at line 1242 of file kstd2.cc.

1243 {
1244  if (strat->tl<0) return 1;
1245  int at,i,ii,li;
1246  int j = 0;
1247  int pass = 0;
1248  assume(h->pFDeg() == h->FDeg);
1249  long reddeg = h->GetpFDeg();
1250  long d;
1251  unsigned long not_sev;
1252 
1253  h->SetShortExpVector();
1254  poly h_p = h->GetLmTailRing();
1255  not_sev = ~ h->sev;
1256  loop
1257  {
1258  j = kFindDivisibleByInT(strat, h);
1259  if (j < 0) return 1;
1260 
1261  li = strat->T[j].pLength;
1262  if (li<=0) li=strat->T[j].GetpLength();
1263  ii = j;
1264  /*
1265  * the polynomial to reduce with (up to the moment) is;
1266  * pi with length li
1267  */
1268 
1269  i = j;
1270 #if 1
1271  if (TEST_OPT_LENGTH)
1272  loop
1273  {
1274  /*- search the shortest possible with respect to length -*/
1275  i++;
1276  if (i > strat->tl)
1277  break;
1278  if (li==1)
1279  break;
1280  if ((strat->T[i].pLength < li)
1281  &&
1282  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1283  h_p, not_sev, strat->tailRing))
1284  {
1285  /*
1286  * the polynomial to reduce with is now;
1287  */
1288  li = strat->T[i].pLength;
1289  if (li<=0) li=strat->T[i].GetpLength();
1290  ii = i;
1291  }
1292  }
1293 #endif
1294 
1295  /*
1296  * end of search: have to reduce with pi
1297  */
1298 
1299 
1300 #ifdef KDEBUG
1301  if (TEST_OPT_DEBUG)
1302  {
1303  PrintS("red:");
1304  h->wrp();
1305  PrintS(" with ");
1306  strat->T[ii].wrp();
1307  }
1308 #endif
1309 
1310  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
1311 #if SBA_PRINT_REDUCTION_STEPS
1312  sba_interreduction_steps++;
1313 #endif
1314 #if SBA_PRINT_OPERATIONS
1315  sba_interreduction_operations += pLength(strat->T[ii].p);
1316 #endif
1317 
1318 #ifdef KDEBUG
1319  if (TEST_OPT_DEBUG)
1320  {
1321  PrintS("\nto ");
1322  h->wrp();
1323  PrintLn();
1324  }
1325 #endif
1326 
1327  h_p=h->GetLmTailRing();
1328 
1329  if (h_p == NULL)
1330  {
1331  kDeleteLcm(h);
1332  return 0;
1333  }
1334  h->SetShortExpVector();
1335  not_sev = ~ h->sev;
1336  d = h->SetpFDeg();
1337  /*- try to reduce the s-polynomial -*/
1338  pass++;
1339  if (//!TEST_OPT_REDTHROUGH &&
1340  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1341  {
1342  h->SetLmCurrRing();
1343  at = strat->posInL(strat->L,strat->Ll,h,strat);
1344  if (at <= strat->Ll)
1345  {
1346 #if 1
1347  int dummy=strat->sl;
1348  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1349  return 1;
1350 #endif
1351 #ifdef KDEBUG
1352  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
1353 #endif
1354  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1355  h->Clear();
1356  return -1;
1357  }
1358  }
1359  else if (d != reddeg)
1360  {
1361  if (d>=(long)strat->tailRing->bitmask)
1362  {
1363  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
1364  {
1365  strat->overflow=TRUE;
1366  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1367  h->GetP();
1368  at = strat->posInL(strat->L,strat->Ll,h,strat);
1369  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1370  h->Clear();
1371  return -1;
1372  }
1373  }
1374  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
1375  {
1376  Print(".%ld",d);mflush();
1377  reddeg = d;
1378  }
1379  }
1380  }
1381 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
unsigned long * sevT
Definition: kutil.h:316
#define TEST_OPT_LENGTH
Definition: options.h:128
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
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:196
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
LSet L
Definition: kutil.h:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
char overflow
Definition: kutil.h:398
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
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:86
int LazyPass
Definition: kutil.h:346
static Poly * h
Definition: janet.cc:972

◆ redNF()

poly redNF ( poly  h,
int &  max_ind,
int  nonorm,
kStrategy  strat 
)

Definition at line 1589 of file kstd2.cc.

1590 {
1591 #define REDNF_CANONICALIZE 60
1592  if (h==NULL) return NULL;
1593  int j;
1594  int cnt=REDNF_CANONICALIZE;
1595  max_ind=strat->sl;
1596 
1597  if (0 > strat->sl)
1598  {
1599  return h;
1600  }
1601  LObject P(h);
1602  P.SetShortExpVector();
1603  P.bucket = kBucketCreate(currRing);
1604  kBucketInit(P.bucket,P.p,pLength(P.p));
1605  kbTest(P.bucket);
1606 #ifdef HAVE_RINGS
1607  BOOLEAN is_ring = rField_is_Ring(currRing);
1608 #endif
1609 #ifdef KDEBUG
1610 // if (TEST_OPT_DEBUG)
1611 // {
1612 // PrintS("redNF: starting S:\n");
1613 // for( j = 0; j <= max_ind; j++ )
1614 // {
1615 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1616 // pWrite(strat->S[j]);
1617 // }
1618 // };
1619 #endif
1620 
1621  loop
1622  {
1623  j=kFindDivisibleByInS(strat,&max_ind,&P);
1624  if (j>=0)
1625  {
1626 #ifdef HAVE_RINGS
1627  if (!is_ring)
1628  {
1629 #endif
1630  int sl=pSize(strat->S[j]);
1631  int jj=j;
1632  loop
1633  {
1634  int sll;
1635  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1636  if (jj<0) break;
1637  sll=pSize(strat->S[jj]);
1638  if (sll<sl)
1639  {
1640  #ifdef KDEBUG
1641  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1642  #endif
1643  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1644  j=jj;
1645  sl=sll;
1646  }
1647  }
1648  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1649  {
1650  pNorm(strat->S[j]);
1651  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1652  }
1653 #ifdef HAVE_RINGS
1654  }
1655 #endif
1656  nNormalize(pGetCoeff(P.p));
1657 #ifdef KDEBUG
1658  if (TEST_OPT_DEBUG)
1659  {
1660  PrintS("red:");
1661  wrp(h);
1662  PrintS(" with ");
1663  wrp(strat->S[j]);
1664  }
1665 #endif
1666 #ifdef HAVE_PLURAL
1667  if (rIsPluralRing(currRing))
1668  {
1669  number coef;
1670  nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef);
1671  nDelete(&coef);
1672  }
1673  else
1674 #endif
1675  {
1676  number coef;
1677  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1678  nDelete(&coef);
1679  }
1680  cnt--;
1681  if (cnt==0)
1682  {
1683  kBucketCanonicalize(P.bucket);
1684  cnt=REDNF_CANONICALIZE;
1685  }
1686  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1687  if (h==NULL)
1688  {
1689  kBucketDestroy(&P.bucket);
1690 
1691 #ifdef KDEBUG
1692 // if (TEST_OPT_DEBUG)
1693 // {
1694 // PrintS("redNF: starting S:\n");
1695 // for( j = 0; j <= max_ind; j++ )
1696 // {
1697 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1698 // pWrite(strat->S[j]);
1699 // }
1700 // };
1701 #endif
1702 
1703  return NULL;
1704  }
1705  kbTest(P.bucket);
1706  P.p=h;
1707  P.t_p=NULL;
1708  P.SetShortExpVector();
1709 #ifdef KDEBUG
1710  if (TEST_OPT_DEBUG)
1711  {
1712  PrintS("\nto:");
1713  wrp(h);
1714  PrintLn();
1715  }
1716 #endif
1717  }
1718  else
1719  {
1720  P.p=kBucketClear(P.bucket);
1721  kBucketDestroy(&P.bucket);
1722  pNormalize(P.p);
1723 
1724 #ifdef KDEBUG
1725 // if (TEST_OPT_DEBUG)
1726 // {
1727 // PrintS("redNF: starting S:\n");
1728 // for( j = 0; j <= max_ind; j++ )
1729 // {
1730 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1731 // pWrite(strat->S[j]);
1732 // }
1733 // };
1734 #endif
1735 
1736  return P.p;
1737  }
1738  }
1739 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:518
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:265
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:194
int j
Definition: facHensel.cc:105
static void nc_kBucketPolyRed_NF(kBucket_pt b, poly p, number *c)
Definition: nc.h:275
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:490
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
class sLObject LObject
Definition: kutil.h:54
#define nNormalize(n)
Definition: numbers.h:31
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1076
#define REDNF_CANONICALIZE
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:503
poly kNoether
Definition: kutil.h:321
#define nIsOne(n)
Definition: numbers.h:26
#define TEST_OPT_DEBUG
Definition: options.h:107
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:213
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
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:196
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
polyset S
Definition: kutil.h:297
#define nDelete(n)
Definition: numbers.h:17
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
void wrp(poly p)
Definition: polys.h:304
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:206
static Poly * h
Definition: janet.cc:972
int BOOLEAN
Definition: auxiliary.h:85
int kBucketCanonicalize(kBucket_pt bucket)
Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in one bucket: Returns number of bu...
#define pSize(p)
Definition: polys.h:312
#define pNormalize(p)
Definition: polys.h:311

◆ redNF0()

int redNF0 ( LObject P,
kStrategy  strat 
)

◆ redNFTail()

poly redNFTail ( poly  h,
const int  sl,
kStrategy  strat 
)

◆ redRiloc()

int redRiloc ( LObject h,
kStrategy  strat 
)

Definition at line 344 of file kstd1.cc.

345 {
346  int i,at,ei,li,ii;
347  int j = 0;
348  int pass = 0;
349  long d,reddeg;
350 
351  d = h->GetpFDeg()+ h->ecart;
352  reddeg = strat->LazyDegree+d;
353  h->SetShortExpVector();
354  loop
355  {
356  j = kFindDivisibleByInT(strat, h);
357  if (j < 0)
358  {
359  // over ZZ: cleanup coefficients by complete reduction with monomials
360  postReduceByMon(h, strat);
361  if(h->p == NULL)
362  {
363  kDeleteLcm(h);
364  h->Clear();
365  return 0;
366  }
367  if (strat->honey) h->SetLength(strat->length_pLength);
368  if(strat->tl >= 0)
369  h->i_r1 = strat->tl;
370  else
371  h->i_r1 = -1;
372  if (h->GetLmTailRing() == NULL)
373  {
374  kDeleteLcm(h);
375  h->Clear();
376  return 0;
377  }
378  return 1;
379  }
380 
381  ei = strat->T[j].ecart;
382  ii = j;
383  if (ei > h->ecart && ii < strat->tl)
384  {
385  li = strat->T[j].length;
386  // the polynomial to reduce with (up to the moment) is;
387  // pi with ecart ei and length li
388  // look for one with smaller ecart
389  i = j;
390  loop
391  {
392  /*- takes the first possible with respect to ecart -*/
393  i++;
394 #if 1
395  if (i > strat->tl) break;
396  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
397  strat->T[i].length < li))
398  &&
399  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
400  &&
401  n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
402 #else
403  j = kFindDivisibleByInT(strat, h, i);
404  if (j < 0) break;
405  i = j;
406  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
407  strat->T[i].length < li))
408 #endif
409  {
410  // the polynomial to reduce with is now
411  ii = i;
412  ei = strat->T[i].ecart;
413  if (ei <= h->ecart) break;
414  li = strat->T[i].length;
415  }
416  }
417  }
418 
419  // end of search: have to reduce with pi
420  if (ei > h->ecart)
421  {
422  // It is not possible to reduce h with smaller ecart;
423  // if possible h goes to the lazy-set L,i.e
424  // if its position in L would be not the last one
425  strat->fromT = TRUE;
426  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
427  {
428  h->SetLmCurrRing();
429  if (strat->honey && strat->posInLDependsOnLength)
430  h->SetLength(strat->length_pLength);
431  assume(h->FDeg == h->pFDeg());
432  at = strat->posInL(strat->L,strat->Ll,h,strat);
433  if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
434  {
435  /*- h will not become the next element to reduce -*/
436  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
437  #ifdef KDEBUG
438  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
439  #endif
440  h->Clear();
441  strat->fromT = FALSE;
442  return -1;
443  }
444  }
445  doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
446  }
447  else
448  {
449  // now we finally can reduce
450  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
451  }
452  strat->fromT=FALSE;
453  // are we done ???
454  if (h->IsNull())
455  {
456  kDeleteLcm(h);
457  h->Clear();
458  return 0;
459  }
460 
461  // NO!
462  h->SetShortExpVector();
463  h->SetpFDeg();
464  if (strat->honey)
465  {
466  if (ei <= h->ecart)
467  h->ecart = d-h->GetpFDeg();
468  else
469  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
470  }
471  else
472  // this has the side effect of setting h->length
473  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
474  /*- try to reduce the s-polynomial -*/
475  pass++;
476  d = h->GetpFDeg()+h->ecart;
477  /*
478  *test whether the polynomial should go to the lazyset L
479  *-if the degree jumps
480  *-if the number of pre-defined reductions jumps
481  */
482  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
483  && ((d >= reddeg) || (pass > strat->LazyPass)))
484  {
485  h->SetLmCurrRing();
486  if (strat->honey && strat->posInLDependsOnLength)
487  h->SetLength(strat->length_pLength);
488  assume(h->FDeg == h->pFDeg());
489  at = strat->posInL(strat->L,strat->Ll,h,strat);
490  if (at <= strat->Ll)
491  {
492  int dummy=strat->sl;
493  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
494  {
495  if (strat->honey && !strat->posInLDependsOnLength)
496  h->SetLength(strat->length_pLength);
497  return 1;
498  }
499  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
500 #ifdef KDEBUG
501  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
502 #endif
503  h->Clear();
504  return -1;
505  }
506  }
507  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
508  {
509  Print(".%ld",d);mflush();
510  reddeg = d+1;
511  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
512  {
513  strat->overflow=TRUE;
514  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
515  h->GetP();
516  at = strat->posInL(strat->L,strat->Ll,h,strat);
517  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
518  h->Clear();
519  return -1;
520  }
521  }
522  }
523 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
#define Print
Definition: emacs.cc:80
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:118
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
char LDegLast
Definition: kutil.h:379
unsigned long * sevT
Definition: kutil.h:316
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define nEqual(n1, n2)
Definition: numbers.h:21
#define loop
Definition: structs.h:78
char length_pLength
Definition: kutil.h:381
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
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:196
int i
Definition: cfEzgcd.cc:125
LSet L
Definition: kutil.h:318
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:10831
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
char overflow
Definition: kutil.h:398
char honey
Definition: kutil.h:371
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
char posInLDependsOnLength
Definition: kutil.h:383
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:86
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972
int LazyDegree
Definition: kutil.h:346

◆ redRing()

int redRing ( LObject h,
kStrategy  strat 
)

Definition at line 438 of file kstd2.cc.

439 {
440  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
441  if (strat->tl<0) return 1;
442 
443  int at/*,i*/;
444  long d;
445  int j = 0;
446  int pass = 0;
447  // poly zeroPoly = NULL;
448 
449 // TODO warum SetpFDeg notwendig?
450  h->SetpFDeg();
451  assume(h->pFDeg() == h->FDeg);
452  long reddeg = h->GetpFDeg();
453 
454  h->SetShortExpVector();
455  loop
456  {
457  j = kFindDivisibleByInT(strat, h);
458  if (j < 0)
459  {
460  // over ZZ: cleanup coefficients by complete reduction with monomials
461  postReduceByMon(h, strat);
462  if(h->p == NULL)
463  {
464  kDeleteLcm(h);
465  h->Clear();
466  return 0;
467  }
468  if(nIsZero(pGetCoeff(h->p))) return 2;
469  j = kFindDivisibleByInT(strat, h);
470  if(j < 0)
471  {
472  if(strat->tl >= 0)
473  h->i_r1 = strat->tl;
474  else
475  h->i_r1 = -1;
476  if (h->GetLmTailRing() == NULL)
477  {
478  kDeleteLcm(h);
479  h->Clear();
480  return 0;
481  }
482  return 1;
483  }
484  }
485  //printf("\nFound one: ");pWrite(strat->T[j].p);
486  //enterT(*h, strat);
487  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
488  //printf("\nAfter small red: ");pWrite(h->p);
489  if (h->GetLmTailRing() == NULL)
490  {
491  kDeleteLcm(h);
492  h->Clear();
493  return 0;
494  }
495  h->SetShortExpVector();
496  d = h->SetpFDeg();
497  /*- try to reduce the s-polynomial -*/
498  pass++;
499  if (!TEST_OPT_REDTHROUGH &&
500  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
501  {
502  h->SetLmCurrRing();
503  if (strat->posInLDependsOnLength)
504  h->SetLength(strat->length_pLength);
505  at = strat->posInL(strat->L,strat->Ll,h,strat);
506  if (at <= strat->Ll)
507  {
508 #ifdef KDEBUG
509  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
510 #endif
511  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
512  h->Clear();
513  return -1;
514  }
515  }
516  if (d != reddeg)
517  {
518  if (d >= (long)strat->tailRing->bitmask)
519  {
520  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
521  {
522  strat->overflow=TRUE;
523  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
524  h->GetP();
525  at = strat->posInL(strat->L,strat->Ll,h,strat);
526  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
527  h->Clear();
528  return -1;
529  }
530  }
531  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
532  {
533  Print(".%ld",d);mflush();
534  reddeg = d;
535  }
536  }
537  }
538 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
int j
Definition: facHensel.cc:105
#define Print
Definition: emacs.cc:80
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:344
int tl
Definition: kutil.h:343
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
char length_pLength
Definition: kutil.h:381
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
LSet L
Definition: kutil.h:318
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:10831
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
char overflow
Definition: kutil.h:398
TSet T
Definition: kutil.h:317
char posInLDependsOnLength
Definition: kutil.h:383
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:86
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972

◆ redSig()

int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 705 of file kstd2.cc.

706 {
707  if (strat->tl<0) return 1;
708  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
709  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
710  assume(h->FDeg == h->pFDeg());
711 //#if 1
712 #ifdef DEBUGF5
713  PrintS("------- IN REDSIG -------\n");
714  Print("p: ");
715  pWrite(pHead(h->p));
716  PrintS("p1: ");
717  pWrite(pHead(h->p1));
718  PrintS("p2: ");
719  pWrite(pHead(h->p2));
720  PrintS("---------------------------\n");
721 #endif
722  poly h_p;
723  int i,j,at,pass, ii;
724  int start=0;
725  int sigSafe;
726  unsigned long not_sev;
727  // long reddeg,d;
728 
729  pass = j = 0;
730  // d = reddeg = h->GetpFDeg();
731  h->SetShortExpVector();
732  int li;
733  h_p = h->GetLmTailRing();
734  not_sev = ~ h->sev;
735  loop
736  {
737  j = kFindDivisibleByInT(strat, h, start);
738  if (j < 0)
739  {
740  return 1;
741  }
742 
743  li = strat->T[j].pLength;
744  if (li<=0) li=strat->T[j].GetpLength();
745  ii = j;
746  /*
747  * the polynomial to reduce with (up to the moment) is;
748  * pi with length li
749  */
750  i = j;
751 #if 1
752  if (TEST_OPT_LENGTH)
753  loop
754  {
755  /*- search the shortest possible with respect to length -*/
756  i++;
757  if (i > strat->tl)
758  break;
759  if (li==1)
760  break;
761  if ((strat->T[i].pLength < li)
762  &&
763  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
764  h_p, not_sev, strat->tailRing))
765  {
766  /*
767  * the polynomial to reduce with is now;
768  */
769  li = strat->T[i].pLength;
770  if (li<=0) li=strat->T[i].GetpLength();
771  ii = i;
772  }
773  }
774  start = ii+1;
775 #endif
776 
777  /*
778  * end of search: have to reduce with pi
779  */
780 #ifdef KDEBUG
781  if (TEST_OPT_DEBUG)
782  {
783  PrintS("red:");
784  h->wrp();
785  PrintS(" with ");
786  strat->T[ii].wrp();
787  }
788 #endif
789  assume(strat->fromT == FALSE);
790 //#if 1
791 #ifdef DEBUGF5
792  Print("BEFORE REDUCTION WITH %d:\n",ii);
793  PrintS("--------------------------------\n");
794  pWrite(h->sig);
795  pWrite(strat->T[ii].sig);
796  pWrite(h->GetLmCurrRing());
797  pWrite(pHead(h->p1));
798  pWrite(pHead(h->p2));
799  pWrite(pHead(strat->T[ii].p));
800  PrintS("--------------------------------\n");
801  printf("INDEX OF REDUCER T: %d\n",ii);
802 #endif
803  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
804 #if SBA_PRINT_REDUCTION_STEPS
805  if (sigSafe != 3)
806  sba_reduction_steps++;
807 #endif
808 #if SBA_PRINT_OPERATIONS
809  if (sigSafe != 3)
810  sba_operations += pLength(strat->T[ii].p);
811 #endif
812  // if reduction has taken place, i.e. the reduction was sig-safe
813  // otherwise start is already at the next position and the loop
814  // searching reducers in T goes on from index start
815 //#if 1
816 #ifdef DEBUGF5
817  Print("SigSAFE: %d\n",sigSafe);
818 #endif
819  if (sigSafe != 3)
820  {
821  // start the next search for reducers in T from the beginning
822  start = 0;
823 #ifdef KDEBUG
824  if (TEST_OPT_DEBUG)
825  {
826  PrintS("\nto ");
827  h->wrp();
828  PrintLn();
829  }
830 #endif
831 
832  h_p = h->GetLmTailRing();
833  if (h_p == NULL)
834  {
835  kDeleteLcm(h);
836  return 0;
837  }
838  h->SetShortExpVector();
839  not_sev = ~ h->sev;
840  /*
841  * try to reduce the s-polynomial h
842  *test first whether h should go to the lazyset L
843  *-if the degree jumps
844  *-if the number of pre-defined reductions jumps
845  */
846  pass++;
847  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
848  {
849  h->SetLmCurrRing();
850  at = strat->posInL(strat->L,strat->Ll,h,strat);
851  if (at <= strat->Ll)
852  {
853  int dummy=strat->sl;
854  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
855  {
856  return 1;
857  }
858  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
859 #ifdef KDEBUG
860  if (TEST_OPT_DEBUG)
861  Print(" lazy: -> L%d\n",at);
862 #endif
863  h->Clear();
864  return -1;
865  }
866  }
867  }
868  }
869 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:335
int tl
Definition: kutil.h:343
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
unsigned long * sevT
Definition: kutil.h:316
void pWrite(poly p)
Definition: polys.h:302
#define TEST_OPT_LENGTH
Definition: options.h:128
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
#define loop
Definition: structs.h:78
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:304
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
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:196
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
#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:318
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
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:86
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972

◆ redSigRing()

int redSigRing ( LObject h,
kStrategy  strat 
)

Definition at line 872 of file kstd2.cc.

873 {
874  //Since reduce is really bad for SBA we use the following idea:
875  // We first check if we can build a gcd pair between h and S
876  //where the sig remains the same and replace h by this gcd poly
878  #if GCD_SBA
879  while(sbaCheckGcdPair(h,strat))
880  {
881  h->sev = pGetShortExpVector(h->p);
882  }
883  #endif
884  poly beforeredsig;
885  beforeredsig = pCopy(h->sig);
886 
887  if (strat->tl<0) return 1;
888  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
889  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
890  assume(h->FDeg == h->pFDeg());
891 //#if 1
892 #ifdef DEBUGF5
893  Print("------- IN REDSIG -------\n");
894  Print("p: ");
895  pWrite(pHead(h->p));
896  Print("p1: ");
897  pWrite(pHead(h->p1));
898  Print("p2: ");
899  pWrite(pHead(h->p2));
900  Print("---------------------------\n");
901 #endif
902  poly h_p;
903  int i,j,at,pass, ii;
904  int start=0;
905  int sigSafe;
906  unsigned long not_sev;
907  // long reddeg,d;
908 
909  pass = j = 0;
910  // d = reddeg = h->GetpFDeg();
911  h->SetShortExpVector();
912  int li;
913  h_p = h->GetLmTailRing();
914  not_sev = ~ h->sev;
915  loop
916  {
917  j = kFindDivisibleByInT(strat, h, start);
918  if (j < 0)
919  {
920  #if GCD_SBA
921  while(sbaCheckGcdPair(h,strat))
922  {
923  h->sev = pGetShortExpVector(h->p);
924  h->is_redundant = FALSE;
925  start = 0;
926  }
927  #endif
928  // over ZZ: cleanup coefficients by complete reduction with monomials
929  postReduceByMonSig(h, strat);
930  if(h->p == NULL || nIsZero(pGetCoeff(h->p))) return 2;
931  j = kFindDivisibleByInT(strat, h,start);
932  if(j < 0)
933  {
934  if(strat->tl >= 0)
935  h->i_r1 = strat->tl;
936  else
937  h->i_r1 = -1;
938  if (h->GetLmTailRing() == NULL)
939  {
940  kDeleteLcm(h);
941  h->Clear();
942  return 0;
943  }
944  //Check for sigdrop after reduction
945  if(pLtCmp(beforeredsig,h->sig) == 1)
946  {
947  strat->sigdrop = TRUE;
948  //Reduce it as much as you can
949  int red_result = redRing(h,strat);
950  if(red_result == 0)
951  {
952  //It reduced to 0, cancel the sigdrop
953  strat->sigdrop = FALSE;
954  p_Delete(&h->sig,currRing);h->sig = NULL;
955  return 0;
956  }
957  else
958  {
959  //strat->enterS(*h, strat->sl+1, strat, strat->tl);
960  return 0;
961  }
962  }
963  p_Delete(&beforeredsig,currRing);
964  return 1;
965  }
966  }
967 
968  li = strat->T[j].pLength;
969  if (li<=0) li=strat->T[j].GetpLength();
970  ii = j;
971  /*
972  * the polynomial to reduce with (up to the moment) is;
973  * pi with length li
974  */
975  i = j;
976  if (TEST_OPT_LENGTH)
977  loop
978  {
979  /*- search the shortest possible with respect to length -*/
980  i++;
981  if (i > strat->tl)
982  break;
983  if (li==1)
984  break;
985  if ((strat->T[i].pLength < li)
986  && n_DivBy(pGetCoeff(h_p),pGetCoeff(strat->T[i].p),currRing->cf)
987  && p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
988  h_p, not_sev, strat->tailRing))
989  {
990  /*
991  * the polynomial to reduce with is now;
992  */
993  li = strat->T[i].pLength;
994  if (li<=0) li=strat->T[i].GetpLength();
995  ii = i;
996  }
997  }
998 
999  start = ii+1;
1000 
1001  /*
1002  * end of search: have to reduce with pi
1003  */
1004 #ifdef KDEBUG
1005  if (TEST_OPT_DEBUG)
1006  {
1007  PrintS("red:");
1008  h->wrp();
1009  PrintS(" with ");
1010  strat->T[ii].wrp();
1011  }
1012 #endif
1013  assume(strat->fromT == FALSE);
1014 //#if 1
1015 #ifdef DEBUGF5
1016  Print("BEFORE REDUCTION WITH %d:\n",ii);
1017  Print("--------------------------------\n");
1018  pWrite(h->sig);
1019  pWrite(strat->T[ii].sig);
1020  pWrite(h->GetLmCurrRing());
1021  pWrite(pHead(h->p1));
1022  pWrite(pHead(h->p2));
1023  pWrite(pHead(strat->T[ii].p));
1024  Print("--------------------------------\n");
1025  printf("INDEX OF REDUCER T: %d\n",ii);
1026 #endif
1027  sigSafe = ksReducePolySigRing(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
1028  if(h->p == NULL && h->sig == NULL)
1029  {
1030  //Trivial case catch
1031  strat->sigdrop = FALSE;
1032  }
1033  #if 0
1034  //If the reducer has the same lt (+ or -) as the other one, reduce it via redRing
1035  //In some cases this proves to be very bad
1036  if(rField_is_Ring(currRing) && h->p != NULL && pLmCmp(h->p,strat->T[ii].p)==0)
1037  {
1038  int red_result = redRing(h,strat);
1039  if(red_result == 0)
1040  {
1041  pDelete(&h->sig);h->sig = NULL;
1042  return 0;
1043  }
1044  else
1045  {
1046  strat->sigdrop = TRUE;
1047  return 1;
1048  }
1049  }
1050  #endif
1051  if(strat->sigdrop)
1052  return 1;
1053 #if SBA_PRINT_REDUCTION_STEPS
1054  if (sigSafe != 3)
1055  sba_reduction_steps++;
1056 #endif
1057 #if SBA_PRINT_OPERATIONS
1058  if (sigSafe != 3)
1059  sba_operations += pLength(strat->T[ii].p);
1060 #endif
1061  // if reduction has taken place, i.e. the reduction was sig-safe
1062  // otherwise start is already at the next position and the loop
1063  // searching reducers in T goes on from index start
1064 //#if 1
1065 #ifdef DEBUGF5
1066  Print("SigSAFE: %d\n",sigSafe);
1067 #endif
1068  if (sigSafe != 3)
1069  {
1070  // start the next search for reducers in T from the beginning
1071  start = 0;
1072 #ifdef KDEBUG
1073  if (TEST_OPT_DEBUG)
1074  {
1075  PrintS("\nto ");
1076  h->wrp();
1077  PrintLn();
1078  }
1079 #endif
1080 
1081  h_p = h->GetLmTailRing();
1082  if (h_p == NULL)
1083  {
1084  kDeleteLcm(h);
1085  return 0;
1086  }
1087  h->SetShortExpVector();
1088  not_sev = ~ h->sev;
1089  /*
1090  * try to reduce the s-polynomial h
1091  *test first whether h should go to the lazyset L
1092  *-if the degree jumps
1093  *-if the number of pre-defined reductions jumps
1094  */
1095  pass++;
1096  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1097  {
1098  h->SetLmCurrRing();
1099  at = strat->posInL(strat->L,strat->Ll,h,strat);
1100  if (at <= strat->Ll)
1101  {
1102  int dummy=strat->sl;
1103  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1104  {
1105  return 1;
1106  }
1107  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1108 #ifdef KDEBUG
1109  if (TEST_OPT_DEBUG)
1110  Print(" lazy: -> L%d\n",at);
1111 #endif
1112  h->Clear();
1113  return -1;
1114  }
1115  }
1116  }
1117  }
1118 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
char fromT
Definition: kutil.h:373
int j
Definition: facHensel.cc:105
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:438
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
bool sigdrop
Definition: kutil.h:353
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition: kutil.cc:10899
int Ll
Definition: kutil.h:344
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:335
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
Definition: kutil.cc:1624
int tl
Definition: kutil.h:343
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
unsigned long * sevT
Definition: kutil.h:316
void pWrite(poly p)
Definition: polys.h:302
#define TEST_OPT_LENGTH
Definition: options.h:128
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1233
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
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:196
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
LSet L
Definition: kutil.h:318
#define nIsZero(n)
Definition: numbers.h:20
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:344
ring tailRing
Definition: kutil.h:336
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int sl
Definition: kutil.h:341
TSet T
Definition: kutil.h:317
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:86
int LazyPass
Definition: kutil.h:346
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:972
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:502

◆ redtail() [1/2]

poly redtail ( poly  p,
int  end_pos,
kStrategy  strat 
)

Definition at line 7391 of file kutil.cc.

7392 {
7393  LObject L(p, currRing);
7394  return redtail(&L, end_pos, strat);
7395 }
class sLObject LObject
Definition: kutil.h:54
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7321
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ redtail() [2/2]

poly redtail ( LObject L,
int  end_pos,
kStrategy  strat 
)

Definition at line 7321 of file kutil.cc.

7322 {
7323  poly h, hn;
7324  strat->redTailChange=FALSE;
7325 
7326  L->GetP();
7327  poly p = L->p;
7328  if (strat->noTailReduction || pNext(p) == NULL)
7329  return p;
7330 
7331  LObject Ln(strat->tailRing);
7332  TObject* With;
7333  // placeholder in case strat->tl < 0
7334  TObject With_s(strat->tailRing);
7335  h = p;
7336  hn = pNext(h);
7337  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7338  long e;
7339  int l;
7340  BOOLEAN save_HE=strat->kHEdgeFound;
7341  strat->kHEdgeFound |=
7342  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7343 
7344  while(hn != NULL)
7345  {
7346  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7347  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7348  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7349  loop
7350  {
7351  Ln.Set(hn, strat->tailRing);
7352  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7353  if (strat->kHEdgeFound)
7354  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7355  else
7356  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s, e);
7357  if (With == NULL) break;
7358  With->length=0;
7359  With->pLength=0;
7360  strat->redTailChange=TRUE;
7361  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7362  {
7363  // reducing the tail would violate the exp bound
7364  if (kStratChangeTailRing(strat, L))
7365  {
7366  strat->kHEdgeFound = save_HE;
7367  return redtail(L, end_pos, strat);
7368  }
7369  else
7370  return NULL;
7371  }
7372  hn = pNext(h);
7373  if (hn == NULL) goto all_done;
7374  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7375  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7376  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7377  }
7378  h = hn;
7379  hn = pNext(h);
7380  }
7381 
7382  all_done:
7383  if (strat->redTailChange)
7384  {
7385  L->pLength = 0;
7386  }
7387  strat->kHEdgeFound = save_HE;
7388  return p;
7389 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:116
char kHEdgeFound
Definition: kutil.h:370
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:78
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7321
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
int Kstd1_deg
Definition: kutil.cc:236
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4679
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
int BOOLEAN
Definition: auxiliary.h:85
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:393
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7179
int l
Definition: cfEzgcd.cc:93
class sTObject TObject
Definition: kutil.h:53

◆ redtailBba() [1/3]

KINLINE poly redtailBba ( poly  p,
int  end_pos,
kStrategy  strat,
BOOLEAN  normalize = FALSE 
)

Definition at line 1087 of file kInline.h.

1088 {
1089  LObject L(p);
1090  return redtailBba(&L, pos, strat,FALSE, normalize);
1091 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
int p
Definition: cfModGcd.cc:4019

◆ redtailBba() [2/3]

poly redtailBba ( LObject L,
int  end_pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 7397 of file kutil.cc.

7398 {
7399 #define REDTAIL_CANONICALIZE 100
7400  strat->redTailChange=FALSE;
7401  if (strat->noTailReduction) return L->GetLmCurrRing();
7402  poly h, p;
7403  p = h = L->GetLmTailRing();
7404  if ((h==NULL) || (pNext(h)==NULL))
7405  return L->GetLmCurrRing();
7406 
7407  TObject* With;
7408  // placeholder in case strat->tl < 0
7409  TObject With_s(strat->tailRing);
7410 
7411  LObject Ln(pNext(h), strat->tailRing);
7412  Ln.GetpLength();
7413 
7414  pNext(h) = NULL;
7415  if (L->p != NULL)
7416  {
7417  pNext(L->p) = NULL;
7418  if (L->t_p != NULL) pNext(L->t_p) = NULL;
7419  }
7420  L->pLength = 1;
7421 
7422  Ln.PrepareRed(strat->use_buckets);
7423 
7424  int cnt=REDTAIL_CANONICALIZE;
7425  while(!Ln.IsNull())
7426  {
7427  loop
7428  {
7429  if (TEST_OPT_IDLIFT)
7430  {
7431  if (Ln.p!=NULL)
7432  {
7433  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7434  }
7435  else
7436  {
7437  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7438  }
7439  }
7440  Ln.SetShortExpVector();
7441  if (withT)
7442  {
7443  int j;
7444  j = kFindDivisibleByInT(strat, &Ln);
7445  if (j < 0) break;
7446  With = &(strat->T[j]);
7447  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7448  }
7449  else
7450  {
7451  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7452  if (With == NULL) break;
7453  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7454  }
7455  cnt--;
7456  if (cnt==0)
7457  {
7459  /*poly tmp=*/Ln.CanonicalizeP();
7460  if (normalize)
7461  {
7462  Ln.Normalize();
7463  //pNormalize(tmp);
7464  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7465  }
7466  }
7467  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7468  {
7469  With->pNorm();
7470  }
7471  strat->redTailChange=TRUE;
7472  if (ksReducePolyTail(L, With, &Ln))
7473  {
7474  // reducing the tail would violate the exp bound
7475  // set a flag and hope for a retry (in bba)
7476  strat->completeReduce_retry=TRUE;
7477  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7478  do
7479  {
7480  pNext(h) = Ln.LmExtractAndIter();
7481  pIter(h);
7482  L->pLength++;
7483  } while (!Ln.IsNull());
7484  goto all_done;
7485  }
7486  if (Ln.IsNull()) goto all_done;
7487  if (! withT) With_s.Init(currRing);
7488  }
7489  pNext(h) = Ln.LmExtractAndIter();
7490  pIter(h);
7491  pNormalize(h);
7492  L->pLength++;
7493  }
7494 
7495  all_done:
7496  Ln.Delete();
7497  if (L->p != NULL) pNext(L->p) = pNext(p);
7498 
7499  if (strat->redTailChange)
7500  {
7501  L->length = 0;
7502  L->pLength = 0;
7503  }
7504 
7505  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7506  //L->Normalize(); // HANNES: should have a test
7507  kTest_L(L);
7508  return L->GetLmCurrRing();
7509 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
int syzComp
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
char use_buckets
Definition: kutil.h:377
char completeReduce_retry
Definition: kutil.h:397
#define pIter(p)
Definition: monomials.h:38
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T)
Definition: kutil.h:647
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:336
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
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:86
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
char redTailChange
Definition: kutil.h:393
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7179
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:311

◆ redtailBba() [3/3]

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

◆ redtailBba_Z() [1/2]

KINLINE poly redtailBba_Z ( poly  p,
int  end_pos,
kStrategy  strat 
)

Definition at line 1100 of file kInline.h.

1101 {
1102  LObject L(p, currRing, strat->tailRing);
1103  return redtailBba_Z(&L, pos, strat);
1104 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1100
class sLObject LObject
Definition: kutil.h:54
ring tailRing
Definition: kutil.h:336
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ redtailBba_Z() [2/2]

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

Definition at line 7627 of file kutil.cc.

7629 {
7630  strat->redTailChange=FALSE;
7631  if (strat->noTailReduction) return L->GetLmCurrRing();
7632  poly h, p;
7633  p = h = L->GetLmTailRing();
7634  if ((h==NULL) || (pNext(h)==NULL))
7635  return L->GetLmCurrRing();
7636 
7637  TObject* With;
7638  // placeholder in case strat->tl < 0
7639  TObject With_s(strat->tailRing);
7640 
7641  LObject Ln(pNext(h), strat->tailRing);
7642  Ln.pLength = L->GetpLength() - 1;
7643 
7644  pNext(h) = NULL;
7645  if (L->p != NULL) pNext(L->p) = NULL;
7646  L->pLength = 1;
7647 
7648  Ln.PrepareRed(strat->use_buckets);
7649 
7650  int cnt=REDTAIL_CANONICALIZE;
7651  while(!Ln.IsNull())
7652  {
7653  loop
7654  {
7655  Ln.SetShortExpVector();
7656  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7657  if (With == NULL) break;
7658  cnt--;
7659  if (cnt==0)
7660  {
7662  /*poly tmp=*/Ln.CanonicalizeP();
7663  }
7664  // we are in Z, do not call pNorm
7665  strat->redTailChange=TRUE;
7666  // test divisibility of coefs:
7667  poly p_Ln=Ln.GetLmCurrRing();
7668  poly p_With=With->GetLmCurrRing();
7669  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7670  if (!nIsZero(z))
7671  {
7672  // subtract z*Ln, add z.Ln to L
7673  poly m=pHead(p_Ln);
7674  pSetCoeff(m,z);
7675  poly mm=pHead(m);
7676  pNext(h) = m;
7677  pIter(h);
7678  L->pLength++;
7679  mm=pNeg(mm);
7680  if (Ln.bucket!=NULL)
7681  {
7682  int dummy=1;
7683  kBucket_Add_q(Ln.bucket,mm,&dummy);
7684  }
7685  else
7686  {
7687  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7688  Ln.GetP();
7689  if (Ln.p!=NULL)
7690  {
7691  Ln.p=pAdd(Ln.p,mm);
7692  if (Ln.t_p!=NULL)
7693  {
7694  pNext(Ln.t_p)=NULL;
7695  p_LmDelete(Ln.t_p,strat->tailRing);
7696  }
7697  }
7698  }
7699  }
7700  else
7701  nDelete(&z);
7702 
7703  if (ksReducePolyTail(L, With, &Ln))
7704  {
7705  // reducing the tail would violate the exp bound
7706  // set a flag and hope for a retry (in bba)
7707  strat->completeReduce_retry=TRUE;
7708  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7709  do
7710  {
7711  pNext(h) = Ln.LmExtractAndIter();
7712  pIter(h);
7713  L->pLength++;
7714  } while (!Ln.IsNull());
7715  goto all_done;
7716  }
7717  if (Ln.IsNull()) goto all_done;
7718  With_s.Init(currRing);
7719  }
7720  pNext(h) = Ln.LmExtractAndIter();
7721  pIter(h);
7722  pNormalize(h);
7723  L->pLength++;
7724  }
7725 
7726  all_done:
7727  Ln.Delete();
7728  if (L->p != NULL) pNext(L->p) = pNext(p);
7729 
7730  if (strat->redTailChange)
7731  {
7732  L->length = 0;
7733  }
7734 
7735  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7736  //L->Normalize(); // HANNES: should have a test
7737  kTest_L(L);
7738  return L->GetLmCurrRing();
7739 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628
#define pAdd(p, q)
Definition: polys.h:198
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
#define pNeg(p)
Definition: polys.h:193
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
char use_buckets
Definition: kutil.h:377
char completeReduce_retry
Definition: kutil.h:397
#define pIter(p)
Definition: monomials.h:38
#define kTest_L(T)
Definition: kutil.h:647
int m
Definition: cfEzgcd.cc:121
#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:17
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:393
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7179
class sTObject TObject
Definition: kutil.h:53
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:651
#define pNormalize(p)
Definition: polys.h:311

◆ redtailBbaBound() [1/2]

KINLINE poly redtailBbaBound ( poly  p,
int  end_pos,
kStrategy  strat,
int  bound,
BOOLEAN  normalize = FALSE 
)

Definition at line 1093 of file kInline.h.

1094 {
1095  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1096  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1097 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1093
ring tailRing
Definition: kutil.h:336
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ redtailBbaBound() [2/2]

poly redtailBbaBound ( LObject L,
int  end_pos,
kStrategy  strat,
int  bound,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 7511 of file kutil.cc.

7512 {
7513  strat->redTailChange=FALSE;
7514  if (strat->noTailReduction) return L->GetLmCurrRing();
7515  poly h, p;
7516  p = h = L->GetLmTailRing();
7517  if ((h==NULL) || (pNext(h)==NULL))
7518  return L->GetLmCurrRing();
7519 
7520  TObject* With;
7521  // placeholder in case strat->tl < 0
7522  TObject With_s(strat->tailRing);
7523 
7524  LObject Ln(pNext(h), strat->tailRing);
7525  Ln.pLength = L->GetpLength() - 1;
7526 
7527  pNext(h) = NULL;
7528  if (L->p != NULL) pNext(L->p) = NULL;
7529  L->pLength = 1;
7530 
7531  Ln.PrepareRed(strat->use_buckets);
7532 
7533  int cnt=REDTAIL_CANONICALIZE;
7534  while(!Ln.IsNull())
7535  {
7536  loop
7537  {
7538  if (TEST_OPT_IDLIFT)
7539  {
7540  if (Ln.p!=NULL)
7541  {
7542  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7543  }
7544  else
7545  {
7546  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7547  }
7548  }
7549  Ln.SetShortExpVector();
7550  if (withT)
7551  {
7552  int j;
7553  j = kFindDivisibleByInT(strat, &Ln);
7554  if (j < 0) break;
7555  With = &(strat->T[j]);
7556  }
7557  else
7558  {
7559  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7560  if (With == NULL) break;
7561  }
7562  cnt--;
7563  if (cnt==0)
7564  {
7566  /*poly tmp=*/Ln.CanonicalizeP();
7567  if (normalize)
7568  {
7569  Ln.Normalize();
7570  //pNormalize(tmp);
7571  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7572  }
7573  }
7574  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7575  {
7576  With->pNorm();
7577  }
7578  strat->redTailChange=TRUE;
7579  if (ksReducePolyTail(L, With, &Ln))
7580  {
7581  // reducing the tail would violate the exp bound
7582  // set a flag and hope for a retry (in bba)
7583  strat->completeReduce_retry=TRUE;
7584  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7585  do
7586  {
7587  pNext(h) = Ln.LmExtractAndIter();
7588  pIter(h);
7589  L->pLength++;
7590  } while (!Ln.IsNull());
7591  goto all_done;
7592  }
7593  if(!Ln.IsNull())
7594  {
7595  Ln.GetP();
7596  Ln.p = pJet(Ln.p,bound);
7597  }
7598  if (Ln.IsNull())
7599  {
7600  goto all_done;
7601  }
7602  if (! withT) With_s.Init(currRing);
7603  }
7604  pNext(h) = Ln.LmExtractAndIter();
7605  pIter(h);
7606  pNormalize(h);
7607  L->pLength++;
7608  }
7609 
7610  all_done:
7611  Ln.Delete();
7612  if (L->p != NULL) pNext(L->p) = pNext(p);
7613 
7614  if (strat->redTailChange)
7615  {
7616  L->length = 0;
7617  L->pLength = 0;
7618  }
7619 
7620  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7621  //L->Normalize(); // HANNES: should have a test
7622  kTest_L(L);
7623  return L->GetLmCurrRing();
7624 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
char use_buckets
Definition: kutil.h:377
char completeReduce_retry
Definition: kutil.h:397
#define pIter(p)
Definition: monomials.h:38
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T)
Definition: kutil.h:647
#define pJet(p, m)
Definition: polys.h:362
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:336
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
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:86
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
char redTailChange
Definition: kutil.h:393
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7179
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:311

◆ redtailBbaShift()

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

Definition at line 12570 of file kutil.cc.

12571 {
12572  /* for the shift case need to run it with withT = TRUE */
12573  strat->redTailChange=FALSE;
12574  if (strat->noTailReduction) return L->GetLmCurrRing();
12575  poly h, p;
12576  p = h = L->GetLmTailRing();
12577  if ((h==NULL) || (pNext(h)==NULL))
12578  return L->GetLmCurrRing();
12579 
12580  TObject* With;
12581  // placeholder in case strat->tl < 0
12582  TObject With_s(strat->tailRing);
12583 
12584  LObject Ln(pNext(h), strat->tailRing);
12585  Ln.pLength = L->GetpLength() - 1;
12586 
12587  pNext(h) = NULL;
12588  if (L->p != NULL) pNext(L->p) = NULL;
12589  L->pLength = 1;
12590 
12591  Ln.PrepareRed(strat->use_buckets);
12592 
12593  while(!Ln.IsNull())
12594  {
12595  loop
12596  {
12597  Ln.SetShortExpVector();
12598  if (withT)
12599  {
12600  int j;
12601  j = kFindDivisibleByInT(strat, &Ln);
12602  if (j < 0) break;
12603  With = &(strat->T[j]);
12604  }
12605  else
12606  {
12607  With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
12608  if (With == NULL) break;
12609  }
12610  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12611  {
12612  With->pNorm();
12613  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12614  }
12615  strat->redTailChange=TRUE;
12616  if (ksReducePolyTail(L, With, &Ln))
12617  {
12618  // reducing the tail would violate the exp bound
12619  // set a flag and hope for a retry (in bba)
12620  strat->completeReduce_retry=TRUE;
12621  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12622  do
12623  {
12624  pNext(h) = Ln.LmExtractAndIter();
12625  pIter(h);
12626  L->pLength++;
12627  } while (!Ln.IsNull());
12628  goto all_done;
12629  }
12630  if (Ln.IsNull()) goto all_done;
12631  if (! withT) With_s.Init(currRing);
12632  }
12633  pNext(h) = Ln.LmExtractAndIter();
12634  pIter(h);
12635  L->pLength++;
12636  }
12637 
12638  all_done:
12639  Ln.Delete();
12640  if (L->p != NULL) pNext(L->p) = pNext(p);
12641 
12642  if (strat->redTailChange)
12643  {
12644  L->length = 0;
12645  }
12646  L->Normalize(); // HANNES: should have a test
12647  kTest_L(L);
12648  return L->GetLmCurrRing();
12649 }
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
char use_buckets
Definition: kutil.h:377
char completeReduce_retry
Definition: kutil.h:397
#define pIter(p)
Definition: monomials.h:38
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T)
Definition: kutil.h:647
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
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:86
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
char redTailChange
Definition: kutil.h:393
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7179
class sTObject TObject
Definition: kutil.h:53

◆ redtailSba()

poly redtailSba ( LObject L,
int  end_pos,
kStrategy  strat,
BOOLEAN  withT = FALSE,
BOOLEAN  normalize = FALSE 
)

Definition at line 1121 of file kstd2.cc.

1122 {
1123 #define REDTAIL_CANONICALIZE 100
1124  strat->redTailChange=FALSE;
1125  if (strat->noTailReduction) return L->GetLmCurrRing();
1126  poly h, p;
1127  p = h = L->GetLmTailRing();
1128  if ((h==NULL) || (pNext(h)==NULL))
1129  return L->GetLmCurrRing();
1130 
1131  TObject* With;
1132  // placeholder in case strat->tl < 0
1133  TObject With_s(strat->tailRing);
1134 
1135  LObject Ln(pNext(h), strat->tailRing);
1136  Ln.sig = L->sig;
1137  Ln.sevSig = L->sevSig;
1138  Ln.pLength = L->GetpLength() - 1;
1139 
1140  pNext(h) = NULL;
1141  if (L->p != NULL) pNext(L->p) = NULL;
1142  L->pLength = 1;
1143 
1144  Ln.PrepareRed(strat->use_buckets);
1145 
1146  int cnt=REDTAIL_CANONICALIZE;
1147  while(!Ln.IsNull())
1148  {
1149  loop
1150  {
1151  if(rField_is_Ring(currRing) && strat->sigdrop)
1152  break;
1153  Ln.SetShortExpVector();
1154  if (withT)
1155  {
1156  int j;
1157  j = kFindDivisibleByInT(strat, &Ln);
1158  if (j < 0) break;
1159  With = &(strat->T[j]);
1160  }
1161  else
1162  {
1163  With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
1164  if (With == NULL) break;
1165  }
1166  cnt--;
1167  if (cnt==0)
1168  {
1170  /*poly tmp=*/Ln.CanonicalizeP();
1172  {
1173  Ln.Normalize();
1174  //pNormalize(tmp);
1175  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1176  }
1177  }
1178  if (normalize && (!TEST_OPT_INTSTRATEGY) && !rField_is_Ring(currRing) && (!nIsOne(pGetCoeff(With->p))))
1179  {
1180  With->pNorm();
1181  }
1182  strat->redTailChange=TRUE;
1183  int ret = ksReducePolyTailSig(L, With, &Ln, strat);
1185  L->sig = Ln.sig;
1186  //Because Ln.sig is set to L->sig, but in ksReducePolyTailSig -> ksReducePolySig
1187  // I delete it an then set Ln.sig. Hence L->sig is lost
1188 #if SBA_PRINT_REDUCTION_STEPS
1189  if (ret != 3)
1190  sba_reduction_steps++;
1191 #endif
1192 #if SBA_PRINT_OPERATIONS
1193  if (ret != 3)
1194  sba_operations += pLength(With->p);
1195 #endif
1196  if (ret)
1197  {
1198  // reducing the tail would violate the exp bound
1199  // set a flag and hope for a retry (in bba)
1200  strat->completeReduce_retry=TRUE;
1201  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
1202  do
1203  {
1204  pNext(h) = Ln.LmExtractAndIter();
1205  pIter(h);
1206  L->pLength++;
1207  } while (!Ln.IsNull());
1208  goto all_done;
1209  }
1210  if (Ln.IsNull()) goto all_done;
1211  if (! withT) With_s.Init(currRing);
1212  if(rField_is_Ring(currRing) && strat->sigdrop)
1213  {
1214  //Cannot break the loop here so easily
1215  break;
1216  }
1217  }
1218  pNext(h) = Ln.LmExtractAndIter();
1219  pIter(h);
1220  if(!rField_is_Ring(currRing))
1221  pNormalize(h);
1222  L->pLength++;
1223  }
1224  all_done:
1225  Ln.Delete();
1226  if (L->p != NULL) pNext(L->p) = pNext(p);
1227 
1228  if (strat->redTailChange)
1229  {
1230  L->length = 0;
1231  }
1232  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
1233  //L->Normalize(); // HANNES: should have a test
1234  kTest_L(L);
1235  return L->GetLmCurrRing();
1236 }
int j
Definition: facHensel.cc:105
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:353
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:372
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define loop
Definition: structs.h:78
char use_buckets
Definition: kutil.h:377
char completeReduce_retry
Definition: kutil.h:397
#define pIter(p)
Definition: monomials.h:38
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T)
Definition: kutil.h:647
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define REDTAIL_CANONICALIZE
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TSet T
Definition: kutil.h:317
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:86
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
Definition: kstd2.cc:667
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:972
char redTailChange
Definition: kutil.h:393
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7179
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:311

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 4898 of file kutil.cc.

4899 {
4900  int i,j,at,ecart, s2r;
4901  int fq=0;
4902  unsigned long sev;
4903  poly p;
4904  int new_suc=strat->sl+1;
4905  i= *suc;
4906  if (i<0) i=0;
4907 
4908  for (; i<=strat->sl; i++)
4909  {
4910  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4911  if (at != i)
4912  {
4913  if (new_suc > at) new_suc = at;
4914  p = strat->S[i];
4915  ecart = strat->ecartS[i];
4916  sev = strat->sevS[i];
4917  s2r = strat->S_2_R[i];
4918  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
4919  for (j=i; j>=at+1; j--)
4920  {
4921  strat->S[j] = strat->S[j-1];
4922  strat->ecartS[j] = strat->ecartS[j-1];
4923  strat->sevS[j] = strat->sevS[j-1];
4924  strat->S_2_R[j] = strat->S_2_R[j-1];
4925  }
4926  strat->S[at] = p;
4927  strat->ecartS[at] = ecart;
4928  strat->sevS[at] = sev;
4929  strat->S_2_R[at] = s2r;
4930  if (strat->fromQ!=NULL)
4931  {
4932  for (j=i; j>=at+1; j--)
4933  {
4934  strat->fromQ[j] = strat->fromQ[j-1];
4935  }
4936  strat->fromQ[at]=fq;
4937  }
4938  }
4939  }
4940  if (new_suc <= strat->sl) *suc=new_suc;
4941  else *suc=-1;
4942 }
int j
Definition: facHensel.cc:105
int * S_2_R
Definition: kutil.h:335
intset fromQ
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
intset ecartS
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
unsigned long * sevS
Definition: kutil.h:313
int sl
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019

◆ sba()

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

Definition at line 2251 of file kstd2.cc.

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

◆ sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair ( LObject h,
kStrategy  strat 
)

Definition at line 1624 of file kutil.cc.

1625 {
1626  if(strat->sl < 0) return FALSE;
1627  int i;
1628  for(i=0;i<strat->sl;i++)
1629  {
1630  //Construct the gcd pair between h and S[i]
1631  number d, s, t;
1632  poly m1, m2, gcd;
1633  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1634  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1635  {
1636  nDelete(&d);
1637  nDelete(&s);
1638  nDelete(&t);
1639  }
1640  else
1641  {
1642  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1643  pSetCoeff0(m1, s);
1644  pSetCoeff0(m2, t);
1645  pSetCoeff0(gcd, d);
1646  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(h->p), m1, strat->tailRing), pp_Mult_mm(pNext(strat->S[i]), m2, strat->tailRing), strat->tailRing);
1647  poly pSigMult = p_Copy(h->sig,currRing);
1648  poly sSigMult = p_Copy(strat->sig[i],currRing);
1649  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1650  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1651  p_LmDelete(m1, strat->tailRing);
1652  p_LmDelete(m2, strat->tailRing);
1653  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1654  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1655  {
1656  pDelete(&h->p);
1657  h->p = gcd;
1658  pDelete(&h->sig);
1659  h->sig = pairsig;
1660  pNext(h->sig) = NULL;
1661  strat->initEcart(h);
1662  h->sev = pGetShortExpVector(h->p);
1663  h->sevSig = pGetShortExpVector(h->sig);
1664  h->i_r1 = -1;h->i_r2 = -1;
1665  if(h->lcm != NULL)
1666  {
1667  pLmDelete(h->lcm);
1668  h->lcm = NULL;
1669  }
1670  if (currRing!=strat->tailRing)
1671  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1672  return TRUE;
1673  }
1674  //Delete what you didn't use
1675  pDelete(&gcd);
1676  pDelete(&pairsig);
1677  }
1678  }
1679  return FALSE;
1680 }
polyset sig
Definition: kutil.h:299
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:998
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:988
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
void(* initEcart)(TObject *L)
Definition: kutil.h:271
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
#define nDelete(n)
Definition: numbers.h:17
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:693
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
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:974
int sl
Definition: kutil.h:341
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
static Poly * h
Definition: janet.cc:972

◆ sbaRing()

ring sbaRing ( kStrategy  strat,
const ring  r = currRing,
BOOLEAN  complete = TRUE,
int  sgn = 1 
)

Definition at line 11199 of file kutil.cc.

11200 {
11201  int n = rBlocks(r); // Including trailing zero!
11202  // if sbaOrder == 1 => use (C,monomial order from r)
11203  if (strat->sbaOrder == 1)
11204  {
11205  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11206  {
11207  return r;
11208  }
11209  ring res = rCopy0(r, TRUE, FALSE);
11210  res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
11211  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11212  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11213  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11214  res->wvhdl = wvhdl;
11215  for (int i=1; i<n; i++)
11216  {
11217  res->order[i] = r->order[i-1];
11218  res->block0[i] = r->block0[i-1];
11219  res->block1[i] = r->block1[i-1];
11220  res->wvhdl[i] = r->wvhdl[i-1];
11221  }
11222 
11223  // new 1st block
11224  res->order[0] = ringorder_C; // Prefix
11225  // removes useless secondary component order if defined in old ring
11226  for (int i=rBlocks(res); i>0; --i)
11227  {
11228  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11229  {
11230  res->order[i] = (rRingOrder_t)0;
11231  }
11232  }
11233  rComplete(res, 1);
11234 #ifdef HAVE_PLURAL
11235  if (rIsPluralRing(r))
11236  {
11237  if ( nc_rComplete(r, res, false) ) // no qideal!
11238  {
11239 #ifndef SING_NDEBUG
11240  WarnS("error in nc_rComplete");
11241 #endif
11242  // cleanup?
11243 
11244  // rDelete(res);
11245  // return r;
11246 
11247  // just go on..
11248  }
11249  }
11250 #endif
11251  strat->tailRing = res;
11252  return (res);
11253  }
11254  // if sbaOrder == 3 => degree - position - ring order
11255  if (strat->sbaOrder == 3)
11256  {
11257  ring res = rCopy0(r, TRUE, FALSE);
11258  res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
11259  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11260  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11261  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11262  res->wvhdl = wvhdl;
11263  for (int i=2; i<n+2; i++)
11264  {
11265  res->order[i] = r->order[i-2];
11266  res->block0[i] = r->block0[i-2];
11267  res->block1[i] = r->block1[i-2];
11268  res->wvhdl[i] = r->wvhdl[i-2];
11269  }
11270 
11271  // new 1st block
11272  res->order[0] = ringorder_a; // Prefix
11273  res->block0[0] = 1;
11274  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11275  for (int i=0; i<res->N; ++i)
11276  res->wvhdl[0][i] = 1;
11277  res->block1[0] = si_min(res->N, rVar(res));
11278  // new 2nd block
11279  res->order[1] = ringorder_C; // Prefix
11280  res->wvhdl[1] = NULL;
11281  // removes useless secondary component order if defined in old ring
11282  for (int i=rBlocks(res); i>1; --i)
11283  {
11284  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11285  {
11286  res->order[i] = (rRingOrder_t)0;
11287  }
11288  }
11289  rComplete(res, 1);
11290 #ifdef HAVE_PLURAL
11291  if (rIsPluralRing(r))
11292  {
11293  if ( nc_rComplete(r, res, false) ) // no qideal!
11294  {
11295 #ifndef SING_NDEBUG
11296  WarnS("error in nc_rComplete");
11297 #endif
11298  // cleanup?
11299 
11300  // rDelete(res);
11301  // return r;
11302 
11303  // just go on..
11304  }
11305  }
11306 #endif
11307  strat->tailRing = res;
11308  return (res);
11309  }
11310 
11311  // not sbaOrder == 1 => use Schreyer order
11312  // this is done by a trick when initializing the signatures
11313  // in initSLSba():
11314  // Instead of using the signature 1e_i for F->m[i], we start
11315  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11316  // Schreyer order w.r.t. the underlying monomial order.
11317  // => we do not need to change the underlying polynomial ring at all!
11318 
11319  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11320 
11321  /*
11322  else
11323  {
11324  ring res = rCopy0(r, FALSE, FALSE);
11325  // Create 2 more blocks for prefix/suffix:
11326  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11327  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11328  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11329  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11330 
11331  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11332  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11333 
11334  // new 1st block
11335  int j = 0;
11336  res->order[j] = ringorder_IS; // Prefix
11337  res->block0[j] = res->block1[j] = 0;
11338  // wvhdl[j] = NULL;
11339  j++;
11340 
11341  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11342  {
11343  res->order [j] = r->order [i];
11344  res->block0[j] = r->block0[i];
11345  res->block1[j] = r->block1[i];
11346 
11347  if (r->wvhdl[i] != NULL)
11348  {
11349  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11350  } // else wvhdl[j] = NULL;
11351  }
11352 
11353  // new last block
11354  res->order [j] = ringorder_IS; // Suffix
11355  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11356  // wvhdl[j] = NULL;
11357  j++;
11358 
11359  // res->order [j] = 0; // The End!
11360  res->wvhdl = wvhdl;
11361 
11362  // j == the last zero block now!
11363  assume(j == (n+1));
11364  assume(res->order[0]==ringorder_IS);
11365  assume(res->order[j-1]==ringorder_IS);
11366  assume(res->order[j]==0);
11367 
11368  if (complete)
11369  {
11370  rComplete(res, 1);
11371 
11372 #ifdef HAVE_PLURAL
11373  if (rIsPluralRing(r))
11374  {
11375  if ( nc_rComplete(r, res, false) ) // no qideal!
11376  {
11377  }
11378  }
11379  assume(rIsPluralRing(r) == rIsPluralRing(res));
11380 #endif
11381 
11382 
11383 #ifdef HAVE_PLURAL
11384  ring old_ring = r;
11385 
11386 #endif
11387 
11388  if (r->qideal!=NULL)
11389  {
11390  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11391 
11392  assume(idRankFreeModule(res->qideal, res) == 0);
11393 
11394 #ifdef HAVE_PLURAL
11395  if( rIsPluralRing(res) )
11396  if( nc_SetupQuotient(res, r, true) )
11397  {
11398  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11399  }
11400 
11401 #endif
11402  assume(idRankFreeModule(res->qideal, res) == 0);
11403  }
11404 
11405 #ifdef HAVE_PLURAL
11406  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11407  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11408  assume(rIsSCA(res) == rIsSCA(old_ring));
11409  assume(ncRingType(res) == ncRingType(old_ring));
11410 #endif
11411  }
11412  strat->tailRing = res;
11413  return res;
11414  }
11415  */
11416 
11417  assume(FALSE);
11418  return(NULL);
11419 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
#define FALSE
Definition: auxiliary.h:94
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5538
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
#define TRUE
Definition: auxiliary.h:98
#define WarnS
Definition: emacs.cc:78
#define omAlloc(size)
Definition: omAllocDecl.h:210
static int rBlocks(ring r)
Definition: ring.h:558
CanonicalForm res
Definition: facAbsFact.cc:64
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:3369
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1340
rRingOrder_t
order stuff
Definition: ring.h:68
unsigned sbaOrder
Definition: kutil.h:307
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:336
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ superenterpairs()

void superenterpairs ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4747 of file kutil.cc.

4748 {
4750  // enter also zero divisor * poly, if this is non zero and of smaller degree
4751  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4752  initenterpairs(h, k, ecart, 0, strat, atR);
4753  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4754  clearSbatch(h, k, pos, strat);
4755 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4721
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3717
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4471
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:478
int k
Definition: cfEzgcd.cc:92
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4520
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static Poly * h
Definition: janet.cc:972

◆ superenterpairsSig()

void superenterpairsSig ( poly  h,
poly  hSig,
int  hFrom,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4757 of file kutil.cc.

4758 {
4760  // enter also zero divisor * poly, if this is non zero and of smaller degree
4761  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4762  if(strat->sigdrop) return;
4763  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4764  if(strat->sigdrop) return;
4765  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4766  if(strat->sigdrop) return;
4767  clearSbatch(h, k, pos, strat);
4768 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4721
bool sigdrop
Definition: kutil.h:353
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3842
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:478
int k
Definition: cfEzgcd.cc:92
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition: kutil.cc:4603
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4493
static Poly * h
Definition: janet.cc:972

◆ syzCriterion()

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

Definition at line 6961 of file kutil.cc.

6962 {
6963 //#if 1
6964 #ifdef DEBUGF5
6965  PrintS("syzygy criterion checks: ");
6966  pWrite(sig);
6967 #endif
6968  for (int k=0; k<strat->syzl; k++)
6969  {
6970  //printf("-%d",k);
6971 //#if 1
6972 #ifdef DEBUGF5
6973  Print("checking with: %d / %d -- \n",k,strat->syzl);
6974  pWrite(pHead(strat->syz[k]));
6975 #endif
6976  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
6977  && (!rField_is_Ring(currRing) ||
6978  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
6979  {
6980 //#if 1
6981 #ifdef DEBUGF5
6982  PrintS("DELETE!\n");
6983 #endif
6984  strat->nrsyzcrit++;
6985  //printf("- T -\n\n");
6986  return TRUE;
6987  }
6988  }
6989  //printf("- F -\n\n");
6990  return FALSE;
6991 }
#define Print
Definition: emacs.cc:80
#define FALSE
Definition: auxiliary.h:94
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:302
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int nrsyzcrit
Definition: kutil.h:354
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:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
unsigned long * sevSyz
Definition: kutil.h:314
polyset syz
Definition: kutil.h:298
int syzl
Definition: kutil.h:342

◆ syzCriterionInc()

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

Definition at line 6996 of file kutil.cc.

6997 {
6998 //#if 1
6999  if(sig == NULL)
7000  return FALSE;
7001 #ifdef DEBUGF5
7002  PrintS("--- syzygy criterion checks: ");
7003  pWrite(sig);
7004 #endif
7005  int comp = __p_GetComp(sig, currRing);
7006  int min, max;
7007  if (comp<=1)
7008  return FALSE;
7009  else
7010  {
7011  min = strat->syzIdx[comp-2];
7012  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7013  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7014  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7015  if (comp == strat->currIdx)
7016  {
7017  max = strat->syzl;
7018  }
7019  else
7020  {
7021  max = strat->syzIdx[comp-1];
7022  }
7023  for (int k=min; k<max; k++)
7024  {
7025 #ifdef F5DEBUG
7026  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7027  Print("checking with: %d -- ",k);
7028  pWrite(pHead(strat->syz[k]));
7029 #endif
7030  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7031  && (!rField_is_Ring(currRing) ||
7032  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7033  {
7034  strat->nrsyzcrit++;
7035  return TRUE;
7036  }
7037  }
7038  return FALSE;
7039  }
7040 }
#define __p_GetComp(p, r)
Definition: monomials.h:64
#define Print
Definition: emacs.cc:80
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:94
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:302
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
int currIdx
Definition: kutil.h:308
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
int nrsyzcrit
Definition: kutil.h:354
static int max(int a, int b)
Definition: fast_mult.cc:264
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1855
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
unsigned long * sevSyz
Definition: kutil.h:314
polyset syz
Definition: kutil.h:298
int syzl
Definition: kutil.h:342
intset syzIdx
Definition: kutil.h:304

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4087 of file kutil.cc.

4088 {
4089  return 1L << arg;
4090 }

◆ updateResult()

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

Definition at line 10203 of file kutil.cc.

10204 {
10205  int l;
10206  if (strat->ak>0)
10207  {
10208  for (l=IDELEMS(r)-1;l>=0;l--)
10209  {
10210  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10211  {
10212  pDelete(&r->m[l]); // and set it to NULL
10213  }
10214  }
10215  int q;
10216  poly p;
10217  if(!rField_is_Ring(currRing))
10218  {
10219  for (l=IDELEMS(r)-1;l>=0;l--)
10220  {
10221  if ((r->m[l]!=NULL)
10222  //&& (strat->syzComp>0)
10223  //&& (pGetComp(r->m[l])<=strat->syzComp)
10224  )
10225  {
10226  for(q=IDELEMS(Q)-1; q>=0;q--)
10227  {
10228  if ((Q->m[q]!=NULL)
10229  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10230  {
10231  if (TEST_OPT_REDSB)
10232  {
10233  p=r->m[l];
10234  r->m[l]=kNF(Q,NULL,p);
10235  pDelete(&p);
10236  }
10237  else
10238  {
10239  pDelete(&r->m[l]); // and set it to NULL
10240  }
10241  break;
10242  }
10243  }
10244  }
10245  }
10246  }
10247  #ifdef HAVE_RINGS
10248  else
10249  {
10250  for (l=IDELEMS(r)-1;l>=0;l--)
10251  {
10252  if ((r->m[l]!=NULL)
10253  //&& (strat->syzComp>0)
10254  //&& (pGetComp(r->m[l])<=strat->syzComp)
10255  )
10256  {
10257  for(q=IDELEMS(Q)-1; q>=0;q--)
10258  {
10259  if ((Q->m[q]!=NULL)
10260  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10261  {
10262  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10263  {
10264  if (TEST_OPT_REDSB)
10265  {
10266  p=r->m[l];
10267  r->m[l]=kNF(Q,NULL,p);
10268  pDelete(&p);
10269  }
10270  else
10271  {
10272  pDelete(&r->m[l]); // and set it to NULL
10273  }
10274  break;
10275  }
10276  }
10277  }
10278  }
10279  }
10280  }
10281  #endif
10282  }
10283  else
10284  {
10285  int q;
10286  poly p;
10287  BOOLEAN reduction_found=FALSE;
10288  if (!rField_is_Ring(currRing))
10289  {
10290  for (l=IDELEMS(r)-1;l>=0;l--)
10291  {
10292  if (r->m[l]!=NULL)
10293  {
10294  for(q=IDELEMS(Q)-1; q>=0;q--)
10295  {
10296  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10297  {
10298  if (TEST_OPT_REDSB)
10299  {
10300  p=r->m[l];
10301  r->m[l]=kNF(Q,NULL,p);
10302  pDelete(&p);
10303  reduction_found=TRUE;
10304  }
10305  else
10306  {
10307  pDelete(&r->m[l]); // and set it to NULL
10308  }
10309  break;
10310  }
10311  }
10312  }
10313  }
10314  }
10315  #ifdef HAVE_RINGS
10316  //Also need divisibility of the leading coefficients
10317  else
10318  {
10319  for (l=IDELEMS(r)-1;l>=0;l--)
10320  {
10321  if (r->m[l]!=NULL)
10322  {
10323  for(q=IDELEMS(Q)-1; q>=0;q--)
10324  {
10325  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10326  {
10327  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10328  {
10329  if (TEST_OPT_REDSB)
10330  {
10331  p=r->m[l];
10332  r->m[l]=kNF(Q,NULL,p);
10333  pDelete(&p);
10334  reduction_found=TRUE;
10335  }
10336  else
10337  {
10338  pDelete(&r->m[l]); // and set it to NULL
10339  }
10340  break;
10341  }
10342  }
10343  }
10344  }
10345  }
10346  }
10347  #endif
10348  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10349  {
10350  #ifdef HAVE_RINGS
10352  {
10353  for (l=IDELEMS(r)-1;l>=0;l--)
10354  {
10355  if (r->m[l]!=NULL)
10356  {
10357  for(q=IDELEMS(r)-1;q>=0;q--)
10358  {
10359  if ((l!=q)
10360  && (r->m[q]!=NULL)
10361  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10362  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10363  )
10364  {
10365  //If they are equal then take the one with the smallest length
10366  if(pLmDivisibleBy(r->m[q],r->m[l])
10367  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10368  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10369  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10370  {
10371  pDelete(&r->m[l]);
10372  break;
10373  }
10374  else
10375  pDelete(&r->m[q]);
10376  }
10377  }
10378  }
10379  }
10380  }
10381  else
10382  #endif
10383  {
10384  for (l=IDELEMS(r)-1;l>=0;l--)
10385  {
10386  if (r->m[l]!=NULL)
10387  {
10388  for(q=IDELEMS(r)-1;q>=0;q--)
10389  {
10390  if ((l!=q)
10391  && (r->m[q]!=NULL)
10392  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10393  )
10394  {
10395  //If they are equal then take the one with the smallest length
10396  if(pLmDivisibleBy(r->m[q],r->m[l])
10397  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10398  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10399  {
10400  pDelete(&r->m[l]);
10401  break;
10402  }
10403  else
10404  pDelete(&r->m[q]);
10405  }
10406  }
10407  }
10408  }
10409  }
10410  }
10411  }
10412  idSkipZeroes(r);
10413 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:103
int ak
Definition: kutil.h:346
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
#define pGetComp(p)
Component.
Definition: polys.h:37
#define nGreaterZero(n)
Definition: numbers.h:28
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:775
static unsigned pLength(poly a)
Definition: p_polys.h:193
#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:475
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:93

◆ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 8823 of file kutil.cc.

8824 {
8825  LObject h;
8826  int i, suc=0;
8827  poly redSi=NULL;
8828  BOOLEAN change,any_change;
8829 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
8830 // for (i=0; i<=(strat->sl); i++)
8831 // {
8832 // Print("s%d:",i);
8833 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
8834 // pWrite(strat->S[i]);
8835 // }
8836 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
8837  any_change=FALSE;
8839  {
8840  while (suc != -1)
8841  {
8842  i=suc+1;
8843  while (i<=strat->sl)
8844  {
8845  change=FALSE;
8847  any_change = FALSE;
8848  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
8849  {
8850  redSi = pHead(strat->S[i]);
8851  strat->S[i] = redBba(strat->S[i],i-1,strat);
8852  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
8853  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
8854  if (pCmp(redSi,strat->S[i])!=0)
8855  {
8856  change=TRUE;
8857  any_change=TRUE;
8858  #ifdef KDEBUG
8859  if (TEST_OPT_DEBUG)
8860  {
8861  PrintS("reduce:");
8862  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
8863  }
8864  #endif
8865  if (TEST_OPT_PROT)
8866  {
8867  if (strat->S[i]==NULL)
8868  PrintS("V");
8869  else
8870  PrintS("v");
8871  mflush();
8872  }
8873  }
8874  pLmDelete(&redSi);
8875  if (strat->S[i]==NULL)
8876  {
8877  deleteInS(i,strat);
8878  i--;
8879  }
8880  else if (change)
8881  {
8883  {
8884  if (TEST_OPT_CONTENTSB)
8885  {
8886  number n;
8887  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
8888  if (!nIsOne(n))
8889  {
8891  denom->n=nInvers(n);
8892  denom->next=DENOMINATOR_LIST;
8893  DENOMINATOR_LIST=denom;
8894  }
8895  nDelete(&n);
8896  }
8897  else
8898  {
8899  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
8900  }
8901  }
8902  else
8903  {
8904  pNorm(strat->S[i]);
8905  }
8906  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
8907  }
8908  }
8909  i++;
8910  }
8911  if (any_change) reorderS(&suc,strat);
8912  else break;
8913  }
8914  if (toT)
8915  {
8916  for (i=0; i<=strat->sl; i++)
8917  {
8918  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
8919  {
8920  h.p = redtailBba(strat->S[i],i-1,strat);
8922  {
8923  h.pCleardenom();// also does remove Content
8924  }
8925  }
8926  else
8927  {
8928  h.p = strat->S[i];
8929  }
8930  strat->initEcart(&h);
8931  if (strat->honey)
8932  {
8933  strat->ecartS[i] = h.ecart;
8934  }
8935  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
8936  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
8937  h.sev = strat->sevS[i];
8938  /*puts the elements of S also to T*/
8939  strat->initEcart(&h);
8940  enterT(h,strat);
8941  strat->S_2_R[i] = strat->tl;
8942  }
8943  }
8944  }
8945  else
8946  {
8947  while (suc != -1)
8948  {
8949  i=suc;
8950  while (i<=strat->sl)
8951  {
8952  change=FALSE;
8953  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
8954  {
8955  redSi=pHead((strat->S)[i]);
8956  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
8957  if ((strat->S)[i]==NULL)
8958  {
8959  deleteInS(i,strat);
8960  i--;
8961  }
8962  else if (pCmp((strat->S)[i],redSi)!=0)
8963  {
8964  any_change=TRUE;
8965  h.p = strat->S[i];
8966  strat->initEcart(&h);
8967  strat->ecartS[i] = h.ecart;
8969  {
8970  if (TEST_OPT_CONTENTSB)
8971  {
8972  number n;
8973  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
8974  if (!nIsOne(n))
8975  {
8977  denom->n=nInvers(n);
8978  denom->next=DENOMINATOR_LIST;
8979  DENOMINATOR_LIST=denom;
8980  }
8981  nDelete(&n);
8982  }
8983  else
8984  {
8985  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
8986  }
8987  }
8988  else
8989  {
8990  pNorm(strat->S[i]); // == h.p
8991  }
8992  h.sev = pGetShortExpVector(h.p);
8993  strat->sevS[i] = h.sev;
8994  }
8995  pLmDelete(&redSi);
8996  kTest(strat);
8997  }
8998  i++;
8999  }
9000 #ifdef KDEBUG
9001  kTest(strat);
9002 #endif
9003  if (any_change) reorderS(&suc,strat);
9004  else { suc=-1; break; }
9005  if (h.p!=NULL)
9006  {
9007  if (!strat->kHEdgeFound)
9008  {
9009  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9010  }
9011  if (strat->kHEdgeFound)
9012  newHEdge(strat);
9013  }
9014  }
9015  for (i=0; i<=strat->sl; i++)
9016  {
9017  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9018  {
9019  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9020  strat->initEcart(&h);
9021  strat->ecartS[i] = h.ecart;
9022  h.sev = pGetShortExpVector(h.p);
9023  strat->sevS[i] = h.sev;
9024  }
9025  else
9026  {
9027  h.p = strat->S[i];
9028  h.ecart=strat->ecartS[i];
9029  h.sev = strat->sevS[i];
9030  h.length = h.pLength = pLength(h.p);
9031  }
9032  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9033  cancelunit1(&h,&suc,strat->sl,strat);
9034  h.SetpFDeg();
9035  /*puts the elements of S also to T*/
9036  enterT(h,strat);
9037  strat->S_2_R[i] = strat->tl;
9038  }
9039  if (suc!= -1) updateS(toT,strat);
9040  }
9041 #ifdef KDEBUG
9042  kTest(strat);
9043 #endif
9044 }
denominator_list_s * denominator_list
Definition: kutil.h:59
char kHEdgeFound
Definition: kutil.h:370
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:335
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8666
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4898
#define TEST_OPT_CONTENTSB
Definition: options.h:125
int tl
Definition: kutil.h:343
#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:98
#define nIsOne(n)
Definition: numbers.h:26
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:87
#define kTest(A)
Definition: kutil.h:643
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1069
#define TEST_OPT_DEBUG
Definition: options.h:107
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:467
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8754
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9291
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2891
void(* initEcart)(TObject *L)
Definition: kutil.h:271
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7321
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:312
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:193
#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:297
#define nDelete(n)
Definition: numbers.h:17
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7397
#define nInvers(a)
Definition: numbers.h:34
intset ecartS
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
ring tailRing
Definition: kutil.h:336
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
denominator_list next
Definition: kutil.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8823
unsigned long * sevS
Definition: kutil.h:313
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
char honey
Definition: kutil.h:371
int sl
Definition: kutil.h:341
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8778
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10537
void wrp(poly p)
Definition: polys.h:304
static Poly * h
Definition: janet.cc:972
int BOOLEAN
Definition: auxiliary.h:85
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782

◆ updateSShift()

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

Definition at line 11879 of file kutil.cc.

11880 {
11881  /* to use after updateS(toT=FALSE,strat) */
11882  /* fills T with shifted elt's of S */
11883  int i;
11884  LObject h;
11885  int atT = -1; // or figure out smth better
11886  strat->tl = -1; // init
11887  for (i=0; i<=strat->sl; i++)
11888  {
11889  memset(&h,0,sizeof(h));
11890  h.p = strat->S[i];
11891  strat->initEcart(&h);
11892  h.sev = strat->sevS[i];
11893  h.t_p = NULL;
11894  h.GetTP(); // creates correct t_p
11895  /*puts the elements of S with their shifts to T*/
11896  // int atT, int uptodeg, int lV)
11897  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
11898  // need a small check for above; we insert >=1 elements
11899  // insert this check into kTest_TS ?
11900  enterTShift(h,strat,atT,uptodeg,lV);
11901  }
11902  /* what about setting strat->tl? */
11903 }
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:335
int tl
Definition: kutil.h:343
void(* initEcart)(TObject *L)
Definition: kutil.h:271
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12523
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:297
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:313
int sl
Definition: kutil.h:341
static Poly * h
Definition: janet.cc:972

Variable Documentation

◆ DENOMINATOR_LIST

denominator_list DENOMINATOR_LIST

Definition at line 87 of file kutil.cc.

◆ HCord

int HCord

Definition at line 235 of file kutil.cc.

◆ strat_nr

int strat_nr

Definition at line 25 of file kstdfac.cc.

◆ test_PosInL

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

Definition at line 81 of file kstd2.cc.

◆ test_PosInT

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

Definition at line 80 of file kstd2.cc.