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, R)   (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 enterSBbaShift (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)
 
void redtailBbaAlsoLC_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 redRing_Z (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 replaceInLAndSAndT (LObject &p, int tj, kStrategy strat)
 
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 kFindDivisibleByInT_Z (const kStrategy strat, const LObject *L, const int start=0)
 
int kFindSameLMInT_Z (const kStrategy strat, const LObject *L, const int start=0)
 
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 ksReducePolyZ (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolyLC (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
 
int ksReducePolyGCD (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=-1)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
 
void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
 
void enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void updateSShift (kStrategy strat)
 
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)
 
ideal bbaShift (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
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 393 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 653 of file kutil.h.

◆ kTest_L

#define kTest_L (   T,
  R 
)    (TRUE)

Definition at line 657 of file kutil.h.

◆ kTest_S

#define kTest_S (   T)    (TRUE)

Definition at line 656 of file kutil.h.

◆ kTest_T

#define kTest_T (   T)    (TRUE)

Definition at line 655 of file kutil.h.

◆ kTest_TS

#define kTest_TS (   A)    (TRUE)

Definition at line 654 of file kutil.h.

◆ messageSets

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

Definition at line 540 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 7188 of file kutil.cc.

7189 {
7191  return FALSE;
7192  poly p1 = pOne();
7193  poly p2 = pOne();
7194  for (int ii=strat->sl; ii>start; ii--)
7195  {
7196  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7197  {
7198  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7199  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7200  if (!(pLmCmp(p1,p2) == 1))
7201  {
7202  pDelete(&p1);
7203  pDelete(&p2);
7204  return TRUE;
7205  }
7206  }
7207  }
7208  pDelete(&p1);
7209  pDelete(&p2);
7210  return FALSE;
7211 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#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:1853
LObject P
Definition: kutil.h:298
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#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:12
int sl
Definition: kutil.h:346
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1360

◆ arriRewCriterionPre()

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

Definition at line 7213 of file kutil.cc.

7214 {
7215  //Over Rings, there are still some changes to do: considering coeffs
7217  return FALSE;
7218  int found = -1;
7219  for (int i=strat->Bl; i>-1; i--) {
7220  if (pLmEqual(strat->B[i].sig,sig))
7221  {
7222  found = i;
7223  break;
7224  }
7225  }
7226  if (found != -1)
7227  {
7228  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7229  {
7230  deleteInL(strat->B,&strat->Bl,found,strat);
7231  }
7232  else
7233  {
7234  return TRUE;
7235  }
7236  }
7237  poly p1 = pOne();
7238  poly p2 = pOne();
7239  for (int ii=strat->sl; ii>-1; ii--)
7240  {
7241  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7242  {
7243  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7244  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7245  if (!(pLmCmp(p1,p2) == 1))
7246  {
7247  pDelete(&p1);
7248  pDelete(&p2);
7249  return TRUE;
7250  }
7251  }
7252  }
7253  pDelete(&p1);
7254  pDelete(&p2);
7255  return FALSE;
7256 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#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:350
#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:1203
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
LSet B
Definition: kutil.h:324
#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:12
int sl
Definition: kutil.h:346
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1360
#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 1203 of file kInline.h.

1204 {
1205  return FALSE;
1206 }
#define FALSE
Definition: auxiliary.h:94

◆ bba()

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

Definition at line 2178 of file kstd2.cc.

2179 {
2180  int red_result = 1;
2181  int olddeg,reduc;
2182  int hilbeledeg=1,hilbcount=0,minimcnt=0;
2183  BOOLEAN withT = FALSE;
2184  BITSET save;
2185  SI_SAVE_OPT1(save);
2186 
2187  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
2189  initBuchMoraPosRing(strat);
2190  else
2191  initBuchMoraPos(strat);
2192  initHilbCrit(F,Q,&hilb,strat);
2193  initBba(strat);
2194  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2195  /*Shdl=*/initBuchMora(F, Q,strat);
2196  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2197  reduc = olddeg = 0;
2198 
2199 #ifndef NO_BUCKETS
2200  if (!TEST_OPT_NOT_BUCKETS)
2201  strat->use_buckets = 1;
2202 #endif
2203  // redtailBBa against T for inhomogenous input
2204  if (!TEST_OPT_OLDSTD)
2205  withT = ! strat->homog;
2206 
2207  // strat->posInT = posInT_pLength;
2208  kTest_TS(strat);
2209 
2210 #ifdef HAVE_TAIL_RING
2211  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2212  kStratInitChangeTailRing(strat);
2213 #endif
2214  if (BVERBOSE(23))
2215  {
2216  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
2217  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
2218  kDebugPrint(strat);
2219  }
2220 
2221 
2222 #ifdef KDEBUG
2223  //kDebugPrint(strat);
2224 #endif
2225  /* compute------------------------------------------------------- */
2226  while (strat->Ll >= 0)
2227  {
2228  #ifdef KDEBUG
2229  if (TEST_OPT_DEBUG) messageSets(strat);
2230  #endif
2231  if (siCntrlc)
2232  {
2233  while (strat->Ll >= 0)
2234  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2235  strat->noClearS=TRUE;
2236  }
2237  if (TEST_OPT_DEGBOUND
2238  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2239  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2240  {
2241  /*
2242  *stops computation if
2243  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2244  *a predefined number Kstd1_deg
2245  */
2246  while ((strat->Ll >= 0)
2247  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2248  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2249  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2250  )
2251  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2252  if (strat->Ll<0) break;
2253  else strat->noClearS=TRUE;
2254  }
2255  if (strat->Ll== 0) strat->interpt=TRUE;
2256  /* picks the last element from the lazyset L */
2257  strat->P = strat->L[strat->Ll];
2258  strat->Ll--;
2259 
2260  if (pNext(strat->P.p) == strat->tail)
2261  {
2262  // deletes the short spoly
2263  if (rField_is_Ring(currRing))
2264  pLmDelete(strat->P.p);
2265  else
2266  pLmFree(strat->P.p);
2267  strat->P.p = NULL;
2268  poly m1 = NULL, m2 = NULL;
2269 
2270  // check that spoly creation is ok
2271  while (strat->tailRing != currRing &&
2272  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2273  {
2274  assume(m1 == NULL && m2 == NULL);
2275  // if not, change to a ring where exponents are at least
2276  // large enough
2277  if (!kStratChangeTailRing(strat))
2278  {
2279  WerrorS("OVERFLOW...");
2280  break;
2281  }
2282  }
2283  // create the real one
2284  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2285  strat->tailRing, m1, m2, strat->R);
2286  }
2287  else if (strat->P.p1 == NULL)
2288  {
2289  if (strat->minim > 0)
2290  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2291  // for input polys, prepare reduction
2292  strat->P.PrepareRed(strat->use_buckets);
2293  }
2294 
2295  if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
2296  {
2297  red_result = 0;
2298  }
2299  else
2300  {
2301  if (TEST_OPT_PROT)
2302  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2303  &olddeg,&reduc,strat, red_result);
2304 
2305  /* reduction of the element chosen from L */
2306  red_result = strat->red(&strat->P,strat);
2307  if (errorreported) break;
2308  }
2309 
2310  if (strat->overflow)
2311  {
2312  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2313  }
2314 
2315  // reduction to non-zero new poly
2316  if (red_result == 1)
2317  {
2318  // get the polynomial (canonicalize bucket, make sure P.p is set)
2319  strat->P.GetP(strat->lmBin);
2320  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2321  // but now, for entering S, T, we reset it
2322  // in the inhomogeneous case: FDeg == pFDeg
2323  if (strat->homog) strat->initEcart(&(strat->P));
2324 
2325  /* statistic */
2326  if (TEST_OPT_PROT) PrintS("s");
2327 
2328  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2329 
2330  // reduce the tail and normalize poly
2331  // in the ring case we cannot expect LC(f) = 1,
2332  // therefore we call pCleardenom instead of pNorm
2333  strat->redTailChange=FALSE;
2334 
2335  /* if we are computing over Z we always want to try and cut down
2336  * the coefficients in the tail terms */
2338  redtailBbaAlsoLC_Z(&(strat->P), strat->tl, strat);
2339  strat->P.pCleardenom();
2340  }
2341 
2343  {
2344  strat->P.pCleardenom();
2346  {
2347  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
2348  strat->P.pCleardenom();
2349  if (strat->redTailChange) { strat->P.t_p=NULL; }
2350  }
2351  }
2352  else
2353  {
2354  strat->P.pNorm();
2356  {
2357  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2358  if (strat->redTailChange) { strat->P.t_p=NULL; }
2359  }
2360  }
2361 
2362 #ifdef KDEBUG
2363  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2364 #endif /* KDEBUG */
2365 
2366  // min_std stuff
2367  if ((strat->P.p1==NULL) && (strat->minim>0))
2368  {
2369  if (strat->minim==1)
2370  {
2371  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2372  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2373  }
2374  else
2375  {
2376  strat->M->m[minimcnt]=strat->P.p2;
2377  strat->P.p2=NULL;
2378  }
2379  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2380  pNext(strat->M->m[minimcnt])
2381  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2382  strat->tailRing, currRing,
2383  currRing->PolyBin);
2384  minimcnt++;
2385  }
2386 
2387  // enter into S, L, and T
2388  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2389  {
2390  enterT(strat->P, strat);
2391  if (rField_is_Ring(currRing))
2392  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2393  else
2394  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2395  // posInS only depends on the leading term
2396  strat->enterS(strat->P, pos, strat, strat->tl);
2397 #if 0
2398  int pl=pLength(strat->P.p);
2399  if (pl==1)
2400  {
2401  //if (TEST_OPT_PROT)
2402  //PrintS("<1>");
2403  }
2404  else if (pl==2)
2405  {
2406  //if (TEST_OPT_PROT)
2407  //PrintS("<2>");
2408  }
2409 #endif
2410  }
2411  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2412 // Print("[%d]",hilbeledeg);
2413  kDeleteLcm(&strat->P);
2414  if (strat->s_poly!=NULL)
2415  {
2416  // the only valid entries are: strat->P.p,
2417  // strat->tailRing (read-only, keep it)
2418  // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2419  if (strat->s_poly(strat))
2420  {
2421  // we are called AFTER enterS, i.e. if we change P
2422  // we have to add it also to S/T
2423  // and add pairs
2424  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2425  enterT(strat->P, strat);
2426  if (rField_is_Ring(currRing))
2427  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2428  else
2429  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2430  strat->enterS(strat->P, pos, strat, strat->tl);
2431  }
2432  }
2433  }
2434  else if (strat->P.p1 == NULL && strat->minim > 0)
2435  {
2436  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2437  }
2438 
2439 #ifdef KDEBUG
2440  memset(&(strat->P), 0, sizeof(strat->P));
2441 #endif /* KDEBUG */
2442  kTest_TS(strat);
2443  }
2444 #ifdef KDEBUG
2445  if (TEST_OPT_DEBUG) messageSets(strat);
2446 #endif /* KDEBUG */
2447 
2448  if (TEST_OPT_SB_1)
2449  {
2450  if(!rField_is_Ring(currRing))
2451  {
2452  int k=1;
2453  int j;
2454  while(k<=strat->sl)
2455  {
2456  j=0;
2457  loop
2458  {
2459  if (j>=k) break;
2460  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2461  j++;
2462  }
2463  k++;
2464  }
2465  }
2466  }
2467  /* complete reduction of the standard basis--------- */
2468  if (TEST_OPT_REDSB)
2469  {
2470  completeReduce(strat);
2471  if (strat->completeReduce_retry)
2472  {
2473  // completeReduce needed larger exponents, retry
2474  // to reduce with S (instead of T)
2475  // and in currRing (instead of strat->tailRing)
2476 #ifdef HAVE_TAIL_RING
2477  if(currRing->bitmask>strat->tailRing->bitmask)
2478  {
2479  strat->completeReduce_retry=FALSE;
2480  cleanT(strat);strat->tailRing=currRing;
2481  int i;
2482  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2483  completeReduce(strat);
2484  }
2485  if (strat->completeReduce_retry)
2486 #endif
2487  Werror("exponent bound is %ld",currRing->bitmask);
2488  }
2489  }
2490  else if (TEST_OPT_PROT) PrintLn();
2491  /* release temp data-------------------------------- */
2492  exitBuchMora(strat);
2493  /* postprocessing for GB over ZZ --------------------*/
2494  if (!errorreported)
2495  {
2496  if(rField_is_Z(currRing))
2497  {
2498  for(int i = 0;i<=strat->sl;i++)
2499  {
2500  if(!nGreaterZero(pGetCoeff(strat->S[i])))
2501  {
2502  strat->S[i] = pNeg(strat->S[i]);
2503  }
2504  }
2505  finalReduceByMon(strat);
2506  for(int i = 0;i<IDELEMS(strat->Shdl);i++)
2507  {
2508  if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
2509  {
2510  strat->S[i] = pNeg(strat->Shdl->m[i]);
2511  }
2512  }
2513  }
2514  //else if (rField_is_Ring(currRing))
2515  // finalReduceByMon(strat);
2516  }
2517 // if (TEST_OPT_WEIGHTM)
2518 // {
2519 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2520 // if (ecartWeights)
2521 // {
2522 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2523 // ecartWeights=NULL;
2524 // }
2525 // }
2526  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
2527  SI_RESTORE_OPT1(save);
2528  /* postprocessing for GB over Q-rings ------------------*/
2529  if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
2530 
2531  idTest(strat->Shdl);
2532 
2533  return (strat->Shdl);
2534 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define TEST_OPT_REDTAIL
Definition: options.h:115
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
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:10025
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7954
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7995
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10198
void redtailBbaAlsoLC_Z(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7711
#define TEST_OPT_CONTENTSB
Definition: options.h:125
char interpt
Definition: kutil.h:369
#define pNeg(p)
Definition: polys.h:193
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4859
#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:400
#define TEST_OPT_REDSB
Definition: options.h:103
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
#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:1334
#define TEST_OPT_DEBUG
Definition: options.h:107
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:504
#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:44
#define loop
Definition: structs.h:80
#define BITSET
Definition: structs.h:20
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10111
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:356
char use_buckets
Definition: kutil.h:381
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11476
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_TS(A)
Definition: kutil.h:654
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9856
#define TEST_OPT_OLDSTD
Definition: options.h:121
#define assume(x)
Definition: mod2.h:390
#define messageSets(s)
Definition: kutil.h:540
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1145
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9874
ideal M
Definition: kutil.h:301
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:332
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define IDELEMS(i)
Definition: simpleideals.h:23
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10905
#define BVERBOSE(a)
Definition: options.h:35
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:35
char homog
Definition: kutil.h:370
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
void cleanT(kStrategy strat)
Definition: kutil.cc:538
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4831
ring tailRing
Definition: kutil.h:341
#define TEST_OPT_SB_1
Definition: options.h:117
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10719
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10507
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:1178
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:237
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:11292
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:10274
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11923
#define idTest(id)
Definition: ideals.h:47

◆ bbaShift()

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

Definition at line 4163 of file kstd2.cc.

4164 {
4165  int red_result = 1;
4166  int olddeg,reduc;
4167  int hilbeledeg=1,hilbcount=0,minimcnt=0;
4168  BOOLEAN withT = TRUE; // currently only T contains the shifts
4169  BITSET save;
4170  SI_SAVE_OPT1(save);
4171 
4172  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
4174  initBuchMoraPosRing(strat);
4175  else
4176  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
4177  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
4178  initBbaShift(strat); /* DONE */
4179  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
4180  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
4181  updateSShift(strat); /* initializes T */
4182  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
4183  reduc = olddeg = 0;
4184 
4185 #ifndef NO_BUCKETS
4186  if (!TEST_OPT_NOT_BUCKETS)
4187  strat->use_buckets = 1;
4188 #endif
4189  // redtailBBa against T for inhomogenous input
4190  // if (!TEST_OPT_OLDSTD)
4191  // withT = ! strat->homog;
4192 
4193  // strat->posInT = posInT_pLength;
4194  kTest_TS(strat);
4195 
4196 #ifdef HAVE_TAIL_RING
4197 // kStratInitChangeTailRing(strat);
4198  strat->tailRing=currRing;
4199 #endif
4200 
4201 
4202 #ifdef KDEBUG
4203  //kDebugPrint(strat);
4204 #endif
4205  /* compute------------------------------------------------------- */
4206  while (strat->Ll >= 0)
4207  {
4208 #ifdef KDEBUG
4209  if (TEST_OPT_DEBUG) messageSets(strat);
4210 #endif
4211  if (strat->Ll== 0) strat->interpt=TRUE;
4212  if (TEST_OPT_DEGBOUND
4213  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4214  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
4215  {
4216  /*
4217  *stops computation if
4218  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
4219  *a predefined number Kstd1_deg
4220  */
4221  while ((strat->Ll >= 0)
4222  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
4223  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4224  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
4225  )
4226  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
4227  if (strat->Ll<0) break;
4228  else strat->noClearS=TRUE;
4229  }
4230  /* picks the last element from the lazyset L */
4231  strat->P = strat->L[strat->Ll];
4232  strat->Ll--;
4233 
4234  if (pNext(strat->P.p) == strat->tail)
4235  {
4236  // deletes the short spoly
4237  pLmFree(strat->P.p);
4238  strat->P.p = NULL;
4239  poly m1 = NULL, m2 = NULL;
4240 
4241  // check that spoly creation is ok
4242  while (strat->tailRing != currRing &&
4243  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
4244  {
4245  assume(m1 == NULL && m2 == NULL);
4246  // if not, change to a ring where exponents are at least
4247  // large enough
4248  kStratChangeTailRing(strat);
4249  }
4250  // create the real one
4251  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
4252  strat->tailRing, m1, m2, strat->R);
4253  }
4254  else if (strat->P.p1 == NULL)
4255  {
4256  if (strat->minim > 0)
4257  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
4258  // for input polys, prepare reduction
4259  strat->P.PrepareRed(strat->use_buckets);
4260  }
4261 
4262  if (strat->P.p == NULL && strat->P.t_p == NULL)
4263  {
4264  red_result = 0;
4265  }
4266  else
4267  {
4268  if (TEST_OPT_PROT)
4269  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
4270  &olddeg,&reduc,strat, red_result);
4271 
4272  /* reduction of the element chosen from L */
4273  red_result = strat->red(&strat->P,strat);
4274  if (errorreported) break;
4275  }
4276 
4277  // reduction to non-zero new poly
4278  if (red_result == 1)
4279  {
4280  // get the polynomial (canonicalize bucket, make sure P.p is set)
4281  strat->P.GetP(strat->lmBin);
4282  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
4283  // but now, for entering S, T, we reset it
4284  // in the inhomogeneous case: FDeg == pFDeg
4285  if (strat->homog) strat->initEcart(&(strat->P));
4286 
4287  /* statistic */
4288  if (TEST_OPT_PROT) PrintS("s");
4289 
4290  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4291 
4292  // reduce the tail and normalize poly
4293  // in the ring case we cannot expect LC(f) = 1,
4294  // therefore we call pCleardenom instead of pNorm
4295  strat->redTailChange=FALSE;
4297  {
4298  strat->P.pCleardenom();
4300  {
4301  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4302  strat->P.pCleardenom();
4303  if (strat->redTailChange) {
4304  strat->P.t_p=NULL;
4305  strat->initEcart(&(strat->P));
4306  }
4307  }
4308  }
4309  else
4310  {
4311  strat->P.pNorm();
4312  if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) {
4313  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4314  if (strat->redTailChange) {
4315  strat->P.t_p=NULL;
4316  strat->initEcart(&(strat->P));
4317  }
4318  }
4319  }
4320 
4321 #ifdef KDEBUG
4322  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4323 #endif
4324 
4325  // min_std stuff
4326  if ((strat->P.p1==NULL) && (strat->minim>0))
4327  {
4328  if (strat->minim==1)
4329  {
4330  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4331  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4332  }
4333  else
4334  {
4335  strat->M->m[minimcnt]=strat->P.p2;
4336  strat->P.p2=NULL;
4337  }
4338  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4339  pNext(strat->M->m[minimcnt])
4340  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4341  strat->tailRing, currRing,
4342  currRing->PolyBin);
4343  minimcnt++;
4344  }
4345 
4346 
4347  // enter into S, L, and T
4348  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4349  {
4350  enterT(strat->P, strat);
4351  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
4352  // posInS only depends on the leading term
4353  strat->enterS(strat->P, pos, strat, strat->tl);
4354  enterTShift(strat->P, strat);
4355  }
4356 
4357  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4358 // Print("[%d]",hilbeledeg);
4359  kDeleteLcm(&strat->P);
4360  if (strat->s_poly!=NULL)
4361  {
4362  // the only valid entries are: strat->P.p,
4363  // strat->tailRing (read-only, keep it)
4364  // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
4365  if (strat->s_poly(strat))
4366  {
4367  // we are called AFTER enterS, i.e. if we change P
4368  // we have to add it also to S/T
4369  // and add pairs
4370  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4371  int atR=strat->tl+1; // enterTShift introduces P.p=T[tl+1], T[tl+2]...
4372  enterTShift(strat->P,strat,-1);
4373  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, atR);
4374  strat->enterS(strat->P, pos, strat, atR);
4375  }
4376  }
4377  }
4378  else if (strat->P.p1 == NULL && strat->minim > 0)
4379  {
4380  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4381  }
4382 #ifdef KDEBUG
4383  memset(&(strat->P), 0, sizeof(strat->P));
4384 #endif
4385  kTest_TS(strat);
4386  }
4387 #ifdef KDEBUG
4388  if (TEST_OPT_DEBUG) messageSets(strat);
4389 #endif
4390  /* shift case: look for elt's in S such that they are divisible by elt in T */
4391  if ((TEST_OPT_SB_1 || TEST_OPT_REDSB) && !strat->noClearS) // when is OPT_SB_1 set?
4392  {
4393  for (int k = 0; k <= strat->sl; ++k)
4394  {
4395  for (int j = 0; j<=strat->tl; ++j)
4396  {
4397  // this is like clearS in bba, but we reduce with elements from T, because it contains the shifts too
4398  assume(strat->sevT[j] == pGetShortExpVector(strat->T[j].p));
4399  assume(strat->sevS[k] == pGetShortExpVector(strat->S[k]));
4400  if (pLmShortDivisibleBy(strat->T[j].p, strat->sevT[j], strat->S[k], ~strat->sevS[k]))
4401  {
4402  if (pLmCmp(strat->T[j].p, strat->S[k]) != 0) { // check whether LM is different
4403  deleteInS(k, strat);
4404  --k;
4405  break;
4406  }
4407  }
4408  }
4409  }
4410  }
4411  /* complete reduction of the standard basis--------- */
4412  if (TEST_OPT_REDSB)
4413  {
4414  completeReduce(strat, TRUE); //shift: withT = TRUE
4415  if (strat->completeReduce_retry)
4416  {
4417  // completeReduce needed larger exponents, retry
4418  // to reduce with S (instead of T)
4419  // and in currRing (instead of strat->tailRing)
4420 #ifdef HAVE_TAIL_RING
4421  if(currRing->bitmask>strat->tailRing->bitmask)
4422  {
4423  strat->completeReduce_retry=FALSE;
4424  cleanT(strat);strat->tailRing=currRing;
4425  int i;
4426  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
4427  WarnS("reduction with S is not yet supported by Letterplace"); // if this ever happens, we'll know
4428  completeReduce(strat);
4429  }
4430  if (strat->completeReduce_retry)
4431 #endif
4432  Werror("exponent bound is %ld",currRing->bitmask);
4433  }
4434  }
4435  else if (TEST_OPT_PROT) PrintLn();
4436 
4437  /* release temp data-------------------------------- */
4438  exitBuchMora(strat);
4439 // if (TEST_OPT_WEIGHTM)
4440 // {
4441 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
4442 // if (ecartWeights)
4443 // {
4444 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
4445 // ecartWeights=NULL;
4446 // }
4447 // }
4448  if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
4449  SI_RESTORE_OPT1(save);
4450  /* postprocessing for GB over Q-rings ------------------*/
4451  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
4452 
4453  idTest(strat->Shdl);
4454 
4455  return (strat->Shdl);
4456 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int j
Definition: facHensel.cc:105
void updateSShift(kStrategy strat)
Definition: kutil.cc:12183
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:112
void enterTShift(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:12759
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:10025
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7954
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7995
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#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:369
char noClearS
Definition: kutil.h:400
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:103
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
#define SI_SAVE_OPT1(A)
Definition: options.h:22
int k
Definition: cfEzgcd.cc:92
#define TEST_OPT_DEBUG
Definition: options.h:107
#define Q
Definition: sirandom.c:25
#define WarnS
Definition: emacs.cc:78
#define BITSET
Definition: structs.h:20
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10111
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:356
char use_buckets
Definition: kutil.h:381
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_TS(A)
Definition: kutil.h:654
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9856
#define assume(x)
Definition: mod2.h:390
#define messageSets(s)
Definition: kutil.h:540
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#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
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1145
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9874
ideal M
Definition: kutil.h:301
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:12211
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10905
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
void initBbaShift(kStrategy strat)
Definition: kstd2.cc:4593
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:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
void cleanT(kStrategy strat)
Definition: kutil.cc:538
ring tailRing
Definition: kutil.h:341
#define TEST_OPT_SB_1
Definition: options.h:117
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10719
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10507
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 Kstd1_deg
Definition: kutil.cc:237
int BOOLEAN
Definition: auxiliary.h:85
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:12728
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10274
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define idTest(id)
Definition: ideals.h:47

◆ cancelunit()

void cancelunit ( LObject p,
BOOLEAN  inNF = FALSE 
)

Definition at line 333 of file kutil.cc.

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

◆ chainCritNormal()

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

Definition at line 3192 of file kutil.cc.

3193 {
3194  int i,j,l;
3195 
3196  /*
3197  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3198  *In this case all elements in B such
3199  *that their lcm is divisible by the leading term of S[i] can be canceled
3200  */
3201  if (strat->pairtest!=NULL)
3202  {
3203  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3204  for (j=0; j<=strat->sl; j++)
3205  {
3206  if (strat->pairtest[j])
3207  {
3208  for (i=strat->Bl; i>=0; i--)
3209  {
3210  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3211  {
3212  deleteInL(strat->B,&strat->Bl,i,strat);
3213  strat->c3++;
3214  }
3215  }
3216  }
3217  }
3218  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3219  strat->pairtest=NULL;
3220  }
3221  if (strat->Gebauer || strat->fromT)
3222  {
3223  if (strat->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 (sugarDivisibleBy(ecart,strat->L[j].ecart)
3233  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3234  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3235  {
3236  if (strat->L[j].p == strat->tail)
3237  {
3238  deleteInL(strat->L,&strat->Ll,j,strat);
3239  strat->c3++;
3240  }
3241  }
3242  }
3243  /*
3244  *this is GEBAUER-MOELLER:
3245  *in B all elements with the same lcm except the "best"
3246  *(i.e. the last one in B with this property) will be canceled
3247  */
3248  j = strat->Bl;
3249  loop /*cannot be changed into a for !!! */
3250  {
3251  if (j <= 0) break;
3252  i = j-1;
3253  loop
3254  {
3255  if (i < 0) break;
3256  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3257  {
3258  strat->c3++;
3259  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3260  {
3261  deleteInL(strat->B,&strat->Bl,i,strat);
3262  j--;
3263  }
3264  else
3265  {
3266  deleteInL(strat->B,&strat->Bl,j,strat);
3267  break;
3268  }
3269  }
3270  i--;
3271  }
3272  j--;
3273  }
3274  }
3275  else /*sugarCrit*/
3276  {
3277  /*
3278  *suppose L[j] == (s,r) and p/lcm(s,r)
3279  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3280  *and in case the sugar is o.k. then L[j] can be canceled
3281  */
3282  for (j=strat->Ll; j>=0; j--)
3283  {
3284  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3285  {
3286  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3287  {
3288  deleteInL(strat->L,&strat->Ll,j,strat);
3289  strat->c3++;
3290  }
3291  }
3292  }
3293  /*
3294  *this is GEBAUER-MOELLER:
3295  *in B all elements with the same lcm except the "best"
3296  *(i.e. the last one in B with this property) will be canceled
3297  */
3298  j = strat->Bl;
3299  loop /*cannot be changed into a for !!! */
3300  {
3301  if (j <= 0) break;
3302  for(i=j-1; i>=0; i--)
3303  {
3304  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3305  {
3306  strat->c3++;
3307  deleteInL(strat->B,&strat->Bl,i,strat);
3308  j--;
3309  }
3310  }
3311  j--;
3312  }
3313  }
3314  /*
3315  *the elements of B enter L
3316  */
3317  kMergeBintoL(strat);
3318  }
3319  else
3320  {
3321  for (j=strat->Ll; j>=0; j--)
3322  {
3323  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3324  {
3325  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3326  {
3327  deleteInL(strat->L,&strat->Ll,j,strat);
3328  strat->c3++;
3329  }
3330  }
3331  }
3332  /*
3333  *this is our MODIFICATION of GEBAUER-MOELLER:
3334  *First the elements of B enter L,
3335  *then we fix a lcm and the "best" element in L
3336  *(i.e the last in L with this lcm and of type (s,p))
3337  *and cancel all the other elements of type (r,p) with this lcm
3338  *except the case the element (s,r) has also the same lcm
3339  *and is on the worst position with respect to (s,p) and (r,p)
3340  */
3341  /*
3342  *B enters to L/their order with respect to B is permutated for elements
3343  *B[i].p with the same leading term
3344  */
3345  kMergeBintoL(strat);
3346  j = strat->Ll;
3347  loop /*cannot be changed into a for !!! */
3348  {
3349  if (j <= 0)
3350  {
3351  /*now L[0] cannot be canceled any more and the tail can be removed*/
3352  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3353  break;
3354  }
3355  if (strat->L[j].p2 == p)
3356  {
3357  i = j-1;
3358  loop
3359  {
3360  if (i < 0) break;
3361  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3362  {
3363  /*L[i] could be canceled but we search for a better one to cancel*/
3364  strat->c3++;
3365  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3366  && (pNext(strat->L[l].p) == strat->tail)
3367  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3368  && pDivisibleBy(p,strat->L[l].lcm))
3369  {
3370  /*
3371  *"NOT equal(...)" because in case of "equal" the element L[l]
3372  *is "older" and has to be from theoretical point of view behind
3373  *L[i], but we do not want to reorder L
3374  */
3375  strat->L[i].p2 = strat->tail;
3376  /*
3377  *L[l] will be canceled, we cannot cancel L[i] later on,
3378  *so we mark it with "tail"
3379  */
3380  deleteInL(strat->L,&strat->Ll,l,strat);
3381  i--;
3382  }
3383  else
3384  {
3385  deleteInL(strat->L,&strat->Ll,i,strat);
3386  }
3387  j--;
3388  }
3389  i--;
3390  }
3391  }
3392  else if (strat->L[j].p2 == strat->tail)
3393  {
3394  /*now L[j] cannot be canceled any more and the tail can be removed*/
3395  strat->L[j].p2 = p;
3396  }
3397  j--;
3398  }
3399  }
3400 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define loop
Definition: structs.h:80
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:675
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:17
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
LSet B
Definition: kutil.h:324
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
char Gebauer
Definition: kutil.h:376
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
#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 3405 of file kutil.cc.

3406 {
3407  if (strat->pairtest!=NULL)
3408  {
3409  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3410  strat->pairtest=NULL;
3411  }
3412  /*
3413  *the elements of B enter L
3414  */
3415  kMergeBintoL(strat);
3416 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
#define NULL
Definition: omList.c:12
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3150
int BOOLEAN
Definition: auxiliary.h:85

◆ chainCritSig()

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

Definition at line 3421 of file kutil.cc.

3422 {
3423  int i,j,l;
3424  kMergeBintoLSba(strat);
3425  j = strat->Ll;
3426  loop /*cannot be changed into a for !!! */
3427  {
3428  if (j <= 0)
3429  {
3430  /*now L[0] cannot be canceled any more and the tail can be removed*/
3431  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3432  break;
3433  }
3434  if (strat->L[j].p2 == p)
3435  {
3436  i = j-1;
3437  loop
3438  {
3439  if (i < 0) break;
3440  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3441  {
3442  /*L[i] could be canceled but we search for a better one to cancel*/
3443  strat->c3++;
3444  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3445  && (pNext(strat->L[l].p) == strat->tail)
3446  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3447  && pDivisibleBy(p,strat->L[l].lcm))
3448  {
3449  /*
3450  *"NOT equal(...)" because in case of "equal" the element L[l]
3451  *is "older" and has to be from theoretical point of view behind
3452  *L[i], but we do not want to reorder L
3453  */
3454  strat->L[i].p2 = strat->tail;
3455  /*
3456  *L[l] will be canceled, we cannot cancel L[i] later on,
3457  *so we mark it with "tail"
3458  */
3459  deleteInL(strat->L,&strat->Ll,l,strat);
3460  i--;
3461  }
3462  else
3463  {
3464  deleteInL(strat->L,&strat->Ll,i,strat);
3465  }
3466  j--;
3467  }
3468  i--;
3469  }
3470  }
3471  else if (strat->L[j].p2 == strat->tail)
3472  {
3473  /*now L[j] cannot be canceled any more and the tail can be removed*/
3474  strat->L[j].p2 = p;
3475  }
3476  j--;
3477  }
3478 }
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
int c3
Definition: kutil.h:345
#define loop
Definition: structs.h:80
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:675
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3171
LSet L
Definition: kutil.h:323
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pNext(p)
Definition: monomials.h:36
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 538 of file kutil.cc.

539 {
540  int i,j;
541  poly p;
542  assume(currRing == strat->tailRing || strat->tailRing != NULL);
543 
544  pShallowCopyDeleteProc p_shallow_copy_delete =
545  (strat->tailRing != currRing ?
547  NULL);
548  for (j=0; j<=strat->tl; j++)
549  {
550  p = strat->T[j].p;
551  strat->T[j].p=NULL;
552  if (strat->T[j].max_exp != NULL)
553  {
554  p_LmFree(strat->T[j].max_exp, strat->tailRing);
555  }
556  i = -1;
557  loop
558  {
559  i++;
560  if (i>strat->sl)
561  {
562  if (strat->T[j].t_p != NULL)
563  {
564  p_Delete(&(strat->T[j].t_p), strat->tailRing);
565  p_LmFree(p, currRing);
566  }
567  else
568  {
569 #ifdef HAVE_SHIFTBBA
570  if (currRing->isLPring && strat->T[j].shift > 0)
571  {
572  pNext(p) = NULL; // pNext(p) points to the unshifted tail, don't try to delete it here
573  }
574 #endif
575  pDelete(&p);
576  }
577  break;
578  }
579  if (p == strat->S[i])
580  {
581  if (strat->T[j].t_p != NULL)
582  {
583  if (p_shallow_copy_delete!=NULL)
584  {
585  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
586  currRing->PolyBin);
587  }
588  p_LmFree(strat->T[j].t_p, strat->tailRing);
589  }
590  break;
591  }
592  }
593  }
594  strat->tl=-1;
595 }
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:348
#define loop
Definition: structs.h:80
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:44
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
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 1178 of file kInline.h.

1180 {
1181  assume(p_sev == pGetShortExpVector(p));
1182  if (strat->noClearS) return;
1183  #ifdef HAVE_RINGS
1185  {
1186  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1187  return;
1188  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1189  return;
1190  }
1191  else
1192  #endif
1193  {
1194  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1195  }
1196  deleteInS((*at),strat);
1197  (*at)--;
1198  (*k)--;
1199 }
char noClearS
Definition: kutil.h:400
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT = FALSE 
)

Definition at line 10719 of file kutil.cc.

10720 {
10721  int i;
10722  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10723  LObject L;
10724 
10725 #ifdef KDEBUG
10726  // need to set this: during tailreductions of T[i], T[i].max is out of
10727  // sync
10728  sloppy_max = TRUE;
10729 #endif
10730 
10731  strat->noTailReduction = FALSE;
10732  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10733  if (TEST_OPT_PROT)
10734  {
10735  PrintLn();
10736 // if (timerv) writeTime("standard base computed:");
10737  }
10738  if (TEST_OPT_PROT)
10739  {
10740  Print("(S:%d)",strat->sl);mflush();
10741  }
10742  for (i=strat->sl; i>=low; i--)
10743  {
10744  int end_pos=strat->sl;
10745  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10746  if (strat->ak==0) end_pos=i-1;
10747  TObject* T_j = strat->s_2_t(i);
10748  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10749  {
10750  L = *T_j;
10751  #ifdef KDEBUG
10752  if (TEST_OPT_DEBUG)
10753  {
10754  Print("test S[%d]:",i);
10755  p_wrp(L.p,currRing,strat->tailRing);
10756  PrintLn();
10757  }
10758  #endif
10760  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10761  else
10762  strat->S[i] = redtail(&L, strat->sl, strat);
10763  #ifdef KDEBUG
10764  if (TEST_OPT_DEBUG)
10765  {
10766  Print("to (tailR) S[%d]:",i);
10767  p_wrp(strat->S[i],currRing,strat->tailRing);
10768  PrintLn();
10769  }
10770  #endif
10771 
10772  if (strat->redTailChange)
10773  {
10774  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10775  if (pNext(T_j->p) != NULL)
10776  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10777  else
10778  T_j->max_exp = NULL;
10779  }
10781  T_j->pCleardenom();
10782  }
10783  else
10784  {
10785  assume(currRing == strat->tailRing);
10786  #ifdef KDEBUG
10787  if (TEST_OPT_DEBUG)
10788  {
10789  Print("test S[%d]:",i);
10790  p_wrp(strat->S[i],currRing,strat->tailRing);
10791  PrintLn();
10792  }
10793  #endif
10795  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10796  else
10797  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10799  {
10800  if (TEST_OPT_CONTENTSB)
10801  {
10802  number n;
10803  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
10804  if (!nIsOne(n))
10805  {
10807  denom->n=nInvers(n);
10808  denom->next=DENOMINATOR_LIST;
10809  DENOMINATOR_LIST=denom;
10810  }
10811  nDelete(&n);
10812  }
10813  else
10814  {
10815  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
10816  }
10817  }
10818  #ifdef KDEBUG
10819  if (TEST_OPT_DEBUG)
10820  {
10821  Print("to (-tailR) S[%d]:",i);
10822  p_wrp(strat->S[i],currRing,strat->tailRing);
10823  PrintLn();
10824  }
10825  #endif
10826  }
10827  if (TEST_OPT_PROT)
10828  PrintS("-");
10829  }
10830  if (TEST_OPT_PROT) PrintLn();
10831 #ifdef KDEBUG
10832  sloppy_max = FALSE;
10833 #endif
10834 }
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:376
#define TEST_OPT_CONTENTSB
Definition: options.h:125
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:88
int ak
Definition: kutil.h:351
#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:682
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2900
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
ring tailRing
Definition: kutil.h:341
denominator_list next
Definition: kutil.h:61
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:47
int sl
Definition: kutil.h:346
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2791
char redTailChange
Definition: kutil.h:397
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:1128

◆ createG0()

ideal createG0 ( )

Definition at line 4456 of file kutil.cc.

4457 {
4458  // Initialize
4459  long exp[50]; // The exponent of \hat{X} (basepoint)
4460  long cexp[50]; // The current exponent for iterating over all
4461  long ind[50]; // The power of 2 in the i-th component of exp
4462  long cind[50]; // analog for cexp
4463  long mult[50]; // How to multiply the elements of G
4464  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4465  long habsind = 0; // The abs. index of the coefficient of h
4466  long step[50]; // The last increases
4467  for (int i = 1; i <= currRing->N; i++)
4468  {
4469  exp[i] = 0;
4470  cexp[i] = exp[i];
4471  ind[i] = 0;
4472  step[i] = 500000;
4473  cind[i] = ind[i];
4474  }
4475  long bound = currRing->ch;
4476  step[1] = 500000;
4477 #ifdef OLI_DEBUG
4478  PrintS("-------------\npoly :");
4479 // wrp(p);
4480  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4481  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4482  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4483  Print("bound : %d\n", bound);
4484  Print("cind : %d\n", cabsind);
4485 #endif
4486  if (cabsind == 0)
4487  {
4488  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4489  {
4490  return idInit(1, 1);
4491  }
4492  }
4493  ideal G0 = idInit(1, 1);
4494  // Now the whole simplex
4495  do
4496  {
4497  // Build s-polynomial
4498  // 2**ind-def * mult * g - exp-def * h
4499  poly t_p;
4500  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4501 #ifdef OLI_DEBUG
4502  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4503  PrintS("zPoly : ");
4504  wrp(zeroPoly);
4505  PrintLn();
4506 #endif
4507  // Add to ideal
4508  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4509  IDELEMS(G0) += 1;
4510  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4511  }
4512  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4513  idSkipZeroes(G0);
4514  return G0;
4515 }
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:357
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4327
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4261
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:23
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:35
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:3656
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void wrp(poly p)
Definition: polys.h:305

◆ deleteHC() [1/2]

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

Definition at line 319 of file kutil.cc.

320 {
321  LObject L(*p, currRing, strat->tailRing);
322 
323  deleteHC(&L, strat);
324  *p = L.p;
325  *e = L.ecart;
326  *l = L.length;
327  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
328 }
class sLObject LObject
Definition: kutil.h:54
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 244 of file kutil.cc.

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

◆ deleteInL()

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

Definition at line 1203 of file kutil.cc.

1204 {
1205  if (set[j].lcm!=NULL)
1206  {
1207  kDeleteLcm(&set[j]);
1208  }
1209  if (set[j].sig!=NULL)
1210  {
1211 #ifdef HAVE_RINGS
1212  if (pGetCoeff(set[j].sig) != NULL)
1213  pLmDelete(set[j].sig);
1214  else
1215 #endif
1216  pLmFree(set[j].sig);
1217  }
1218  if (set[j].p!=NULL)
1219  {
1220  if (pNext(set[j].p) == strat->tail)
1221  {
1222 #ifdef HAVE_RINGS
1223  if (pGetCoeff(set[j].p) != NULL)
1224  pLmDelete(set[j].p);
1225  else
1226 #endif
1227  pLmFree(set[j].p);
1228  /*- tail belongs to several int spolys -*/
1229  }
1230  else
1231  {
1232  // search p in T, if it is there, do not delete it
1233  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1234  {
1235  // assure that for global orderings kFindInT fails
1236  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1237  set[j].Delete();
1238  }
1239  }
1240  }
1241  if (*length > 0 && j < *length)
1242  {
1243 #ifdef ENTER_USE_MEMMOVE
1244  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1245 #else
1246  int i;
1247  for (i=j; i < (*length); i++)
1248  set[i] = set[i+1];
1249 #endif
1250  }
1251 #ifdef KDEBUG
1252  memset(&(set[*length]),0,sizeof(LObject));
1253 #endif
1254  (*length)--;
1255 }
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:711
#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:876
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 1096 of file kutil.cc.

1097 {
1098 #ifdef ENTER_USE_MEMMOVE
1099  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1100  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1101  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1102  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1103 #else
1104  int j;
1105  for (j=i; j<strat->sl; j++)
1106  {
1107  strat->S[j] = strat->S[j+1];
1108  strat->ecartS[j] = strat->ecartS[j+1];
1109  strat->sevS[j] = strat->sevS[j+1];
1110  strat->S_2_R[j] = strat->S_2_R[j+1];
1111  }
1112 #endif
1113  if (strat->lenS!=NULL)
1114  {
1115 #ifdef ENTER_USE_MEMMOVE
1116  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1117 #else
1118  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1119 #endif
1120  }
1121  if (strat->lenSw!=NULL)
1122  {
1123 #ifdef ENTER_USE_MEMMOVE
1124  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1125 #else
1126  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1127 #endif
1128  }
1129  if (strat->fromQ!=NULL)
1130  {
1131 #ifdef ENTER_USE_MEMMOVE
1132  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1133 #else
1134  for (j=i; j<strat->sl; j++)
1135  {
1136  strat->fromQ[j] = strat->fromQ[j+1];
1137  }
1138 #endif
1139  }
1140  strat->S[strat->sl] = NULL;
1141  strat->sl--;
1142 }
int j
Definition: facHensel.cc:105
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346

◆ deleteInSSba()

void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 1148 of file kutil.cc.

1149 {
1150 #ifdef ENTER_USE_MEMMOVE
1151  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1152  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1153  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1154  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1155  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1156  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1157 #else
1158  int j;
1159  for (j=i; j<strat->sl; j++)
1160  {
1161  strat->S[j] = strat->S[j+1];
1162  strat->sig[j] = strat->sig[j+1];
1163  strat->ecartS[j] = strat->ecartS[j+1];
1164  strat->sevS[j] = strat->sevS[j+1];
1165  strat->sevSig[j] = strat->sevSig[j+1];
1166  strat->S_2_R[j] = strat->S_2_R[j+1];
1167  }
1168 #endif
1169  if (strat->lenS!=NULL)
1170  {
1171 #ifdef ENTER_USE_MEMMOVE
1172  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1173 #else
1174  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1175 #endif
1176  }
1177  if (strat->lenSw!=NULL)
1178  {
1179 #ifdef ENTER_USE_MEMMOVE
1180  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1181 #else
1182  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1183 #endif
1184  }
1185  if (strat->fromQ!=NULL)
1186  {
1187 #ifdef ENTER_USE_MEMMOVE
1188  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1189 #else
1190  for (j=i; j<strat->sl; j++)
1191  {
1192  strat->fromQ[j] = strat->fromQ[j+1];
1193  }
1194 #endif
1195  }
1196  strat->S[strat->sl] = NULL;
1197  strat->sl--;
1198 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int j
Definition: facHensel.cc:105
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4604 of file kutil.cc.

4605 {
4606  if (nIsOne(pGetCoeff(h))) return;
4607  number gcd;
4608  bool go = false;
4609  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4610  {
4611  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4612  go = true;
4613  }
4614  else
4615  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4616  if (go || !nIsOne(gcd))
4617  {
4618  poly p = h->next;
4619  if (!go)
4620  {
4621  number tmp = gcd;
4622  gcd = n_Ann(gcd,currRing->cf);
4623  nDelete(&tmp);
4624  }
4625  p_Test(p,strat->tailRing);
4626  p = __pp_Mult_nn(p, gcd, strat->tailRing);
4627  nDelete(&gcd);
4628 
4629  if (p != NULL)
4630  {
4631  if (TEST_OPT_PROT)
4632  {
4633  PrintS("Z");
4634  }
4635 #ifdef KDEBUG
4636  if (TEST_OPT_DEBUG)
4637  {
4638  PrintS("--- create zero spoly: ");
4639  p_wrp(h,currRing,strat->tailRing);
4640  PrintS(" ---> ");
4641  }
4642 #endif
4643  poly tmp = pInit();
4644  pSetCoeff0(tmp, pGetCoeff(p));
4645  for (int i = 1; i <= rVar(currRing); i++)
4646  {
4647  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4648  }
4650  {
4651  p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
4652  }
4653  p_Setm(tmp, currRing);
4654  p = p_LmFreeAndNext(p, strat->tailRing);
4655  pNext(tmp) = p;
4656  LObject Lp;
4657  Lp.Init();
4658  Lp.p = tmp;
4659  Lp.tailRing = strat->tailRing;
4660  int posx;
4661  if (Lp.p!=NULL)
4662  {
4663  strat->initEcart(&Lp);
4664  if (strat->Ll==-1)
4665  posx =0;
4666  else
4667  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4668  Lp.sev = pGetShortExpVector(Lp.p);
4669  if (strat->tailRing != currRing)
4670  {
4671  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4672  }
4673 #ifdef KDEBUG
4674  if (TEST_OPT_DEBUG)
4675  {
4676  p_wrp(tmp,currRing,strat->tailRing);
4677  PrintLn();
4678  }
4679 #endif
4680  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4681  }
4682  }
4683  }
4684  nDelete(&gcd);
4685 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h: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:349
#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:246
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
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:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:957
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:702
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:162
#define rRing_has_Comp(r)
Definition: monomials.h:266
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
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:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ enterExtendedSpolySig()

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

Definition at line 4687 of file kutil.cc.

4688 {
4689  if (nIsOne(pGetCoeff(h))) return;
4690  number gcd;
4691  bool go = false;
4692  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4693  {
4694  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4695  go = true;
4696  }
4697  else
4698  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4699  if (go || !nIsOne(gcd))
4700  {
4701  poly p = h->next;
4702  if (!go)
4703  {
4704  number tmp = gcd;
4705  gcd = n_Ann(gcd,currRing->cf);
4706  nDelete(&tmp);
4707  }
4708  p_Test(p,strat->tailRing);
4709  p = __pp_Mult_nn(p, gcd, strat->tailRing);
4710 
4711  if (p != NULL)
4712  {
4713  if (TEST_OPT_PROT)
4714  {
4715  PrintS("Z");
4716  }
4717 #ifdef KDEBUG
4718  if (TEST_OPT_DEBUG)
4719  {
4720  PrintS("--- create zero spoly: ");
4721  p_wrp(h,currRing,strat->tailRing);
4722  PrintS(" ---> ");
4723  }
4724 #endif
4725  poly tmp = pInit();
4726  pSetCoeff0(tmp, pGetCoeff(p));
4727  for (int i = 1; i <= rVar(currRing); i++)
4728  {
4729  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4730  }
4732  {
4733  p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
4734  }
4735  p_Setm(tmp, currRing);
4736  p = p_LmFreeAndNext(p, strat->tailRing);
4737  pNext(tmp) = p;
4738  LObject Lp;
4739  Lp.Init();
4740  Lp.p = tmp;
4741  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4742  #if EXT_POLY_NEW
4743  Lp.sig = __pp_Mult_nn(hSig, gcd, currRing);
4744  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4745  {
4746  strat->sigdrop = TRUE;
4747  //Try to reduce it as far as we can via redRing
4748  int red_result = redRing(&Lp,strat);
4749  if(red_result == 0)
4750  {
4751  // Cancel the sigdrop
4752  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4753  strat->sigdrop = FALSE;
4754  return;
4755  }
4756  else
4757  {
4758  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4759  #if 1
4760  strat->enterS(Lp,0,strat,strat->tl);
4761  #endif
4762  return;
4763  }
4764 
4765  }
4766  #else
4767  Lp.sig = pOne();
4768  if(strat->Ll >= 0)
4769  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4770  else
4771  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4772  #endif
4773  Lp.tailRing = strat->tailRing;
4774  int posx;
4775  if (Lp.p!=NULL)
4776  {
4777  strat->initEcart(&Lp);
4778  if (strat->Ll==-1)
4779  posx =0;
4780  else
4781  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4782  Lp.sev = pGetShortExpVector(Lp.p);
4783  if (strat->tailRing != currRing)
4784  {
4785  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4786  }
4787 #ifdef KDEBUG
4788  if (TEST_OPT_DEBUG)
4789  {
4790  p_wrp(tmp,currRing,strat->tailRing);
4791  PrintLn();
4792  }
4793 #endif
4794  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4795  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4796  }
4797  }
4798  nDelete(&gcd);
4799  }
4800  nDelete(&gcd);
4801 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:686
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:358
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#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:246
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#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:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
LObject P
Definition: kutil.h:298
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:957
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:310
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:702
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:162
#define rRing_has_Comp(r)
Definition: monomials.h:266
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
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:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int sl
Definition: kutil.h:346
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ enterL()

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

Definition at line 1260 of file kutil.cc.

1261 {
1262  // this should be corrected
1263  assume(p.FDeg == p.pFDeg());
1264 
1265  if ((*length)>=0)
1266  {
1267  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1268  if (at <= (*length))
1269 #ifdef ENTER_USE_MEMMOVE
1270  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1271 #else
1272  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1273 #endif
1274  }
1275  else at = 0;
1276  (*set)[at] = p;
1277  (*length)++;
1278 }
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:656
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 1929 of file kutil.cc.

1930 {
1931  assume(i<=strat->sl);
1932 
1933  int l,j,compare;
1934  LObject Lp;
1935  Lp.i_r = -1;
1936 
1937 #ifdef KDEBUG
1938  Lp.ecart=0; Lp.length=0;
1939 #endif
1940  /*- computes the lcm(s[i],p) -*/
1941  Lp.lcm = pInit();
1942 
1943 #ifndef HAVE_RATGRING
1944  pLcm(p,strat->S[i],Lp.lcm);
1945 #elif defined(HAVE_RATGRING)
1946  if (rIsRatGRing(currRing))
1947  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1948  else
1949  pLcm(p,strat->S[i],Lp.lcm);
1950 #endif
1951  pSetm(Lp.lcm);
1952 
1953 
1954  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1955  {
1956  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1957  && pHasNotCF(p,strat->S[i]))
1958  {
1959  /*
1960  *the product criterion has applied for (s,p),
1961  *i.e. lcm(s,p)=product of the leading terms of s and p.
1962  *Suppose (s,r) is in L and the leading term
1963  *of p divides lcm(s,r)
1964  *(==> the leading term of p divides the leading term of r)
1965  *but the leading term of s does not divide the leading term of r
1966  *(notice that tis condition is automatically satisfied if r is still
1967  *in S), then (s,r) can be cancelled.
1968  *This should be done here because the
1969  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1970  *
1971  *Moreover, skipping (s,r) holds also for the noncommutative case.
1972  */
1973  strat->cp++;
1974  pLmFree(Lp.lcm);
1975  return;
1976  }
1977  else
1978  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1979  if (strat->fromT && (strat->ecartS[i]>ecart))
1980  {
1981  pLmFree(Lp.lcm);
1982  return;
1983  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1984  }
1985  /*
1986  *the set B collects the pairs of type (S[j],p)
1987  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1988  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1989  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1990  */
1991  {
1992  j = strat->Bl;
1993  loop
1994  {
1995  if (j < 0) break;
1996  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1997  if ((compare==1)
1998  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1999  {
2000  strat->c3++;
2001  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2002  {
2003  pLmFree(Lp.lcm);
2004  return;
2005  }
2006  break;
2007  }
2008  else
2009  if ((compare ==-1)
2010  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2011  {
2012  deleteInL(strat->B,&strat->Bl,j,strat);
2013  strat->c3++;
2014  }
2015  j--;
2016  }
2017  }
2018  }
2019  else /*sugarcrit*/
2020  {
2021  if (ALLOW_PROD_CRIT(strat))
2022  {
2023  // if currRing->nc_type!=quasi (or skew)
2024  // TODO: enable productCrit for super commutative algebras...
2025  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2026  pHasNotCF(p,strat->S[i]))
2027  {
2028  /*
2029  *the product criterion has applied for (s,p),
2030  *i.e. lcm(s,p)=product of the leading terms of s and p.
2031  *Suppose (s,r) is in L and the leading term
2032  *of p devides lcm(s,r)
2033  *(==> the leading term of p devides the leading term of r)
2034  *but the leading term of s does not devide the leading term of r
2035  *(notice that tis condition is automatically satisfied if r is still
2036  *in S), then (s,r) can be canceled.
2037  *This should be done here because the
2038  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2039  */
2040  strat->cp++;
2041  pLmFree(Lp.lcm);
2042  return;
2043  }
2044  if (strat->fromT && (strat->ecartS[i]>ecart))
2045  {
2046  pLmFree(Lp.lcm);
2047  return;
2048  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2049  }
2050  /*
2051  *the set B collects the pairs of type (S[j],p)
2052  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2053  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2054  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2055  */
2056  for(j = strat->Bl;j>=0;j--)
2057  {
2058  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2059  if (compare==1)
2060  {
2061  strat->c3++;
2062  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2063  {
2064  pLmFree(Lp.lcm);
2065  return;
2066  }
2067  break;
2068  }
2069  else
2070  if (compare ==-1)
2071  {
2072  deleteInL(strat->B,&strat->Bl,j,strat);
2073  strat->c3++;
2074  }
2075  }
2076  }
2077  }
2078  /*
2079  *the pair (S[i],p) enters B if the spoly != 0
2080  */
2081  /*- compute the short s-polynomial -*/
2082  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2083  pNorm(p);
2084 
2085  if ((strat->S[i]==NULL) || (p==NULL))
2086  return;
2087 
2088  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2089  Lp.p=NULL;
2090  else
2091  {
2092  #ifdef HAVE_PLURAL
2093  if ( rIsPluralRing(currRing) )
2094  {
2095  if(pHasNotCF(p, strat->S[i]))
2096  {
2097  if(ncRingType(currRing) == nc_lie)
2098  {
2099  // generalized prod-crit for lie-type
2100  strat->cp++;
2101  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2102  }
2103  else
2104  if( ALLOW_PROD_CRIT(strat) )
2105  {
2106  // product criterion for homogeneous case in SCA
2107  strat->cp++;
2108  Lp.p = NULL;
2109  }
2110  else
2111  {
2112  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2113  nc_CreateShortSpoly(strat->S[i], p, currRing);
2114  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2115  pNext(Lp.p) = strat->tail; // !!!
2116  }
2117  }
2118  else
2119  {
2120  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2121  nc_CreateShortSpoly(strat->S[i], p, currRing);
2122 
2123  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2124  pNext(Lp.p) = strat->tail; // !!!
2125  }
2126  }
2127  else
2128  #endif
2129  {
2131  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2132  }
2133  }
2134  if (Lp.p == NULL)
2135  {
2136  /*- the case that the s-poly is 0 -*/
2137  if (strat->pairtest==NULL) initPairtest(strat);
2138  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2139  strat->pairtest[strat->sl+1] = TRUE;
2140  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2141  /*
2142  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2143  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2144  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2145  *term of p devides the lcm(s,r)
2146  *(this canceling should be done here because
2147  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2148  *the first case is handeled in chainCrit
2149  */
2150  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2151  }
2152  else
2153  {
2154  /*- the pair (S[i],p) enters B -*/
2155  Lp.p1 = strat->S[i];
2156  Lp.p2 = p;
2157 
2158  if (
2160 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2161  )
2162  {
2163  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2164  pNext(Lp.p) = strat->tail; // !!!
2165  }
2166 
2167  if (atR >= 0)
2168  {
2169  Lp.i_r1 = strat->S_2_R[i];
2170  Lp.i_r2 = atR;
2171  }
2172  else
2173  {
2174  Lp.i_r1 = -1;
2175  Lp.i_r2 = -1;
2176  }
2177  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2178 
2180  {
2181  if (!rIsPluralRing(currRing)
2183  && (Lp.p->coef!=NULL))
2184  nDelete(&(Lp.p->coef));
2185  }
2186 
2187  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2188  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2189  }
2190 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
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:266
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:340
int c3
Definition: kutil.h:345
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:331
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:258
#define pLcm(a, b, m)
Definition: polys.h:290
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1879
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
#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:397
intset fromQ
Definition: kutil.h:317
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:332
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
void initPairtest(kStrategy strat)
Definition: kutil.cc:666
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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:346
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:393
int p
Definition: cfModGcd.cc:4019
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
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 
)

Definition at line 12337 of file kutil.cc.

12338 {
12339  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12340  /* that is create the pairs (f, s \dot g) */
12341 
12342  int toInsert = itoInsert(qq, currRing);
12343 
12344  /* these vars hold for all shifts of s[i] */
12345  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12346  int qfromQ = 0; // strat->fromQ[i];
12347 
12348  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 */
12349  for (int j = 1; j<= toInsert; j++)
12350  {
12351  poly q = pLPCopyAndShiftLM(qq, j);
12352  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1);
12353  }
12354 }
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
int j
Definition: facHensel.cc:105
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
Definition: kutil.cc:12361
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 
)

Definition at line 12361 of file kutil.cc.

12362 {
12363 
12364  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12365 
12366  /* check this Formats: */
12368  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12371 
12372 #ifdef KDEBUG
12373 // if (TEST_OPT_DEBUG)
12374 // {
12375 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12376 // wrp(q); // wrp(pHead(q));
12377 // PrintS(", p = ");
12378 // wrp(p); //wrp(pHead(p));
12379 // PrintLn();
12380 // }
12381 #endif
12382 
12383  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12384 
12385  int qfromQ = qisFromQ;
12386 
12387  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12388 
12389  int l,j,compare;
12390  LObject Lp;
12391  Lp.i_r = -1;
12392 
12393 #ifdef KDEBUG
12394  Lp.ecart=0; Lp.length=0;
12395 #endif
12396  /*- computes the lcm(s[i],p) -*/
12397  Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation
12398 
12399  /* apply the V criterion */
12400  if (!pIsInV(Lp.lcm))
12401  {
12402 #ifdef KDEBUG
12403  if (TEST_OPT_DEBUG)
12404  {
12405  PrintS("V crit applied to q = ");
12406  wrp(q); // wrp(pHead(q));
12407  PrintS(", p = ");
12408  wrp(p); //wrp(pHead(p));
12409  PrintLn();
12410  }
12411 #endif
12412  pLmFree(Lp.lcm);
12413  /* + counter for applying the V criterion */
12414  strat->cv++;
12415  return;
12416  }
12417 
12418  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12419  {
12420  if((!((ecartq>0)&&(ecart>0)))
12421  && pHasNotCF(p,q))
12422  {
12423  /*
12424  *the product criterion has applied for (s,p),
12425  *i.e. lcm(s,p)=product of the leading terms of s and p.
12426  *Suppose (s,r) is in L and the leading term
12427  *of p divides lcm(s,r)
12428  *(==> the leading term of p divides the leading term of r)
12429  *but the leading term of s does not divide the leading term of r
12430  *(notice that this condition is automatically satisfied if r is still
12431  *in S), then (s,r) can be cancelled.
12432  *This should be done here because the
12433  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12434  *
12435  *Moreover, skipping (s,r) holds also for the noncommutative case.
12436  */
12437  strat->cp++;
12438  pLmFree(Lp.lcm);
12439  return;
12440  }
12441  else
12442  Lp.ecart = si_max(ecart,ecartq);
12443  if (strat->fromT && (ecartq>ecart))
12444  {
12445  pLmFree(Lp.lcm);
12446  return;
12447  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12448  }
12449  /*
12450  *the set B collects the pairs of type (S[j],p)
12451  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12452  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12453  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12454  */
12455  {
12456  j = strat->Bl;
12457  loop
12458  {
12459  if (j < 0) break;
12460  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12461  if ((compare==1)
12462  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12463  {
12464  strat->c3++;
12465  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12466  {
12467  pLmFree(Lp.lcm);
12468  return;
12469  }
12470  break;
12471  }
12472  else
12473  if ((compare ==-1)
12474  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12475  {
12476  deleteInL(strat->B,&strat->Bl,j,strat);
12477  strat->c3++;
12478  }
12479  j--;
12480  }
12481  }
12482  }
12483  else /*sugarcrit*/
12484  {
12485  if (ALLOW_PROD_CRIT(strat))
12486  {
12487  // if currRing->nc_type!=quasi (or skew)
12488  // TODO: enable productCrit for super commutative algebras...
12489  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12490  pHasNotCF(p,q))
12491  {
12492  /*
12493  *the product criterion has applied for (s,p),
12494  *i.e. lcm(s,p)=product of the leading terms of s and p.
12495  *Suppose (s,r) is in L and the leading term
12496  *of p devides lcm(s,r)
12497  *(==> the leading term of p devides the leading term of r)
12498  *but the leading term of s does not devide the leading term of r
12499  *(notice that tis condition is automatically satisfied if r is still
12500  *in S), then (s,r) can be canceled.
12501  *This should be done here because the
12502  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12503  */
12504  strat->cp++;
12505  pLmFree(Lp.lcm);
12506  return;
12507  }
12508  if (strat->fromT && (ecartq>ecart))
12509  {
12510  pLmFree(Lp.lcm);
12511  return;
12512  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12513  }
12514  /*
12515  *the set B collects the pairs of type (S[j],p)
12516  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12517  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12518  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12519  */
12520  for(j = strat->Bl;j>=0;j--)
12521  {
12522  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12523  if (compare==1)
12524  {
12525  strat->c3++;
12526  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12527  {
12528  pLmFree(Lp.lcm);
12529  return;
12530  }
12531  break;
12532  }
12533  else
12534  if (compare ==-1)
12535  {
12536  deleteInL(strat->B,&strat->Bl,j,strat);
12537  strat->c3++;
12538  }
12539  }
12540  }
12541  }
12542  /*
12543  *the pair (S[i],p) enters B if the spoly != 0
12544  */
12545  /*- compute the short s-polynomial -*/
12546  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12547  pNorm(p);
12548  if ((q==NULL) || (p==NULL))
12549  return;
12550  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12551  Lp.p=NULL;
12552  else
12553  {
12554 // if ( rIsPluralRing(currRing) )
12555 // {
12556 // if(pHasNotCF(p, q))
12557 // {
12558 // if(ncRingType(currRing) == nc_lie)
12559 // {
12560 // // generalized prod-crit for lie-type
12561 // strat->cp++;
12562 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12563 // }
12564 // else
12565 // if( ALLOW_PROD_CRIT(strat) )
12566 // {
12567 // // product criterion for homogeneous case in SCA
12568 // strat->cp++;
12569 // Lp.p = NULL;
12570 // }
12571 // else
12572 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12573 // }
12574 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12575 // }
12576 // else
12577 // {
12578 
12579  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12580  /* p is already in this form, so convert q */
12581  // q = pMove2CurrTail(q, strat);
12582  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12583  // }
12584  }
12585  if (Lp.p == NULL)
12586  {
12587  /*- the case that the s-poly is 0 -*/
12588  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12589 // if (strat->pairtest==NULL) initPairtest(strat);
12590 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12591 // strat->pairtest[strat->sl+1] = TRUE;
12592 // new: visual check how often this happens: ! for the debug situation
12593 #ifdef KDEBUG
12594  Print("!");
12595  //if (TEST_OPT_DEBUG){Print("!");} // option teach
12596 #endif /* KDEBUG */
12597  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12598  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12599  /*
12600  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12601  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12602  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12603  *term of p devides the lcm(s,r)
12604  *(this canceling should be done here because
12605  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12606  *the first case is handeled in chainCrit
12607  */
12608  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12609  }
12610  else
12611  {
12612  /*- the pair (S[i],p) enters B -*/
12613  /* both of them should have their LM in currRing and TAIL in tailring */
12614  Lp.p1 = q; // already in the needed form
12615  Lp.p2 = p; // already in the needed form
12616 
12617  if ( !rIsPluralRing(currRing) )
12618  pNext(Lp.p) = strat->tail;
12619 
12620  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12621  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12622  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12623  {
12624  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12625  Lp.i_r2 = atR;
12626  }
12627  else
12628  {
12629  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12630  Lp.i_r1 = -1;
12631  Lp.i_r2 = -1;
12632  }
12633  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12634 
12636  {
12637  if (!rIsPluralRing(currRing)
12639  && (Lp.p->coef!=NULL))
12640  nDelete(&(Lp.p->coef));
12641  }
12642 
12643  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12644  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12645  }
12646 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
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:69
class sLObject LObject
Definition: kutil.h:54
int c3
Definition: kutil.h:345
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:711
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
int cv
Definition: kutil.h:367
int Bl
Definition: kutil.h:350
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
#define pHasNotCF(p1, p2)
Definition: polys.h:258
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1390
int Bmax
Definition: kutil.h:350
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
char sugarCrit
Definition: kutil.h:375
#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:397
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:100
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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:393
int p
Definition: cfModGcd.cc:4019
void wrp(poly p)
Definition: polys.h:305
#define pIsInV(p)
Definition: shiftop.h:50
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1317
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 4859 of file kutil.cc.

4860 {
4861  int j=pos;
4862 
4864  initenterpairs(h,k,ecart,0,strat, atR);
4865  if ( (!strat->fromT)
4866  && ((strat->syzComp==0)
4867  ||(pGetComp(h)<=strat->syzComp)))
4868  {
4869  unsigned long h_sev = pGetShortExpVector(h);
4870  loop
4871  {
4872  if (j > k) break;
4873  clearS(h,h_sev, &j,&k,strat);
4874  j++;
4875  }
4876  }
4877 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3769
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#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.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ enterpairsShift()

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

Definition at line 12728 of file kutil.cc.

12729 {
12730  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12731  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12732  int j=pos;
12733 
12735  initenterpairsShift(h,k,ecart,0,strat, atR);
12736  if ( (!strat->fromT)
12737  && ((strat->syzComp==0)
12738  ||(pGetComp(h)<=strat->syzComp)))
12739  {
12740  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12741  unsigned long h_sev = pGetShortExpVector(h);
12742  loop
12743  {
12744  if (j > k) break;
12745  clearS(h,h_sev, &j,&k,strat);
12746  j++;
12747  }
12748  //Print("end clearS sl=%d\n",strat->sl);
12749  }
12750  // PrintS("end enterpairs\n");
12751 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#define pGetComp(p)
Component.
Definition: polys.h:37
#define assume(x)
Definition: mod2.h:390
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:12655
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ enterpairsSig()

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

Definition at line 4885 of file kutil.cc.

4886 {
4887  int j=pos;
4889  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4890  if ( (!strat->fromT)
4891  && ((strat->syzComp==0)
4892  ||(pGetComp(h)<=strat->syzComp)))
4893  {
4894  unsigned long h_sev = pGetShortExpVector(h);
4895  loop
4896  {
4897  if (j > k) break;
4898  clearS(h,h_sev, &j,&k,strat);
4899  j++;
4900  }
4901  }
4902 }
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int syzComp
Definition: kutil.h:352
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3834
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#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.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
static Poly * h
Definition: janet.cc:971

◆ enterSBba()

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

Definition at line 9261 of file kutil.cc.

9262 {
9263  strat->news = TRUE;
9264  /*- puts p to the standardbasis s at position at -*/
9265  if (strat->sl == IDELEMS(strat->Shdl)-1)
9266  {
9267  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9268  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9269  (IDELEMS(strat->Shdl)+setmaxTinc)
9270  *sizeof(unsigned long));
9271  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9272  IDELEMS(strat->Shdl)*sizeof(int),
9273  (IDELEMS(strat->Shdl)+setmaxTinc)
9274  *sizeof(int));
9275  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9276  IDELEMS(strat->Shdl)*sizeof(int),
9277  (IDELEMS(strat->Shdl)+setmaxTinc)
9278  *sizeof(int));
9279  if (strat->lenS!=NULL)
9280  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9281  IDELEMS(strat->Shdl)*sizeof(int),
9282  (IDELEMS(strat->Shdl)+setmaxTinc)
9283  *sizeof(int));
9284  if (strat->lenSw!=NULL)
9285  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9286  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9287  (IDELEMS(strat->Shdl)+setmaxTinc)
9288  *sizeof(wlen_type));
9289  if (strat->fromQ!=NULL)
9290  {
9291  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9292  IDELEMS(strat->Shdl)*sizeof(int),
9293  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9294  }
9295  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9296  IDELEMS(strat->Shdl)+=setmaxTinc;
9297  strat->Shdl->m=strat->S;
9298  }
9299  if (atS <= strat->sl)
9300  {
9301 #ifdef ENTER_USE_MEMMOVE
9302  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9303  (strat->sl - atS + 1)*sizeof(poly));
9304  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9305  (strat->sl - atS + 1)*sizeof(int));
9306  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9307  (strat->sl - atS + 1)*sizeof(unsigned long));
9308  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9309  (strat->sl - atS + 1)*sizeof(int));
9310  if (strat->lenS!=NULL)
9311  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9312  (strat->sl - atS + 1)*sizeof(int));
9313  if (strat->lenSw!=NULL)
9314  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9315  (strat->sl - atS + 1)*sizeof(wlen_type));
9316 #else
9317  for (i=strat->sl+1; i>=atS+1; i--)
9318  {
9319  strat->S[i] = strat->S[i-1];
9320  strat->ecartS[i] = strat->ecartS[i-1];
9321  strat->sevS[i] = strat->sevS[i-1];
9322  strat->S_2_R[i] = strat->S_2_R[i-1];
9323  }
9324  if (strat->lenS!=NULL)
9325  for (i=strat->sl+1; i>=atS+1; i--)
9326  strat->lenS[i] = strat->lenS[i-1];
9327  if (strat->lenSw!=NULL)
9328  for (i=strat->sl+1; i>=atS+1; i--)
9329  strat->lenSw[i] = strat->lenSw[i-1];
9330 #endif
9331  }
9332  if (strat->fromQ!=NULL)
9333  {
9334 #ifdef ENTER_USE_MEMMOVE
9335  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9336  (strat->sl - atS + 1)*sizeof(int));
9337 #else
9338  for (i=strat->sl+1; i>=atS+1; i--)
9339  {
9340  strat->fromQ[i] = strat->fromQ[i-1];
9341  }
9342 #endif
9343  strat->fromQ[atS]=0;
9344  }
9345 
9346  /*- save result -*/
9347  poly pp=p.p;
9348  strat->S[atS] = pp;
9349  if (strat->honey) strat->ecartS[atS] = p.ecart;
9350  if (p.sev == 0)
9351  p.sev = pGetShortExpVector(pp);
9352  else
9353  assume(p.sev == pGetShortExpVector(pp));
9354  strat->sevS[atS] = p.sev;
9355  strat->ecartS[atS] = p.ecart;
9356  strat->S_2_R[atS] = atR;
9357  strat->sl++;
9358 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
char news
Definition: kutil.h:398
#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:317
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.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
char honey
Definition: kutil.h:375
#define setmaxTinc
Definition: kutil.h:34
int * intset
Definition: kutil.h:49
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299

◆ enterSBbaShift()

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

Definition at line 9361 of file kutil.cc.

9362 {
9363  int toInsert = itoInsert(p.p, strat->tailRing);
9364  for (int i = toInsert; i > 0; i--)
9365  {
9366  LObject qq;
9367  qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order
9368  qq.shift = i;
9369  strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart
9370  enterSBba(qq, atS, strat, -1);
9371  }
9372  enterSBba(p, atS, strat, atR);
9373 }
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
class sLObject LObject
Definition: kutil.h:54
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int i
Definition: cfEzgcd.cc:125
ring tailRing
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ entersets()

void entersets ( LObject  h)

◆ enterSSba()

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

Definition at line 9380 of file kutil.cc.

9381 {
9382  strat->news = TRUE;
9383  /*- puts p to the standardbasis s at position at -*/
9384  if (strat->sl == IDELEMS(strat->Shdl)-1)
9385  {
9386  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9387  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9388  (IDELEMS(strat->Shdl)+setmax)
9389  *sizeof(unsigned long));
9390  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9391  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9392  (IDELEMS(strat->Shdl)+setmax)
9393  *sizeof(unsigned long));
9394  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9395  IDELEMS(strat->Shdl)*sizeof(int),
9396  (IDELEMS(strat->Shdl)+setmax)
9397  *sizeof(int));
9398  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9399  IDELEMS(strat->Shdl)*sizeof(int),
9400  (IDELEMS(strat->Shdl)+setmax)
9401  *sizeof(int));
9402  if (strat->lenS!=NULL)
9403  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9404  IDELEMS(strat->Shdl)*sizeof(int),
9405  (IDELEMS(strat->Shdl)+setmax)
9406  *sizeof(int));
9407  if (strat->lenSw!=NULL)
9408  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9409  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9410  (IDELEMS(strat->Shdl)+setmax)
9411  *sizeof(wlen_type));
9412  if (strat->fromQ!=NULL)
9413  {
9414  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9415  IDELEMS(strat->Shdl)*sizeof(int),
9416  (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
9417  }
9418  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
9419  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmax);
9420  IDELEMS(strat->Shdl)+=setmax;
9421  strat->Shdl->m=strat->S;
9422  }
9423  // in a signature-based algorithm the following situation will never
9424  // appear due to the fact that the critical pairs are already sorted
9425  // by increasing signature.
9426  // True. However, in the case of integers we need to put the element
9427  // that caused the signature drop on the first position
9428  if (atS <= strat->sl)
9429  {
9430 #ifdef ENTER_USE_MEMMOVE
9431  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9432  (strat->sl - atS + 1)*sizeof(poly));
9433  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9434  (strat->sl - atS + 1)*sizeof(poly));
9435  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9436  (strat->sl - atS + 1)*sizeof(unsigned long));
9437  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9438  (strat->sl - atS + 1)*sizeof(int));
9439  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9440  (strat->sl - atS + 1)*sizeof(unsigned long));
9441  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9442  (strat->sl - atS + 1)*sizeof(int));
9443  if (strat->lenS!=NULL)
9444  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9445  (strat->sl - atS + 1)*sizeof(int));
9446  if (strat->lenSw!=NULL)
9447  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9448  (strat->sl - atS + 1)*sizeof(wlen_type));
9449 #else
9450  for (i=strat->sl+1; i>=atS+1; i--)
9451  {
9452  strat->S[i] = strat->S[i-1];
9453  strat->ecartS[i] = strat->ecartS[i-1];
9454  strat->sevS[i] = strat->sevS[i-1];
9455  strat->S_2_R[i] = strat->S_2_R[i-1];
9456  strat->sig[i] = strat->sig[i-1];
9457  strat->sevSig[i] = strat->sevSig[i-1];
9458  }
9459  if (strat->lenS!=NULL)
9460  for (i=strat->sl+1; i>=atS+1; i--)
9461  strat->lenS[i] = strat->lenS[i-1];
9462  if (strat->lenSw!=NULL)
9463  for (i=strat->sl+1; i>=atS+1; i--)
9464  strat->lenSw[i] = strat->lenSw[i-1];
9465 #endif
9466  }
9467  if (strat->fromQ!=NULL)
9468  {
9469 #ifdef ENTER_USE_MEMMOVE
9470  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9471  (strat->sl - atS + 1)*sizeof(int));
9472 #else
9473  for (i=strat->sl+1; i>=atS+1; i--)
9474  {
9475  strat->fromQ[i] = strat->fromQ[i-1];
9476  }
9477 #endif
9478  strat->fromQ[atS]=0;
9479  }
9480 
9481  /*- save result -*/
9482  strat->S[atS] = p.p;
9483  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9484  if (strat->honey) strat->ecartS[atS] = p.ecart;
9485  if (p.sev == 0)
9486  p.sev = pGetShortExpVector(p.p);
9487  else
9488  assume(p.sev == pGetShortExpVector(p.p));
9489  strat->sevS[atS] = p.sev;
9490  // during the interreduction process of a signature-based algorithm we do not
9491  // compute the signature at this point, but when the whole interreduction
9492  // process finishes, i.e. f5c terminates!
9493  if (p.sig != NULL)
9494  {
9495  if (p.sevSig == 0)
9496  p.sevSig = pGetShortExpVector(p.sig);
9497  else
9498  assume(p.sevSig == pGetShortExpVector(p.sig));
9499  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9500  }
9501  strat->ecartS[atS] = p.ecart;
9502  strat->S_2_R[atS] = atR;
9503  strat->sl++;
9504 #ifdef DEBUGF5
9505  int k;
9506  Print("--- LIST S: %d ---\n",strat->sl);
9507  for(k=0;k<=strat->sl;k++)
9508  {
9509  pWrite(strat->sig[k]);
9510  }
9511  PrintS("--- LIST S END ---\n");
9512 #endif
9513 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:80
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
char news
Definition: kutil.h:398
#define TRUE
Definition: auxiliary.h:98
#define setmax
Definition: kutil.h:29
void pWrite(poly p)
Definition: polys.h:303
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:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
int64 wlen_type
Definition: kutil.h:50
unsigned long * sevS
Definition: kutil.h:318
char honey
Definition: kutil.h:375
int * intset
Definition: kutil.h:49
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299

◆ enterSyz()

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

Definition at line 9778 of file kutil.cc.

9779 {
9780  int i;
9781  strat->newt = TRUE;
9782  if (strat->syzl == strat->syzmax-1)
9783  {
9784  pEnlargeSet(&strat->syz,strat->syzmax,setmax);
9785  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9786  (strat->syzmax)*sizeof(unsigned long),
9787  ((strat->syzmax)+setmax)
9788  *sizeof(unsigned long));
9789  strat->syzmax += setmax;
9790  }
9791  if (atT < strat->syzl)
9792  {
9793 #ifdef ENTER_USE_MEMMOVE
9794  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9795  (strat->syzl-atT+1)*sizeof(poly));
9796  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9797  (strat->syzl-atT+1)*sizeof(unsigned long));
9798 #endif
9799  for (i=strat->syzl; i>=atT+1; i--)
9800  {
9801 #ifndef ENTER_USE_MEMMOVE
9802  strat->syz[i] = strat->syz[i-1];
9803  strat->sevSyz[i] = strat->sevSyz[i-1];
9804 #endif
9805  }
9806  }
9807  //i = strat->syzl;
9808  i = atT;
9809  //Makes sure the syz saves just the signature
9810  #ifdef HAVE_RINGS
9812  pNext(p.sig) = NULL;
9813  #endif
9814  strat->syz[atT] = p.sig;
9815  strat->sevSyz[atT] = p.sevSig;
9816  strat->syzl++;
9817 #if F5DEBUG
9818  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9819  pWrite(strat->syz[atT]);
9820 #endif
9821  // recheck pairs in strat->L with new rule and delete correspondingly
9822  int cc = strat->Ll;
9823  while (cc>-1)
9824  {
9825  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9826  //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);
9827  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9828  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9829  #ifdef HAVE_RINGS
9830  &&((!rField_is_Ring(currRing))
9831  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9832  #endif
9833  )
9834  {
9835  //printf("\nYES!\n");
9836  deleteInL(strat->L,&strat->Ll,cc,strat);
9837  }
9838  cc--;
9839  }
9840 //#if 1
9841 #ifdef DEBUGF5
9842  PrintS("--- Syzygies ---\n");
9843  Print("syzl %d\n",strat->syzl);
9844  Print("syzmax %d\n",strat->syzmax);
9845  PrintS("--------------------------------\n");
9846  for(i=0;i<=strat->syzl-1;i++)
9847  {
9848  Print("%d - ",i);
9849  pWrite(strat->syz[i]);
9850  }
9851  PrintS("--------------------------------\n");
9852 #endif
9853 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:80
int syzmax
Definition: kutil.h:347
int Ll
Definition: kutil.h:349
char newt
Definition: kutil.h:399
#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:303
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int p
Definition: cfModGcd.cc:4019
int syzl
Definition: kutil.h:347

◆ enterT()

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

Definition at line 9576 of file kutil.cc.

9577 {
9578  int i;
9579 
9580 #ifdef PDEBUG
9581 #ifdef HAVE_SHIFTBBA
9582  if (currRing->isLPring && p.shift > 0)
9583  {
9584  // in this case, the order is not correct. test LM and tail separately
9585  p_LmTest(p.p, currRing);
9586  p_Test(pNext(p.p), currRing);
9587  }
9588  else
9589 #endif
9590  {
9591  pp_Test(p.p, currRing, p.tailRing);
9592  }
9593 #endif
9594  assume(strat->tailRing == p.tailRing);
9595  // redMoraNF complains about this -- but, we don't really
9596  // neeed this so far
9597  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9598  assume(p.FDeg == p.pFDeg());
9599  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9600 
9601 #ifdef KDEBUG
9602  // do not put an LObject twice into T:
9603  for(i=strat->tl;i>=0;i--)
9604  {
9605  if (p.p==strat->T[i].p)
9606  {
9607  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9608  return;
9609  }
9610  }
9611 #endif
9612 
9613 #ifdef HAVE_TAIL_RING
9614  if (currRing!=strat->tailRing)
9615  {
9616  p.t_p=p.GetLmTailRing();
9617  }
9618 #endif
9619  strat->newt = TRUE;
9620  if (atT < 0)
9621  atT = strat->posInT(strat->T, strat->tl, p);
9622  if (strat->tl == strat->tmax-1)
9623  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9624  if (atT <= strat->tl)
9625  {
9626 #ifdef ENTER_USE_MEMMOVE
9627  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9628  (strat->tl-atT+1)*sizeof(TObject));
9629  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9630  (strat->tl-atT+1)*sizeof(unsigned long));
9631 #endif
9632  for (i=strat->tl+1; i>=atT+1; i--)
9633  {
9634 #ifndef ENTER_USE_MEMMOVE
9635  strat->T[i] = strat->T[i-1];
9636  strat->sevT[i] = strat->sevT[i-1];
9637 #endif
9638  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9639  }
9640  }
9641 
9642  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9643  {
9644 #ifdef HAVE_SHIFTBBA
9645  // letterplace: if p.shift > 0 then pNext(p.p) is already in the tailBin
9646  if (!(currRing->isLPring && p.shift > 0))
9647 #endif
9648  {
9650  (strat->tailRing != NULL ?
9651  strat->tailRing : currRing),
9652  strat->tailBin);
9653  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9654  }
9655  }
9656  strat->T[atT] = (TObject) p;
9657  //printf("\nenterT: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9658 
9659  if (pNext(p.p) != NULL)
9660  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9661  else
9662  strat->T[atT].max_exp = NULL;
9663 
9664  strat->tl++;
9665  strat->R[strat->tl] = &(strat->T[atT]);
9666  strat->T[atT].i_r = strat->tl;
9667  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9668  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9669  kTest_T(&(strat->T[atT]));
9670 }
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
char newt
Definition: kutil.h:399
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:517
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:883
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define p_LmTest(p, r)
Definition: p_polys.h:163
int tmax
Definition: kutil.h:348
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:655
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:1128

◆ enterT_strong()

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

Definition at line 9676 of file kutil.cc.

9677 {
9679  int i;
9680 
9681  pp_Test(p.p, currRing, p.tailRing);
9682  assume(strat->tailRing == p.tailRing);
9683  // redMoraNF complains about this -- but, we don't really
9684  // neeed this so far
9685  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9686  assume(p.FDeg == p.pFDeg());
9687  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9688 
9689 #ifdef KDEBUG
9690  // do not put an LObject twice into T:
9691  for(i=strat->tl;i>=0;i--)
9692  {
9693  if (p.p==strat->T[i].p)
9694  {
9695  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9696  return;
9697  }
9698  }
9699 #endif
9700 
9701 #ifdef HAVE_TAIL_RING
9702  if (currRing!=strat->tailRing)
9703  {
9704  p.t_p=p.GetLmTailRing();
9705  }
9706 #endif
9707  strat->newt = TRUE;
9708  if (atT < 0)
9709  atT = strat->posInT(strat->T, strat->tl, p);
9710  if (strat->tl == strat->tmax-1)
9711  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9712  if (atT <= strat->tl)
9713  {
9714 #ifdef ENTER_USE_MEMMOVE
9715  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9716  (strat->tl-atT+1)*sizeof(TObject));
9717  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9718  (strat->tl-atT+1)*sizeof(unsigned long));
9719 #endif
9720  for (i=strat->tl+1; i>=atT+1; i--)
9721  {
9722 #ifndef ENTER_USE_MEMMOVE
9723  strat->T[i] = strat->T[i-1];
9724  strat->sevT[i] = strat->sevT[i-1];
9725 #endif
9726  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9727  }
9728  }
9729 
9730  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9731  {
9733  (strat->tailRing != NULL ?
9734  strat->tailRing : currRing),
9735  strat->tailBin);
9736  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9737  }
9738  strat->T[atT] = (TObject) p;
9739  //printf("\nenterT_strong: add new: length = %i, ecart = %i\n",p.length,p.ecart);
9740 
9741  if (pNext(p.p) != NULL)
9742  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9743  else
9744  strat->T[atT].max_exp = NULL;
9745 
9746  strat->tl++;
9747  strat->R[strat->tl] = &(strat->T[atT]);
9748  strat->T[atT].i_r = strat->tl;
9749  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9750  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9751  #if 1
9753  && !n_IsUnit(p.p->coef, currRing->cf))
9754  {
9755  for(i=strat->tl;i>=0;i--)
9756  {
9757  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9758  {
9759  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9760  }
9761  }
9762  }
9763  /*
9764  printf("\nThis is T:\n");
9765  for(i=strat->tl;i>=0;i--)
9766  {
9767  pWrite(strat->T[i].p);
9768  }
9769  //getchar();*/
9770  #endif
9771  kTest_T(&(strat->T[atT]));
9772 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
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:714
char newt
Definition: kutil.h:399
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
#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:44
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:517
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:883
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
int tmax
Definition: kutil.h:348
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1528
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
#define kTest_T(T)
Definition: kutil.h:655
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:1128

◆ enterTShift()

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

Definition at line 12759 of file kutil.cc.

12760 {
12761  /* determine how many elements we have to insert */
12762  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12763  /* hence, a total number of elt's to add is: */
12764  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12765  pAssume(p.p != NULL);
12766 
12767  int toInsert = itoInsert(p.p, strat->tailRing);
12768 
12769  for (int i = 1; i <= toInsert; i++)
12770  {
12771  LObject qq;
12772  qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order
12773  qq.shift = i;
12774  strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart
12775 
12776  enterT(qq, strat, atT); // enterT is modified, so it doesn't copy and delete the tail of shifted polys
12777  }
12778 }
int itoInsert(poly p, const ring r)
Definition: shiftgb.cc:46
class sLObject LObject
Definition: kutil.h:54
#define pAssume(cond)
Definition: monomials.h:90
#define pLPCopyAndShiftLM(p, sh)
Definition: shiftgb.h:15
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
int p
Definition: cfModGcd.cc:4019

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10274 of file kutil.cc.

10275 {
10276  /*- release temp data -*/
10277  cleanT(strat);
10278  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10279  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10280  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10281  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10282  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10283  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10284  /*- set L: should be empty -*/
10285  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10286  /*- set B: should be empty -*/
10287  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10288  pLmFree(&strat->tail);
10289  strat->syzComp=0;
10290 }
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:133
int Bmax
Definition: kutil.h:350
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:538
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
unsigned long * sevS
Definition: kutil.h:318
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:53

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10467 of file kutil.cc.

10468 {
10469  /*- release temp data -*/
10471  cleanTSbaRing(strat);
10472  else
10473  cleanT(strat);
10474  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10475  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10476  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10477  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10478  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10479  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10480  if(strat->syzmax>0)
10481  {
10482  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10483  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10484  if (strat->sbaOrder == 1)
10485  {
10486  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10487  }
10488  }
10489  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10490  /*- set L: should be empty -*/
10491  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10492  /*- set B: should be empty -*/
10493  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10494  /*- set sig: no need for the signatures anymore -*/
10495  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10496  pLmDelete(&strat->tail);
10497  strat->syzComp=0;
10498 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int syzComp
Definition: kutil.h:352
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void cleanTSbaRing(kStrategy strat)
Definition: kutil.cc:597
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:133
int Bmax
Definition: kutil.h:350
unsigned sbaOrder
Definition: kutil.h:312
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
void cleanT(kStrategy strat)
Definition: kutil.cc:538
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
int syzidxmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:53
intset syzIdx
Definition: kutil.h:309

◆ f5c()

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

Definition at line 3848 of file kstd2.cc.

3851 {
3852  int Ll_old, red_result = 1;
3853  int pos = 0;
3854  hilbeledeg=1;
3855  hilbcount=0;
3856  minimcnt=0;
3857  srmax = 0; // strat->sl is 0 at this point
3858  reduc = olddeg = lrmax = 0;
3859  // we cannot use strat->T anymore
3860  //cleanT(strat);
3861  //strat->tl = -1;
3862  Ll_old = strat->Ll;
3863  while (strat->tl >= 0)
3864  {
3865  if(!strat->T[strat->tl].is_redundant)
3866  {
3867  LObject h;
3868  h.p = strat->T[strat->tl].p;
3869  h.tailRing = strat->T[strat->tl].tailRing;
3870  h.t_p = strat->T[strat->tl].t_p;
3871  if (h.p!=NULL)
3872  {
3873  if (currRing->OrdSgn==-1)
3874  {
3875  cancelunit(&h);
3876  deleteHC(&h, strat);
3877  }
3878  if (h.p!=NULL)
3879  {
3881  {
3882  h.pCleardenom(); // also does remove Content
3883  }
3884  else
3885  {
3886  h.pNorm();
3887  }
3888  strat->initEcart(&h);
3890  pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
3891  else
3892  pos = strat->Ll+1;
3893  h.sev = pGetShortExpVector(h.p);
3894  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
3895  }
3896  }
3897  }
3898  strat->tl--;
3899  }
3900  strat->sl = -1;
3901 #if 0
3902 //#ifdef HAVE_TAIL_RING
3903  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
3904  kStratInitChangeTailRing(strat);
3905 #endif
3906  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
3907  //strat->sl = -1;
3908  /* picks the last element from the lazyset L */
3909  while (strat->Ll>Ll_old)
3910  {
3911  strat->P = strat->L[strat->Ll];
3912  strat->Ll--;
3913 //#if 1
3914 #ifdef DEBUGF5
3915  PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3916  PrintS("-------------------------------------------------\n");
3917  pWrite(pHead(strat->P.p));
3918  pWrite(pHead(strat->P.p1));
3919  pWrite(pHead(strat->P.p2));
3920  printf("%d\n",strat->tl);
3921  PrintS("-------------------------------------------------\n");
3922 #endif
3923  if (pNext(strat->P.p) == strat->tail)
3924  {
3925  // deletes the short spoly
3926  if (rField_is_Ring(currRing))
3927  pLmDelete(strat->P.p);
3928  else
3929  pLmFree(strat->P.p);
3930 
3931  // TODO: needs some masking
3932  // TODO: masking needs to vanish once the signature
3933  // sutff is completely implemented
3934  strat->P.p = NULL;
3935  poly m1 = NULL, m2 = NULL;
3936 
3937  // check that spoly creation is ok
3938  while (strat->tailRing != currRing &&
3939  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3940  {
3941  assume(m1 == NULL && m2 == NULL);
3942  // if not, change to a ring where exponents are at least
3943  // large enough
3944  if (!kStratChangeTailRing(strat))
3945  {
3946  WerrorS("OVERFLOW...");
3947  break;
3948  }
3949  }
3950  // create the real one
3951  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3952  strat->tailRing, m1, m2, strat->R);
3953  }
3954  else if (strat->P.p1 == NULL)
3955  {
3956  if (strat->minim > 0)
3957  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3958  // for input polys, prepare reduction
3959  if(!rField_is_Ring(currRing))
3960  strat->P.PrepareRed(strat->use_buckets);
3961  }
3962 
3963  if (strat->P.p == NULL && strat->P.t_p == NULL)
3964  {
3965  red_result = 0;
3966  }
3967  else
3968  {
3969  if (TEST_OPT_PROT)
3970  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3971  &olddeg,&reduc,strat, red_result);
3972 
3973 #ifdef DEBUGF5
3974  PrintS("Poly before red: ");
3975  pWrite(strat->P.p);
3976 #endif
3977  /* complete reduction of the element chosen from L */
3978  red_result = strat->red2(&strat->P,strat);
3979  if (errorreported) break;
3980  }
3981 
3982  if (strat->overflow)
3983  {
3984  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
3985  }
3986 
3987  // reduction to non-zero new poly
3988  if (red_result == 1)
3989  {
3990  // get the polynomial (canonicalize bucket, make sure P.p is set)
3991  strat->P.GetP(strat->lmBin);
3992  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
3993  // but now, for entering S, T, we reset it
3994  // in the inhomogeneous case: FDeg == pFDeg
3995  if (strat->homog) strat->initEcart(&(strat->P));
3996 
3997  /* statistic */
3998  if (TEST_OPT_PROT) PrintS("s");
3999  int pos;
4000  #if 1
4001  if(!rField_is_Ring(currRing))
4002  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4003  else
4004  pos = posInSMonFirst(strat,strat->sl,strat->P.p);
4005  #else
4006  pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4007  #endif
4008  // reduce the tail and normalize poly
4009  // in the ring case we cannot expect LC(f) = 1,
4010  // therefore we call pCleardenom instead of pNorm
4011 #if F5CTAILRED
4012  BOOLEAN withT = TRUE;
4014  {
4015  strat->P.pCleardenom();
4017  {
4018  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4019  strat->P.pCleardenom();
4020  }
4021  }
4022  else
4023  {
4024  strat->P.pNorm();
4026  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4027  }
4028 #endif
4029 #ifdef KDEBUG
4030  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4031 #endif /* KDEBUG */
4032 
4033  // min_std stuff
4034  if ((strat->P.p1==NULL) && (strat->minim>0))
4035  {
4036  if (strat->minim==1)
4037  {
4038  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4039  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4040  }
4041  else
4042  {
4043  strat->M->m[minimcnt]=strat->P.p2;
4044  strat->P.p2=NULL;
4045  }
4046  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4047  pNext(strat->M->m[minimcnt])
4048  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4049  strat->tailRing, currRing,
4050  currRing->PolyBin);
4051  minimcnt++;
4052  }
4053 
4054  // enter into S, L, and T
4055  // here we need to recompute new signatures, but those are trivial ones
4056  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4057  {
4058  enterT(strat->P, strat);
4059  // posInS only depends on the leading term
4060  strat->enterS(strat->P, pos, strat, strat->tl);
4061 //#if 1
4062 #ifdef DEBUGF5
4063  PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
4064  pWrite(pHead(strat->S[strat->sl]));
4065  pWrite(strat->sig[strat->sl]);
4066 #endif
4067  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4068  }
4069  // Print("[%d]",hilbeledeg);
4070  kDeleteLcm(&strat->P);
4071  if (strat->sl>srmax) srmax = strat->sl;
4072  }
4073  else
4074  {
4075  // adds signature of the zero reduction to
4076  // strat->syz. This is the leading term of
4077  // syzygy and can be used in syzCriterion()
4078  // the signature is added if and only if the
4079  // pair was not detected by the rewritten criterion in strat->red = redSig
4080  if (strat->P.p1 == NULL && strat->minim > 0)
4081  {
4082  p_Delete(&strat->P.p2, currRing, strat->tailRing);
4083  }
4084  }
4085 
4086 #ifdef KDEBUG
4087  memset(&(strat->P), 0, sizeof(strat->P));
4088 #endif /* KDEBUG */
4089  }
4090  int cc = 0;
4091  while (cc<strat->tl+1)
4092  {
4093  strat->T[cc].sig = pOne();
4094  p_SetComp(strat->T[cc].sig,cc+1,currRing);
4095  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
4096  strat->sig[cc] = strat->T[cc].sig;
4097  strat->sevSig[cc] = strat->T[cc].sevSig;
4098  strat->T[cc].is_sigsafe = TRUE;
4099  cc++;
4100  }
4101  strat->max_lower_index = strat->tl;
4102  // set current signature index of upcoming iteration step
4103  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
4104  // the corresponding syzygy rules correctly
4105  strat->currIdx = cc+1;
4106  for (int cd=strat->Ll; cd>=0; cd--)
4107  {
4108  p_SetComp(strat->L[cd].sig,cc+1,currRing);
4109  cc++;
4110  }
4111  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
4112  strat->Shdl->m[cc] = NULL;
4113  #if 0
4114  printf("\nAfter f5c sorting\n");
4115  for(int i=0;i<=strat->sl;i++)
4116  pWrite(pHead(strat->S[i]));
4117  getchar();
4118  #endif
4119 //#if 1
4120 #if DEBUGF5
4121  PrintS("------------------- STRAT S ---------------------\n");
4122  cc = 0;
4123  while (cc<strat->tl+1)
4124  {
4125  pWrite(pHead(strat->S[cc]));
4126  pWrite(strat->sig[cc]);
4127  printf("- - - - - -\n");
4128  cc++;
4129  }
4130  PrintS("-------------------------------------------------\n");
4131  PrintS("------------------- STRAT T ---------------------\n");
4132  cc = 0;
4133  while (cc<strat->tl+1)
4134  {
4135  pWrite(pHead(strat->T[cc].p));
4136  pWrite(strat->T[cc].sig);
4137  printf("- - - - - -\n");
4138  cc++;
4139  }
4140  PrintS("-------------------------------------------------\n");
4141  PrintS("------------------- STRAT L ---------------------\n");
4142  cc = 0;
4143  while (cc<strat->Ll+1)
4144  {
4145  pWrite(pHead(strat->L[cc].p));
4146  pWrite(pHead(strat->L[cc].p1));
4147  pWrite(pHead(strat->L[cc].p2));
4148  pWrite(strat->L[cc].sig);
4149  printf("- - - - - -\n");
4150  cc++;
4151  }
4152  PrintS("-------------------------------------------------\n");
4153  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
4154 #endif
4155 
4156 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
Definition: kutil.cc:5136
void PrintLn()
Definition: reporter.cc:310
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7954
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:6399
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:103
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
void pWrite(poly p)
Definition: polys.h:303
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
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:1260
#define Q
Definition: sirandom.c:25
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:356
char use_buckets
Definition: kutil.h:381
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11476
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#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.cc )
Definition: polys.h:152
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1145
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
#define pOne()
Definition: polys.h:310
TObject ** R
Definition: kutil.h:338
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:23
short errorreported
Definition: feFopen.cc:23
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10905
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:28
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85

◆ faugereRewCriterion()

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

Definition at line 7129 of file kutil.cc.

7130 {
7131  //printf("Faugere Rewritten Criterion\n");
7133  return FALSE;
7134 //#if 1
7135 #ifdef DEBUGF5
7136  PrintS("rewritten criterion checks: ");
7137  pWrite(sig);
7138 #endif
7139  for(int k = strat->sl; k>=start; k--)
7140  {
7141 //#if 1
7142 #ifdef DEBUGF5
7143  PrintS("checking with: ");
7144  pWrite(strat->sig[k]);
7145  pWrite(pHead(strat->S[k]));
7146 #endif
7147  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7148  {
7149 //#if 1
7150 #ifdef DEBUGF5
7151  PrintS("DELETE!\n");
7152 #endif
7153  strat->nrrewcrit++;
7154  return TRUE;
7155  }
7156  //k--;
7157  }
7158 #ifdef DEBUGF5
7159  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7160  for(int kk = 0; kk<strat->sl+1; kk++)
7161  {
7162  pWrite(pHead(strat->S[kk]));
7163  }
7164  PrintS("------------------------------\n");
7165 #endif
7166  return FALSE;
7167 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
int nrrewcrit
Definition: kutil.h:360
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346

◆ finalReduceByMon()

void finalReduceByMon ( kStrategy  strat)

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

Definition at line 11292 of file kutil.cc.

11293 {
11294  assume(strat->tl<0); /* can only be called with no elements in T:
11295  i.e. after exitBuchMora */
11296  /* do not use strat->S, strat->sl as they may be out of sync*/
11297  if(!nCoeff_is_Z(currRing->cf))
11298  return;
11299  poly p,pp;
11300  for(int j = 0; j<IDELEMS(strat->Shdl); j++)
11301  {
11302  if((strat->Shdl->m[j]!=NULL)&&(pNext(strat->Shdl->m[j]) == NULL))
11303  {
11304  for(int i = 0; i<IDELEMS(strat->Shdl); i++)
11305  {
11306  if((i != j) && (strat->Shdl->m[i] != NULL))
11307  {
11308  p = strat->Shdl->m[i];
11309  while((p!=NULL) && pLmDivisibleBy(strat->Shdl->m[j], p))
11310  {
11311  number dummy = n_IntMod(p->coef, strat->Shdl->m[j]->coef, currRing->cf);
11312  if (!nEqual(dummy,p->coef))
11313  {
11314  if (nIsZero(dummy))
11315  {
11316  nDelete(&dummy);
11317  pLmDelete(&strat->Shdl->m[i]);
11318  p=strat->Shdl->m[i];
11319  }
11320  else
11321  {
11322  p_SetCoeff(p,dummy,currRing);
11323  break;
11324  }
11325  }
11326  else
11327  {
11328  nDelete(&dummy);
11329  break;
11330  }
11331  }
11332  if (p!=NULL)
11333  {
11334  pp = pNext(p);
11335  while(pp != NULL)
11336  {
11337  if(pLmDivisibleBy(strat->Shdl->m[j], pp))
11338  {
11339  number dummy = n_IntMod(pp->coef, strat->Shdl->m[j]->coef, currRing->cf);
11340  if (!nEqual(dummy,pp->coef))
11341  {
11342  p_SetCoeff(pp,dummy,currRing);
11343  if(nIsZero(pp->coef))
11344  {
11345  pLmDelete(&pNext(p));
11346  pp = pNext(p);
11347  }
11348  else
11349  {
11350  p = pp;
11351  pp = pNext(p);
11352  }
11353  }
11354  else
11355  {
11356  nDelete(&dummy);
11357  p = pp;
11358  pp = pNext(p);
11359  }
11360  }
11361  else
11362  {
11363  p = pp;
11364  pp = pNext(p);
11365  }
11366  }
11367  }
11368  }
11369  }
11370  //idPrint(strat->Shdl);
11371  }
11372  }
11373  idSkipZeroes(strat->Shdl);
11374 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:628
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define nEqual(n1, n2)
Definition: numbers.h:20
#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:411
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:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299

◆ findMinLMPair()

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

◆ freegb()

ideal freegb ( ideal  I)

Definition at line 4459 of file kstd2.cc.

4460 {
4462  assume(idIsInV(I));
4463  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL);
4464  idSkipZeroes(RS); // is this even necessary?
4465  assume(idIsInV(RS));
4466  return(RS);
4467 }
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2569
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408
#define idIsInV(I)
Definition: shiftop.h:49
#define assume(x)
Definition: mod2.h:390
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12

◆ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 468 of file kutil.cc.

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

◆ homogTest()

BOOLEAN homogTest ( polyset  F,
int  Fmax 
)

◆ ind2()

long ind2 ( long  arg)

Definition at line 4111 of file kutil.cc.

4112 {
4113  long ind = 0;
4114  if (arg <= 0) return 0;
4115  while (arg%2 == 0)
4116  {
4117  arg = arg / 2;
4118  ind++;
4119  }
4120  return ind;
4121 }

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4123 of file kutil.cc.

4124 {
4125  long ind = 0;
4126  if (arg <= 0) return 0;
4127  if (arg%2 == 1) { arg--; }
4128  while (arg > 0)
4129  {
4130  ind += ind2(arg);
4131  arg = arg - 2;
4132  }
4133  return ind;
4134 }
long ind2(long arg)
Definition: kutil.cc:4111

◆ initBba()

void initBba ( kStrategy  strat)

Definition at line 1334 of file kstd1.cc.

1335 {
1336  /* setting global variables ------------------- */
1337  strat->enterS = enterSBba;
1338  strat->red = redHoney;
1339  if (strat->honey)
1340  strat->red = redHoney;
1341  else if (currRing->pLexOrder && !strat->homog)
1342  strat->red = redLazy;
1343  else
1344  {
1345  strat->LazyPass *=4;
1346  strat->red = redHomog;
1347  }
1348  if (rField_is_Ring(currRing))
1349  {
1350  if (rField_is_Z(currRing))
1351  strat->red = redRing_Z;
1352  else
1353  strat->red = redRing;
1354  }
1355  if (currRing->pLexOrder && strat->honey)
1356  strat->initEcart = initEcartNormal;
1357  else
1358  strat->initEcart = initEcartBBA;
1359  if (strat->honey)
1361  else
1363 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1364 // {
1365 // //interred machen Aenderung
1366 // strat->pOrigFDeg=pFDeg;
1367 // strat->pOrigLDeg=pLDeg;
1368 // //h=ggetid("ecart");
1369 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1370 // //{
1371 // // ecartWeights=iv2array(IDINTVEC(h));
1372 // //}
1373 // //else
1374 // {
1375 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1376 // /*uses automatic computation of the ecartWeights to set them*/
1377 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1378 // }
1379 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1380 // if (TEST_OPT_PROT)
1381 // {
1382 // for(i=1; i<=(currRing->N); i++)
1383 // Print(" %d",ecartWeights[i]);
1384 // PrintLn();
1385 // mflush();
1386 // }
1387 // }
1388 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
int redRing_Z(LObject *h, kStrategy strat)
Definition: kstd2.cc:568
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:504
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1519
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
char homog
Definition: kutil.h:370
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ initBbaShift()

void initBbaShift ( kStrategy  strat)

Definition at line 4593 of file kstd2.cc.

4594 {
4595  /* setting global variables ------------------- */
4596  strat->enterS = enterSBba; /* remains as is, we change enterT! */
4597 
4598  strat->red = redFirstShift; /* no redHomog ! */
4599 
4600  if (currRing->pLexOrder && strat->honey)
4601  strat->initEcart = initEcartNormal;
4602  else
4603  strat->initEcart = initEcartBBA;
4604  if (strat->honey)
4606  else
4608 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
4609 // {
4610 // //interred machen Aenderung
4611 // pFDegOld=currRing->pFDeg;
4612 // pLDegOld=pLDeg;
4613 // //h=ggetid("ecart");
4614 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
4615 // //{
4616 // // ecartWeights=iv2array(IDINTVEC(h));
4617 // //}
4618 // //else
4619 // {
4620 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
4621 // /*uses automatic computation of the ecartWeights to set them*/
4622 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
4623 // }
4624 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
4625 // if (TEST_OPT_PROT)
4626 // {
4627 // for(int i=1; i<=rVar(currRing); i++)
4628 // Print(" %d",ecartWeights[i]);
4629 // PrintLn();
4630 // mflush();
4631 // }
4632 // }
4633 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:4473
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ initBuchMora()

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

Definition at line 10198 of file kutil.cc.

10199 {
10200  strat->interpt = BTEST1(OPT_INTERRUPT);
10201  strat->kHEdge=NULL;
10203  /*- creating temp data structures------------------- -*/
10204  strat->cp = 0;
10205  strat->c3 = 0;
10206  strat->tail = pInit();
10207  /*- set s -*/
10208  strat->sl = -1;
10209  /*- set L -*/
10210  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10211  strat->Ll = -1;
10212  strat->L = initL(strat->Lmax);
10213  /*- set B -*/
10214  strat->Bmax = setmaxL;
10215  strat->Bl = -1;
10216  strat->B = initL();
10217  /*- set T -*/
10218  strat->tl = -1;
10219  strat->tmax = setmaxT;
10220  strat->T = initT();
10221  strat->R = initR();
10222  strat->sevT = initsevT();
10223  /*- init local data struct.---------------------------------------- -*/
10224  strat->P.ecart=0;
10225  strat->P.length=0;
10226  strat->P.pLength=0;
10228  {
10229  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10230  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10231  }
10233  {
10234  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10235  }
10236  else
10237  {
10238  if(TEST_OPT_SB_1)
10239  {
10240  int i;
10241  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10242  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10243  {
10244  P->m[i-strat->newIdeal] = F->m[i];
10245  F->m[i] = NULL;
10246  }
10247  initSSpecial(F,Q,P,strat);
10248  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10249  {
10250  F->m[i] = P->m[i-strat->newIdeal];
10251  P->m[i-strat->newIdeal] = NULL;
10252  }
10253  idDelete(&P);
10254  }
10255  else
10256  {
10257  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10258  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10259  }
10260  }
10261  strat->fromT = FALSE;
10263  if ((!TEST_OPT_SB_1)
10264  || (rField_is_Ring(currRing))
10265  )
10266  {
10267  updateS(TRUE,strat);
10268  }
10269  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10270  strat->fromQ=NULL;
10271  assume(kTest_TS(strat));
10272 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define TEST_OPT_REDTAIL
Definition: options.h:115
KINLINE TObject ** initR()
Definition: kInline.h:95
char fromT
Definition: kutil.h:377
char kHEdgeFound
Definition: kutil.h:374
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
int c3
Definition: kutil.h:345
char interpt
Definition: kutil.h:369
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8169
#define BTEST1(a)
Definition: options.h:34
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:31
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8571
#define setmaxT
Definition: kutil.h:33
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#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:9034
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9874 of file kutil.cc.

9875 {
9877  strat->chainCrit=chainCritNormal;
9878  if (TEST_OPT_SB_1)
9879  strat->chainCrit=chainCritOpt_1;
9880 #ifdef HAVE_RINGS
9881  if (rField_is_Ring(currRing))
9882  {
9884  strat->chainCrit=chainCritRing;
9885  }
9886 #endif
9887 #ifdef HAVE_RATGRING
9888  if (rIsRatGRing(currRing))
9889  {
9890  strat->chainCrit=chainCritPart;
9891  /* enterOnePairNormal get rational part in it */
9892  }
9893 #endif
9894  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9895  && (!rIsPluralRing(currRing)))
9897 
9898  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9899  strat->Gebauer = strat->homog || strat->sugarCrit;
9900  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9901  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9902  strat->pairtest = NULL;
9903  /* alway use tailreduction, except:
9904  * - in local rings, - in lex order case, -in ring over extensions */
9906  //if(rHasMixedOrdering(currRing)==2)
9907  //{
9908  // strat->noTailReduction =TRUE;
9909  //}
9910 
9911 #ifdef HAVE_PLURAL
9912  // and r is plural_ring
9913  // hence this holds for r a rational_plural_ring
9914  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9915  { //or it has non-quasi-comm type... later
9916  strat->sugarCrit = FALSE;
9917  strat->Gebauer = FALSE;
9918  strat->honey = FALSE;
9919  }
9920 #endif
9921 
9922  // Coefficient ring?
9923  if (rField_is_Ring(currRing))
9924  {
9925  strat->sugarCrit = FALSE;
9926  strat->Gebauer = FALSE ;
9927  strat->honey = FALSE;
9928  }
9929  #ifdef KDEBUG
9930  if (TEST_OPT_DEBUG)
9931  {
9932  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9933  else PrintS("ideal/module is not homogeneous\n");
9934  }
9935  #endif
9936 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3192
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2210
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
BOOLEAN * pairtest
Definition: kutil.h:331
#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:1326
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1929
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
char sugarCrit
Definition: kutil.h:375
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3956
#define TEST_OPT_NOT_SUGAR
Definition: options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
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:370
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
char z2homog
Definition: kutil.h:372
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#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:12
char honey
Definition: kutil.h:375
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3405
char Gebauer
Definition: kutil.h:376
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 10025 of file kutil.cc.

10026 {
10028  {
10029  if (strat->honey)
10030  {
10031  strat->posInL = posInL15;
10032  // ok -- here is the deal: from my experiments for Singular-2-0
10033  // I conclude that that posInT_EcartpLength is the best of
10034  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10035  // see the table at the end of this file
10036  if (TEST_OPT_OLDSTD)
10037  strat->posInT = posInT15;
10038  else
10039  strat->posInT = posInT_EcartpLength;
10040  }
10041  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10042  {
10043  strat->posInL = posInL11;
10044  strat->posInT = posInT11;
10045  }
10046  else if (TEST_OPT_INTSTRATEGY)
10047  {
10048  strat->posInL = posInL11;
10049  strat->posInT = posInT11;
10050  }
10051  else
10052  {
10053  strat->posInL = posInL0;
10054  strat->posInT = posInT0;
10055  }
10056  //if (strat->minim>0) strat->posInL =posInLSpecial;
10057  if (strat->homog)
10058  {
10059  strat->posInL = posInL110;
10060  strat->posInT = posInT110;
10061  }
10062  }
10063  else
10064  {
10065  if (strat->homog)
10066  {
10067  strat->posInL = posInL11;
10068  strat->posInT = posInT11;
10069  }
10070  else
10071  {
10072  if ((currRing->order[0]==ringorder_c)
10073  ||(currRing->order[0]==ringorder_C))
10074  {
10075  strat->posInL = posInL17_c;
10076  strat->posInT = posInT17_c;
10077  }
10078  else
10079  {
10080  strat->posInL = posInL17;
10081  strat->posInT = posInT17;
10082  }
10083  }
10084  }
10085  if (strat->minim>0) strat->posInL =posInLSpecial;
10086  // for further tests only
10087  if ((BTEST1(11)) || (BTEST1(12)))
10088  strat->posInL = posInL11;
10089  else if ((BTEST1(13)) || (BTEST1(14)))
10090  strat->posInL = posInL13;
10091  else if ((BTEST1(15)) || (BTEST1(16)))
10092  strat->posInL = posInL15;
10093  else if ((BTEST1(17)) || (BTEST1(18)))
10094  strat->posInL = posInL17;
10095  if (BTEST1(11))
10096  strat->posInT = posInT11;
10097  else if (BTEST1(13))
10098  strat->posInT = posInT13;
10099  else if (BTEST1(15))
10100  strat->posInT = posInT15;
10101  else if ((BTEST1(17)))
10102  strat->posInT = posInT17;
10103  else if ((BTEST1(19)))
10104  strat->posInT = posInT19;
10105  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10106  strat->posInT = posInT1;
10108 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
#define BTEST1(a)
Definition: options.h:34
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:10009
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
#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:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
char homog
Definition: kutil.h:370
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
char posInLDependsOnLength
Definition: kutil.h:387
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10111 of file kutil.cc.

10112 {
10114  {
10115  if (strat->honey)
10116  {
10117  strat->posInL = posInL15Ring;
10118  // ok -- here is the deal: from my experiments for Singular-2-0
10119  // I conclude that that posInT_EcartpLength is the best of
10120  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10121  // see the table at the end of this file
10122  if (TEST_OPT_OLDSTD)
10123  strat->posInT = posInT15Ring;
10124  else
10125  strat->posInT = posInT_EcartpLength;
10126  }
10127  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10128  {
10129  strat->posInL = posInL11Ring;
10130  strat->posInT = posInT11;
10131  }
10132  else if (TEST_OPT_INTSTRATEGY)
10133  {
10134  strat->posInL = posInL11Ring;
10135  strat->posInT = posInT11;
10136  }
10137  else
10138  {
10139  strat->posInL = posInL0Ring;
10140  strat->posInT = posInT0;
10141  }
10142  //if (strat->minim>0) strat->posInL =posInLSpecial;
10143  if (strat->homog)
10144  {
10145  strat->posInL = posInL110Ring;
10146  strat->posInT = posInT110Ring;
10147  }
10148  }
10149  else
10150  {
10151  if (strat->homog)
10152  {
10153  //printf("\nHere 3\n");
10154  strat->posInL = posInL11Ring;
10155  strat->posInT = posInT11Ring;
10156  }
10157  else
10158  {
10159  if ((currRing->order[0]==ringorder_c)
10160  ||(currRing->order[0]==ringorder_C))
10161  {
10162  strat->posInL = posInL17_cRing;
10163  strat->posInT = posInT17_cRing;
10164  }
10165  else
10166  {
10167  strat->posInL = posInL11Ringls;
10168  strat->posInT = posInT17Ring;
10169  }
10170  }
10171  }
10172  if (strat->minim>0) strat->posInL =posInLSpecial;
10173  // for further tests only
10174  if ((BTEST1(11)) || (BTEST1(12)))
10175  strat->posInL = posInL11Ring;
10176  else if ((BTEST1(13)) || (BTEST1(14)))
10177  strat->posInL = posInL13;
10178  else if ((BTEST1(15)) || (BTEST1(16)))
10179  strat->posInL = posInL15Ring;
10180  else if ((BTEST1(17)) || (BTEST1(18)))
10181  strat->posInL = posInL17Ring;
10182  if (BTEST1(11))
10183  strat->posInT = posInT11Ring;
10184  else if (BTEST1(13))
10185  strat->posInT = posInT13;
10186  else if (BTEST1(15))
10187  strat->posInT = posInT15Ring;
10188  else if ((BTEST1(17)))
10189  strat->posInT = posInT17Ring;
10190  else if ((BTEST1(19)))
10191  strat->posInT = posInT19;
10192  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10193  strat->posInT = posInT1;
10195 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6779
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6864
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6662
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
#define BTEST1(a)
Definition: options.h:34
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6978
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:10009
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5362
#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:5792
char homog
Definition: kutil.h:370
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5521
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6091
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
char posInLDependsOnLength
Definition: kutil.h:387
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5899
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568

◆ initBuchMoraShift()

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

Definition at line 12211 of file kutil.cc.

12212 {
12213  strat->interpt = BTEST1(OPT_INTERRUPT);
12214  strat->kHEdge=NULL;
12216  /*- creating temp data structures------------------- -*/
12217  strat->cp = 0;
12218  strat->c3 = 0;
12219  strat->cv = 0;
12220  strat->tail = pInit();
12221  /*- set s -*/
12222  strat->sl = -1;
12223  /*- set L -*/
12224  strat->Lmax = setmaxL;
12225  strat->Ll = -1;
12226  strat->L = initL();
12227  /*- set B -*/
12228  strat->Bmax = setmaxL;
12229  strat->Bl = -1;
12230  strat->B = initL();
12231  /*- set T -*/
12232  strat->tl = -1;
12233  strat->tmax = setmaxT;
12234  strat->T = initT();
12235  strat->R = initR();
12236  strat->sevT = initsevT();
12237  /*- init local data struct.---------------------------------------- -*/
12238  strat->P.ecart=0;
12239  strat->P.length=0;
12241  {
12242  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12243  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12244  }
12246  {
12247  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12248  }
12249  {
12250  if(TEST_OPT_SB_1)
12251  {
12252  int i;
12253  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12254  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12255  {
12256  P->m[i-strat->newIdeal] = F->m[i];
12257  F->m[i] = NULL;
12258  }
12259  initSSpecial(F,Q,P,strat);
12260  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12261  {
12262  F->m[i] = P->m[i-strat->newIdeal];
12263  P->m[i-strat->newIdeal] = NULL;
12264  }
12265  idDelete(&P);
12266  }
12267  else
12268  {
12269  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12270  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12271  }
12272  }
12273  strat->fromT = FALSE;
12274  if (!TEST_OPT_SB_1)
12275  {
12276  /* the only change: we do not fill the set T*/
12277  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12278  }
12279  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12280  strat->fromQ=NULL;
12281  /* more changes: fill the set T with all the shifts of elts of S*/
12282  /* is done by other procedure */
12283 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
KINLINE TObject ** initR()
Definition: kInline.h:95
char fromT
Definition: kutil.h:377
char kHEdgeFound
Definition: kutil.h:374
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:345
char interpt
Definition: kutil.h:369
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:367
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8169
#define BTEST1(a)
Definition: options.h:34
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8571
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#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:9034
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ initEcartBBA()

void initEcartBBA ( TObject h)

Definition at line 1292 of file kutil.cc.

1293 {
1294  h->FDeg = h->pFDeg();
1295  (*h).ecart = 0;
1296  h->length=h->pLength=pLength(h->p);
1297 }
static unsigned pLength(poly a)
Definition: p_polys.h:191
static Poly * h
Definition: janet.cc:971

◆ initEcartNormal()

void initEcartNormal ( TObject h)

Definition at line 1284 of file kutil.cc.

1285 {
1286  h->FDeg = h->pFDeg();
1287  h->ecart = h->pLDeg() - h->FDeg;
1288  // h->length is set by h->pLDeg
1289  h->length=h->pLength=pLength(h->p);
1290 }
static unsigned pLength(poly a)
Definition: p_polys.h:191
static Poly * h
Definition: janet.cc:971

◆ initEcartPairBba()

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

Definition at line 1299 of file kutil.cc.

1300 {
1301  Lp->FDeg = Lp->pFDeg();
1302  (*Lp).ecart = 0;
1303  (*Lp).length = 0;
1304 }

◆ initEcartPairMora()

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

Definition at line 1306 of file kutil.cc.

1307 {
1308  Lp->FDeg = Lp->pFDeg();
1309  (*Lp).ecart = si_max(ecartF,ecartG);
1310  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1311  (*Lp).length = 0;
1312 }
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:379
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:12

◆ initHilbCrit()

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

Definition at line 9856 of file kutil.cc.

9857 {
9858 
9859  //if the ordering is local, then hilb criterion
9860  //can be used also if the ideal is not homogenous
9862  {
9864  *hilb=NULL;
9865  else
9866  return;
9867  }
9868  if (strat->homog!=isHomog)
9869  {
9870  *hilb=NULL;
9871  }
9872 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define FALSE
Definition: auxiliary.h:94
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
char homog
Definition: kutil.h:370
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12

◆ initL()

static LSet initL ( int  nr = setmaxL)
inlinestatic

Definition at line 419 of file kutil.h.

420 { 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 95 of file kInline.h.

96 {
97  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
98 }
#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 8075 of file kutil.cc.

8076 {
8077  int i,pos;
8078 
8079  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8080  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8081  strat->ecartS=initec(i);
8082  strat->sevS=initsevS(i);
8083  strat->S_2_R=initS_2_R(i);
8084  strat->fromQ=NULL;
8085  strat->Shdl=idInit(i,F->rank);
8086  strat->S=strat->Shdl->m;
8087  /*- put polys into S -*/
8088  if (Q!=NULL)
8089  {
8090  strat->fromQ=initec(i);
8091  memset(strat->fromQ,0,i*sizeof(int));
8092  for (i=0; i<IDELEMS(Q); i++)
8093  {
8094  if (Q->m[i]!=NULL)
8095  {
8096  LObject h;
8097  h.p = pCopy(Q->m[i]);
8099  {
8100  h.pCleardenom(); // also does remove Content
8101  }
8102  else
8103  {
8104  h.pNorm();
8105  }
8107  {
8108  deleteHC(&h, strat);
8109  }
8110  if (h.p!=NULL)
8111  {
8112  strat->initEcart(&h);
8113  if (strat->sl==-1)
8114  pos =0;
8115  else
8116  {
8117  pos = posInS(strat,strat->sl,h.p,h.ecart);
8118  }
8119  h.sev = pGetShortExpVector(h.p);
8120  strat->enterS(h,pos,strat,-1);
8121  strat->fromQ[pos]=1;
8122  }
8123  }
8124  }
8125  }
8126  for (i=0; i<IDELEMS(F); i++)
8127  {
8128  if (F->m[i]!=NULL)
8129  {
8130  LObject h;
8131  h.p = pCopy(F->m[i]);
8133  {
8134  cancelunit(&h); /*- tries to cancel a unit -*/
8135  deleteHC(&h, strat);
8136  }
8137  if (h.p!=NULL)
8138  // do not rely on the input being a SB!
8139  {
8141  {
8142  h.pCleardenom(); // also does remove Content
8143  }
8144  else
8145  {
8146  h.pNorm();
8147  }
8148  strat->initEcart(&h);
8149  if (strat->sl==-1)
8150  pos =0;
8151  else
8152  pos = posInS(strat,strat->sl,h.p,h.ecart);
8153  h.sev = pGetShortExpVector(h.p);
8154  strat->enterS(h,pos,strat,-1);
8155  }
8156  }
8157  }
8158  /*- test, if a unit is in F -*/
8159  if ((strat->sl>=0)
8160 #ifdef HAVE_RINGS
8161  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8162 #endif
8163  && pIsConstant(strat->S[0]))
8164  {
8165  while (strat->sl>0) deleteInS(strat->sl,strat);
8166  }
8167 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
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:512
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
#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:44
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSba()

void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1390 of file kstd1.cc.

1391 {
1392  int i;
1393  //idhdl h;
1394  /* setting global variables ------------------- */
1395  strat->enterS = enterSSba;
1396  strat->red2 = redHoney;
1397  if (strat->honey)
1398  strat->red2 = redHoney;
1399  else if (currRing->pLexOrder && !strat->homog)
1400  strat->red2 = redLazy;
1401  else
1402  {
1403  strat->LazyPass *=4;
1404  strat->red2 = redHomog;
1405  }
1406  if (rField_is_Ring(currRing))
1407  {
1409  {strat->red2 = redRiloc;}
1410  else
1411  {strat->red2 = redRing;}
1412  }
1413  if (currRing->pLexOrder && strat->honey)
1414  strat->initEcart = initEcartNormal;
1415  else
1416  strat->initEcart = initEcartBBA;
1417  if (strat->honey)
1419  else
1421  //strat->kIdeal = NULL;
1422  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1423  //else strat->kIdeal->rtyp=MODUL_CMD;
1424  //strat->kIdeal->data=(void *)strat->Shdl;
1425  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1426  {
1427  //interred machen Aenderung
1428  strat->pOrigFDeg = currRing->pFDeg;
1429  strat->pOrigLDeg = currRing->pLDeg;
1430  //h=ggetid("ecart");
1431  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1432  //{
1433  // ecartWeights=iv2array(IDINTVEC(h));
1434  //}
1435  //else
1436  {
1437  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1438  /*uses automatic computation of the ecartWeights to set them*/
1440  }
1442  if (TEST_OPT_PROT)
1443  {
1444  for(i=1; i<=(currRing->N); i++)
1445  Print(" %d",ecartWeights[i]);
1446  PrintLn();
1447  mflush();
1448  }
1449  }
1450  // for sig-safe reductions in signature-based
1451  // standard basis computations
1453  strat->red = redSigRing;
1454  else
1455  strat->red = redSig;
1456  //strat->sbaOrder = 1;
1457  strat->currIdx = 1;
1458 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9380
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
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:182
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:217
short * ecartWeights
Definition: weight0.c:28
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:982
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int currIdx
Definition: kutil.h:313
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
pFDegProc pOrigFDeg
Definition: kutil.h:292
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:342
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1519
pLDegProc pOrigLDeg
Definition: kutil.h:293
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
int redSigRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:1149
#define IDELEMS(i)
Definition: simpleideals.h:23
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:370
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:247
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:275

◆ initSbaBuchMora()

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

Definition at line 10394 of file kutil.cc.

10395 {
10396  strat->interpt = BTEST1(OPT_INTERRUPT);
10397  strat->kHEdge=NULL;
10399  /*- creating temp data structures------------------- -*/
10400  strat->cp = 0;
10401  strat->c3 = 0;
10402  strat->tail = pInit();
10403  /*- set s -*/
10404  strat->sl = -1;
10405  /*- set ps -*/
10406  strat->syzl = -1;
10407  /*- set L -*/
10408  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10409  strat->Ll = -1;
10410  strat->L = initL(strat->Lmax);
10411  /*- set B -*/
10412  strat->Bmax = setmaxL;
10413  strat->Bl = -1;
10414  strat->B = initL();
10415  /*- set T -*/
10416  strat->tl = -1;
10417  strat->tmax = setmaxT;
10418  strat->T = initT();
10419  strat->R = initR();
10420  strat->sevT = initsevT();
10421  /*- init local data struct.---------------------------------------- -*/
10422  strat->P.ecart=0;
10423  strat->P.length=0;
10425  {
10426  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10427  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10428  }
10430  {
10431  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10432  }
10433  else
10434  {
10435  if(TEST_OPT_SB_1)
10436  {
10437  int i;
10438  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10439  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10440  {
10441  P->m[i-strat->newIdeal] = F->m[i];
10442  F->m[i] = NULL;
10443  }
10444  initSSpecialSba(F,Q,P,strat);
10445  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10446  {
10447  F->m[i] = P->m[i-strat->newIdeal];
10448  P->m[i-strat->newIdeal] = NULL;
10449  }
10450  idDelete(&P);
10451  }
10452  else
10453  {
10454  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10455  }
10456  }
10457  strat->fromT = FALSE;
10458  if (!TEST_OPT_SB_1)
10459  {
10460  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10461  }
10462  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10463  //strat->fromQ=NULL;
10464  assume(kTest_TS(strat));
10465 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
KINLINE TObject ** initR()
Definition: kInline.h:95
char fromT
Definition: kutil.h:377
char kHEdgeFound
Definition: kutil.h:374
#define setmaxL
Definition: kutil.h:30
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:345
char interpt
Definition: kutil.h:369
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#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:8715
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:31
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8266
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
#define setmaxT
Definition: kutil.h:33
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
#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:9034
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static LSet initL(int nr=setmaxL)
Definition: kutil.h:419
int newIdeal
Definition: kutil.h:355
#define OPT_INTERRUPT
Definition: options.h:78
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int syzl
Definition: kutil.h:347

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9938 of file kutil.cc.

9939 {
9940  //strat->enterOnePair=enterOnePairNormal;
9942  //strat->chainCrit=chainCritNormal;
9943  strat->chainCrit = chainCritSig;
9944  /******************************************
9945  * rewCrit1 and rewCrit2 are already set in
9946  * kSba() in kstd1.cc
9947  *****************************************/
9948  //strat->rewCrit1 = faugereRewCriterion;
9949  if (strat->sbaOrder == 1)
9950  {
9951  strat->syzCrit = syzCriterionInc;
9952  }
9953  else
9954  {
9955  strat->syzCrit = syzCriterion;
9956  }
9957 #ifdef HAVE_RINGS
9958  if (rField_is_Ring(currRing))
9959  {
9961  strat->chainCrit=chainCritRing;
9962  }
9963 #endif
9964 #ifdef HAVE_RATGRING
9965  if (rIsRatGRing(currRing))
9966  {
9967  strat->chainCrit=chainCritPart;
9968  /* enterOnePairNormal get rational part in it */
9969  }
9970 #endif
9971 
9972  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9973  strat->Gebauer = strat->homog || strat->sugarCrit;
9974  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9975  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9976  strat->pairtest = NULL;
9977  /* alway use tailreduction, except:
9978  * - in local rings, - in lex order case, -in ring over extensions */
9981 
9982 #ifdef HAVE_PLURAL
9983  // and r is plural_ring
9984  // hence this holds for r a rational_plural_ring
9985  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9986  { //or it has non-quasi-comm type... later
9987  strat->sugarCrit = FALSE;
9988  strat->Gebauer = FALSE;
9989  strat->honey = FALSE;
9990  }
9991 #endif
9992 
9993  // Coefficient ring?
9994  if (rField_is_Ring(currRing))
9995  {
9996  strat->sugarCrit = FALSE;
9997  strat->Gebauer = FALSE ;
9998  strat->honey = FALSE;
9999  }
10000  #ifdef KDEBUG
10001  if (TEST_OPT_DEBUG)
10002  {
10003  if (strat->homog) PrintS("ideal/module is homogeneous\n");
10004  else PrintS("ideal/module is not homogeneous\n");
10005  }
10006  #endif
10007 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
BOOLEAN * pairtest
Definition: kutil.h:331
#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:1326
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3421
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1929
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
char sugarCrit
Definition: kutil.h:375
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:3956
#define TEST_OPT_NOT_SUGAR
Definition: options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
unsigned sbaOrder
Definition: kutil.h:312
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7045
#define TEST_OPT_SUGARCRIT
Definition: options.h:106
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7080
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:370
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
char z2homog
Definition: kutil.h:372
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
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:12
char honey
Definition: kutil.h:375
char Gebauer
Definition: kutil.h:376
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3480

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10292 of file kutil.cc.

10293 {
10295  {
10296  if (strat->honey)
10297  {
10298  strat->posInL = posInL15;
10299  // ok -- here is the deal: from my experiments for Singular-2-0
10300  // I conclude that that posInT_EcartpLength is the best of
10301  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10302  // see the table at the end of this file
10303  if (TEST_OPT_OLDSTD)
10304  strat->posInT = posInT15;
10305  else
10306  strat->posInT = posInT_EcartpLength;
10307  }
10308  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10309  {
10310  strat->posInL = posInL11;
10311  strat->posInT = posInT11;
10312  }
10313  else if (TEST_OPT_INTSTRATEGY)
10314  {
10315  strat->posInL = posInL11;
10316  strat->posInT = posInT11;
10317  }
10318  else
10319  {
10320  strat->posInL = posInL0;
10321  strat->posInT = posInT0;
10322  }
10323  //if (strat->minim>0) strat->posInL =posInLSpecial;
10324  if (strat->homog)
10325  {
10326  strat->posInL = posInL110;
10327  strat->posInT = posInT110;
10328  }
10329  }
10330  else
10331  {
10332  if (strat->homog)
10333  {
10334  strat->posInL = posInL11;
10335  strat->posInT = posInT11;
10336  }
10337  else
10338  {
10339  if ((currRing->order[0]==ringorder_c)
10340  ||(currRing->order[0]==ringorder_C))
10341  {
10342  strat->posInL = posInL17_c;
10343  strat->posInT = posInT17_c;
10344  }
10345  else
10346  {
10347  strat->posInL = posInL17;
10348  strat->posInT = posInT17;
10349  }
10350  }
10351  }
10352  if (strat->minim>0) strat->posInL =posInLSpecial;
10353  // for further tests only
10354  if ((BTEST1(11)) || (BTEST1(12)))
10355  strat->posInL = posInL11;
10356  else if ((BTEST1(13)) || (BTEST1(14)))
10357  strat->posInL = posInL13;
10358  else if ((BTEST1(15)) || (BTEST1(16)))
10359  strat->posInL = posInL15;
10360  else if ((BTEST1(17)) || (BTEST1(18)))
10361  strat->posInL = posInL17;
10362  if (BTEST1(11))
10363  strat->posInT = posInT11;
10364  else if (BTEST1(13))
10365  strat->posInT = posInT13;
10366  else if (BTEST1(15))
10367  strat->posInT = posInT15;
10368  else if ((BTEST1(17)))
10369  strat->posInT = posInT17;
10370  else if ((BTEST1(19)))
10371  strat->posInT = posInT19;
10372  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10373  strat->posInT = posInT1;
10374  if (rField_is_Ring(currRing))
10375  {
10376  strat->posInL = posInL11Ring;
10377  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10378  strat->posInL = posInL11Ringls;
10379  strat->posInT = posInT11;
10380  }
10381  strat->posInLDependsOnLength = FALSE;
10382  strat->posInLSba = posInLSig;
10383  //strat->posInL = posInLSig;
10384  strat->posInL = posInLF5C;
10385  /*
10386  if (rField_is_Ring(currRing))
10387  {
10388  strat->posInLSba = posInLSigRing;
10389  strat->posInL = posInL11Ring;
10390  }*/
10391  //strat->posInT = posInTSig;
10392 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#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:6311
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6123
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
#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:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
char homog
Definition: kutil.h:370
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
char posInLDependsOnLength
Definition: kutil.h:387
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568

◆ initsevT()

KINLINE unsigned long* initsevT ( )

Definition at line 100 of file kInline.h.

101 {
102  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
103 }
#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 8169 of file kutil.cc.

8170 {
8171  int i,pos;
8172 
8173  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8174  else i=setmaxT;
8175  strat->ecartS=initec(i);
8176  strat->sevS=initsevS(i);
8177  strat->S_2_R=initS_2_R(i);
8178  strat->fromQ=NULL;
8179  strat->Shdl=idInit(i,F->rank);
8180  strat->S=strat->Shdl->m;
8181  /*- put polys into S -*/
8182  if (Q!=NULL)
8183  {
8184  strat->fromQ=initec(i);
8185  memset(strat->fromQ,0,i*sizeof(int));
8186  for (i=0; i<IDELEMS(Q); i++)
8187  {
8188  if (Q->m[i]!=NULL)
8189  {
8190  LObject h;
8191  h.p = pCopy(Q->m[i]);
8193  {
8194  deleteHC(&h,strat);
8195  }
8197  {
8198  h.pCleardenom(); // also does remove Content
8199  }
8200  else
8201  {
8202  h.pNorm();
8203  }
8204  if (h.p!=NULL)
8205  {
8206  strat->initEcart(&h);
8207  if (strat->sl==-1)
8208  pos =0;
8209  else
8210  {
8211  pos = posInS(strat,strat->sl,h.p,h.ecart);
8212  }
8213  h.sev = pGetShortExpVector(h.p);
8214  strat->enterS(h,pos,strat,-1);
8215  strat->fromQ[pos]=1;
8216  }
8217  }
8218  }
8219  }
8220  for (i=0; i<IDELEMS(F); i++)
8221  {
8222  if (F->m[i]!=NULL)
8223  {
8224  LObject h;
8225  h.p = pCopy(F->m[i]);
8226  if (h.p!=NULL)
8227  {
8229  {
8230  cancelunit(&h); /*- tries to cancel a unit -*/
8231  deleteHC(&h, strat);
8232  }
8233  if (h.p!=NULL)
8234  {
8236  {
8237  h.pCleardenom(); // also does remove Content
8238  }
8239  else
8240  {
8241  h.pNorm();
8242  }
8243  strat->initEcart(&h);
8244  if (strat->Ll==-1)
8245  pos =0;
8246  else
8247  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8248  h.sev = pGetShortExpVector(h.p);
8249  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8250  }
8251  }
8252  }
8253  }
8254  /*- test, if a unit is in F -*/
8255 
8256  if ((strat->Ll>=0)
8257 #ifdef HAVE_RINGS
8258  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8259 #endif
8260  && pIsConstant(strat->L[strat->Ll].p))
8261  {
8262  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8263  }
8264 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#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:44
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define setmaxTinc
Definition: kutil.h:34
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
#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 8266 of file kutil.cc.

8267 {
8268  int i,pos;
8269  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8270  else i=setmaxT;
8271  strat->ecartS = initec(i);
8272  strat->sevS = initsevS(i);
8273  strat->sevSig = initsevS(i);
8274  strat->S_2_R = initS_2_R(i);
8275  strat->fromQ = NULL;
8276  strat->Shdl = idInit(i,F->rank);
8277  strat->S = strat->Shdl->m;
8278  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8279  if (strat->sbaOrder != 1)
8280  {
8281  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8282  strat->sevSyz = initsevS(i);
8283  strat->syzmax = i;
8284  strat->syzl = 0;
8285  }
8286  /*- put polys into S -*/
8287  if (Q!=NULL)
8288  {
8289  strat->fromQ=initec(i);
8290  memset(strat->fromQ,0,i*sizeof(int));
8291  for (i=0; i<IDELEMS(Q); i++)
8292  {
8293  if (Q->m[i]!=NULL)
8294  {
8295  LObject h;
8296  h.p = pCopy(Q->m[i]);
8298  {
8299  deleteHC(&h,strat);
8300  }
8302  {
8303  h.pCleardenom(); // also does remove Content
8304  }
8305  else
8306  {
8307  h.pNorm();
8308  }
8309  if (h.p!=NULL)
8310  {
8311  strat->initEcart(&h);
8312  if (strat->sl==-1)
8313  pos =0;
8314  else
8315  {
8316  pos = posInS(strat,strat->sl,h.p,h.ecart);
8317  }
8318  h.sev = pGetShortExpVector(h.p);
8319  strat->enterS(h,pos,strat,-1);
8320  strat->fromQ[pos]=1;
8321  }
8322  }
8323  }
8324  }
8325  for (i=0; i<IDELEMS(F); i++)
8326  {
8327  if (F->m[i]!=NULL)
8328  {
8329  LObject h;
8330  h.p = pCopy(F->m[i]);
8331  h.sig = pOne();
8332  //h.sig = pInit();
8333  //p_SetCoeff(h.sig,nInit(1),currRing);
8334  p_SetComp(h.sig,i+1,currRing);
8335  // if we are working with the Schreyer order we generate it
8336  // by multiplying the initial signatures with the leading monomial
8337  // of the corresponding initial polynomials generating the ideal
8338  // => we can keep the underlying monomial order and get a Schreyer
8339  // order without any bigger overhead
8340  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8341  {
8342  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8343  }
8344  h.sevSig = pGetShortExpVector(h.sig);
8345 #ifdef DEBUGF5
8346  pWrite(h.p);
8347  pWrite(h.sig);
8348 #endif
8349  if (h.p!=NULL)
8350  {
8352  {
8353  cancelunit(&h); /*- tries to cancel a unit -*/
8354  deleteHC(&h, strat);
8355  }
8356  if (h.p!=NULL)
8357  {
8359  {
8360  h.pCleardenom(); // also does remove Content
8361  }
8362  else
8363  {
8364  h.pNorm();
8365  }
8366  strat->initEcart(&h);
8367  if (strat->Ll==-1)
8368  pos =0;
8369  else
8370  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8371  h.sev = pGetShortExpVector(h.p);
8372  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8373  }
8374  }
8375  /*
8376  if (strat->sbaOrder != 1)
8377  {
8378  for(j=0;j<i;j++)
8379  {
8380  strat->syz[ctr] = pCopy(F->m[j]);
8381  p_SetCompP(strat->syz[ctr],i+1,currRing);
8382  // add LM(F->m[i]) to the signature to get a Schreyer order
8383  // without changing the underlying polynomial ring at all
8384  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8385  // since p_Add_q() destroys all input
8386  // data we need to recreate help
8387  // each time
8388  poly help = pCopy(F->m[i]);
8389  p_SetCompP(help,j+1,currRing);
8390  pWrite(strat->syz[ctr]);
8391  pWrite(help);
8392  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8393  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8394  printf("%d. SYZ ",ctr);
8395  pWrite(strat->syz[ctr]);
8396  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8397  ctr++;
8398  }
8399  strat->syzl = ps;
8400  }
8401  */
8402  }
8403  }
8404  /*- test, if a unit is in F -*/
8405 
8406  if ((strat->Ll>=0)
8407 #ifdef HAVE_RINGS
8408  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8409 #endif
8410  && pIsConstant(strat->L[strat->Ll].p))
8411  {
8412  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8413  }
8414 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
int syzmax
Definition: kutil.h:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:512
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
void pWrite(poly p)
Definition: polys.h:303
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#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:44
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define setmaxT
Definition: kutil.h:33
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:233
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:34
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:971
int syzl
Definition: kutil.h:347
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8416 of file kutil.cc.

8417 {
8418  if( strat->S[0] )
8419  {
8420  if( strat->S[1] && !rField_is_Ring(currRing))
8421  {
8422  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8423  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8424  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8425  }
8426  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8427  /************************************************************
8428  * computing the length of the syzygy array needed
8429  ***********************************************************/
8430  for(i=1; i<=strat->sl; i++)
8431  {
8432  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8433  {
8434  ps += i;
8435  }
8436  }
8437  ps += strat->sl+1;
8438  //comp = pGetComp (strat->P.sig);
8439  comp = strat->currIdx;
8440  strat->syzIdx = initec(comp);
8441  strat->sevSyz = initsevS(ps);
8442  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8443  strat->syzmax = ps;
8444  strat->syzl = 0;
8445  strat->syzidxmax = comp;
8446 #if defined(DEBUGF5) || defined(DEBUGF51)
8447  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8448 #endif
8449  i = 1;
8450  j = 0;
8451  /************************************************************
8452  * generating the leading terms of the principal syzygies
8453  ***********************************************************/
8454  while (i <= strat->sl)
8455  {
8456  /**********************************************************
8457  * principal syzygies start with component index 2
8458  * the array syzIdx starts with index 0
8459  * => the rules for a signature with component comp start
8460  * at strat->syz[strat->syzIdx[comp-2]] !
8461  *********************************************************/
8462  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8463  {
8464  comp = pGetComp(strat->sig[i]);
8465  comp_old = pGetComp(strat->sig[i-1]);
8466  diff = comp - comp_old - 1;
8467  // diff should be zero, but sometimes also the initial generating
8468  // elements of the input ideal reduce to zero. then there is an
8469  // index-gap between the signatures. for these inbetween signatures we
8470  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8471  // in the following.
8472  // doing this, we keep the relation "j = comp - 2" alive, which makes
8473  // jumps way easier when checking criteria
8474  while (diff>0)
8475  {
8476  strat->syzIdx[j] = 0;
8477  diff--;
8478  j++;
8479  }
8480  strat->syzIdx[j] = ctr;
8481  j++;
8482  LObject Q;
8483  int pos;
8484  for (k = 0; k<i; k++)
8485  {
8486  Q.sig = pOne();
8488  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8489  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8490  p_SetCompP (Q.sig, comp, currRing);
8491  poly q = p_One(currRing);
8493  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8494  p_ExpVectorCopy(q,strat->S[i],currRing);
8495  q = p_Neg (q, currRing);
8496  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8497  Q.sig = p_Add_q (Q.sig, q, currRing);
8498  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8499  pos = posInSyz(strat, Q.sig);
8500  enterSyz(Q, strat, pos);
8501  ctr++;
8502  }
8503  }
8504  i++;
8505  }
8506  /**************************************************************
8507  * add syzygies for upcoming first element of new iteration step
8508  **************************************************************/
8509  comp = strat->currIdx;
8510  comp_old = pGetComp(strat->sig[i-1]);
8511  diff = comp - comp_old - 1;
8512  // diff should be zero, but sometimes also the initial generating
8513  // elements of the input ideal reduce to zero. then there is an
8514  // index-gap between the signatures. for these inbetween signatures we
8515  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8516  // in the following.
8517  // doing this, we keep the relation "j = comp - 2" alive, which makes
8518  // jumps way easier when checking criteria
8519  while (diff>0)
8520  {
8521  strat->syzIdx[j] = 0;
8522  diff--;
8523  j++;
8524  }
8525  strat->syzIdx[j] = ctr;
8526  LObject Q;
8527  int pos;
8528  for (k = 0; k<strat->sl+1; k++)
8529  {
8530  Q.sig = pOne();
8532  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8533  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8534  p_SetCompP (Q.sig, comp, currRing);
8535  poly q = p_One(currRing);
8537  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8538  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8539  q = p_Neg (q, currRing);
8540  p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
8541  Q.sig = p_Add_q (Q.sig, q, currRing);
8542  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8543  pos = posInSyz(strat, Q.sig);
8544  enterSyz(Q, strat, pos);
8545  ctr++;
8546  }
8547 //#if 1
8548 #ifdef DEBUGF5
8549  PrintS("Principal syzygies:\n");
8550  Print("syzl %d\n",strat->syzl);
8551  Print("syzmax %d\n",strat->syzmax);
8552  Print("ps %d\n",ps);
8553  PrintS("--------------------------------\n");
8554  for(i=0;i<=strat->syzl-1;i++)
8555  {
8556  Print("%d - ",i);
8557  pWrite(strat->syz[i]);
8558  }
8559  for(i=0;i<strat->currIdx;i++)
8560  {
8561  Print("%d - %d\n",i,strat->syzIdx[i]);
8562  }
8563  PrintS("--------------------------------\n");
8564 #endif
8565  }
8566 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
polyset sig
Definition: kutil.h:304
int j
Definition: facHensel.cc:105
static gmp_float * diff
Definition: mpr_complex.cc:45
#define Print
Definition: emacs.cc:80
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:303
int k
Definition: cfEzgcd.cc:92
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:508
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
int currIdx
Definition: kutil.h:313
#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:253
poly p_One(const ring r)
Definition: p_polys.cc:1303
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1248
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:310
polyset S
Definition: kutil.h:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6283
int syzidxmax
Definition: kutil.h:347
#define nCopy(n)
Definition: numbers.h:15
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
#define p_GetCoeff(p, r)
Definition: monomials.h:50
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:503
int sl
Definition: kutil.h:346
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
int syzl
Definition: kutil.h:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9778
intset syzIdx
Definition: kutil.h:309

◆ initT()

KINLINE TSet initT ( )

Definition at line 84 of file kInline.h.

85 {
86  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
87  for (int i=setmaxT-1; i>=0; i--)
88  {
89  T[i].tailRing = currRing;
90  T[i].i_r = -1;
91  }
92  return T;
93 }
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:12
static jList * T
Definition: janet.cc:30
#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 964 of file kInline.h.

966 {
967  p_LmCheckPolyRing(p1, p_r);
968  p_LmCheckPolyRing(p2, p_r);
969 
970  int i;
971  long x;
972  m1 = p_Init(m_r,m_r->PolyBin);
973  m2 = p_Init(m_r,m_r->PolyBin);
974 
975  for (i = p_r->N; i; i--)
976  {
977  x = p_GetExpDiff(p1, p2, i, p_r);
978  if (x > 0)
979  {
980  if (x > (long) m_r->bitmask) goto false_return;
981  p_SetExp(m2,i,x, m_r);
982  p_SetExp(m1,i,0, m_r);
983  }
984  else
985  {
986  if (-x > (long) m_r->bitmask) goto false_return;
987  p_SetExp(m1,i,-x, m_r);
988  p_SetExp(m2,i,0, m_r);
989  }
990  }
991 
992  p_Setm(m1, m_r);
993  p_Setm(m2, m_r);
994  return TRUE;
995 
996  false_return:
997  p_LmFree(m1, m_r);
998  p_LmFree(m2, m_r);
999  m1 = m2 = NULL;
1000  return FALSE;
1001 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:634
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 : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define NULL
Definition: omList.c:12
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ 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 1007 of file kInline.h.

1009 {
1010  p_LmCheckPolyRing(p1, leadRing);
1011  p_LmCheckPolyRing(p2, leadRing);
1012 
1013  int i;
1014  int x;
1015  int e1;
1016  int e2;
1017  int s;
1018  m1 = p_Init(tailRing,tailRing->PolyBin);
1019  m2 = p_Init(tailRing,tailRing->PolyBin);
1020  lcm = p_Init(leadRing,leadRing->PolyBin);
1021 
1022  for (i = leadRing->N; i>=0; i--)
1023  {
1024  e1 = p_GetExp(p1,i,leadRing);
1025  e2 = p_GetExp(p2,i,leadRing);
1026  x = e1 - e2;
1027  if (x > 0)
1028  {
1029  p_SetExp(m2,i,x, tailRing);
1030  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1031  s = e1;
1032  }
1033  else if (x<0)
1034  {
1035  p_SetExp(m1,i,-x, tailRing);
1036  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1037  s = e2;
1038  }
1039  else
1040  s = e1; // e1==e2
1041  p_SetExp(lcm,i,s, leadRing);
1042  }
1043 
1044  p_Setm(m1, tailRing);
1045  p_Setm(m2, tailRing);
1046  p_Setm(lcm, leadRing);
1047 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
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 : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118
Variable x
Definition: cfModGcd.cc:4023
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ k_LmInit_currRing_2_tailRing() [1/2]

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

Definition at line 905 of file kInline.h.

906 {
907 
908  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
909  pNext(t_p) = pNext(p);
910  pSetCoeff0(t_p, pGetCoeff(p));
911  return t_p;
912 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1270
#define pSetCoeff0(p, n)
Definition: monomials.h:59
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 937 of file kInline.h.

938 {
939  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
940 }
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
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 914 of file kInline.h.

915 {
916  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
917  pNext(p) = pNext(t_p);
918  pSetCoeff0(p, pGetCoeff(t_p));
919  return p;
920 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1270
#define pSetCoeff0(p, n)
Definition: monomials.h:59
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 942 of file kInline.h.

943 {
944  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
945 }
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:914
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 923 of file kInline.h.

924 {
925  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
926  p_LmFree(p, currRing);
927  return np;
928 }
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 947 of file kInline.h.

948 {
949  return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
950 }
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:923
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 930 of file kInline.h.

931 {
932  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
933  p_LmFree(p, tailRing);
934  return np;
935 }
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:914
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 952 of file kInline.h.

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

◆ kCheckSpolyCreation()

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

Definition at line 10905 of file kutil.cc.

10906 {
10907  if (strat->overflow) return FALSE;
10908  assume(L->p1 != NULL && L->p2 != NULL);
10909  // shift changes: from 0 to -1
10910  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10911  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10912  assume(strat->tailRing != currRing);
10913 
10914  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10915  return FALSE;
10916  // shift changes: extra case inserted
10917  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10918  {
10919  return TRUE;
10920  }
10921  poly p1_max=NULL;
10922  if (L->i_r1>=0) p1_max = (strat->R[L->i_r1])->max_exp;
10923  poly p2_max=NULL;
10924  if (L->i_r2>=0) p2_max = (strat->R[L->i_r2])->max_exp;
10925 
10926  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10927  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10928  {
10929  p_LmFree(m1, strat->tailRing);
10930  p_LmFree(m2, strat->tailRing);
10931  m1 = NULL;
10932  m2 = NULL;
10933  return FALSE;
10934  }
10935  return TRUE;
10936 }
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
#define assume(x)
Definition: mod2.h:390
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12

◆ kCheckStrongCreation()

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

Definition at line 10945 of file kutil.cc.

10946 {
10947  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10948  //assume(strat->tailRing != currRing);
10949 
10950  poly p1_max = (strat->R[atR])->max_exp;
10951  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10952 
10953  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10954  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10955  {
10956  return FALSE;
10957  }
10958  return TRUE;
10959 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:390
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341

◆ kCreateZeroPoly()

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

Definition at line 4327 of file kutil.cc.

4328 {
4329 
4330  poly zeroPoly = NULL;
4331 
4332  number tmp1;
4333  poly tmp2, tmp3;
4334 
4335  if (cabsind == -1)
4336  {
4337  cabsind = 0;
4338  for (int i = 1; i <= leadRing->N; i++)
4339  {
4340  cabsind += ind_fact_2(exp[i]);
4341  }
4342 // Print("cabsind: %d\n", cabsind);
4343  }
4344  if (cabsind < leadRing->ch)
4345  {
4346  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4347  }
4348  else
4349  {
4350  zeroPoly = p_ISet(1, tailRing);
4351  }
4352  for (int i = 1; i <= leadRing->N; i++)
4353  {
4354  for (long j = 1; j <= exp[i]; j++)
4355  {
4356  tmp1 = nInit(j);
4357  tmp2 = p_ISet(1, tailRing);
4358  p_SetExp(tmp2, i, 1, tailRing);
4359  p_Setm(tmp2, tailRing);
4360  if (nIsZero(tmp1))
4361  { // should nowbe obsolet, test ! TODO OLIVER
4362  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4363  }
4364  else
4365  {
4366  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4367  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4368  }
4369  }
4370  }
4371  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4372  for (int i = 1; i <= leadRing->N; i++)
4373  {
4374  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4375  }
4376  p_Setm(tmp2, leadRing);
4377  *t_p = zeroPoly;
4378  zeroPoly = pNext(zeroPoly);
4379  pNext(*t_p) = NULL;
4380  pNext(tmp2) = zeroPoly;
4381  return tmp2;
4382 }
int j
Definition: facHensel.cc:105
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
#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:1455
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
long twoPow(long arg)
Definition: kutil.cc:4138
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
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 : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
long ind_fact_2(long arg)
Definition: kutil.cc:4123
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1287
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 11923 of file kutil.cc.

11924 {
11925  PrintS("red: ");
11926  if (strat->red==redFirst) PrintS("redFirst\n");
11927  else if (strat->red==redHoney) PrintS("redHoney\n");
11928  else if (strat->red==redEcart) PrintS("redEcart\n");
11929  else if (strat->red==redHomog) PrintS("redHomog\n");
11930  else Print("%p\n",(void*)strat->red);
11931  PrintS("posInT: ");
11932  if (strat->posInT==posInT0) PrintS("posInT0\n");
11933  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11934  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11935  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11936  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11937  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11938  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11939  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11940  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11941  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11942  #ifdef HAVE_RINGS
11943  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11944  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11945  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11946  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11947  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11948  #endif
11949 #ifdef HAVE_MORE_POS_IN_T
11950  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11951  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11952  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11953 #endif
11954  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11955  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11956  else Print("%p\n",(void*)strat->posInT);
11957  PrintS("posInL: ");
11958  if (strat->posInL==posInL0) PrintS("posInL0\n");
11959  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11960  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11961  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11962  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11963  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11964  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11965  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11966  #ifdef HAVE_RINGS
11967  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11968  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11969  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11970  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11971  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11972  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11973  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11974  #endif
11975  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11976  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11977  else Print("%p\n",(void*)strat->posInL);
11978  PrintS("enterS: ");
11979  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11980  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11981  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11982  else Print("%p\n",(void*)strat->enterS);
11983  PrintS("initEcart: ");
11984  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11985  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11986  else Print("%p\n",(void*)strat->initEcart);
11987  PrintS("initEcartPair: ");
11988  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11989  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11990  else Print("%p\n",(void*)strat->initEcartPair);
11991  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11992  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11993  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11994  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11995  PrintS("chainCrit: ");
11996  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11997  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11998  else Print("%p\n",(void*)strat->chainCrit);
11999  Print("posInLDependsOnLength=%d\n",
12000  strat->posInLDependsOnLength);
12001  PrintS(showOption());PrintLn();
12002  PrintS("LDeg: ");
12003  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12004  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12005  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
12006  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12007  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12008  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12009  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12010  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12011  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12012  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12013  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12014  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12015  else Print("? (%lx)", (long)currRing->pLDeg);
12016  PrintS(" / ");
12017  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12018  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12019  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
12020  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12021  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12022  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12023  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12024  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12025  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12026  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12027  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12028  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12029  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
12030  PrintLn();
12031  PrintS("currRing->pFDeg: ");
12032  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
12033  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
12034  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
12035  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
12036  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
12037  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
12038  else Print("? (%lx)", (long)currRing->pFDeg);
12039  PrintLn();
12040  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
12041  if(TEST_OPT_DEGBOUND)
12042  Print(" degBound: %d\n", Kstd1_deg);
12043 
12044  if( ecartWeights != NULL )
12045  {
12046  PrintS("ecartWeights: ");
12047  for (int i = rVar(currRing); i > 0; i--)
12048  Print("%hd ", ecartWeights[i]);
12049  PrintLn();
12051  }
12052 
12053 #ifndef SING_NDEBUG
12055 #endif
12056 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11889
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5403
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1270
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5296
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:831
#define TEST_OPT_DEGBOUND
Definition: options.h:112
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:995
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6779
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:867
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
char noTailReduction
Definition: kutil.h:376
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:217
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3192
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6537
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6864
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6662
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:760
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:723
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:900
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6978
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
char use_buckets
Definition: kutil.h:381
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:931
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
char sugarCrit
Definition: kutil.h:375
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
#define assume(x)
Definition: mod2.h:390
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:586
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5792
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:729
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
void rDebugPrint(const ring r)
Definition: ring.cc:4041
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:5731
int Kstd1_deg
Definition: kutil.cc:237
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11798
#define TEST_OPT_WEIGHTM
Definition: options.h:119
char homog
Definition: kutil.h:370
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:801
#define NULL
Definition: omList.c:12
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:965
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:166
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5521
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3405
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:247
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1028
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1058
char posInLDependsOnLength
Definition: kutil.h:387
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:603
char Gebauer
Definition: kutil.h:376
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11852
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006
int LazyDegree
Definition: kutil.h:351
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5899
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261

◆ kDeleteLcm()

static void kDeleteLcm ( LObject P)
inlinestatic

Definition at line 876 of file kutil.h.

877 {
878  if (P->lcm!=NULL)
879  {
880  #ifdef HAVE_RINGS
882  pLmDelete(P->lcm);
883  else
884  #endif
885  pLmFree(P->lcm);
886  P->lcm=NULL;
887  }
888 }
#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:479
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 326 of file kstd2.cc.

327 {
328  unsigned long not_sev = ~L->sev;
329  poly p = L->GetLmCurrRing();
330  int j = 0;
331 
332  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
333 
335 #if 1
336  int ende;
337  if (is_Ring
338  || (strat->ak>0)
339  || currRing->pLexOrder)
340  ende=strat->sl;
341  else
342  {
343  ende=posInS(strat,*max_ind,p,0)+1;
344  if (ende>(*max_ind)) ende=(*max_ind);
345  }
346 #else
347  int ende=strat->sl;
348 #endif
349  if(is_Ring)
350  {
351  loop
352  {
353  if (j > ende) return -1;
354 #if defined(PDEBUG) || defined(PDIV_DEBUG)
355  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
356  p, not_sev, currRing))
357  {
358  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
359  return j;
360  }
361 #else
362  if ( !(strat->sevS[j] & not_sev) &&
363  p_LmDivisibleBy(strat->S[j], p, currRing))
364  {
365  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
366  return j;
367  }
368 #endif
369  j++;
370  }
371  }
372  else
373  {
374  loop
375  {
376  if (j > ende) return -1;
377 #if defined(PDEBUG) || defined(PDIV_DEBUG)
378  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
379  p, not_sev, currRing))
380  {
381  return j;
382  }
383 #else
384  if ( !(strat->sevS[j] & not_sev) &&
385  p_LmDivisibleBy(strat->S[j], p, currRing))
386  {
387  return j;
388  }
389 #endif
390  j++;
391  }
392  }
393 }
int j
Definition: facHensel.cc:105
#define pAssume(cond)
Definition: monomials.h:90
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
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 7263 of file kutil.cc.

7264 {
7265  int j = 0;
7266  const unsigned long not_sev = ~L->sev;
7267  const unsigned long* sev = strat->sevS;
7268  poly p;
7269  ring r;
7270  L->GetLm(p, r);
7271 
7272  assume(~not_sev == p_GetShortExpVector(p, r));
7273 
7274  if (r == currRing)
7275  {
7276  if(!rField_is_Ring(r))
7277  {
7278  loop
7279  {
7280  if (j > end_pos) return NULL;
7281  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7282  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7283  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7284  {
7285  break;
7286  }
7287  #else
7288  if (!(sev[j] & not_sev) &&
7289  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7290  p_LmDivisibleBy(strat->S[j], p, r))
7291  {
7292  break;
7293  }
7294  #endif
7295  j++;
7296  }
7297  }
7298  #ifdef HAVE_RINGS
7299  else
7300  {
7301  loop
7302  {
7303  if (j > end_pos) return NULL;
7304  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7305  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7306  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7307  {
7308  break;
7309  }
7310  #else
7311  if (!(sev[j] & not_sev) &&
7312  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7313  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7314  {
7315  break;
7316  }
7317  #endif
7318  j++;
7319  }
7320  }
7321  #endif
7322  // if called from NF, T objects do not exist:
7323  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7324  {
7325  T->Set(strat->S[j], r, strat->tailRing);
7326  assume(T->GetpLength()==pLength(T->p != __null ? T->p : T->t_p));
7327  return T;
7328  }
7329  else
7330  {
7331 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7332 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7333 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7334  return strat->S_2_T(j);
7335  }
7336  }
7337  else
7338  {
7339  TObject* t;
7340  if(!rField_is_Ring(r))
7341  {
7342  loop
7343  {
7344  if (j > end_pos) return NULL;
7345  assume(strat->S_2_R[j] != -1);
7346  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7347  t = strat->S_2_T(j);
7348  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7349  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7350  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7351  {
7352  t->pLength=pLength(t->t_p);
7353  return t;
7354  }
7355  #else
7356  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7357  {
7358  t = strat->S_2_T(j);
7359  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7360  if (p_LmDivisibleBy(t->t_p, p, r))
7361  {
7362  t->pLength=pLength(t->t_p);
7363  return t;
7364  }
7365  }
7366  #endif
7367  j++;
7368  }
7369  }
7370  #ifdef HAVE_RINGS
7371  else
7372  {
7373  loop
7374  {
7375  if (j > end_pos) return NULL;
7376  assume(strat->S_2_R[j] != -1);
7377  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7378  t = strat->S_2_T(j);
7379  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7380  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7381  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7382  {
7383  t->pLength=pLength(t->t_p);
7384  return t;
7385  }
7386  #else
7387  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7388  {
7389  t = strat->S_2_T(j);
7390  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7391  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7392  {
7393  t->pLength=pLength(t->t_p);
7394  return t;
7395  }
7396  }
7397  #endif
7398  j++;
7399  }
7400  }
7401  #endif
7402  }
7403 }
int j
Definition: facHensel.cc:105
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:38
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
static unsigned pLength(poly a)
Definition: p_polys.h:191
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30
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 216 of file kstd2.cc.

217 {
218  unsigned long not_sev = ~L->sev;
219  int j = start;
220 
221  const TSet T=strat->T;
222  const unsigned long* sevT=strat->sevT;
223  const ring r=currRing;
224  const BOOLEAN is_Ring=rField_is_Ring(r);
225  if (L->p!=NULL)
226  {
227  const poly p=L->p;
228 
229  pAssume(~not_sev == p_GetShortExpVector(p, r));
230 
231  if(is_Ring)
232  {
233  loop
234  {
235  if (j > strat->tl) return -1;
236 #if defined(PDEBUG) || defined(PDIV_DEBUG)
237  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
238  {
239  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
240  return j;
241  }
242 #else
243  if (!(sevT[j] & not_sev) &&
244  p_LmDivisibleBy(T[j].p, p, r))
245  {
246  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
247  return j;
248  }
249 #endif
250  j++;
251  }
252  }
253  else
254  {
255  loop
256  {
257  if (j > strat->tl) return -1;
258 #if defined(PDEBUG) || defined(PDIV_DEBUG)
259  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
260  {
261  return j;
262  }
263 #else
264  if (!(sevT[j] & not_sev) &&
265  p_LmDivisibleBy(T[j].p, p, r))
266  {
267  return j;
268  }
269 #endif
270  j++;
271  }
272  }
273  }
274  else
275  {
276  const poly p=L->t_p;
277  const ring r=strat->tailRing;
278  if(is_Ring)
279  {
280  loop
281  {
282  if (j > strat->tl) return -1;
283 #if defined(PDEBUG) || defined(PDIV_DEBUG)
284  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
285  p, not_sev, r))
286  {
287  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
288  return j;
289  }
290 #else
291  if (!(sevT[j] & not_sev) &&
292  p_LmDivisibleBy(T[j].t_p, p, r))
293  {
294  if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
295  return j;
296  }
297 #endif
298  j++;
299  }
300  }
301  else
302  {
303  loop
304  {
305  if (j > strat->tl) return -1;
306 #if defined(PDEBUG) || defined(PDIV_DEBUG)
307  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
308  p, not_sev, r))
309  {
310  return j;
311  }
312 #else
313  if (!(sevT[j] & not_sev) &&
314  p_LmDivisibleBy(T[j].t_p, p, r))
315  {
316  return j;
317  }
318 #endif
319  j++;
320  }
321  }
322  }
323 }
int j
Definition: facHensel.cc:105
TObject * TSet
Definition: kutil.h:55
#define pAssume(cond)
Definition: monomials.h:90
int tl
Definition: kutil.h:348
unsigned long * sevT
Definition: kutil.h:321
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30
int BOOLEAN
Definition: auxiliary.h:85

◆ kFindDivisibleByInT_Z()

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

Definition at line 139 of file kstd2.cc.

140 {
141  unsigned long not_sev = ~L->sev;
142  int j = start;
143  int o = -1;
144 
145  const TSet T=strat->T;
146  const unsigned long* sevT=strat->sevT;
147  number rest, orest, mult;
148  if (L->p!=NULL)
149  {
150  const ring r=currRing;
151  const poly p=L->p;
152  orest = pGetCoeff(p);
153 
154  pAssume(~not_sev == p_GetShortExpVector(p, r));
155 
156  loop
157  {
158  if (j > strat->tl) return o;
159 #if defined(PDEBUG) || defined(PDIV_DEBUG)
160  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
161  {
162  mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].p), &rest, r->cf);
163  if (!n_IsZero(mult, r) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf) == TRUE) {
164  o = j;
165  orest = rest;
166  }
167  }
168 #else
169  if (!(sevT[j] & not_sev) && p_LmDivisibleBy(T[j].p, p, r))
170  {
171  mult = n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].p), &rest, r->cf);
172  if (!n_IsZero(mult, r) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf) == TRUE) {
173  o = j;
174  orest = rest;
175  }
176  }
177 #endif
178  j++;
179  }
180  }
181  else
182  {
183  const ring r=strat->tailRing;
184  const poly p=L->t_p;
185  orest = pGetCoeff(p);
186  loop
187  {
188  if (j > strat->tl) return o;
189 #if defined(PDEBUG) || defined(PDIV_DEBUG)
190  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
191  p, not_sev, r))
192  {
193  mult = n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].p), &rest, r->cf);
194  if (!n_IsZero(mult, r) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf) == TRUE) {
195  o = j;
196  orest = rest;
197  }
198  }
199 #else
200  if (!(sevT[j] & not_sev) && p_LmDivisibleBy(T[j].t_p, p, r))
201  {
202  mult = n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].p), &rest, r->cf);
203  if (!n_IsZero(mult, r) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf) == TRUE) {
204  o = j;
205  orest = rest;
206  }
207  }
208 #endif
209  j++;
210  }
211  }
212 }
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff &#39;a&#39; is larger than &#39;b&#39;; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:511
static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
Definition: coeffs.h:697
int j
Definition: facHensel.cc:105
TObject * TSet
Definition: kutil.h:55
#define pAssume(cond)
Definition: monomials.h:90
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:321
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:703
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30

◆ kFindInT()

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

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

Definition at line 711 of file kutil.cc.

712 {
713  int i;
714 
715  for (i=0; i<=tlength; i++)
716  {
717  if (T[i].p == p) return i;
718  }
719  return -1;
720 }
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30

◆ kFindNextDivisibleByInS()

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

Definition at line 395 of file kstd2.cc.

396 {
397  unsigned long not_sev = ~L->sev;
398  poly p = L->GetLmCurrRing();
399  int j = start;
400 
401  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
402 #if 1
403  int ende=max_ind;
404 #else
405  int ende=strat->sl;
406 #endif
408  {
409  loop
410  {
411  if (j > ende) return -1;
412 #if defined(PDEBUG) || defined(PDIV_DEBUG)
413  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
414  p, not_sev, currRing))
415  {
416  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
417  return j;
418  }
419 #else
420  if ( !(strat->sevS[j] & not_sev) &&
421  p_LmDivisibleBy(strat->S[j], p, currRing))
422  {
423  if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
424  return j;
425  }
426 #endif
427  j++;
428  }
429  }
430  else
431  {
432  loop
433  {
434  if (j > ende) return -1;
435 #if defined(PDEBUG) || defined(PDIV_DEBUG)
436  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
437  p, not_sev, currRing))
438  {
439  return j;
440  }
441 #else
442  if ( !(strat->sevS[j] & not_sev) &&
443  p_LmDivisibleBy(strat->S[j], p, currRing))
444  {
445  return j;
446  }
447 #endif
448  j++;
449  }
450  }
451 }
int j
Definition: facHensel.cc:105
#define pAssume(cond)
Definition: monomials.h:90
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
polyset S
Definition: kutil.h:302
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019

◆ kFindSameLMInT_Z()

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

Definition at line 84 of file kstd2.cc.

85 {
86  unsigned long not_sev = ~L->sev;
87  int j = start;
88  int o = -1;
89 
90  const TSet T=strat->T;
91  const unsigned long* sevT=strat->sevT;
92  number gcd, ogcd;
93  if (L->p!=NULL)
94  {
95  const ring r=currRing;
96  const poly p=L->p;
97  ogcd = pGetCoeff(p);
98 
99  pAssume(~not_sev == p_GetShortExpVector(p, r));
100 
101  loop
102  {
103  if (j > strat->tl) return o;
104  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r) && p_LmEqual(T[j].p, p, r))
105  {
106  gcd = n_Gcd(pGetCoeff(p), pGetCoeff(T[j].p), r->cf);
107  if (o == -1 ||
108  n_Greater(n_EucNorm(ogcd, r->cf), n_EucNorm(gcd, r->cf), r->cf) == TRUE) {
109  ogcd = gcd;
110  o = j;
111  }
112  }
113  j++;
114  }
115  }
116  else
117  {
118  const ring r=strat->tailRing;
119  const poly p=L->t_p;
120  ogcd = pGetCoeff(p);
121  loop
122  {
123  if (j > strat->tl) return o;
124  if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r) && p_LmEqual(T[j].p, p, r))
125  {
126  gcd = n_Gcd(pGetCoeff(p), pGetCoeff(T[j].p), r->cf);
127  if (o == -1 ||
128  n_Greater(n_EucNorm(ogcd, r->cf), n_EucNorm(gcd, r->cf), r->cf) == TRUE) {
129  ogcd = gcd;
130  o = j;
131  }
132  }
133  j++;
134  }
135  }
136 }
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff &#39;a&#39; is larger than &#39;b&#39;; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:511
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:686
static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
Definition: coeffs.h:697
int j
Definition: facHensel.cc:105
TObject * TSet
Definition: kutil.h:55
#define pAssume(cond)
Definition: monomials.h:90
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:321
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1853
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1647
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
static jList * T
Definition: janet.cc:30

◆ kFindZeroPoly()

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

Definition at line 454 of file kstd2.cc.

455 {
456  // m = currRing->ch
457 
458  if (input_p == NULL) return NULL;
459 
460  poly p = input_p;
461  poly zeroPoly = NULL;
462  unsigned long a = (unsigned long) pGetCoeff(p);
463 
464  int k_ind2 = 0;
465  int a_ind2 = ind2(a);
466 
467  // unsigned long k = 1;
468  // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
469  for (int i = 1; i <= leadRing->N; i++)
470  {
471  k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
472  }
473 
474  a = (unsigned long) pGetCoeff(p);
475 
476  number tmp1;
477  poly tmp2, tmp3;
478  poly lead_mult = p_ISet(1, tailRing);
479  if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
480  {
481  int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
482  int s_exp;
483  zeroPoly = p_ISet(a, tailRing);
484  for (int i = 1; i <= leadRing->N; i++)
485  {
486  s_exp = p_GetExp(p, i,leadRing);
487  if (s_exp % 2 != 0)
488  {
489  s_exp = s_exp - 1;
490  }
491  while ( (0 < ind2(s_exp)) && (ind2(s_exp) <= too_much) )
492  {
493  too_much = too_much - ind2(s_exp);
494  s_exp = s_exp - 2;
495  }
496  p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
497  for (int j = 1; j <= s_exp; j++)
498  {
499  tmp1 = nInit(j);
500  tmp2 = p_ISet(1, tailRing);
501  p_SetExp(tmp2, i, 1, tailRing);
502  p_Setm(tmp2, tailRing);
503  if (nIsZero(tmp1))
504  { // should nowbe obsolet, test ! TODO OLIVER
505  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
506  }
507  else
508  {
509  tmp3 = p_NSet(nCopy(tmp1), tailRing);
510  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
511  }
512  }
513  }
514  p_Setm(lead_mult, tailRing);
515  zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
516  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
517  for (int i = 1; i <= leadRing->N; i++)
518  {
519  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
520  }
521  p_Setm(tmp2, leadRing);
522  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
523  pNext(tmp2) = zeroPoly;
524  return tmp2;
525  }
526 /* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
527  if (1 == 0 && alpha_k <= a)
528  { // Temporarly disabled, reducing coefficients not compatible with std TODO Oliver
529  zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
530  for (int i = 1; i <= leadRing->N; i++)
531  {
532  for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
533  {
534  tmp1 = nInit(j);
535  tmp2 = p_ISet(1, tailRing);
536  p_SetExp(tmp2, i, 1, tailRing);
537  p_Setm(tmp2, tailRing);
538  if (nIsZero(tmp1))
539  {
540  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
541  }
542  else
543  {
544  tmp3 = p_ISet((unsigned long) tmp1, tailRing);
545  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
546  }
547  }
548  }
549  tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
550  for (int i = 1; i <= leadRing->N; i++)
551  {
552  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
553  }
554  p_Setm(tmp2, leadRing);
555  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
556  pNext(tmp2) = zeroPoly;
557  return tmp2;
558  } */
559  return NULL;
560 }
int j
Definition: facHensel.cc:105
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:724
#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:996
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1455
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:44
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
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 : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
long ind_fact_2(long arg)
Definition: kutil.cc:4123
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
long ind2(long arg)
Definition: kutil.cc:4111
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1287
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049

◆ kFreeStrat()

void kFreeStrat ( kStrategy  strat)

◆ kNF2() [1/2]

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

Definition at line 3503 of file kstd2.cc.

3504 {
3505  assume(q!=NULL);
3506  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3507 
3508 // lazy_reduce flags: can be combined by |
3509 //#define KSTD_NF_LAZY 1
3510  // do only a reduction of the leading term
3511 //#define KSTD_NF_NONORM 4
3512  // only global: avoid normalization, return a multiply of NF
3513  poly p;
3514 
3515  //if ((idIs0(F))&&(Q==NULL))
3516  // return pCopy(q); /*F=0*/
3517  //strat->ak = idRankFreeModule(F);
3518  /*- creating temp data structures------------------- -*/
3519  BITSET save1;
3520  SI_SAVE_OPT1(save1);
3522  initBuchMoraCrit(strat);
3523  strat->initEcart = initEcartBBA;
3524 #ifdef HAVE_SHIFTBBA
3525  if (rIsLPRing(currRing))
3526  {
3527  strat->enterS = enterSBbaShift;
3528  }
3529  else
3530 #endif
3531  {
3532  strat->enterS = enterSBba;
3533  }
3534 #ifndef NO_BUCKETS
3536 #endif
3537  /*- set S -*/
3538  strat->sl = -1;
3539  /*- init local data struct.---------------------------------------- -*/
3540  /*Shdl=*/initS(F,Q,strat);
3541  /*- compute------------------------------------------------------- -*/
3542  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3543  //{
3544  // for (i=strat->sl;i>=0;i--)
3545  // pNorm(strat->S[i]);
3546  //}
3547  kTest(strat);
3548  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3549  if (BVERBOSE(23)) kDebugPrint(strat);
3550  int max_ind;
3551  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3552  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3553  {
3554  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3555  if (rField_is_Ring(currRing))
3556  {
3557  p = redtailBba_Z(p,max_ind,strat);
3558  }
3559  else
3560  {
3562  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3563  }
3564  }
3565  /*- release temp data------------------------------- -*/
3566  assume(strat->L==NULL); /* strat->L unused */
3567  assume(strat->B==NULL); /* strat->B unused */
3568  omFree(strat->sevS);
3569  omFree(strat->ecartS);
3570  assume(strat->T==NULL);//omfree(strat->T);
3571  assume(strat->sevT==NULL);//omfree(strat->sevT);
3572  assume(strat->R==NULL);//omfree(strat->R);
3573  omfree(strat->S_2_R);
3574  omfree(strat->fromQ);
3575 #ifdef HAVE_SHIFTBBA
3576  // only LM of elements in S is shifted
3577  // necessary to prevent deleting the tail multiple times
3578  if (rIsLPRing(currRing))
3579  {
3580  for (int j = 0; j < IDELEMS(strat->Shdl); j++)
3581  {
3582  if (strat->Shdl->m[j]!=NULL && pmFirstVblock(strat->Shdl->m[j]) > 1)
3583  {
3584  // otherwise the tail would be freed multiple times
3585  pNext(strat->Shdl->m[j]) = NULL;
3586  }
3587  }
3588  }
3589 #endif
3590  idDelete(&strat->Shdl);
3591  SI_RESTORE_OPT1(save1);
3592  if (TEST_OPT_PROT) PrintLn();
3593  return p;
3594 }
unsigned si_opt_1
Definition: options.c:5
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1171
#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:340
void enterSBbaShift(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9361
#define kTest(A)
Definition: kutil.h:653
unsigned long * sevT
Definition: kutil.h:321
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408
#define BITSET
Definition: structs.h:20
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:381
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1866
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
#define mflush()
Definition: reporter.h:57
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8075
#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:397
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
#define pmFirstVblock(p)
Definition: shiftop.h:35
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9874
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
#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:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11923
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261
#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 3666 of file kstd2.cc.

3667 {
3668  assume(!idIs0(q));
3669  assume(!(idIs0(F)&&(Q==NULL)));
3670 // lazy_reduce flags: can be combined by |
3671 //#define KSTD_NF_LAZY 1
3672  // do only a reduction of the leading term
3673 //#define KSTD_NF_NONORM 4
3674  // only global: avoid normalization, return a multiply of NF
3675  poly p;
3676  int i;
3677  ideal res;
3678  int max_ind;
3679 
3680  //if (idIs0(q))
3681  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3682  //if ((idIs0(F))&&(Q==NULL))
3683  // return idCopy(q); /*F=0*/
3684  //strat->ak = idRankFreeModule(F);
3685  /*- creating temp data structures------------------- -*/
3686  BITSET save1;
3687  SI_SAVE_OPT1(save1);
3689  initBuchMoraCrit(strat);
3690  strat->initEcart = initEcartBBA;
3691 #ifdef HAVE_SHIFTBBA
3692  if (rIsLPRing(currRing))
3693  {
3694  strat->enterS = enterSBbaShift;
3695  }
3696  else
3697 #endif
3698  {
3699  strat->enterS = enterSBba;
3700  }
3701  /*- set S -*/
3702  strat->sl = -1;
3703 #ifndef NO_BUCKETS
3705 #endif
3706  /*- init local data struct.---------------------------------------- -*/
3707  /*Shdl=*/initS(F,Q,strat);
3708  /*- compute------------------------------------------------------- -*/
3709  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3711  for (i=IDELEMS(q)-1; i>=0; i--)
3712  {
3713  if (q->m[i]!=NULL)
3714  {
3715  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3716  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
3717  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3718  {
3719  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3720  if (rField_is_Ring(currRing))
3721  {
3722  p = redtailBba_Z(p,max_ind,strat);
3723  }
3724  else
3725  {
3726  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3727  }
3728  }
3729  res->m[i]=p;
3730  }
3731  //else
3732  // res->m[i]=NULL;
3733  }
3734  /*- release temp data------------------------------- -*/
3735  assume(strat->L==NULL); /* strat->L unused */
3736  assume(strat->B==NULL); /* strat->B unused */
3737  omFree(strat->sevS);
3738  omFree(strat->ecartS);
3739  assume(strat->T==NULL);//omfree(strat->T);
3740  assume(strat->sevT==NULL);//omfree(strat->sevT);
3741  assume(strat->R==NULL);//omfree(strat->R);
3742  omfree(strat->S_2_R);
3743  omfree(strat->fromQ);
3744 #ifdef HAVE_SHIFTBBA
3745  // only LM of elements in S is shifted
3746  // necessary to prevent deleting the tail multiple times
3747  if (rIsLPRing(currRing))
3748  {
3749  for (int j = 0; j < IDELEMS(strat->Shdl); j++)
3750  {
3751  if (strat->Shdl->m[j]!=NULL && pmFirstVblock(strat->Shdl->m[j]) > 1)
3752  {
3753  // otherwise the tail would be freed multiple times
3754  pNext(strat->Shdl->m[j]) = NULL;
3755  }
3756  }
3757  }
3758 #endif
3759  idDelete(&strat->Shdl);
3760  SI_RESTORE_OPT1(save1);
3761  if (TEST_OPT_PROT) PrintLn();
3762  return res;
3763 }
unsigned si_opt_1
Definition: options.c:5
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1171
#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:340
void enterSBbaShift(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9361
unsigned long * sevT
Definition: kutil.h:321
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408
#define BITSET
Definition: structs.h:20
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:381
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1866
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
#define mflush()
Definition: reporter.h:57
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8075
#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:397
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
#define pmFirstVblock(p)
Definition: shiftop.h:35
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9874
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:338
#define IDELEMS(i)
Definition: simpleideals.h:23
#define OPT_INTSTRATEGY
Definition: options.h:91
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261
#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 3596 of file kstd2.cc.

3597 {
3598  assume(q!=NULL);
3599  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3600 
3601 // lazy_reduce flags: can be combined by |
3602 //#define KSTD_NF_LAZY 1
3603  // do only a reduction of the leading term
3604 //#define KSTD_NF_NONORM 4
3605  // only global: avoid normalization, return a multiply of NF
3606  poly p;
3607 
3608  //if ((idIs0(F))&&(Q==NULL))
3609  // return pCopy(q); /*F=0*/
3610  //strat->ak = idRankFreeModule(F);
3611  /*- creating temp data structures------------------- -*/
3612  BITSET save1;
3613  SI_SAVE_OPT1(save1);
3615  initBuchMoraCrit(strat);
3616  strat->initEcart = initEcartBBA;
3617  strat->enterS = enterSBba;
3618 #ifndef NO_BUCKETS
3620 #endif
3621  /*- set S -*/
3622  strat->sl = -1;
3623  /*- init local data struct.---------------------------------------- -*/
3624  /*Shdl=*/initS(F,Q,strat);
3625  /*- compute------------------------------------------------------- -*/
3626  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3627  //{
3628  // for (i=strat->sl;i>=0;i--)
3629  // pNorm(strat->S[i]);
3630  //}
3631  kTest(strat);
3632  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3633  if (BVERBOSE(23)) kDebugPrint(strat);
3634  int max_ind;
3635  p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3636  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3637  {
3638  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3639  if (rField_is_Ring(currRing))
3640  {
3641  p = redtailBba_Z(p,max_ind,strat);
3642  }
3643  else
3644  {
3646  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3647  //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3648  }
3649  }
3650  /*- release temp data------------------------------- -*/
3651  assume(strat->L==NULL); /* strat->L unused */
3652  assume(strat->B==NULL); /* strat->B unused */
3653  omFree(strat->sevS);
3654  omFree(strat->ecartS);
3655  assume(strat->T==NULL);//omfree(strat->T);
3656  assume(strat->sevT==NULL);//omfree(strat->sevT);
3657  assume(strat->R==NULL);//omfree(strat->R);
3658  omfree(strat->S_2_R);
3659  omfree(strat->fromQ);
3660  idDelete(&strat->Shdl);
3661  SI_RESTORE_OPT1(save1);
3662  if (TEST_OPT_PROT) PrintLn();
3663  return p;
3664 }
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:1171
#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:340
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition: kstd2.cc:2022
#define kTest(A)
Definition: kutil.h:653
unsigned long * sevT
Definition: kutil.h:321
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:20
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:381
#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:1164
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8075
#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:397
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9874
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:338
#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:305
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11923
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261
#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 3765 of file kstd2.cc.

3766 {
3767  assume(!idIs0(q));
3768  assume(!(idIs0(F)&&(Q==NULL)));
3769 // lazy_reduce flags: can be combined by |
3770 //#define KSTD_NF_LAZY 1
3771  // do only a reduction of the leading term
3772 //#define KSTD_NF_NONORM 4
3773  // only global: avoid normalization, return a multiply of NF
3774  poly p;
3775  int i;
3776  ideal res;
3777  int max_ind;
3778 
3779  //if (idIs0(q))
3780  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
3781  //if ((idIs0(F))&&(Q==NULL))
3782  // return idCopy(q); /*F=0*/
3783  //strat->ak = idRankFreeModule(F);
3784  /*- creating temp data structures------------------- -*/
3785  BITSET save1;
3786  SI_SAVE_OPT1(save1);
3788  initBuchMoraCrit(strat);
3789  strat->initEcart = initEcartBBA;
3790  strat->enterS = enterSBba;
3791  /*- set S -*/
3792  strat->sl = -1;
3793 #ifndef NO_BUCKETS
3795 #endif
3796  /*- init local data struct.---------------------------------------- -*/
3797  /*Shdl=*/initS(F,Q,strat);
3798  /*- compute------------------------------------------------------- -*/
3799  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
3801  for (i=IDELEMS(q)-1; i>=0; i--)
3802  {
3803  if (q->m[i]!=NULL)
3804  {
3805  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
3806  p = redNFBound(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
3807  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3808  {
3809  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3810  if (rField_is_Ring(currRing))
3811  {
3812  p = redtailBba_Z(p,max_ind,strat);
3813  }
3814  else
3815  {
3816  p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
3817  }
3818  }
3819  res->m[i]=p;
3820  }
3821  //else
3822  // res->m[i]=NULL;
3823  }
3824  /*- release temp data------------------------------- -*/
3825  assume(strat->L==NULL); /* strat->L unused */
3826  assume(strat->B==NULL); /* strat->B unused */
3827  omFree(strat->sevS);
3828  omFree(strat->ecartS);
3829  assume(strat->T==NULL);//omfree(strat->T);
3830  assume(strat->sevT==NULL);//omfree(strat->sevT);
3831  assume(strat->R==NULL);//omfree(strat->R);
3832  omfree(strat->S_2_R);
3833  omfree(strat->fromQ);
3834  idDelete(&strat->Shdl);
3835  SI_RESTORE_OPT1(save1);
3836  if (TEST_OPT_PROT) PrintLn();
3837  return res;
3838 }
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:1171
#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:340
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition: kstd2.cc:2022
unsigned long * sevT
Definition: kutil.h:321
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:20
#define Sy_bit(x)
Definition: options.h:32
char use_buckets
Definition: kutil.h:381
#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:1164
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8075
#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:397
intset fromQ
Definition: kutil.h:317
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9874
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:338
#define IDELEMS(i)
Definition: simpleideals.h:23
#define OPT_INTSTRATEGY
Definition: options.h:91
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
LSet B
Definition: kutil.h:324
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9261
#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 1390 of file kspoly.cc.

1391 {
1392  poly a1 = pNext(p1), a2 = pNext(p2);
1393 #ifdef HAVE_SHIFTBBA
1394  int shift1, shift2;
1395  if (tailRing->isLPring) {
1396  // assume: LM is shifted, tail unshifted
1397  assume(p_FirstVblock(a1, tailRing) <= 1);
1398  assume(p_FirstVblock(a2, tailRing) <= 1);
1399  // save the shift of the LM so we can shift the other monomials on demand
1400  shift1 = p_mFirstVblock(p1, tailRing) - 1;
1401  shift2 = p_mFirstVblock(p2, tailRing) - 1;
1402  }
1403 #endif
1404  long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
1405  long c;
1406  poly m1,m2;
1407  number t1 = NULL,t2 = NULL;
1408  int cm,i;
1409  BOOLEAN equal;
1410 
1411 #ifdef HAVE_RINGS
1412  BOOLEAN is_Ring=rField_is_Ring(currRing);
1413  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
1414  if (is_Ring)
1415  {
1416  ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
1417  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1418  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1419  while (a1 != NULL && nIsZero(t2))
1420  {
1421  pIter(a1);
1422  nDelete(&t2);
1423  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1424  }
1425  while (a2 != NULL && nIsZero(t1))
1426  {
1427  pIter(a2);
1428  nDelete(&t1);
1429  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1430  }
1431  }
1432 #endif
1433 
1434 #ifdef HAVE_SHIFTBBA
1435  // shift the next monomial on demand
1436  if (tailRing->isLPring)
1437  {
1438  a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing);
1439  a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing);
1440  }
1441 #endif
1442  if (a1==NULL)
1443  {
1444  if(a2!=NULL)
1445  {
1446  m2=p_Init(currRing);
1447 x2:
1448  for (i = (currRing->N); i; i--)
1449  {
1450  c = p_GetExpDiff(p1, p2,i, currRing);
1451  if (c>0)
1452  {
1453  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
1454  }
1455  else
1456  {
1457  p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
1458  }
1459  }
1460  if ((c1==c2)||(c2!=0))
1461  {
1462  p_SetComp(m2,p_GetComp(a2,tailRing), currRing);
1463  }
1464  else
1465  {
1466  p_SetComp(m2,c1,currRing);
1467  }
1468  p_Setm(m2, currRing);
1469 #ifdef HAVE_RINGS
1470  if (is_Ring)
1471  {
1472  nDelete(&lc1);
1473  nDelete(&lc2);
1474  nDelete(&t2);
1475  pSetCoeff0(m2, t1);
1476  }
1477 #endif
1478  return m2;
1479  }
1480  else
1481  {
1482 #ifdef HAVE_RINGS
1483  if (is_Ring)
1484  {
1485  nDelete(&lc1);
1486  nDelete(&lc2);
1487  nDelete(&t1);
1488  nDelete(&t2);
1489  }
1490 #endif
1491  return NULL;
1492  }
1493  }
1494  if (a2==NULL)
1495  {
1496  m1=p_Init(currRing);
1497 x1:
1498  for (i = (currRing->N); i; i--)
1499  {
1500  c = p_GetExpDiff(p2, p1,i,currRing);
1501  if (c>0)
1502  {
1503  p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
1504  }
1505  else
1506  {
1507  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1508  }
1509  }
1510  if ((c1==c2)||(c1!=0))
1511  {
1512  p_SetComp(m1,p_GetComp(a1,tailRing),currRing);
1513  }
1514  else
1515  {
1516  p_SetComp(m1,c2,currRing);
1517  }
1518  p_Setm(m1, currRing);
1519 #ifdef HAVE_RINGS
1520  if (is_Ring)
1521  {
1522  pSetCoeff0(m1, t2);
1523  nDelete(&lc1);
1524  nDelete(&lc2);
1525  nDelete(&t1);
1526  }
1527 #endif
1528  return m1;
1529  }
1530  m1 = p_Init(currRing);
1531  m2 = p_Init(currRing);
1532  loop
1533  {
1534  for (i = (currRing->N); i; i--)
1535  {
1536  c = p_GetExpDiff(p1, p2,i,currRing);
1537  if (c > 0)
1538  {
1539  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
1540  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1541  }
1542  else
1543  {
1544  p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
1545  p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
1546  }
1547  }
1548  if(c1==c2)
1549  {
1550  p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
1551  p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
1552  }
1553  else
1554  {
1555  if(c1!=0)
1556  {
1557  p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
1558  p_SetComp(m2,c1, currRing);
1559  }
1560  else
1561  {
1562  p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
1563  p_SetComp(m1,c2, currRing);
1564  }
1565  }
1566  p_Setm(m1,currRing);
1567  p_Setm(m2,currRing);
1568  cm = p_LmCmp(m1, m2,currRing);
1569  if (cm!=0)
1570  {
1571  if(cm==1)
1572  {
1573  p_LmFree(m2,currRing);
1574 #ifdef HAVE_RINGS
1575  if (is_Ring)
1576  {
1577  pSetCoeff0(m1, t2);
1578  nDelete(&lc1);
1579  nDelete(&lc2);
1580  nDelete(&t1);
1581  }
1582 #endif
1583  return m1;
1584  }
1585  else
1586  {
1587  p_LmFree(m1,currRing);
1588 #ifdef HAVE_RINGS
1589  if (is_Ring)
1590  {
1591  pSetCoeff0(m2, t1);
1592  nDelete(&lc1);
1593  nDelete(&lc2);
1594  nDelete(&t2);
1595  }
1596 #endif
1597  return m2;
1598  }
1599  }
1600 #ifdef HAVE_RINGS
1601  if (is_Ring)
1602  {
1603  equal = nEqual(t1,t2);
1604  }
1605  else
1606 #endif
1607  {
1608  t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
1609  t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
1610  equal = nEqual(t1,t2);
1611  nDelete(&t2);
1612  nDelete(&t1);
1613  }
1614  if (!equal)
1615  {
1616  p_LmFree(m2,currRing);
1617 #ifdef HAVE_RINGS
1618  if (is_Ring)
1619  {
1620  pSetCoeff0(m1, nSub(t1, t2));
1621  nDelete(&lc1);
1622  nDelete(&lc2);
1623  nDelete(&t1);
1624  nDelete(&t2);
1625  }
1626 #endif
1627  return m1;
1628  }
1629  pIter(a1);
1630  pIter(a2);
1631 #ifdef HAVE_RINGS
1632  if (is_Ring)
1633  {
1634  if (a2 != NULL)
1635  {
1636  nDelete(&t1);
1637  t1 = nMult(pGetCoeff(a2),lc1);
1638  }
1639  if (a1 != NULL)
1640  {
1641  nDelete(&t2);
1642  t2 = nMult(pGetCoeff(a1),lc2);
1643  }
1644  while ((a1 != NULL) && nIsZero(t2))
1645  {
1646  pIter(a1);
1647  if (a1 != NULL)
1648  {
1649  nDelete(&t2);
1650  t2 = nMult(pGetCoeff(a1),lc2);
1651  }
1652  }
1653  while ((a2 != NULL) && nIsZero(t1))
1654  {
1655  pIter(a2);
1656  if (a2 != NULL)
1657  {
1658  nDelete(&t1);
1659  t1 = nMult(pGetCoeff(a2),lc1);
1660  }
1661  }
1662  }
1663 #endif
1664 #ifdef HAVE_SHIFTBBA
1665  if (tailRing->isLPring)
1666  {
1667  a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing);
1668  a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing);
1669  }
1670 #endif
1671  if (a2==NULL)
1672  {
1673  p_LmFree(m2,currRing);
1674  if (a1==NULL)
1675  {
1676 #ifdef HAVE_RINGS
1677  if (is_Ring)
1678  {
1679  nDelete(&lc1);
1680  nDelete(&lc2);
1681  nDelete(&t1);
1682  nDelete(&t2);
1683  }
1684 #endif
1685  p_LmFree(m1,currRing);
1686  return NULL;
1687  }
1688  goto x1;
1689  }
1690  if (a1==NULL)
1691  {
1692  p_LmFree(m1,currRing);
1693  goto x2;
1694  }
1695  }
1696 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_GetComp(p, r)
Definition: monomials.h:64
int ksCheckCoeff(number *a, number *b)
int p_mFirstVblock(poly p, const ring ri)
Definition: shiftop.cc:469
#define nEqual(n1, n2)
Definition: numbers.h:20
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
#define pIter(p)
Definition: monomials.h:37
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:634
bool equal
Definition: cfModGcd.cc:4067
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
#define nMult(n1, n2)
Definition: numbers.h:17
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
#define nSub(n1, n2)
Definition: numbers.h:22
int i
Definition: cfEzgcd.cc:125
#define nDelete(n)
Definition: numbers.h:16
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
poly p_LPCopyAndShiftLM(poly p, int sh, const ring r)
Definition: shiftgb.cc:35
int p_FirstVblock(poly p, const ring r)
Definition: shiftop.cc:447
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int BOOLEAN
Definition: auxiliary.h:85
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ 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 1145 of file kspoly.cc.

1148 {
1149 #ifdef KDEBUG
1150  create_count++;
1151 #endif
1152  kTest_L(Pair,tailRing);
1153  poly p1 = Pair->p1;
1154  poly p2 = Pair->p2;
1155  Pair->tailRing = tailRing;
1156 
1157  assume(p1 != NULL);
1158  assume(p2 != NULL);
1159  assume(tailRing != NULL);
1160 
1161  poly a1 = pNext(p1), a2 = pNext(p2);
1162  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
1163  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
1164  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
1165 
1166  int l1=0, l2=0;
1167 
1168  if (currRing->pCompIndex >= 0)
1169  {
1170  if (__p_GetComp(p1, currRing)!=__p_GetComp(p2, currRing))
1171  {
1172  if (__p_GetComp(p1, currRing)==0)
1173  {
1174  co=1;
1175  p_SetCompP(p1,__p_GetComp(p2, currRing), currRing, tailRing);
1176  }
1177  else
1178  {
1179  co=2;
1180  p_SetCompP(p2, __p_GetComp(p1, currRing), currRing, tailRing);
1181  }
1182  }
1183  }
1184 
1185  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
1186  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
1187  if (m1 == NULL)
1188  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
1189 
1190 #ifdef HAVE_SHIFTBBA
1191  poly m12, m22;
1192  if (tailRing->isLPring)
1193  {
1194  // note: because of the crits, p2 is never shifted
1195  int split = p_mFirstVblock(p1, tailRing);
1196  k_SplitFrame(m1, m12, split, tailRing);
1197  k_SplitFrame(m2, m22, split, tailRing);
1198  // manually free the coeffs, because pSetCoeff0 is used in the next step
1199  n_Delete(&(m1->coef), tailRing->cf);
1200  n_Delete(&(m2->coef), tailRing->cf);
1201  }
1202 #endif
1203 
1204  pSetCoeff0(m1, lc2);
1205  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
1206 
1207  if (R != NULL)
1208  {
1209  if (Pair->i_r1 == -1)
1210  {
1211  l1 = pLength(p1) - 1;
1212  }
1213  else
1214  {
1215  l1 = (R[Pair->i_r1])->GetpLength() - 1;
1216  }
1217  if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
1218  {
1219  l2 = pLength(p2) - 1;
1220  }
1221  else
1222  {
1223  l2 = (R[Pair->i_r2])->GetpLength() - 1;
1224  }
1225  }
1226 
1227  // get m2 * a2
1228  if (spNoether != NULL)
1229  {
1230  l2 = -1;
1231  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
1232  assume(l2 == pLength(a2));
1233  }
1234  else
1235 #ifdef HAVE_SHIFTBBA
1236  if (tailRing->isLPring)
1237  {
1238  // m2*a2*m22
1239  a2 = tailRing->p_Procs->pp_Mult_mm(tailRing->p_Procs->pp_mm_Mult(a2, m2, tailRing), m22, tailRing);
1240  }
1241  else
1242 #endif
1243  {
1244  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
1245  }
1246 #ifdef HAVE_RINGS
1247  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
1248 #endif
1249 
1250  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
1251 
1252 #ifdef HAVE_SHIFTBBA
1253  if (tailRing->isLPring)
1254  {
1255  // get m2*a2*m22 - m1*a1*m12
1256  Pair->Tail_Minus_mm_Mult_qq(m1, tailRing->p_Procs->pp_Mult_mm(a1, m12, tailRing), l1, spNoether);
1257  }
1258  else
1259 #endif
1260  {
1261  // get m2*a2 - m1*a1
1262  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
1263  }
1264 
1265  // Clean-up time
1266  Pair->LmDeleteAndIter();
1267  p_LmDelete(m1, tailRing);
1268 #ifdef HAVE_SHIFTBBA
1269  if (tailRing->isLPring)
1270  {
1271  p_LmDelete(m12, tailRing);
1272  p_LmDelete(m22, tailRing);
1273  // m2 is already deleted
1274  }
1275 #endif
1276 
1277  if (co != 0)
1278  {
1279  if (co==1)
1280  {
1281  p_SetCompP(p1,0, currRing, tailRing);
1282  }
1283  else
1284  {
1285  p_SetCompP(p2,0, currRing, tailRing);
1286  }
1287  }
1288 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:964
int ksCheckCoeff(number *a, number *b)
int p_mFirstVblock(poly p, const ring ri)
Definition: shiftop.cc:469
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:482
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:253
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
static unsigned pLength(poly a)
Definition: p_polys.h:191
static CFList split(const CanonicalForm &F, const int m, const Variable &x)
Definition: facMul.cc:3336
#define NULL
Definition: omList.c:12
int create_count
Definition: kspoly.cc:28
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:585

◆ ksOldCreateSpoly()

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

Definition at line 1140 of file kInline.h.

1141 {
1142  LObject L(r);
1143  L.p1 = p1;
1144  L.p2 = p2;
1145 
1146  ksCreateSpoly(&L, spNoether);
1147  return L.GetLmCurrRing();
1148 }
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:1145

◆ ksOldSpolyRed()

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

Definition at line 1120 of file kInline.h.

1121 {
1122  LObject L(p2);
1123  TObject T(p1);
1124 
1125  ksReducePoly(&L, &T, spNoether);
1126 
1127  return L.GetLmCurrRing();
1128 }
class sLObject LObject
Definition: kutil.h:54
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
static jList * T
Definition: janet.cc:30
class sTObject TObject
Definition: kutil.h:53

◆ ksOldSpolyRedNew()

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

Definition at line 1130 of file kInline.h.

1131 {
1132  LObject L(p_Copy(p2, currRing));
1133  TObject T(p1);
1134 
1135  ksReducePoly(&L, &T, spNoether);
1136 
1137  return L.GetLmCurrRing();
1138 }
class sLObject LObject
Definition: kutil.h:54
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static jList * T
Definition: janet.cc:30
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 1150 of file kInline.h.

1151 {
1152  LObject L(q, currRing, r);
1153  TObject T(p1, currRing, r);
1154 
1155  ksReducePolyTail(&L, &T, q2, spNoether);
1156 }
class sLObject LObject
Definition: kutil.h:54
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static jList * T
Definition: janet.cc:30
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 185 of file kspoly.cc.

190 {
191 #ifdef KDEBUG
192  red_count++;
193 #ifdef TEST_OPT_DEBUG_RED
194 // if (TEST_OPT_DEBUG)
195 // {
196 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
197 // PW->wrp();
198 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
199 // //pWrite(PR->p);
200 // }
201 #endif
202 #endif
203  int ret = 0;
204  ring tailRing = PR->tailRing;
205  kTest_L(PR,tailRing);
206  kTest_T(PW);
207 
208  poly p1 = PR->GetLmTailRing(); // p2 | p1
209  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
210  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
211  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
212  p_CheckPolyRing(p1, tailRing);
213  p_CheckPolyRing(p2, tailRing);
214 
215  pAssume1(p2 != NULL && p1 != NULL &&
216  p_DivisibleBy(p2, p1, tailRing));
217 
218  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
219  (p_GetComp(p2, tailRing) == 0 &&
220  p_MaxComp(pNext(p2),tailRing) == 0));
221 
222 #ifdef HAVE_PLURAL
223  if (rIsPluralRing(currRing))
224  {
225  // for the time being: we know currRing==strat->tailRing
226  // no exp-bound checking needed
227  // (only needed if exp-bound(tailring)<exp-b(currRing))
228  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
229  else
230  {
231  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
232  assume(_p != NULL);
233  nc_PolyPolyRed(_p, p2,coef, currRing);
234  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
235  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
236  }
237  return 0;
238  }
239 #endif
240 
241  if (t2==NULL) // Divisor is just one term, therefore it will
242  { // just cancel the leading term
243  PR->LmDeleteAndIter();
244  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
245  return 0;
246  }
247 
248  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
249 
250  //if (tailRing != currRing)
251  {
252  // check that reduction does not violate exp bound
253  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
254  {
255  // undo changes of lm
256  p_ExpVectorAdd(lm, p2, tailRing);
257  if (strat == NULL) return 2;
258  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
259  tailRing = strat->tailRing;
260  p1 = PR->GetLmTailRing();
261  p2 = PW->GetLmTailRing();
262  t2 = pNext(p2);
263  lm = p1;
264  p_ExpVectorSub(lm, p2, tailRing);
265  ret = 1;
266  }
267  }
268 
269 #ifdef HAVE_SHIFTBBA
270  poly lmRight;
271  if (tailRing->isLPring)
272  {
273  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
274  }
275 #endif
276 
277  // take care of coef buisness
278  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
279  {
280  number bn = pGetCoeff(lm);
281  number an = pGetCoeff(p2);
282  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
283  p_SetCoeff(lm, bn, tailRing);
284 #ifdef HAVE_SHIFTBBA
285  if (tailRing->isLPring) pSetCoeff0(p1, bn); // lm doesn't point to p1 anymore, if the coef was a pointer, it has been deleted
286 #endif
287  if ((ct == 0) || (ct == 2))
288  PR->Tail_Mult_nn(an);
289  if (coef != NULL) *coef = an;
290  else n_Delete(&an, tailRing->cf);
291  }
292  else
293  {
294  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
295  }
296 
297 
298  // and finally,
299 #ifdef HAVE_SHIFTBBA
300  if (tailRing->isLPring)
301  {
302  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
303  }
304  else
305 #endif
306  {
307  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
308  }
309  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
310  PR->LmDeleteAndIter();
311 
312  return ret;
313 }
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 &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:655
#define pAssume1(cond)
Definition: monomials.h:171
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:585
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291

◆ ksReducePolyBound()

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

Definition at line 538 of file kspoly.cc.

544 {
545 #ifdef KDEBUG
546  red_count++;
547 #ifdef TEST_OPT_DEBUG_RED
548  if (TEST_OPT_DEBUG)
549  {
550  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
551  PW->wrp();
552  //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
553  //pWrite(PR->p);
554  }
555 #endif
556 #endif
557  int ret = 0;
558  ring tailRing = PR->tailRing;
559  kTest_L(PR,tailRing);
560  kTest_T(PW);
561 
562  poly p1 = PR->GetLmTailRing(); // p2 | p1
563  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
564  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
565  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
566  p_CheckPolyRing(p1, tailRing);
567  p_CheckPolyRing(p2, tailRing);
568 
569  pAssume1(p2 != NULL && p1 != NULL &&
570  p_DivisibleBy(p2, p1, tailRing));
571 
572  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
573  (p_GetComp(p2, tailRing) == 0 &&
574  p_MaxComp(pNext(p2),tailRing) == 0));
575 
576 #ifdef HAVE_PLURAL
577  if (rIsPluralRing(currRing))
578  {
579  // for the time being: we know currRing==strat->tailRing
580  // no exp-bound checking needed
581  // (only needed if exp-bound(tailring)<exp-b(currRing))
582  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
583  else
584  {
585  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
586  assume(_p != NULL);
587  nc_PolyPolyRed(_p, p2,coef, currRing);
588  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
589  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
590  }
591  return 0;
592  }
593 #endif
594 
595  if (t2==NULL) // Divisor is just one term, therefore it will
596  { // just cancel the leading term
597  PR->LmDeleteAndIter();
598  if (coef != NULL) *coef = n_Init(1, tailRing);
599  return 0;
600  }
601 
602  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
603 
604  if (tailRing != currRing)
605  {
606  // check that reduction does not violate exp bound
607  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
608  {
609  // undo changes of lm
610  p_ExpVectorAdd(lm, p2, tailRing);
611  if (strat == NULL) return 2;
612  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
613  tailRing = strat->tailRing;
614  p1 = PR->GetLmTailRing();
615  p2 = PW->GetLmTailRing();
616  t2 = pNext(p2);
617  lm = p1;
618  p_ExpVectorSub(lm, p2, tailRing);
619  ret = 1;
620  }
621  }
622 
623 #ifdef HAVE_SHIFTBBA
624  poly lmRight;
625  if (tailRing->isLPring) {
626  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
627  }
628 #endif
629 
630  // take care of coef buisness
631  if (! n_IsOne(pGetCoeff(p2), tailRing))
632  {
633  number bn = pGetCoeff(lm);
634  number an = pGetCoeff(p2);
635  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
636  p_SetCoeff(lm, bn, tailRing);
637 #ifdef HAVE_SHIFTBBA
638  if (tailRing->isLPring) pSetCoeff0(p1, bn); // lm doesn't point to p1 anymore, if the coef was a pointer, it has been deleted
639 #endif
640  if ((ct == 0) || (ct == 2))
641  PR->Tail_Mult_nn(an);
642  if (coef != NULL) *coef = an;
643  else n_Delete(&an, tailRing);
644  }
645  else
646  {
647  if (coef != NULL) *coef = n_Init(1, tailRing);
648  }
649 
650 
651  // and finally,
652 #ifdef HAVE_SHIFTBBA
653  if (tailRing->isLPring)
654  {
655  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
656  }
657  else
658 #endif
659  {
660  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
661  }
662  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
663  PR->LmDeleteAndIter();
664 
665 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
666  if (TEST_OPT_DEBUG)
667  {
668  Print(" to: "); PR->wrp(); Print("\n");
669  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
670  }
671 #endif
672  return ret;
673 }
#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 &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:655
#define pAssume1(cond)
Definition: monomials.h:171
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:585
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291

◆ ksReducePolyGCD()

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

Definition at line 315 of file kspoly.cc.

320 {
321 #ifdef KDEBUG
322  red_count++;
323 #ifdef TEST_OPT_DEBUG_RED
324 // if (TEST_OPT_DEBUG)
325 // {
326 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
327 // PW->wrp();
328 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
329 // //pWrite(PR->p);
330 // }
331 #endif
332 #endif
333  int ret = 0;
334  ring tailRing = PR->tailRing;
335  kTest_L(PR, tailRing);
336  kTest_T(PW);
337 
338  poly p1 = PR->GetLmTailRing();
339  poly p2 = PW->GetLmTailRing();
340  poly t2 = pNext(p2), lm = pOne();
341  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
342  p_CheckPolyRing(p1, tailRing);
343  p_CheckPolyRing(p2, tailRing);
344 
345  pAssume1(p2 != NULL && p1 != NULL &&
346  p_DivisibleBy(p2, p1, tailRing));
347 
348  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
349  (p_GetComp(p2, tailRing) == 0 &&
350  p_MaxComp(pNext(p2),tailRing) == 0));
351 
352 #ifdef HAVE_PLURAL
353  if (rIsPluralRing(currRing))
354  {
355  // for the time being: we know currRing==strat->tailRing
356  // no exp-bound checking needed
357  // (only needed if exp-bound(tailring)<exp-b(currRing))
358  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
359  else
360  {
361  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
362  assume(_p != NULL);
363  nc_PolyPolyRed(_p, p2,coef, currRing);
364  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
365  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
366  }
367  return 0;
368  }
369 #endif
370  // check that reduction does not violate exp bound
371  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
372  {
373  // undo changes of lm
374  p_ExpVectorAdd(lm, p2, tailRing);
375  if (strat == NULL) return 2;
376  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
377  tailRing = strat->tailRing;
378  p1 = PR->GetLmTailRing();
379  p2 = PW->GetLmTailRing();
380  t2 = pNext(p2);
381  lm = p1;
382  p_ExpVectorSub(lm, p2, tailRing);
383  ret = 1;
384  }
385 
386  number ct, an, bn;
387  // take care of coef buisness
388  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
389  {
390  ct = n_ExtGcd(pGetCoeff(p1), pGetCoeff(p2), &an, &bn, tailRing->cf); // Calculate GCD
391  /* negate bn since we subtract in Tail_Minus_mm_Mult_qq */
392  bn = n_InpNeg(bn, tailRing->cf);
393  p_SetCoeff(lm, bn, tailRing);
394  PR->Tail_Mult_nn(an);
395  }
396  else
397  {
398  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
399  }
400 
401 
402  // and finally,
403  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
404  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
405  pSetCoeff(PR->p, ct);
406 
407  // the following is commented out: shrinking
408 #ifdef HAVE_SHIFTBBA_NONEXISTENT
409  if ( (currRing->isLPring) && (!strat->homog) )
410  {
411  // assume? h->p in currRing
412  PR->GetP();
413  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
414  PR->Clear(); // does the right things
415  PR->p = qq;
416  PR->t_p = NULL;
417  PR->SetShortExpVector();
418  }
419 #endif
420 
421  return ret;
422 }
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 &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
#define pOne()
Definition: polys.h:310
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
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
char homog
Definition: kutil.h:370
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define kTest_T(T)
Definition: kutil.h:655
#define pAssume1(cond)
Definition: monomials.h:171
#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:291

◆ ksReducePolyLC()

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

Definition at line 431 of file kspoly.cc.

436 {
437 #ifdef KDEBUG
438  red_count++;
439 #ifdef TEST_OPT_DEBUG_RED
440 // if (TEST_OPT_DEBUG)
441 // {
442 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
443 // PW->wrp();
444 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
445 // //pWrite(PR->p);
446 // }
447 #endif
448 #endif
449  /* printf("PR->P: ");
450  * p_Write(PR->p, currRing, PR->tailRing); */
451  int ret = 0;
452  ring tailRing = PR->tailRing;
453  kTest_L(PR,tailRing);
454  kTest_T(PW);
455 
456  poly p1 = PR->GetLmTailRing(); // p2 | p1
457  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
458  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
459  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
460  p_CheckPolyRing(p1, tailRing);
461  p_CheckPolyRing(p2, tailRing);
462 
463  pAssume1(p2 != NULL && p1 != NULL &&
464  p_DivisibleBy(p2, p1, tailRing));
465 
466  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
467  (p_GetComp(p2, tailRing) == 0 &&
468  p_MaxComp(pNext(p2),tailRing) == 0));
469 
470 #ifdef HAVE_PLURAL
471  if (rIsPluralRing(currRing))
472  {
473  // for the time being: we know currRing==strat->tailRing
474  // no exp-bound checking needed
475  // (only needed if exp-bound(tailring)<exp-b(currRing))
476  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
477  else
478  {
479  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
480  assume(_p != NULL);
481  nc_PolyPolyRed(_p, p2,coef, currRing);
482  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
483  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
484  }
485  return 0;
486  }
487 #endif
488 
489  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
490  p_SetCoeff(lm, n_Init(1, tailRing), tailRing);
491  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
492  {
493  // undo changes of lm
494  p_ExpVectorAdd(lm, p2, tailRing);
495  if (strat == NULL) return 2;
496  /* if (! kStratChangeTailRing(strat, PR, PW)) return -1; */
497  tailRing = strat->tailRing;
498  p1 = PR->GetLmTailRing();
499  p2 = PW->GetLmTailRing();
500  t2 = pNext(p2);
501  lm = p1;
502  p_ExpVectorSub(lm, p2, tailRing);
503  ret = 1;
504  }
505 
506  // and finally,
507  PR->Tail_Minus_mm_Mult_qq(lm, p2, pLength(p2) /*PW->GetpLength() - 1*/, spNoether);
508  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
509 
510  PR->LmDeleteAndIter();
511  p_SetCoeff(PR->p, *coef, currRing);
512 
513 
514  // the following is commented out: shrinking
515 #ifdef HAVE_SHIFTBBA_NONEXISTENT
516  if ( (currRing->isLPring) && (!strat->homog) )
517  {
518  // assume? h->p in currRing
519  PR->GetP();
520  poly qq = p_Shrink(PR->p, currRing->isLPring, currRing);
521  PR->Clear(); // does the right things
522  PR->p = qq;
523  PR->t_p = NULL;
524  PR->SetShortExpVector();
525  }
526 #endif
527 
528 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
529  if (TEST_OPT_DEBUG)
530  {
531  Print(" to: "); PR->wrp(); Print("\n");
532  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
533  }
534 #endif
535  return ret;
536 }
#define Print
Definition: emacs.cc:80
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2230
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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
#define TEST_OPT_DEBUG
Definition: options.h:107
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
char homog
Definition: kutil.h:370
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define kTest_T(T)
Definition: kutil.h:655
#define pAssume1(cond)
Definition: monomials.h:171
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291

◆ ksReducePolySig()

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

Definition at line 682 of file kspoly.cc.

688 {
689 #ifdef KDEBUG
690  red_count++;
691 #ifdef TEST_OPT_DEBUG_RED
692  if (TEST_OPT_DEBUG)
693  {
694  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
695  PW->wrp();
696  }
697 #endif
698 #endif
699  int ret = 0;
700  ring tailRing = PR->tailRing;
701  kTest_L(PR,tailRing);
702  kTest_T(PW);
703 
704  // signature-based stuff:
705  // checking for sig-safeness first
706  // NOTE: This has to be done in the current ring
707  //
708  /**********************************************
709  *
710  * TODO:
711  * --------------------------------------------
712  * if strat->sbaOrder == 1
713  * Since we are subdividing lower index and
714  * current index reductions it is enough to
715  * look at the polynomial part of the signature
716  * for a check. This should speed-up checking
717  * a lot!
718  * if !strat->sbaOrder == 0
719  * We are not subdividing lower and current index
720  * due to the fact that we are using the induced
721  * Schreyer order
722  *
723  * nevertheless, this different behaviour is
724  * taken care of by is_sigsafe
725  * => one reduction procedure can be used for
726  * both, the incremental and the non-incremental
727  * attempt!
728  * --------------------------------------------
729  *
730  *********************************************/
731  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
732  if (!PW->is_sigsafe)
733  {
734  poly sigMult = pCopy(PW->sig); // copy signature of reducer
735 //#if 1
736 #ifdef DEBUGF5
737  printf("IN KSREDUCEPOLYSIG: \n");
738  pWrite(pHead(f1));
739  pWrite(pHead(f2));
740  pWrite(sigMult);
741  printf("--------------\n");
742 #endif
743  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
744 //#if 1
745 #ifdef DEBUGF5
746  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
747  pWrite(pHead(f1));
748  pWrite(pHead(f2));
749  pWrite(sigMult);
750  pWrite(PR->sig);
751  printf("--------------\n");
752 #endif
753  int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
754  // now we can delete the copied polynomial data used for checking for
755  // sig-safeness of the reduction step
756 //#if 1
757 #ifdef DEBUGF5
758  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
759 
760 #endif
761  //pDelete(&f1);
762  pDelete(&sigMult);
763  // go on with the computations only if the signature of p2 is greater than the
764  // signature of fm*p1
765  if(sigSafe != 1)
766  {
767  PR->is_redundant = TRUE;
768  return 3;
769  }
770  //PW->is_sigsafe = TRUE;
771  }
772  PR->is_redundant = FALSE;
773  poly p1 = PR->GetLmTailRing(); // p2 | p1
774  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
775  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
776  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
777  p_CheckPolyRing(p1, tailRing);
778  p_CheckPolyRing(p2, tailRing);
779 
780  pAssume1(p2 != NULL && p1 != NULL &&
781  p_DivisibleBy(p2, p1, tailRing));
782 
783  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
784  (p_GetComp(p2, tailRing) == 0 &&
785  p_MaxComp(pNext(p2),tailRing) == 0));
786 
787 #ifdef HAVE_PLURAL
788  if (rIsPluralRing(currRing))
789  {
790  // for the time being: we know currRing==strat->tailRing
791  // no exp-bound checking needed
792  // (only needed if exp-bound(tailring)<exp-b(currRing))
793  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
794  else
795  {
796  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
797  assume(_p != NULL);
798  nc_PolyPolyRed(_p, p2, coef, currRing);
799  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
800  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
801  }
802  return 0;
803  }
804 #endif
805 
806  if (t2==NULL) // Divisor is just one term, therefore it will
807  { // just cancel the leading term
808  PR->LmDeleteAndIter();
809  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
810  return 0;
811  }
812 
813  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
814 
815  if (tailRing != currRing)
816  {
817  // check that reduction does not violate exp bound
818  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
819  {
820  // undo changes of lm
821  p_ExpVectorAdd(lm, p2, tailRing);
822  if (strat == NULL) return 2;
823  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
824  tailRing = strat->tailRing;
825  p1 = PR->GetLmTailRing();
826  p2 = PW->GetLmTailRing();
827  t2 = pNext(p2);
828  lm = p1;
829  p_ExpVectorSub(lm, p2, tailRing);
830  ret = 1;
831  }
832  }
833 
834 #ifdef HAVE_SHIFTBBA
835  poly lmRight;
836  if (tailRing->isLPring) {
837  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
838  }
839 #endif
840 
841  // take care of coef buisness
842  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
843  {
844  number bn = pGetCoeff(lm);
845  number an = pGetCoeff(p2);
846  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
847  p_SetCoeff(lm, bn, tailRing);
848 #ifdef HAVE_SHIFTBBA
849  if (tailRing->isLPring) pSetCoeff0(p1, bn); // lm doesn't point to p1 anymore, if the coef was a pointer, it has been deleted
850 #endif
851  if ((ct == 0) || (ct == 2))
852  PR->Tail_Mult_nn(an);
853  if (coef != NULL) *coef = an;
854  else n_Delete(&an, tailRing->cf);
855  }
856  else
857  {
858  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
859  }
860 
861 
862  // and finally,
863 #ifdef HAVE_SHIFTBBA
864  if (tailRing->isLPring)
865  {
866  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
867  }
868  else
869 #endif
870  {
871  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
872  }
873  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
874  PR->LmDeleteAndIter();
875 
876 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
877  if (TEST_OPT_DEBUG)
878  {
879  Print(" to: "); PR->wrp(); Print("\n");
880  }
881 #endif
882  return ret;
883 }
#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 &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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:303
#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:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
static unsigned pLength(poly a)
Definition: p_polys.h:191
#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 NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:655
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1391
#define pAssume1(cond)
Definition: monomials.h:171
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:585
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291
#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 885 of file kspoly.cc.

891 {
892 #ifdef KDEBUG
893  red_count++;
894 #ifdef TEST_OPT_DEBUG_RED
895  if (TEST_OPT_DEBUG)
896  {
897  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
898  PW->wrp();
899  }
900 #endif
901 #endif
902  int ret = 0;
903  ring tailRing = PR->tailRing;
904  kTest_L(PR,tailRing);
905  kTest_T(PW);
906 
907  // signature-based stuff:
908  // checking for sig-safeness first
909  // NOTE: This has to be done in the current ring
910  //
911  /**********************************************
912  *
913  * TODO:
914  * --------------------------------------------
915  * if strat->sbaOrder == 1
916  * Since we are subdividing lower index and
917  * current index reductions it is enough to
918  * look at the polynomial part of the signature
919  * for a check. This should speed-up checking
920  * a lot!
921  * if !strat->sbaOrder == 0
922  * We are not subdividing lower and current index
923  * due to the fact that we are using the induced
924  * Schreyer order
925  *
926  * nevertheless, this different behaviour is
927  * taken care of by is_sigsafe
928  * => one reduction procedure can be used for
929  * both, the incremental and the non-incremental
930  * attempt!
931  * --------------------------------------------
932  *
933  *********************************************/
934  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
935  if (!PW->is_sigsafe)
936  {
937  poly sigMult = pCopy(PW->sig); // copy signature of reducer
938 //#if 1
939 #ifdef DEBUGF5
940  printf("IN KSREDUCEPOLYSIG: \n");
941  pWrite(pHead(f1));
942  pWrite(pHead(f2));
943  pWrite(sigMult);
944  printf("--------------\n");
945 #endif
946  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
947  //I have also to set the leading coeficient for sigMult (in the case of rings)
949  {
950  pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
951  if(nIsZero(pGetCoeff(sigMult)))
952  {
953  sigMult = NULL;
954  }
955  }
956 //#if 1
957 #ifdef DEBUGF5
958  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
959  pWrite(pHead(f1));
960  pWrite(pHead(f2));
961  pWrite(sigMult);
962  pWrite(PR->sig);
963  printf("--------------\n");
964 #endif
965  int sigSafe;
967  sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
968  // now we can delete the copied polynomial data used for checking for
969  // sig-safeness of the reduction step
970 //#if 1
971 #ifdef DEBUGF5
972  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
973 
974 #endif
976  {
977  // Set the sig
978  poly origsig = pCopy(PR->sig);
979  if(sigMult != NULL)
980  PR->sig = pHead(pSub(PR->sig, sigMult));
981  //The sigs have the same lm, have to substract
982  //It may happen that now the signature is 0 (drop)
983  if(PR->sig == NULL)
984  {
985  strat->sigdrop=TRUE;
986  }
987  else
988  {
989  if(pLtCmp(PR->sig,origsig) == 1)
990  {
991  // do not allow this reduction - it will increase it's signature
992  // and the partially standard basis is just till the old sig, not the new one
993  PR->is_redundant = TRUE;
994  pDelete(&PR->sig);
995  PR->sig = origsig;
996  strat->blockred++;
997  return 3;
998  }
999  if(pLtCmp(PR->sig,origsig) == -1)
1000  {
1001  strat->sigdrop=TRUE;
1002  }
1003  }
1004  pDelete(&origsig);
1005  }
1006  //pDelete(&f1);
1007  // go on with the computations only if the signature of p2 is greater than the
1008  // signature of fm*p1
1009  if(sigSafe != 1 && !rField_is_Ring(currRing))
1010  {
1011  PR->is_redundant = TRUE;
1012  return 3;
1013  }
1014  //PW->is_sigsafe = TRUE;
1015  }
1016  PR->is_redundant = FALSE;
1017  poly p1 = PR->GetLmTailRing(); // p2 | p1
1018  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
1019  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
1020  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
1021  p_CheckPolyRing(p1, tailRing);
1022  p_CheckPolyRing(p2, tailRing);
1023 
1024  pAssume1(p2 != NULL && p1 != NULL &&
1025  p_DivisibleBy(p2, p1, tailRing));
1026 
1027  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
1028  (p_GetComp(p2, tailRing) == 0 &&
1029  p_MaxComp(pNext(p2),tailRing) == 0));
1030 
1031 #ifdef HAVE_PLURAL
1032  if (rIsPluralRing(currRing))
1033  {
1034  // for the time being: we know currRing==strat->tailRing
1035  // no exp-bound checking needed
1036  // (only needed if exp-bound(tailring)<exp-b(currRing))
1037  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
1038  else
1039  {
1040  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
1041  assume(_p != NULL);
1042  nc_PolyPolyRed(_p, p2, coef, currRing);
1043  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
1044  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
1045  }
1046  return 0;
1047  }
1048 #endif
1049 
1050  if (t2==NULL) // Divisor is just one term, therefore it will
1051  { // just cancel the leading term
1052  PR->LmDeleteAndIter();
1053  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
1054  return 0;
1055  }
1056 
1057  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
1058 
1059  if (tailRing != currRing)
1060  {
1061  // check that reduction does not violate exp bound
1062  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
1063  {
1064  // undo changes of lm
1065  p_ExpVectorAdd(lm, p2, tailRing);
1066  if (strat == NULL) return 2;
1067  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
1068  tailRing = strat->tailRing;
1069  p1 = PR->GetLmTailRing();
1070  p2 = PW->GetLmTailRing();
1071  t2 = pNext(p2);
1072  lm = p1;
1073  p_ExpVectorSub(lm, p2, tailRing);
1074  ret = 1;
1075  }
1076  }
1077 
1078 #ifdef HAVE_SHIFTBBA
1079  poly lmRight;
1080  if (tailRing->isLPring) {
1081  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
1082  }
1083 #endif
1084 
1085  // take care of coef buisness
1087  {
1088  p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
1089 #ifdef HAVE_SHIFTBBA
1090  if (tailRing->isLPring) pSetCoeff0(p1, pGetCoeff(lm)); // lm doesn't point to p1 anymore, if the coef was a pointer, it has been deleted
1091 #endif
1092  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
1093  }
1094  else
1095  {
1096  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
1097  {
1098  number bn = pGetCoeff(lm);
1099  number an = pGetCoeff(p2);
1100  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
1101  p_SetCoeff(lm, bn, tailRing);
1102 #ifdef HAVE_SHIFTBBA
1103  if (tailRing->isLPring) pSetCoeff0(p1, bn); // lm doesn't point to p1 anymore, if the coef was a pointer, it has been deleted
1104 #endif
1105  if (((ct == 0) || (ct == 2)))
1106  PR->Tail_Mult_nn(an);
1107  if (coef != NULL) *coef = an;
1108  else n_Delete(&an, tailRing->cf);
1109  }
1110  else
1111  {
1112  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
1113  }
1114  }
1115 
1116  // and finally,
1117 #ifdef HAVE_SHIFTBBA
1118  if (tailRing->isLPring)
1119  {
1120  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
1121  }
1122  else
1123 #endif
1124  {
1125  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
1126  }
1127  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
1128  PR->LmDeleteAndIter();
1129 
1130 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
1131  if (TEST_OPT_DEBUG)
1132  {
1133  Print(" to: "); PR->wrp(); Print("\n");
1134  }
1135 #endif
1136  return ret;
1137 }
#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:358
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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:303
#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:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define pSub(a, b)
Definition: polys.h:282
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
#define nMult(n1, n2)
Definition: numbers.h:17
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
static unsigned pLength(poly a)
Definition: p_polys.h:191
#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:32
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
int blockred
Definition: kutil.h:363
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:655
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1391
#define pAssume1(cond)
Definition: monomials.h:171
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:585
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291
#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 1290 of file kspoly.cc.

1291 {
1292  BOOLEAN ret;
1293  number coef;
1294  poly Lp = PR->GetLmCurrRing();
1295  poly Save = PW->GetLmCurrRing();
1296 
1297  kTest_L(PR,PR->tailRing);
1298  kTest_T(PW);
1299  pAssume(pIsMonomOf(Lp, Current));
1300 
1301  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
1302  assume(PR->bucket == NULL);
1303 
1304  LObject Red(pNext(Current), PR->tailRing);
1305  TObject With(PW, Lp == Save);
1306 
1307  pAssume(!pHaveCommonMonoms(Red.p, With.p));
1308  ret = ksReducePoly(&Red, &With, spNoether, &coef);
1309 
1310  if (!ret)
1311  {
1312  if (! n_IsOne(coef, currRing->cf))
1313  {
1314  pNext(Current) = NULL;
1315  if (Current == PR->p && PR->t_p != NULL)
1316  pNext(PR->t_p) = NULL;
1317  PR->Mult_nn(coef);
1318  }
1319 
1320  n_Delete(&coef, currRing->cf);
1321  pNext(Current) = Red.GetLmTailRing();
1322  if (Current == PR->p && PR->t_p != NULL)
1323  pNext(PR->t_p) = pNext(Current);
1324  }
1325 
1326  if (Lp == Save)
1327  With.Delete();
1328 
1329  return ret;
1330 }
class sLObject LObject
Definition: kutil.h:54
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define pAssume(cond)
Definition: monomials.h:90
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
BOOLEAN pHaveCommonMonoms(poly p, poly q)
Definition: pDebug.cc:173
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:163
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:655
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 1093 of file kInline.h.

1094 {
1095  BOOLEAN ret;
1096  number coef;
1097 
1098  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1099  Red->HeadNormalize();
1100  ret = ksReducePoly(Red, PW, NULL, &coef);
1101 
1102  if (!ret)
1103  {
1104  if (! n_IsOne(coef, currRing->cf))
1105  {
1106  PR->Mult_nn(coef);
1107  // HANNES: mark for Normalize
1108  }
1109  n_Delete(&coef, currRing->cf);
1110  }
1111  return ret;
1112 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int BOOLEAN
Definition: auxiliary.h:85

◆ ksReducePolyZ()

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

Definition at line 44 of file kspoly.cc.

49 {
50 #ifdef KDEBUG
51  red_count++;
52 #ifdef TEST_OPT_DEBUG_RED
53 // if (TEST_OPT_DEBUG)
54 // {
55 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
56 // PW->wrp();
57 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
58 // //pWrite(PR->p);
59 // }
60 #endif
61 #endif
62  int ret = 0;
63  ring tailRing = PR->tailRing;
64  kTest_L(PR,tailRing);
65  kTest_T(PW);
66 
67  poly p1 = PR->GetLmTailRing(); // p2 | p1
68  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
69  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
70  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
71  p_CheckPolyRing(p1, tailRing);
72  p_CheckPolyRing(p2, tailRing);
73 
74  pAssume1(p2 != NULL && p1 != NULL &&
75  p_DivisibleBy(p2, p1, tailRing));
76 
77  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
78  (p_GetComp(p2, tailRing) == 0 &&
79  p_MaxComp(pNext(p2),tailRing) == 0));
80 
81 #ifdef HAVE_PLURAL
83  {
84  // for the time being: we know currRing==strat->tailRing
85  // no exp-bound checking needed
86  // (only needed if exp-bound(tailring)<exp-b(currRing))
87  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
88  else
89  {
90  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
91  assume(_p != NULL);
92  nc_PolyPolyRed(_p, p2,coef, currRing);
93  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
94  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
95  }
96  return 0;
97  }
98 #endif
99 
100  if (t2==NULL) // Divisor is just one term, therefore it will
101  { // just cancel the leading term
102  // adjust lead coefficient if needed
103  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
104  {
105  number bn = pGetCoeff(lm);
106  number an = pGetCoeff(p2);
107  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
108  p_SetCoeff(lm, bn, tailRing);
109  if ((ct == 0) || (ct == 2))
110  PR->Tail_Mult_nn(an);
111  if (coef != NULL) *coef = an;
112  else n_Delete(&an, tailRing->cf);
113  }
114  PR->LmDeleteAndIter();
115  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
116  return 0;
117  }
118 
119  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
120 
121  //if (tailRing != currRing)
122  {
123  // check that reduction does not violate exp bound
124  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
125  {
126  // undo changes of lm
127  p_ExpVectorAdd(lm, p2, tailRing);
128  if (strat == NULL) return 2;
129  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
130  tailRing = strat->tailRing;
131  p1 = PR->GetLmTailRing();
132  p2 = PW->GetLmTailRing();
133  t2 = pNext(p2);
134  lm = p1;
135  p_ExpVectorSub(lm, p2, tailRing);
136  ret = 1;
137  }
138  }
139 
140 #ifdef HAVE_SHIFTBBA
141  poly lmRight;
142  if (tailRing->isLPring) {
143  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
144  }
145 #endif
146 
147  // take care of coef buisness
148  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
149  {
150  number bn = pGetCoeff(lm);
151  number an = pGetCoeff(p2);
152  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
153  p_SetCoeff(lm, bn, tailRing);
154 #ifdef HAVE_SHIFTBBA
155  if (tailRing->isLPring) pSetCoeff0(p1, bn); // lm doesn't point to p1 anymore, if the coef was a pointer, it has been deleted
156 #endif
157  if ((ct == 0) || (ct == 2))
158  PR->Tail_Mult_nn(an);
159  if (coef != NULL) *coef = an;
160  else n_Delete(&an, tailRing->cf);
161  }
162  else
163  {
164  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
165  }
166 
167 
168  // and finally,
169 #ifdef HAVE_SHIFTBBA
170  if (tailRing->isLPring)
171  {
172  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
173  }
174  else
175 #endif
176  {
177  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
178  }
179  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
180  PR->LmDeleteAndIter();
181 
182  return ret;
183 }
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 &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define p_GetComp(p, r)
Definition: monomials.h:64
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1962
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:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
#define kTest_L(T, R)
Definition: kutil.h:657
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int red_count
Definition: kspoly.cc:27
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define kTest_T(T)
Definition: kutil.h:655
#define pAssume1(cond)
Definition: monomials.h:171
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:585
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291

◆ kStratChangeTailRing()

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

Definition at line 11377 of file kutil.cc.

11378 {
11379  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11380  /* initial setup or extending */
11381 
11382  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11383  if (expbound >= currRing->bitmask) return FALSE;
11384  strat->overflow=FALSE;
11385  ring new_tailRing = rModifyRing(currRing,
11386  // Hmmm .. the condition pFDeg == p_Deg
11387  // might be too strong
11388  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11389  (strat->ak==0), // omit_comp if the input is an ideal
11390  expbound); // exp_limit
11391 
11392  if (new_tailRing == currRing) return TRUE;
11393 
11394  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11395  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11396 
11397  if (currRing->pFDeg != currRing->pFDegOrig)
11398  {
11399  new_tailRing->pFDeg = currRing->pFDeg;
11400  new_tailRing->pLDeg = currRing->pLDeg;
11401  }
11402 
11403  if (TEST_OPT_PROT)
11404  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11405  kTest_TS(strat);
11406  assume(new_tailRing != strat->tailRing);
11407  pShallowCopyDeleteProc p_shallow_copy_delete
11408  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11409 
11410  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11411 
11412  int i;
11413  for (i=0; i<=strat->tl; i++)
11414  {
11415  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11416  p_shallow_copy_delete);
11417  }
11418  for (i=0; i<=strat->Ll; i++)
11419  {
11420  assume(strat->L[i].p != NULL);
11421  if (pNext(strat->L[i].p) != strat->tail)
11422  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11423  }
11424  if ((strat->P.t_p != NULL) ||
11425  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11426  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11427 
11428  if ((L != NULL) && (L->tailRing != new_tailRing))
11429  {
11430  if (L->i_r < 0)
11431  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11432  else
11433  {
11434  assume(L->i_r <= strat->tl);
11435  TObject* t_l = strat->R[L->i_r];
11436  assume(t_l != NULL);
11437  L->tailRing = new_tailRing;
11438  L->p = t_l->p;
11439  L->t_p = t_l->t_p;
11440  L->max_exp = t_l->max_exp;
11441  }
11442  }
11443 
11444  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11445  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11446 
11447  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11448  if (strat->tailRing != currRing)
11449  rKillModifiedRing(strat->tailRing);
11450 
11451  strat->tailRing = new_tailRing;
11452  strat->tailBin = new_tailBin;
11453  strat->p_shallow_copy_delete
11454  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11455 
11456  if (strat->kHEdge != NULL)
11457  {
11458  if (strat->t_kHEdge != NULL)
11459  p_LmFree(strat->t_kHEdge, strat->tailRing);
11460  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11461  }
11462 
11463  if (strat->kNoether != NULL)
11464  {
11465  if (strat->t_kNoether != NULL)
11466  p_LmFree(strat->t_kNoether, strat->tailRing);
11468  new_tailRing);
11469  }
11470  kTest_TS(strat);
11471  if (TEST_OPT_PROT)
11472  PrintS("]");
11473  return TRUE;
11474 }
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:80
poly kHEdge
Definition: kutil.h:325
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2638
#define TRUE
Definition: auxiliary.h:98
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
int ak
Definition: kutil.h:351
#define omMergeStickyBinIntoBin(A, B)
Definition: xalloc.h:319
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:390
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
poly t_kHEdge
Definition: kutil.h:327
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:44
char homog
Definition: kutil.h:370
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
omBin tailBin
Definition: kutil.h:343
char overflow
Definition: kutil.h:402
#define omGetStickyBinOfBin(B)
Definition: xalloc.h:290
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void rKillModifiedRing(ring r)
Definition: ring.cc:2998
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:30
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:53

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11476 of file kutil.cc.

11477 {
11478  unsigned long l = 0;
11479  int i;
11480  long e;
11481 
11482  assume(strat->tailRing == currRing);
11483 
11484  for (i=0; i<= strat->Ll; i++)
11485  {
11486  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11487  }
11488  for (i=0; i<=strat->tl; i++)
11489  {
11490  // Hmm ... this we could do in one Step
11491  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11492  }
11493  if (rField_is_Ring(currRing))
11494  {
11495  l *= 2;
11496  }
11497  e = p_GetMaxExp(l, currRing);
11498  if (e <= 1) e = 2;
11499 
11500  kStratChangeTailRing(strat, NULL, NULL, e);
11501 }
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:1165
int Ll
Definition: kutil.h:349
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:746
int tl
Definition: kutil.h:348
#define assume(x)
Definition: mod2.h:390
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int i
Definition: cfEzgcd.cc:125
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int l
Definition: cfEzgcd.cc:93

◆ message()

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

Definition at line 7954 of file kutil.cc.

7955 {
7956  if (i != *olddeg)
7957  {
7958  Print("%d",i);
7959  *olddeg = i;
7960  }
7961  if (TEST_OPT_OLDSTD)
7962  {
7963  if (strat->Ll != *reduc)
7964  {
7965  if (strat->Ll != *reduc-1)
7966  Print("(%d)",strat->Ll+1);
7967  else
7968  PrintS("-");
7969  *reduc = strat->Ll;
7970  }
7971  else
7972  PrintS(".");
7973  mflush();
7974  }
7975  else
7976  {
7977  if (red_result == 0)
7978  PrintS("-");
7979  else if (red_result < 0)
7980  PrintS(".");
7981  if ((red_result > 0) || ((strat->Ll % 100)==99))
7982  {
7983  if (strat->Ll != *reduc && strat->Ll > 0)
7984  {
7985  Print("(%d)",strat->Ll+1);
7986  *reduc = strat->Ll;
7987  }
7988  }
7989  }
7990 }
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:349
#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 7995 of file kutil.cc.

7996 {
7997  //PrintS("\nUsage/Allocation of temporary storage:\n");
7998  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7999  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
8000  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
8001  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
8002  #ifdef HAVE_SHIFTBBA
8003  /* in usual case strat->cv is 0, it gets changed only in shift routines */
8004  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
8005  #endif
8006 }
#define Print
Definition: emacs.cc:80
int c3
Definition: kutil.h:345
int cv
Definition: kutil.h:367
int cp
Definition: kutil.h:345

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 8008 of file kutil.cc.

8009 {
8010  //PrintS("\nUsage/Allocation of temporary storage:\n");
8011  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
8012  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
8013  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
8014  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
8015  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
8016  #ifdef HAVE_SHIFTBBA
8017  /* in usual case strat->cv is 0, it gets changed only in shift routines */
8018  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
8019  #endif
8020 }
#define Print
Definition: emacs.cc:80
int cv
Definition: kutil.h:367
int nrsyzcrit
Definition: kutil.h:359
int nrrewcrit
Definition: kutil.h:360

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10841 of file kutil.cc.

10842 {
10843  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10844  return FALSE;
10845  int i,j;
10846  poly newNoether;
10847 
10848 #if 0
10849  if (currRing->weight_all_1)
10850  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10851  else
10852  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10853 #else
10854  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10855 #endif
10856  if (strat->kHEdge==NULL) return FALSE;
10857  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10858  if (strat->tailRing != currRing)
10859  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10860  /* compare old and new noether*/
10861  newNoether = pLmInit(strat->kHEdge);
10862  pSetCoeff0(newNoether,nInit(1));
10863  j = p_FDeg(newNoether,currRing);
10864  for (i=1; i<=(currRing->N); i++)
10865  {
10866  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10867  }
10868  pSetm(newNoether);
10869  if (j < strat->HCord) /*- statistics -*/
10870  {
10871  if (TEST_OPT_PROT)
10872  {
10873  Print("H(%d)",j);
10874  mflush();
10875  }
10876  strat->HCord=j;
10877  #ifdef KDEBUG
10878  if (TEST_OPT_DEBUG)
10879  {
10880  Print("H(%d):",j);
10881  wrp(strat->kHEdge);
10882  PrintLn();
10883  }
10884  #endif
10885  }
10886  if (pCmp(strat->kNoether,newNoether)!=1)
10887  {
10888  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
10889  strat->kNoether=newNoether;
10890  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10891  if (strat->tailRing != currRing)
10892  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10893 
10894  return TRUE;
10895  }
10896  pLmDelete(newNoether);
10897  return FALSE;
10898 }
int j
Definition: facHensel.cc:105
#define pSetm(p)
Definition: polys.h:266
int HCord
Definition: kutil.cc:236
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
poly kHEdge
Definition: kutil.h:325
#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:326
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1004
#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:351
#define TEST_OPT_DEBUG
Definition: options.h:107
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
int HCord
Definition: kutil.h:353
#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:905
#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:379
int i
Definition: cfEzgcd.cc:125
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
poly t_kHEdge
Definition: kutil.h:327
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
void wrp(poly p)
Definition: polys.h:305
ideal Shdl
Definition: kutil.h:299
#define nInit(i)
Definition: numbers.h:24

◆ pairs()

void pairs ( )

◆ pCopyL2p()

poly pCopyL2p ( LObject  h,
kStrategy  strat 
)

Definition at line 12090 of file kutil.cc.

12091 {
12092  /* restores a poly in currRing from LObject */
12093  LObject h = H;
12094  h.Copy();
12095  poly p;
12096  if (h.p == NULL)
12097  {
12098  if (h.t_p != NULL)
12099  {
12100  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
12101  return(p);
12102  }
12103  else
12104  {
12105  /* h.tp == NULL -> the object is NULL */
12106  return(NULL);
12107  }
12108  }
12109  /* we're here if h.p != NULL */
12110  if (h.t_p == NULL)
12111  {
12112  /* then h.p is the whole poly in currRing */
12113  p = h.p;
12114  return(p);
12115  }
12116  /* we're here if h.p != NULL and h.t_p != NULL */
12117  // clean h.p, get poly from t_p
12118  pNext(h.p)=NULL;
12119  pLmDelete(&h.p);
12120  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12121  /* dest. ring: */ currRing);
12122  // no need to clean h: we re-used the polys
12123  return(p);
12124 }
class sLObject LObject
Definition: kutil.h:54
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
#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:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 12059 of file kutil.cc.

12060 {
12061  /* assume: p is completely in currRing */
12062  /* produces an object with LM in curring
12063  and TAIL in tailring */
12064  if (pNext(p)!=NULL)
12065  {
12066  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
12067  }
12068  return(p);
12069 }
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 12073 of file kutil.cc.

12074 {
12075  /* assume: p has LM in curring and TAIL in tailring */
12076  /* convert it to complete currRing */
12077 
12078  /* check that LM is in currRing */
12080 
12081  if (pNext(p)!=NULL)
12082  {
12083  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
12084  }
12085  return(p);
12086 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:69
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInIdealMonFirst()

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

Definition at line 5213 of file kutil.cc.

5214 {
5215  if(end < 0 || end >= IDELEMS(F))
5216  end = IDELEMS(F);
5217  if (end<0) return 0;
5218  if(pNext(p) == NULL) return start;
5219  polyset set=F->m;
5220  int o = p_Deg(p,currRing);
5221  int op;
5222  int i;
5223  int an = start;
5224  for(i=start;i<end;i++)
5225  if(set[i] != NULL && pNext(set[i]) == NULL)
5226  an++;
5227  if(an == end-1)
5228  return end;
5229  int en= end;
5230  loop
5231  {
5232  if(an>=en)
5233  return en;
5234  if (an == en-1)
5235  {
5236  op = p_Deg(set[an],currRing);
5237  if ((op < o)
5238  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5239  return en;
5240  return an;
5241  }
5242  i=(an+en) / 2;
5243  op = p_Deg(set[i],currRing);
5244  if ((op < o)
5245  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5246  an=i;
5247  else
5248  en=i;
5249  }
5250 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:23
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInL0()

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

Definition at line 6065 of file kutil.cc.

6067 {
6068  if (length<0) return 0;
6069 
6070  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6071  return length+1;
6072 
6073  int i;
6074  int an = 0;
6075  int en= length;
6076  loop
6077  {
6078  if (an >= en-1)
6079  {
6080  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6081  return an;
6082  }
6083  i=(an+en) / 2;
6084  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6085  else en=i;
6086  /*aend. fuer lazy == in !=- machen */
6087  }
6088 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInL10()

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

Definition at line 1006 of file kstd1.cc.

1007 {
1008  int j,dp,dL;
1009 
1010  if (length<0) return 0;
1011  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1012  {
1013  int op= p->GetpFDeg() +p->ecart;
1014  for (j=length; j>=0; j--)
1015  {
1016  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1017  return j+1;
1018  if (dp < dL)
1019  return j+1;
1020  if ((dp == dL)
1021  && (set[j].GetpFDeg()+set[j].ecart >= op))
1022  return j+1;
1023  }
1024  }
1025  j=length;
1026  loop
1027  {
1028  if (j<0) break;
1029  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1030  j--;
1031  }
1032  return strat->posInLOld(set,j,p,strat);
1033 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:80
int lastAxis
Definition: kutil.h:354
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:958
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 6323 of file kutil.cc.

6325 {
6326  if (length<0) return 0;
6327 
6328  int o = p->GetpFDeg();
6329  int op = set[length].GetpFDeg();
6330 
6331  if ((op > o)
6332  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6333  return length+1;
6334  int i;
6335  int an = 0;
6336  int en= length;
6337  loop
6338  {
6339  if (an >= en-1)
6340  {
6341  op = set[an].GetpFDeg();
6342  if ((op > o)
6343  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6344  return en;
6345  return an;
6346  }
6347  i=(an+en) / 2;
6348  op = set[i].GetpFDeg();
6349  if ((op > o)
6350  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6351  an=i;
6352  else
6353  en=i;
6354  }
6355 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInL110()

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

Definition at line 6621 of file kutil.cc.

6623 {
6624  if (length<0) return 0;
6625 
6626  int o = p->GetpFDeg();
6627  int op = set[length].GetpFDeg();
6628 
6629  if ((op > o)
6630  || ((op == o) && (set[length].length >p->length))
6631  || ((op == o) && (set[length].length <= p->length)
6632  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6633  return length+1;
6634  int i;
6635  int an = 0;
6636  int en= length;
6637  loop
6638  {
6639  if (an >= en-1)
6640  {
6641  op = set[an].GetpFDeg();
6642  if ((op > o)
6643  || ((op == o) && (set[an].length >p->length))
6644  || ((op == o) && (set[an].length <=p->length)
6645  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6646  return en;
6647  return an;
6648  }
6649  i=(an+en) / 2;
6650  op = set[i].GetpFDeg();
6651  if ((op > o)
6652  || ((op == o) && (set[i].length > p->length))
6653  || ((op == o) && (set[i].length <= p->length)
6654  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6655  an=i;
6656  else
6657  en=i;
6658  }
6659 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInL11Ring()

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

Definition at line 6365 of file kutil.cc.

6367 {
6368  if (length<0) return 0;
6369 
6370  int o = p->GetpFDeg();
6371  int op = set[length].GetpFDeg();
6372 
6373  if ((op > o)
6374  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6375  return length+1;
6376  int i;
6377  int an = 0;
6378  int en= length;
6379  loop
6380  {
6381  if (an >= en-1)
6382  {
6383  op = set[an].GetpFDeg();
6384  if ((op > o)
6385  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6386  return en;
6387  return an;
6388  }
6389  i=(an+en) / 2;
6390  op = set[i].GetpFDeg();
6391  if ((op > o)
6392  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6393  an=i;
6394  else
6395  en=i;
6396  }
6397 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
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 6435 of file kutil.cc.

6437 {
6438  if (length < 0) return 0;
6439  int an,en,i;
6440  an = 0;
6441  en = length+1;
6442  loop
6443  {
6444  if (an >= en-1)
6445  {
6446  if(an == en)
6447  return en;
6448  if (set[an].FDeg > p->FDeg)
6449  return en;
6450  if (set[an].FDeg < p->FDeg)
6451  return an;
6452  if (set[an].FDeg == p->FDeg)
6453  {
6454  number lcset,lcp;
6455  lcset = pGetCoeff(set[an].p);
6456  lcp = pGetCoeff(p->p);
6457  if(!nGreaterZero(lcset))
6458  {
6459  set[an].p=p_Neg(set[an].p,currRing);
6460  if (set[an].t_p!=NULL)
6461  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6462  lcset=pGetCoeff(set[an].p);
6463  }
6464  if(!nGreaterZero(lcp))
6465  {
6466  p->p=p_Neg(p->p,currRing);
6467  if (p->t_p!=NULL)
6468  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6469  lcp=pGetCoeff(p->p);
6470  }
6471  if(nGreater(lcset, lcp))
6472  {
6473  return en;
6474  }
6475  else
6476  {
6477  return an;
6478  }
6479  }
6480  }
6481  i=(an+en) / 2;
6482  if (set[i].FDeg > p->FDeg)
6483  an=i;
6484  if (set[i].FDeg < p->FDeg)
6485  en=i;
6486  if (set[i].FDeg == p->FDeg)
6487  {
6488  number lcset,lcp;
6489  lcset = pGetCoeff(set[i].p);
6490  lcp = pGetCoeff(p->p);
6491  if(!nGreaterZero(lcset))
6492  {
6493  set[i].p=p_Neg(set[i].p,currRing);
6494  if (set[i].t_p!=NULL)
6495  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6496  lcset=pGetCoeff(set[i].p);
6497  }
6498  if(!nGreaterZero(lcp))
6499  {
6500  p->p=p_Neg(p->p,currRing);
6501  if (p->t_p!=NULL)
6502  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6503  lcp=pGetCoeff(p->p);
6504  }
6505  if(nGreater(lcset, lcp))
6506  {
6507  an = i;
6508  }
6509  else
6510  {
6511  en = i;
6512  }
6513  }
6514  }
6515 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
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:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
int p
Definition: cfModGcd.cc:4019
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInL13()

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

Definition at line 6709 of file kutil.cc.

6711 {
6712  if (length<0) return 0;
6713 
6714  int o = p->GetpFDeg();
6715 
6716  if (set[length].GetpFDeg() > o)
6717  return length+1;
6718 
6719  int i;
6720  int an = 0;
6721  int en= length;
6722  loop
6723  {
6724  if (an >= en-1)
6725  {
6726  if (set[an].GetpFDeg() >= o)
6727  return en;
6728  return an;
6729  }
6730  i=(an+en) / 2;
6731  if (set[i].GetpFDeg() >= o)
6732  an=i;
6733  else
6734  en=i;
6735  }
6736 }
#define loop
Definition: structs.h:80
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 6744 of file kutil.cc.

6746 {
6747  if (length<0) return 0;
6748 
6749  int o = p->GetpFDeg() + p->ecart;
6750  int op = set[length].GetpFDeg() + set[length].ecart;
6751 
6752  if ((op > o)
6753  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6754  return length+1;
6755  int i;
6756  int an = 0;
6757  int en= length;
6758  loop
6759  {
6760  if (an >= en-1)
6761  {
6762  op = set[an].GetpFDeg() + set[an].ecart;
6763  if ((op > o)
6764  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6765  return en;
6766  return an;
6767  }
6768  i=(an+en) / 2;
6769  op = set[i].GetpFDeg() + set[i].ecart;
6770  if ((op > o)
6771  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6772  an=i;
6773  else
6774  en=i;
6775  }
6776 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInL15Ring()

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

Definition at line 6779 of file kutil.cc.

6781 {
6782  if (length<0) return 0;
6783 
6784  int o = p->GetpFDeg() + p->ecart;
6785  int op = set[length].GetpFDeg() + set[length].ecart;
6786 
6787  if ((op > o)
6788  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6789  return length+1;
6790  int i;
6791  int an = 0;
6792  int en= length;
6793  loop
6794  {
6795  if (an >= en-1)
6796  {
6797  op = set[an].GetpFDeg() + set[an].ecart;
6798  if ((op > o)
6799  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6800  return en;
6801  return an;
6802  }
6803  i=(an+en) / 2;
6804  op = set[i].GetpFDeg() + set[i].ecart;
6805  if ((op > o)
6806  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6807  an=i;
6808  else
6809  en=i;
6810  }
6811 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
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 6820 of file kutil.cc.

6822 {
6823  if (length<0) return 0;
6824 
6825  int o = p->GetpFDeg() + p->ecart;
6826 
6827  if ((set[length].GetpFDeg() + set[length].ecart > o)
6828  || ((set[length].GetpFDeg() + set[length].ecart == o)
6829  && (set[length].ecart > p->ecart))
6830  || ((set[length].GetpFDeg() + set[length].ecart == o)
6831  && (set[length].ecart == p->ecart)
6832  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6833  return length+1;
6834  int i;
6835  int an = 0;
6836  int en= length;
6837  loop
6838  {
6839  if (an >= en-1)
6840  {
6841  if ((set[an].GetpFDeg() + set[an].ecart > o)
6842  || ((set[an].GetpFDeg() + set[an].ecart == o)
6843  && (set[an].ecart > p->ecart))
6844  || ((set[an].GetpFDeg() + set[an].ecart == o)
6845  && (set[an].ecart == p->ecart)
6846  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6847  return en;
6848  return an;
6849  }
6850  i=(an+en) / 2;
6851  if ((set[i].GetpFDeg() + set[i].ecart > o)
6852  || ((set[i].GetpFDeg() + set[i].ecart == o)
6853  && (set[i].ecart > p->ecart))
6854  || ((set[i].GetpFDeg() +set[i].ecart == o)
6855  && (set[i].ecart == p->ecart)
6856  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6857  an=i;
6858  else
6859  en=i;
6860  }
6861 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInLF5C()

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

Definition at line 6311 of file kutil.cc.

6313 {
6314  return strat->Ll+1;
6315 }
int Ll
Definition: kutil.h:349

◆ posInLF5CRing()

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

Definition at line 6399 of file kutil.cc.

6401 {
6402  if (length<0) return 0;
6403  if(start == (length +1)) return (length+1);
6404  int o = p->GetpFDeg();
6405  int op = set[length].GetpFDeg();
6406 
6407  if ((op > o)
6408  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6409  return length+1;
6410  int i;
6411  int an = start;
6412  int en= length;
6413  loop
6414  {
6415  if (an >= en-1)
6416  {
6417  op = set[an].GetpFDeg();
6418  if ((op > o)
6419  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6420  return en;
6421  return an;
6422  }
6423  i=(an+en) / 2;
6424  op = set[i].GetpFDeg();
6425  if ((op > o)
6426  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6427  an=i;
6428  else
6429  en=i;
6430  }
6431 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
#define loop
Definition: structs.h:80
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 6210 of file kutil.cc.

6212 {
6213  if (length < 0) return 0;
6214  if (set[length].FDeg > p->FDeg)
6215  return length+1;
6216  if (set[length].FDeg == p->FDeg)
6217  if(set[length].GetpLength() > p->GetpLength())
6218  return length+1;
6219  int i;
6220  int an = 0;
6221  int en= length+1;
6222  loop
6223  {
6224  if (an >= en-1)
6225  {
6226  if(an == en)
6227  return en;
6228  if (set[an].FDeg > p->FDeg)
6229  return en;
6230  if(set[an].FDeg == p->FDeg)
6231  {
6232  if(set[an].GetpLength() > p->GetpLength())
6233  return en;
6234  else
6235  {
6236  if(set[an].GetpLength() == p->GetpLength())
6237  {
6238  if(nGreater(set[an].p->coef, p->p->coef))
6239  return en;
6240  else
6241  return an;
6242  }
6243  else
6244  {
6245  return an;
6246  }
6247  }
6248  }
6249  else
6250  return an;
6251  }
6252  i=(an+en) / 2;
6253  if (set[i].FDeg > p->FDeg)
6254  an=i;
6255  else
6256  {
6257  if(set[i].FDeg == p->FDeg)
6258  {
6259  if(set[i].GetpLength() > p->GetpLength())
6260  an=i;
6261  else
6262  {
6263  if(set[i].GetpLength() == p->GetpLength())
6264  {
6265  if(nGreater(set[i].p->coef, p->p->coef))
6266  an = i;
6267  else
6268  en = i;
6269  }
6270  else
6271  {
6272  en=i;
6273  }
6274  }
6275  }
6276  else
6277  en=i;
6278  }
6279  }
6280 }
#define loop
Definition: structs.h:80
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:28

◆ posInLSig()

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

Definition at line 6123 of file kutil.cc.

6125 {
6126  if (length<0) return 0;
6127  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6128  return length+1;
6129 
6130  int i;
6131  int an = 0;
6132  int en= length;
6133  loop
6134  {
6135  if (an >= en-1)
6136  {
6137  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6138  return an;
6139  }
6140  i=(an+en) / 2;
6141  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6142  else en=i;
6143  /*aend. fuer lazy == in !=- machen */
6144  }
6145 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInLSigRing()

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

Definition at line 6147 of file kutil.cc.

6149 {
6150  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6151  if (length<0) return 0;
6152  if (pLtCmp(set[length].sig,p->sig)== 1)
6153  return length+1;
6154 
6155  int an,en,i;
6156  an = 0;
6157  en = length+1;
6158  int cmp;
6159  loop
6160  {
6161  if (an >= en-1)
6162  {
6163  if(an == en)
6164  return en;
6165  cmp = pLtCmp(set[an].sig,p->sig);
6166  if (cmp == 1)
6167  return en;
6168  if (cmp == -1)
6169  return an;
6170  if (cmp == 0)
6171  {
6172  if (set[an].FDeg > p->FDeg)
6173  return en;
6174  if (set[an].FDeg < p->FDeg)
6175  return an;
6176  if (set[an].FDeg == p->FDeg)
6177  {
6178  cmp = pLtCmp(set[an].p,p->p);
6179  if(cmp == 1)
6180  return en;
6181  else
6182  return an;
6183  }
6184  }
6185  }
6186  i=(an+en) / 2;
6187  cmp = pLtCmp(set[i].sig,p->sig);
6188  if (cmp == 1)
6189  an = i;
6190  if (cmp == -1)
6191  en = i;
6192  if (cmp == 0)
6193  {
6194  if (set[i].FDeg > p->FDeg)
6195  an = i;
6196  if (set[i].FDeg < p->FDeg)
6197  en = i;
6198  if (set[i].FDeg == p->FDeg)
6199  {
6200  cmp = pLtCmp(set[i].p,p->p);
6201  if(cmp == 1)
6202  an = i;
6203  else
6204  en = i;
6205  }
6206  }
6207  }
6208 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
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:12
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 5035 of file kutil.cc.

5037 {
5038  if(length==-1) return 0;
5039  polyset set=strat->S;
5040  int i;
5041  int an = 0;
5042  int en = length;
5043  int cmp_int = currRing->OrdSgn;
5045 #ifdef HAVE_PLURAL
5046  && (currRing->real_var_start==0)
5047 #endif
5048 #if 0
5049  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5050 #endif
5051  )
5052  {
5053  int o=p_Deg(p,currRing);
5054  int oo=p_Deg(set[length],currRing);
5055 
5056  if ((oo<o)
5057  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5058  return length+1;
5059 
5060  loop
5061  {
5062  if (an >= en-1)
5063  {
5064  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5065  {
5066  return an;
5067  }
5068  return en;
5069  }
5070  i=(an+en) / 2;
5071  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5072  else an=i;
5073  }
5074  }
5075  else
5076  {
5077  if (rField_is_Ring(currRing))
5078  {
5079  if (pLmCmp(set[length],p)== -cmp_int)
5080  return length+1;
5081  int cmp;
5082  loop
5083  {
5084  if (an >= en-1)
5085  {
5086  cmp = pLmCmp(set[an],p);
5087  if (cmp == cmp_int) return an;
5088  if (cmp == -cmp_int) return en;
5089  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5090  return an;
5091  }
5092  i = (an+en) / 2;
5093  cmp = pLmCmp(set[i],p);
5094  if (cmp == cmp_int) en = i;
5095  else if (cmp == -cmp_int) an = i;
5096  else
5097  {
5098  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5099  else en = i;
5100  }
5101  }
5102  }
5103  else
5104  if (pLmCmp(set[length],p)== -cmp_int)
5105  return length+1;
5106 
5107  loop
5108  {
5109  if (an >= en-1)
5110  {
5111  if (pLmCmp(set[an],p) == cmp_int) return an;
5112  if (pLmCmp(set[an],p) == -cmp_int) return en;
5113  if ((cmp_int!=1)
5114  && ((strat->ecartS[an])>ecart_p))
5115  return an;
5116  return en;
5117  }
5118  i=(an+en) / 2;
5119  if (pLmCmp(set[i],p) == cmp_int) en=i;
5120  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5121  else
5122  {
5123  if ((cmp_int!=1)
5124  &&((strat->ecartS[i])<ecart_p))
5125  en=i;
5126  else
5127  an=i;
5128  }
5129  }
5130  }
5131 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int ak
Definition: kutil.h:351
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInSMonFirst()

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

Definition at line 5136 of file kutil.cc.

5137 {
5138  if (length<0) return 0;
5139  polyset set=strat->S;
5140  if(pNext(p) == NULL)
5141  {
5142  int mon = 0;
5143  for(int i = 0;i<=length;i++)
5144  {
5145  if(set[i] != NULL && pNext(set[i]) == NULL)
5146  mon++;
5147  }
5148  int o = p_Deg(p,currRing);
5149  int op = p_Deg(set[mon],currRing);
5150 
5151  if ((op < o)
5152  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5153  return length+1;
5154  int i;
5155  int an = 0;
5156  int en= mon;
5157  loop
5158  {
5159  if (an >= en-1)
5160  {
5161  op = p_Deg(set[an],currRing);
5162  if ((op < o)
5163  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5164  return en;
5165  return an;
5166  }
5167  i=(an+en) / 2;
5168  op = p_Deg(set[i],currRing);
5169  if ((op < o)
5170  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5171  an=i;
5172  else
5173  en=i;
5174  }
5175  }
5176  else /*if(pNext(p) != NULL)*/
5177  {
5178  int o = p_Deg(p,currRing);
5179  int op = p_Deg(set[length],currRing);
5180 
5181  if ((op < o)
5182  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5183  return length+1;
5184  int i;
5185  int an = 0;
5186  for(i=0;i<=length;i++)
5187  if(set[i] != NULL && pNext(set[i]) == NULL)
5188  an++;
5189  int en= length;
5190  loop
5191  {
5192  if (an >= en-1)
5193  {
5194  op = p_Deg(set[an],currRing);
5195  if ((op < o)
5196  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5197  return en;
5198  return an;
5199  }
5200  i=(an+en) / 2;
5201  op = p_Deg(set[i],currRing);
5202  if ((op < o)
5203  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5204  an=i;
5205  else
5206  en=i;
5207  }
5208  }
5209 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:12
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ posInSyz()

int posInSyz ( const kStrategy  strat,
const poly  sig 
)

Definition at line 6283 of file kutil.cc.

6284 {
6285  if (strat->syzl==0) return 0;
6286  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6287  return strat->syzl;
6288  int i;
6289  int an = 0;
6290  int en= strat->syzl-1;
6291  loop
6292  {
6293  if (an >= en-1)
6294  {
6295  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6296  return an;
6297  }
6298  i=(an+en) / 2;
6299  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6300  else en=i;
6301  /*aend. fuer lazy == in !=- machen */
6302  }
6303 }
#define pLtCmp(p, q)
Definition: polys.h:123
#define loop
Definition: structs.h:80
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:12
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

◆ posInT0()

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

Definition at line 5257 of file kutil.cc.

5258 {
5259  return (length+1);
5260 }
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 5268 of file kutil.cc.

5269 {
5270  if (length==-1) return 0;
5271 
5272  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5273 
5274  int i;
5275  int an = 0;
5276  int en= length;
5277 
5278  loop
5279  {
5280  if (an >= en-1)
5281  {
5282  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5283  return en;
5284  }
5285  i=(an+en) / 2;
5286  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5287  else an=i;
5288  }
5289 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInT11()

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

Definition at line 5326 of file kutil.cc.

5327 {
5328  if (length==-1) return 0;
5329 
5330  int o = p.GetpFDeg();
5331  int op = set[length].GetpFDeg();
5332 
5333  if ((op < o)
5334  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5335  return length+1;
5336 
5337  int i;
5338  int an = 0;
5339  int en= length;
5340 
5341  loop
5342  {
5343  if (an >= en-1)
5344  {
5345  op= set[an].GetpFDeg();
5346  if ((op > o)
5347  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5348  return an;
5349  return en;
5350  }
5351  i=(an+en) / 2;
5352  op = set[i].GetpFDeg();
5353  if (( op > o)
5354  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5355  en=i;
5356  else
5357  an=i;
5358  }
5359 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInT110()

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

Definition at line 5479 of file kutil.cc.

5480 {
5481  p.GetpLength();
5482  if (length==-1) return 0;
5483 
5484  int o = p.GetpFDeg();
5485  int op = set[length].GetpFDeg();
5486 
5487  if (( op < o)
5488  || (( op == o) && (set[length].length<p.length))
5489  || (( op == o) && (set[length].length == p.length)
5490  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
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  op = set[an].GetpFDeg();
5501  if (( op > o)
5502  || (( op == o) && (set[an].length > p.length))
5503  || (( op == o) && (set[an].length == p.length)
5504  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5505  return an;
5506  return en;
5507  }
5508  i=(an+en) / 2;
5509  op = set[i].GetpFDeg();
5510  if (( op > o)
5511  || (( op == o) && (set[i].length > p.length))
5512  || (( op == o) && (set[i].length == p.length)
5513  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5514  en=i;
5515  else
5516  an=i;
5517  }
5518 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInT13()

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

Definition at line 5568 of file kutil.cc.

5569 {
5570  if (length==-1) return 0;
5571 
5572  int o = p.GetpFDeg();
5573 
5574  if (set[length].GetpFDeg() <= o)
5575  return length+1;
5576 
5577  int i;
5578  int an = 0;
5579  int en= length;
5580  loop
5581  {
5582  if (an >= en-1)
5583  {
5584  if (set[an].GetpFDeg() > o)
5585  return an;
5586  return en;
5587  }
5588  i=(an+en) / 2;
5589  if (set[i].GetpFDeg() > o)
5590  en=i;
5591  else
5592  an=i;
5593  }
5594 }
#define loop
Definition: structs.h:80
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 5636 of file kutil.cc.

5655 {
5656  if (length==-1) return 0;
5657 
5658  int o = p.GetpFDeg() + p.ecart;
5659  int op = set[length].GetpFDeg()+set[length].ecart;
5660 
5661  if ((op < o)
5662  || ((op == o)
5663  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5664  return length+1;
5665 
5666  int i;
5667  int an = 0;
5668  int en= length;
5669  loop
5670  {
5671  if (an >= en-1)
5672  {
5673  op = set[an].GetpFDeg()+set[an].ecart;
5674  if (( op > o)
5675  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5676  return an;
5677  return en;
5678  }
5679  i=(an+en) / 2;
5680  op = set[i].GetpFDeg()+set[i].ecart;
5681  if (( op > o)
5682  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5683  en=i;
5684  else
5685  an=i;
5686  }
5687 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInT17()

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

Definition at line 5731 of file kutil.cc.

5752 {
5753  if (length==-1) return 0;
5754 
5755  int o = p.GetpFDeg() + p.ecart;
5756  int op = set[length].GetpFDeg()+set[length].ecart;
5757 
5758  if ((op < o)
5759  || (( op == o) && (set[length].ecart > p.ecart))
5760  || (( op == o) && (set[length].ecart==p.ecart)
5761  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5762  return length+1;
5763 
5764  int i;
5765  int an = 0;
5766  int en= length;
5767  loop
5768  {
5769  if (an >= en-1)
5770  {
5771  op = set[an].GetpFDeg()+set[an].ecart;
5772  if (( op > o)
5773  || (( op == o) && (set[an].ecart < p.ecart))
5774  || (( op == o) && (set[an].ecart==p.ecart)
5775  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5776  return an;
5777  return en;
5778  }
5779  i=(an+en) / 2;
5780  op = set[i].GetpFDeg()+set[i].ecart;
5781  if ((op > o)
5782  || (( op == o) && (set[i].ecart < p.ecart))
5783  || (( op == o) && (set[i].ecart == p.ecart)
5784  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5785  en=i;
5786  else
5787  an=i;
5788  }
5789 }
#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:80
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:12
int p
Definition: cfModGcd.cc:4019

◆ posInT17_c()

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

Definition at line 5838 of file kutil.cc.

5839 {
5840  if (length==-1) return 0;
5841 
5842  int cc = (-1+2*currRing->order[0]==ringorder_c);
5843  /* cc==1 for (c,..), cc==-1 for (C,..) */
5844  int o = p.GetpFDeg() + p.ecart;
5845  int c = pGetComp(p.p)*cc;
5846 
5847  if (pGetComp(set[length].p)*cc < c)
5848  return length+1;
5849  if (pGetComp(set[length].p)*cc == c)
5850  {
5851  int op = set[length].GetpFDeg()+set[length].ecart;
5852  if ((op < o)
5853  || ((op == o) && (set[length].ecart > p.ecart))
5854  || ((op == o) && (set[length].ecart==p.ecart)
5855  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5856  return length+1;
5857  }
5858 
5859  int i;
5860  int an = 0;
5861  int en= length;
5862  loop
5863  {
5864  if (an >= en-1)
5865  {
5866  if (pGetComp(set[an].p)*cc < c)
5867  return en;
5868  if (pGetComp(set[an].p)*cc == c)
5869  {
5870  int op = set[an].GetpFDeg()+set[an].ecart;
5871  if ((op > o)
5872  || ((op == o) && (set[an].ecart < p.ecart))
5873  || ((op == o) && (set[an].ecart==p.ecart)
5874  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5875  return an;
5876  }
5877  return en;
5878  }
5879  i=(an+en) / 2;
5880  if (pGetComp(set[i].p)*cc > c)
5881  en=i;
5882  else if (pGetComp(set[i].p)*cc == c)
5883  {
5884  int op = set[i].GetpFDeg()+set[i].ecart;
5885  if ((op > o)
5886  || ((op == o) && (set[i].ecart < p.ecart))
5887  || ((op == o) && (set[i].ecart == p.ecart)
5888  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5889  en=i;
5890  else
5891  an=i;
5892  }
5893  else
5894  an=i;
5895  }
5896 }
#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:80
#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:12
int p
Definition: cfModGcd.cc:4019

◆ posInT19()

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

Definition at line 5965 of file kutil.cc.

5966 {
5967  p.GetpLength();
5968  if (length==-1) return 0;
5969 
5970  int o = p.ecart;
5971  int op=p.GetpFDeg();
5972 
5973  if (set[length].ecart < o)
5974  return length+1;
5975  if (set[length].ecart == o)
5976  {
5977  int oo=set[length].GetpFDeg();
5978  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
5979  return length+1;
5980  }
5981 
5982  int i;
5983  int an = 0;
5984  int en= length;
5985  loop
5986  {
5987  if (an >= en-1)
5988  {
5989  if (set[an].ecart > o)
5990  return an;
5991  if (set[an].ecart == o)
5992  {
5993  int oo=set[an].GetpFDeg();
5994  if((oo > op)
5995  || ((oo==op) && (set[an].length > p.length)))
5996  return an;
5997  }
5998  return en;
5999  }
6000  i=(an+en) / 2;
6001  if (set[i].ecart > o)
6002  en=i;
6003  else if (set[i].ecart == o)
6004  {
6005  int oo=set[i].GetpFDeg();
6006  if ((oo > op)
6007  || ((oo == op) && (set[i].length > p.length)))
6008  en=i;
6009  else
6010  an=i;
6011  }
6012  else
6013  an=i;
6014  }
6015 }
#define loop
Definition: structs.h:80
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 5296 of file kutil.cc.

5297 {
5298  p.GetpLength();
5299  if (length==-1)
5300  return 0;
5301  if (set[length].length<p.length)
5302  return length+1;
5303 
5304  int i;
5305  int an = 0;
5306  int en= length;
5307 
5308  loop
5309  {
5310  if (an >= en-1)
5311  {
5312  if (set[an].length>p.length) return an;
5313  return en;
5314  }
5315  i=(an+en) / 2;
5316  if (set[i].length>p.length) en=i;
5317  else an=i;
5318  }
5319 }
#define loop
Definition: structs.h:80
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 11798 of file kutil.cc.

11799 {
11800 
11801  if (length==-1) return 0;
11802 
11803  int o = p.ecart;
11804  int op=p.GetpFDeg();
11805  int ol = p.GetpLength();
11806 
11807  if (set[length].ecart < o)
11808  return length+1;
11809  if (set[length].ecart == o)
11810  {
11811  int oo=set[length].GetpFDeg();
11812  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11813  return length+1;
11814  }
11815 
11816  int i;
11817  int an = 0;
11818  int en= length;
11819  loop
11820  {
11821  if (an >= en-1)
11822  {
11823  if (set[an].ecart > o)
11824  return an;
11825  if (set[an].ecart == o)
11826  {
11827  int oo=set[an].GetpFDeg();
11828  if((oo > op)
11829  || ((oo==op) && (set[an].pLength > ol)))
11830  return an;
11831  }
11832  return en;
11833  }
11834  i=(an+en) / 2;
11835  if (set[i].ecart > o)
11836  en=i;
11837  else if (set[i].ecart == o)
11838  {
11839  int oo=set[i].GetpFDeg();
11840  if ((oo > op)
11841  || ((oo == op) && (set[i].pLength > ol)))
11842  en=i;
11843  else
11844  an=i;
11845  }
11846  else
11847  an=i;
11848  }
11849 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
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 5597 of file kutil.cc.

5598 {
5599  int ol = p.GetpLength();
5600  if (length==-1) return 0;
5601 
5602  int op=p.ecart;
5603 
5604  int oo=set[length].ecart;
5605  if ((oo < op) || ((oo==op) && (set[length].length <= ol)))
5606  return length+1;
5607 
5608  int i;
5609  int an = 0;
5610  int en= length;
5611  loop
5612  {
5613  if (an >= en-1)
5614  {
5615  int oo=set[an].ecart;
5616  if((oo > op)
5617  || ((oo==op) && (set[an].pLength > ol)))
5618  return an;
5619  return en;
5620  }
5621  i=(an+en) / 2;
5622  int oo=set[i].ecart;
5623  if ((oo > op)
5624  || ((oo == op) && (set[i].pLength > ol)))
5625  en=i;
5626  else
5627  an=i;
5628  }
5629 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
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 11852 of file kutil.cc.

11853 {
11854 
11855  if (length==-1) return 0;
11856 
11857  int op=p.GetpFDeg();
11858  int ol = p.GetpLength();
11859 
11860  int oo=set[length].GetpFDeg();
11861  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11862  return length+1;
11863 
11864  int i;
11865  int an = 0;
11866  int en= length;
11867  loop
11868  {
11869  if (an >= en-1)
11870  {
11871  int oo=set[an].GetpFDeg();
11872  if((oo > op)
11873  || ((oo==op) && (set[an].pLength > ol)))
11874  return an;
11875  return en;
11876  }
11877  i=(an+en) / 2;
11878  int oo=set[i].GetpFDeg();
11879  if ((oo > op)
11880  || ((oo == op) && (set[i].pLength > ol)))
11881  en=i;
11882  else
11883  an=i;
11884  }
11885 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
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 11889 of file kutil.cc.

11890 {
11891  int ol = p.GetpLength();
11892  if (length==-1)
11893  return 0;
11894  if (set[length].length<p.length)
11895  return length+1;
11896 
11897  int i;
11898  int an = 0;
11899  int en= length;
11900 
11901  loop
11902  {
11903  if (an >= en-1)
11904  {
11905  if (set[an].pLength>ol) return an;
11906  return en;
11907  }
11908  i=(an+en) / 2;
11909  if (set[i].pLength>ol) en=i;
11910  else an=i;
11911  }
11912 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
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 11135 of file kutil.cc.

11136 {
11137  if(!nCoeff_is_Z(currRing->cf))
11138  return;
11139  poly pH = h->GetP();
11140  poly p,pp;
11141  p = pH;
11142  bool deleted = FALSE, ok = FALSE;
11143  for(int i = 0; i<=strat->sl; i++)
11144  {
11145  p = pH;
11146  if(pNext(strat->S[i]) == NULL)
11147  {
11148  //pWrite(p);
11149  //pWrite(strat->S[i]);
11150  while(ok == FALSE && p != NULL)
11151  {
11152  if(pLmDivisibleBy(strat->S[i], p))
11153  {
11154  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11155  p_SetCoeff(p,dummy,currRing);
11156  }
11157  if(nIsZero(p->coef))
11158  {
11159  pLmDelete(&p);
11160  h->p = p;
11161  deleted = TRUE;
11162  }
11163  else
11164  {
11165  ok = TRUE;
11166  }
11167  }
11168  if (p!=NULL)
11169  {
11170  pp = pNext(p);
11171  while(pp != NULL)
11172  {
11173  if(pLmDivisibleBy(strat->S[i], pp))
11174  {
11175  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11176  p_SetCoeff(pp,dummy,currRing);
11177  if(nIsZero(pp->coef))
11178  {
11179  pLmDelete(&pNext(p));
11180  pp = pNext(p);
11181  deleted = TRUE;
11182  }
11183  else
11184  {
11185  p = pp;
11186  pp = pNext(p);
11187  }
11188  }
11189  else
11190  {
11191  p = pp;
11192  pp = pNext(p);
11193  }
11194  }
11195  }
11196  }
11197  }
11198  h->SetLmCurrRing();
11199  if((deleted)&&(h->p!=NULL))
11200  strat->initEcart(h);
11201 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h: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:411
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11203 of file kutil.cc.

11204 {
11205  if(!nCoeff_is_Z(currRing->cf))
11206  return;
11207  poly hSig = h->sig;
11208  poly pH = h->GetP();
11209  poly p,pp;
11210  p = pH;
11211  bool deleted = FALSE, ok = FALSE;
11212  for(int i = 0; i<=strat->sl; i++)
11213  {
11214  p = pH;
11215  if(pNext(strat->S[i]) == NULL)
11216  {
11217  while(ok == FALSE && p!=NULL)
11218  {
11219  if(pLmDivisibleBy(strat->S[i], p))
11220  {
11221  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11222  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11223  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11224  {
11225  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11226  p_SetCoeff(p,dummy,currRing);
11227  }
11228  pDelete(&sigMult);
11229  }
11230  if(nIsZero(p->coef))
11231  {
11232  pLmDelete(&p);
11233  h->p = p;
11234  deleted = TRUE;
11235  }
11236  else
11237  {
11238  ok = TRUE;
11239  }
11240  }
11241  if(p == NULL)
11242  return;
11243  pp = pNext(p);
11244  while(pp != NULL)
11245  {
11246  if(pLmDivisibleBy(strat->S[i], pp))
11247  {
11248  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11249  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11250  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11251  {
11252  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11253  p_SetCoeff(pp,dummy,currRing);
11254  if(nIsZero(pp->coef))
11255  {
11256  pLmDelete(&pNext(p));
11257  pp = pNext(p);
11258  deleted = TRUE;
11259  }
11260  else
11261  {
11262  p = pp;
11263  pp = pNext(p);
11264  }
11265  }
11266  else
11267  {
11268  p = pp;
11269  pp = pNext(p);
11270  }
11271  pDelete(&sigMult);
11272  }
11273  else
11274  {
11275  p = pp;
11276  pp = pNext(p);
11277  }
11278  }
11279  }
11280  }
11281  h->SetLmCurrRing();
11282  if(deleted)
11283  strat->initEcart(h);
11284 
11285 }
polyset sig
Definition: kutil.h:304
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h: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:411
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define pDivideM(a, b)
Definition: polys.h:289
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:302
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
#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 10968 of file kutil.cc.

10969 {
10970  if(!nCoeff_is_Z(currRing->cf))
10971  return NULL;
10972  ideal F = idCopy(Forig);
10973  idSkipZeroes(F);
10974  poly pmon;
10975  ring origR = currRing;
10976  ideal monred = idInit(1,1);
10977  for(int i=0; i<idElem(F); i++)
10978  {
10979  if(pNext(F->m[i]) == NULL)
10980  idInsertPoly(monred, pCopy(F->m[i]));
10981  }
10982  int posconst = idPosConstant(F);
10983  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10984  {
10985  idDelete(&F);
10986  idDelete(&monred);
10987  return NULL;
10988  }
10989  int idelemQ = 0;
10990  if(Q!=NULL)
10991  {
10992  idelemQ = IDELEMS(Q);
10993  for(int i=0; i<idelemQ; i++)
10994  {
10995  if(pNext(Q->m[i]) == NULL)
10996  idInsertPoly(monred, pCopy(Q->m[i]));
10997  }
10998  idSkipZeroes(monred);
10999  posconst = idPosConstant(monred);
11000  //the constant, if found, will be from Q
11001  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
11002  {
11003  pmon = pCopy(monred->m[posconst]);
11004  idDelete(&F);
11005  idDelete(&monred);
11006  return pmon;
11007  }
11008  }
11009  ring QQ_ring = rCopy0(currRing,FALSE);
11010  nKillChar(QQ_ring->cf);
11011  QQ_ring->cf = nInitChar(n_Q, NULL);
11012  rComplete(QQ_ring,1);
11013  QQ_ring = rAssure_c_dp(QQ_ring);
11014  rChangeCurrRing(QQ_ring);
11015  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
11016  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
11017  for(int i = 0, j = 0; i<IDELEMS(F); i++)
11018  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
11019  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
11020  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
11021  ideal one = kStd(II, NULL, isNotHomog, NULL);
11022  idSkipZeroes(one);
11023  if(idIsConstant(one))
11024  {
11025  //one should be <1>
11026  for(int i = IDELEMS(II)-1; i>=0; i--)
11027  if(II->m[i] != NULL)
11028  II->m[i+1] = II->m[i];
11029  II->m[0] = pOne();
11030  ideal syz = idSyzygies(II, isNotHomog, NULL);
11031  poly integer = NULL;
11032  for(int i = IDELEMS(syz)-1;i>=0; i--)
11033  {
11034  if(pGetComp(syz->m[i]) == 1)
11035  {
11036  pSetComp(syz->m[i],0);
11037  if(pIsConstant(pHead(syz->m[i])))
11038  {
11039  integer = pHead(syz->m[i]);
11040  break;
11041  }
11042  }
11043  }
11044  rChangeCurrRing(origR);
11045  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11046  pmon = prMapR(integer, nMap2, QQ_ring, origR);
11047  idDelete(&monred);
11048  idDelete(&F);
11049  id_Delete(&II,QQ_ring);
11050  id_Delete(&one,QQ_ring);
11051  id_Delete(&syz,QQ_ring);
11052  p_Delete(&integer,QQ_ring);
11053  rDelete(QQ_ring);
11054  return pmon;
11055  }
11056  else
11057  {
11058  if(idIs0(monred))
11059  {
11060  poly mindegmon = NULL;
11061  for(int i = 0; i<IDELEMS(one); i++)
11062  {
11063  if(pNext(one->m[i]) == NULL)
11064  {
11065  if(mindegmon == NULL)
11066  mindegmon = pCopy(one->m[i]);
11067  else
11068  {
11069  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
11070  mindegmon = pCopy(one->m[i]);
11071  }
11072  }
11073  }
11074  if(mindegmon != NULL)
11075  {
11076  for(int i = IDELEMS(II)-1; i>=0; i--)
11077  if(II->m[i] != NULL)
11078  II->m[i+1] = II->m[i];
11079  II->m[0] = pCopy(mindegmon);
11080  ideal syz = idSyzygies(II, isNotHomog, NULL);
11081  bool found = FALSE;
11082  for(int i = IDELEMS(syz)-1;i>=0; i--)
11083  {
11084  if(pGetComp(syz->m[i]) == 1)
11085  {
11086  pSetComp(syz->m[i],0);
11087  if(pIsConstant(pHead(syz->m[i])))
11088  {
11089  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
11090  found = TRUE;
11091  break;
11092  }
11093  }
11094  }
11095  id_Delete(&syz,QQ_ring);
11096  if (found == FALSE)
11097  {
11098  rChangeCurrRing(origR);
11099  idDelete(&monred);
11100  idDelete(&F);
11101  id_Delete(&II,QQ_ring);
11102  id_Delete(&one,QQ_ring);
11103  rDelete(QQ_ring);
11104  return NULL;
11105  }
11106  rChangeCurrRing(origR);
11107  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11108  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11109  idDelete(&monred);
11110  idDelete(&F);
11111  id_Delete(&II,QQ_ring);
11112  id_Delete(&one,QQ_ring);
11113  id_Delete(&syz,QQ_ring);
11114  rDelete(QQ_ring);
11115  return pmon;
11116  }
11117  }
11118  }
11119  rChangeCurrRing(origR);
11120  idDelete(&monred);
11121  idDelete(&F);
11122  id_Delete(&II,QQ_ring);
11123  id_Delete(&one,QQ_ring);
11124  rDelete(QQ_ring);
11125  return NULL;
11126 }
#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:2088
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4920
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:45
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
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:3394
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1365
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 must be 0
Definition: polys.h:233
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:310
#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:23
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:14
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:728
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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:510
#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:349
#define idIsConstant(I)
Definition: ideals.h:40

◆ redFirstShift()

int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 4473 of file kstd2.cc.

4474 {
4475  if (h->IsNull()) return 0;
4476 
4477  int at, reddeg,d;
4478  int pass = 0;
4479  int j = 0;
4480 
4481  if (! strat->homog)
4482  {
4483  d = h->GetpFDeg() + h->ecart;
4484  reddeg = strat->LazyDegree+d;
4485  }
4486  h->SetShortExpVector();
4487  loop
4488  {
4489  j = kFindDivisibleByInT(strat, h);
4490  if (j < 0)
4491  {
4492  h->SetDegStuffReturnLDeg(strat->LDegLast);
4493  return 1;
4494  }
4495 
4496  if (!TEST_OPT_INTSTRATEGY)
4497  strat->T[j].pNorm();
4498 #ifdef KDEBUG
4499  if (TEST_OPT_DEBUG)
4500  {
4501  PrintS("reduce ");
4502  h->wrp();
4503  PrintS(" with ");
4504  strat->T[j].wrp();
4505  }
4506 #endif
4507  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
4508 
4509 #ifdef KDEBUG
4510  if (TEST_OPT_DEBUG)
4511  {
4512  PrintS("\nto ");
4513  wrp(h->p);
4514  PrintLn();
4515  }
4516 #endif
4517  if (h->IsNull())
4518  {
4519  kDeleteLcm(h);
4520  h->Clear();
4521  return 0;
4522  }
4523  h->SetShortExpVector();
4524 
4525 #if 0
4526  if ((strat->syzComp!=0) && !strat->honey)
4527  {
4528  if ((strat->syzComp>0) &&
4529  (h->Comp() > strat->syzComp))
4530  {
4531  assume(h->MinComp() > strat->syzComp);
4532 #ifdef KDEBUG
4533  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
4534 #endif
4535  if (strat->homog)
4536  h->SetDegStuffReturnLDeg(strat->LDegLast);
4537  return -2;
4538  }
4539  }
4540 #endif
4541  if (!strat->homog)
4542  {
4543  if (!TEST_OPT_OLDSTD && strat->honey)
4544  {
4545  h->SetpFDeg();
4546  if (strat->T[j].ecart <= h->ecart)
4547  h->ecart = d - h->GetpFDeg();
4548  else
4549  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
4550 
4551  d = h->GetpFDeg() + h->ecart;
4552  }
4553  else
4554  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
4555  /*- try to reduce the s-polynomial -*/
4556  pass++;
4557  /*
4558  *test whether the polynomial should go to the lazyset L
4559  *-if the degree jumps
4560  *-if the number of pre-defined reductions jumps
4561  */
4562  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
4563  && ((d >= reddeg) || (pass > strat->LazyPass)))
4564  {
4565  h->SetLmCurrRing();
4566  if (strat->posInLDependsOnLength)
4567  h->SetLength(strat->length_pLength);
4568  at = strat->posInL(strat->L,strat->Ll,h,strat);
4569  if (at <= strat->Ll)
4570  {
4571  //int dummy=strat->sl;
4572  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
4573  //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
4574  if (kFindDivisibleByInT(strat, h) < 0)
4575  return 1;
4576  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
4577 #ifdef KDEBUG
4578  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
4579 #endif
4580  h->Clear();
4581  return -1;
4582  }
4583  }
4584  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
4585  {
4586  reddeg = d+1;
4587  Print(".%d",d);mflush();
4588  }
4589  }
4590  }
4591 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
char LDegLast
Definition: kutil.h:383
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:385
#define mflush()
Definition: reporter.h:57
#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:370
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
char honey
Definition: kutil.h:375
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:387
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:216
void wrp(poly p)
Definition: polys.h:305
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int LazyDegree
Definition: kutil.h:351

◆ redHomog()

int redHomog ( LObject h,
kStrategy  strat 
)

Definition at line 822 of file kstd2.cc.

823 {
824  if (strat->tl<0) return 1;
825  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
826  assume(h->FDeg == h->pFDeg());
827 
828  poly h_p;
829  int i,j,at,pass, ii;
830  unsigned long not_sev;
831  // long reddeg,d;
832 
833  pass = j = 0;
834  // d = reddeg = h->GetpFDeg();
835  h->SetShortExpVector();
836  int li;
837  h_p = h->GetLmTailRing();
838  not_sev = ~ h->sev;
839  loop
840  {
841  j = kFindDivisibleByInT(strat, h);
842  if (j < 0) return 1;
843 
844  li = strat->T[j].pLength;
845  if (li<=0) li=strat->T[j].GetpLength();
846  ii = j;
847  /*
848  * the polynomial to reduce with (up to the moment) is;
849  * pi with length li
850  */
851  i = j;
852 #if 1
853  if (TEST_OPT_LENGTH)
854  loop
855  {
856  /*- search the shortest possible with respect to length -*/
857  i++;
858  if (i > strat->tl)
859  break;
860  if (li==1)
861  break;
862  if ((strat->T[i].pLength < li)
863  &&
864  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
865  h_p, not_sev, strat->tailRing))
866  {
867  /*
868  * the polynomial to reduce with is now;
869  */
870  li = strat->T[i].pLength;
871  if (li<=0) li=strat->T[i].GetpLength();
872  ii = i;
873  }
874  }
875 #endif
876 
877  /*
878  * end of search: have to reduce with pi
879  */
880 #ifdef KDEBUG
881  if (TEST_OPT_DEBUG)
882  {
883  PrintS("red:");
884  h->wrp();
885  PrintS(" with ");
886  strat->T[ii].wrp();
887  }
888 #endif
889  assume(strat->fromT == FALSE);
890 
891  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
892 #if SBA_PRINT_REDUCTION_STEPS
893  sba_interreduction_steps++;
894 #endif
895 #if SBA_PRINT_OPERATIONS
896  sba_interreduction_operations += pLength(strat->T[ii].p);
897 #endif
898 
899 #ifdef KDEBUG
900  if (TEST_OPT_DEBUG)
901  {
902  PrintS("\nto ");
903  h->wrp();
904  PrintLn();
905  }
906 #endif
907 
908  h_p = h->GetLmTailRing();
909  if (h_p == NULL)
910  {
911  kDeleteLcm(h);
912  return 0;
913  }
914  h->SetShortExpVector();
915  not_sev = ~ h->sev;
916  /*
917  * try to reduce the s-polynomial h
918  *test first whether h should go to the lazyset L
919  *-if the degree jumps
920  *-if the number of pre-defined reductions jumps
921  */
922  pass++;
923  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
924  {
925  h->SetLmCurrRing();
926  at = strat->posInL(strat->L,strat->Ll,h,strat);
927  if (at <= strat->Ll)
928  {
929  int dummy=strat->sl;
930  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
931  return 1;
932  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
933 #ifdef KDEBUG
934  if (TEST_OPT_DEBUG)
935  Print(" lazy: -> L%d\n",at);
936 #endif
937  h->Clear();
938  return -1;
939  }
940  }
941  }
942 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int tl
Definition: kutil.h:348
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
unsigned long * sevT
Definition: kutil.h:321
#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:1260
#define loop
Definition: structs.h:80
#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:1853
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:326
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971

◆ redHoney()

int redHoney ( LObject h,
kStrategy  strat 
)

Definition at line 1664 of file kstd2.cc.

1665 {
1666  if (strat->tl<0) return 1;
1667  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1668  assume(h->FDeg == h->pFDeg());
1669  poly h_p;
1670  int i,j,at,pass,ei, ii, h_d;
1671  unsigned long not_sev;
1672  long reddeg,d;
1673 
1674  pass = j = 0;
1675  d = reddeg = h->GetpFDeg() + h->ecart;
1676  h->SetShortExpVector();
1677  int li;
1678  h_p = h->GetLmTailRing();
1679  not_sev = ~ h->sev;
1680 
1681  h->PrepareRed(strat->use_buckets);
1682  loop
1683  {
1684  j=kFindDivisibleByInT(strat, h);
1685  if (j < 0) return 1;
1686 
1687  ei = strat->T[j].ecart;
1688  li = strat->T[j].pLength;
1689  if (li<=0) li=strat->T[j].GetpLength();
1690  ii = j;
1691  /*
1692  * the polynomial to reduce with (up to the moment) is;
1693  * pi with ecart ei (T[ii])
1694  */
1695  i = j;
1696  if (TEST_OPT_LENGTH)
1697  loop
1698  {
1699  /*- takes the first possible with respect to ecart -*/
1700  i++;
1701  if (i > strat->tl)
1702  break;
1703  //if (ei < h->ecart)
1704  // break;
1705  if (li==1)
1706  break;
1707  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1708  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1709  &&
1710  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1711  h_p, not_sev, strat->tailRing))
1712  {
1713  /*
1714  * the polynomial to reduce with is now;
1715  */
1716  ei = strat->T[i].ecart;
1717  li = strat->T[i].pLength;
1718  if (li<=0) li=strat->T[i].GetpLength();
1719  ii = i;
1720  }
1721  }
1722 
1723  /*
1724  * end of search: have to reduce with pi
1725  */
1726  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1727  {
1728  h->GetTP(); // clears bucket
1729  h->SetLmCurrRing();
1730  /*
1731  * It is not possible to reduce h with smaller ecart;
1732  * if possible h goes to the lazy-set L,i.e
1733  * if its position in L would be not the last one
1734  */
1735  if (strat->Ll >= 0) /* L is not empty */
1736  {
1737  at = strat->posInL(strat->L,strat->Ll,h,strat);
1738  if(at <= strat->Ll)
1739  /*- h will not become the next element to reduce -*/
1740  {
1741  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1742 #ifdef KDEBUG
1743  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1744 #endif
1745  h->Clear();
1746  return -1;
1747  }
1748  }
1749  }
1750 #ifdef KDEBUG
1751  if (TEST_OPT_DEBUG)
1752  {
1753  PrintS("red:");
1754  h->wrp();
1755  Print("\nwith T[%d]:",ii);
1756  strat->T[ii].wrp();
1757  }
1758 #endif
1759  assume(strat->fromT == FALSE);
1760 
1761  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),NULL,strat);
1762 #if SBA_PRINT_REDUCTION_STEPS
1763  sba_interreduction_steps++;
1764 #endif
1765 #if SBA_PRINT_OPERATIONS
1766  sba_interreduction_operations += pLength(strat->T[ii].p);
1767 #endif
1768 #ifdef KDEBUG
1769  if (TEST_OPT_DEBUG)
1770  {
1771  PrintS("\nto:");
1772  h->wrp();
1773  PrintLn();
1774  }
1775 #endif
1776  if(h->IsNull())
1777  {
1778  kDeleteLcm(h);
1779  h->Clear();
1780  return 0;
1781  }
1782  if (TEST_OPT_IDLIFT)
1783  {
1784  if (h->p!=NULL)
1785  {
1786  if(p_GetComp(h->p,currRing)>strat->syzComp)
1787  {
1788  h->Delete();
1789  return 0;
1790  }
1791  }
1792  else if (h->t_p!=NULL)
1793  {
1794  if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1795  {
1796  h->Delete();
1797  return 0;
1798  }
1799  }
1800  }
1801  h->SetShortExpVector();
1802  not_sev = ~ h->sev;
1803  h_d = h->SetpFDeg();
1804  /* compute the ecart */
1805  if (ei <= h->ecart)
1806  h->ecart = d-h_d;
1807  else
1808  h->ecart = d-h_d+ei-h->ecart;
1809 
1810  /*
1811  * try to reduce the s-polynomial h
1812  *test first whether h should go to the lazyset L
1813  *-if the degree jumps
1814  *-if the number of pre-defined reductions jumps
1815  */
1816  pass++;
1817  d = h_d + h->ecart;
1818  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1819  {
1820  h->GetTP(); // clear bucket
1821  h->SetLmCurrRing();
1822  at = strat->posInL(strat->L,strat->Ll,h,strat);
1823  if (at <= strat->Ll)
1824  {
1825  int dummy=strat->sl;
1826  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1827  return 1;
1828  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1829 #ifdef KDEBUG
1830  if (TEST_OPT_DEBUG)
1831  Print(" degree jumped: -> L%d\n",at);
1832 #endif
1833  h->Clear();
1834  return -1;
1835  }
1836  }
1837  else if (d > reddeg)
1838  {
1839  if (d>=(long)strat->tailRing->bitmask)
1840  {
1841  if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
1842  {
1843  strat->overflow=TRUE;
1844  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1845  h->GetP();
1846  at = strat->posInL(strat->L,strat->Ll,h,strat);
1847  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1848  h->Clear();
1849  return -1;
1850  }
1851  }
1852  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1853  {
1854  //h->wrp(); Print("<%d>\n",h->GetpLength());
1855  reddeg = d;
1856  Print(".%ld",d); mflush();
1857  }
1858  }
1859  }
1860 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
unsigned long * sevT
Definition: kutil.h:321
#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:1260
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
#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:1853
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:326
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ redLazy()

int redLazy ( LObject h,
kStrategy  strat 
)

TEST_OPT_REDTHROUGH &&

Definition at line 1519 of file kstd2.cc.

1520 {
1521  if (strat->tl<0) return 1;
1522  int at,i,ii,li;
1523  int j = 0;
1524  int pass = 0;
1525  assume(h->pFDeg() == h->FDeg);
1526  long reddeg = h->GetpFDeg();
1527  long d;
1528  unsigned long not_sev;
1529 
1530  h->SetShortExpVector();
1531  poly h_p = h->GetLmTailRing();
1532  not_sev = ~ h->sev;
1533  loop
1534  {
1535  j = kFindDivisibleByInT(strat, h);
1536  if (j < 0) return 1;
1537 
1538  li = strat->T[j].pLength;
1539  if (li<=0) li=strat->T[j].GetpLength();
1540  ii = j;
1541  /*
1542  * the polynomial to reduce with (up to the moment) is;
1543  * pi with length li
1544  */
1545 
1546  i = j;
1547 #if 1
1548  if (TEST_OPT_LENGTH)
1549  loop
1550  {
1551  /*- search the shortest possible with respect to length -*/
1552  i++;
1553  if (i > strat->tl)
1554  break;
1555  if (li==1)
1556  break;
1557  if ((strat->T[i].pLength < li)
1558  &&
1559  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1560  h_p, not_sev, strat->tailRing))
1561  {
1562  /*
1563  * the polynomial to reduce with is now;
1564  */
1565  li = strat->T[i].pLength;
1566  if (li<=0) li=strat->T[i].GetpLength();
1567  ii = i;
1568  }
1569  }
1570 #endif
1571 
1572  /*
1573  * end of search: have to reduce with pi
1574  */
1575 
1576 
1577 #ifdef KDEBUG
1578  if (TEST_OPT_DEBUG)
1579  {
1580  PrintS("red:");
1581  h->wrp();
1582  PrintS(" with ");
1583  strat->T[ii].wrp();
1584  }
1585 #endif
1586 
1587  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
1588 #if SBA_PRINT_REDUCTION_STEPS
1589  sba_interreduction_steps++;
1590 #endif
1591 #if SBA_PRINT_OPERATIONS
1592  sba_interreduction_operations += pLength(strat->T[ii].p);
1593 #endif
1594 
1595 #ifdef KDEBUG
1596  if (TEST_OPT_DEBUG)
1597  {
1598  PrintS("\nto ");
1599  h->wrp();
1600  PrintLn();
1601  }
1602 #endif
1603 
1604  h_p=h->GetLmTailRing();
1605 
1606  if (h_p == NULL)
1607  {
1608  kDeleteLcm(h);
1609  return 0;
1610  }
1611  h->SetShortExpVector();
1612  not_sev = ~ h->sev;
1613  d = h->SetpFDeg();
1614  /*- try to reduce the s-polynomial -*/
1615  pass++;
1616  if (//!TEST_OPT_REDTHROUGH &&
1617  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1618  {
1619  h->SetLmCurrRing();
1620  at = strat->posInL(strat->L,strat->Ll,h,strat);
1621  if (at <= strat->Ll)
1622  {
1623 #if 1
1624  int dummy=strat->sl;
1625  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1626  return 1;
1627 #endif
1628 #ifdef KDEBUG
1629  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
1630 #endif
1631  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1632  h->Clear();
1633  return -1;
1634  }
1635  }
1636  else if (d != reddeg)
1637  {
1638  if (d>=(long)strat->tailRing->bitmask)
1639  {
1640  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
1641  {
1642  strat->overflow=TRUE;
1643  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1644  h->GetP();
1645  at = strat->posInL(strat->L,strat->Ll,h,strat);
1646  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1647  h->Clear();
1648  return -1;
1649  }
1650  }
1651  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
1652  {
1653  Print(".%ld",d);mflush();
1654  reddeg = d;
1655  }
1656  }
1657  }
1658 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
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:349
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
unsigned long * sevT
Definition: kutil.h:321
#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:1260
#define loop
Definition: structs.h:80
#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:1853
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:326
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int LazyPass
Definition: kutil.h:351
static Poly * h
Definition: janet.cc:971

◆ redNF()

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

Definition at line 1866 of file kstd2.cc.

1867 {
1868 #define REDNF_CANONICALIZE 60
1869  if (h==NULL) return NULL;
1870  int j;
1871  int cnt=REDNF_CANONICALIZE;
1872  max_ind=strat->sl;
1873 
1874  if (0 > strat->sl)
1875  {
1876  return h;
1877  }
1878  LObject P(h);
1879  P.SetShortExpVector();
1880  P.bucket = kBucketCreate(currRing);
1881  kBucketInit(P.bucket,P.p,pLength(P.p));
1882  kbTest(P.bucket);
1883 #ifdef HAVE_RINGS
1884  BOOLEAN is_ring = rField_is_Ring(currRing);
1885 #endif
1886 #ifdef KDEBUG
1887 // if (TEST_OPT_DEBUG)
1888 // {
1889 // PrintS("redNF: starting S:\n");
1890 // for( j = 0; j <= max_ind; j++ )
1891 // {
1892 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1893 // pWrite(strat->S[j]);
1894 // }
1895 // };
1896 #endif
1897 
1898  loop
1899  {
1900  j=kFindDivisibleByInS(strat,&max_ind,&P);
1901  if (j>=0)
1902  {
1903 #ifdef HAVE_RINGS
1904  if (!is_ring)
1905  {
1906 #endif
1907  int sl=pSize(strat->S[j]);
1908  int jj=j;
1909  loop
1910  {
1911  int sll;
1912  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1913  if (jj<0) break;
1914  sll=pSize(strat->S[jj]);
1915  if (sll<sl)
1916  {
1917  #ifdef KDEBUG
1918  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1919  #endif
1920  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1921  j=jj;
1922  sl=sll;
1923  }
1924  }
1925  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1926  {
1927  pNorm(strat->S[j]);
1928  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1929  }
1930 #ifdef HAVE_RINGS
1931  }
1932 #endif
1933  nNormalize(pGetCoeff(P.p));
1934 #ifdef KDEBUG
1935  if (TEST_OPT_DEBUG)
1936  {
1937  PrintS("red:");
1938  wrp(h);
1939  PrintS(" with ");
1940  wrp(strat->S[j]);
1941  }
1942 #endif
1943 #ifdef HAVE_PLURAL
1944  if (rIsPluralRing(currRing))
1945  {
1946  number coef;
1947  nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef);
1948  nDelete(&coef);
1949  }
1950  else
1951 #endif
1952  {
1953  number coef;
1954  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1955  nDelete(&coef);
1956  }
1957  cnt--;
1958  if (cnt==0)
1959  {
1960  kBucketCanonicalize(P.bucket);
1961  cnt=REDNF_CANONICALIZE;
1962  }
1963  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1964  if (h==NULL)
1965  {
1966  kBucketDestroy(&P.bucket);
1967 
1968 #ifdef KDEBUG
1969 // if (TEST_OPT_DEBUG)
1970 // {
1971 // PrintS("redNF: starting S:\n");
1972 // for( j = 0; j <= max_ind; j++ )
1973 // {
1974 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1975 // pWrite(strat->S[j]);
1976 // }
1977 // };
1978 #endif
1979 
1980  return NULL;
1981  }
1982  kbTest(P.bucket);
1983  P.p=h;
1984  P.t_p=NULL;
1985  P.SetShortExpVector();
1986 #ifdef KDEBUG
1987  if (TEST_OPT_DEBUG)
1988  {
1989  PrintS("\nto:");
1990  wrp(h);
1991  PrintLn();
1992  }
1993 #endif
1994  }
1995  else
1996  {
1997  P.p=kBucketClear(P.bucket);
1998  kBucketDestroy(&P.bucket);
1999  pNormalize(P.p);
2000 
2001 #ifdef KDEBUG
2002 // if (TEST_OPT_DEBUG)
2003 // {
2004 // PrintS("redNF: starting S:\n");
2005 // for( j = 0; j <= max_ind; j++ )
2006 // {
2007 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
2008 // pWrite(strat->S[j]);
2009 // }
2010 // };
2011 #endif
2012 
2013  return P.p;
2014  }
2015  }
2016 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:521
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:395
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:197
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:493
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:30
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1079
#define REDNF_CANONICALIZE
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:506
poly kNoether
Definition: kutil.h:326
#define nIsOne(n)
Definition: numbers.h:25
#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:44
#define loop
Definition: structs.h:80
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:216
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
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:326
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
void wrp(poly p)
Definition: polys.h:305
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:209
static Poly * h
Definition: janet.cc:971
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:313
#define pNormalize(p)
Definition: polys.h:312

◆ 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 342 of file kstd1.cc.

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

◆ redRing()

int redRing ( LObject h,
kStrategy  strat 
)

Definition at line 715 of file kstd2.cc.

716 {
717  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
718  if (strat->tl<0) return 1;
719 
720  int at/*,i*/;
721  long d;
722  int j = 0;
723  int pass = 0;
724  // poly zeroPoly = NULL;
725 
726 // TODO warum SetpFDeg notwendig?
727  h->SetpFDeg();
728  assume(h->pFDeg() == h->FDeg);
729  long reddeg = h->GetpFDeg();
730 
731  h->SetShortExpVector();
732  loop
733  {
734  j = kFindDivisibleByInT(strat, h);
735  if (j < 0)
736  {
737  // over ZZ: cleanup coefficients by complete reduction with monomials
738  postReduceByMon(h, strat);
739  if(h->p == NULL)
740  {
741  kDeleteLcm(h);
742  h->Clear();
743  return 0;
744  }
745  if(nIsZero(pGetCoeff(h->p))) return 2;
746  j = kFindDivisibleByInT(strat, h);
747  if(j < 0)
748  {
749  if(strat->tl >= 0)
750  h->i_r1 = strat->tl;
751  else
752  h->i_r1 = -1;
753  if (h->GetLmTailRing() == NULL)
754  {
755  kDeleteLcm(h);
756  h->Clear();
757  return 0;
758  }
759  return 1;
760  }
761  }
762  //printf("\nFound one: ");pWrite(strat->T[j].p);
763  //enterT(*h, strat);
764  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
765  //printf("\nAfter small red: ");pWrite(h->p);
766  if (h->GetLmTailRing() == NULL)
767  {
768  kDeleteLcm(h);
769  h->Clear();
770  return 0;
771  }
772  h->SetShortExpVector();
773  d = h->SetpFDeg();
774  /*- try to reduce the s-polynomial -*/
775  pass++;
776  if (!TEST_OPT_REDTHROUGH &&
777  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
778  {
779  h->SetLmCurrRing();
780  if (strat->posInLDependsOnLength)
781  h->SetLength(strat->length_pLength);
782  at = strat->posInL(strat->L,strat->Ll,h,strat);
783  if (at <= strat->Ll)
784  {
785 #ifdef KDEBUG
786  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
787 #endif
788  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
789  h->Clear();
790  return -1;
791  }
792  }
793  if (d != reddeg)
794  {
795  if (d >= (long)strat->tailRing->bitmask)
796  {
797  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
798  {
799  strat->overflow=TRUE;
800  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
801  h->GetP();
802  at = strat->posInL(strat->L,strat->Ll,h,strat);
803  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
804  h->Clear();
805  return -1;
806  }
807  }
808  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
809  {
810  Print(".%ld",d);mflush();
811  reddeg = d;
812  }
813  }
814  }
815 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
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:349
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:385
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
LSet L
Definition: kutil.h:323
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11135
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:387
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:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971

◆ redRing_Z()

int redRing_Z ( LObject h,
kStrategy  strat 
)

Definition at line 568 of file kstd2.cc.

569 {
570  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
571  if (strat->tl<0) return 1;
572 
573  int at/*,i*/;
574  long d;
575  int j = 0;
576  int pass = 0;
577  // poly zeroPoly = NULL;
578 
579 // TODO warum SetpFDeg notwendig?
580  h->SetpFDeg();
581  assume(h->pFDeg() == h->FDeg);
582  long reddeg = h->GetpFDeg();
583 
584  h->SetShortExpVector();
585  loop
586  {
587  /* check if a reducer of the lead term exists */
588  j = kFindDivisibleByInT(strat, h);
589  if (j < 0) {
590  /* check if a reducer with the same lead monomial exists */
591  j = kFindSameLMInT_Z(strat, h);
592  if (j < 0) {
593  /* check if a reducer of the lead monomial exists, by the above
594  * check this is a real divisor of the lead monomial */
595  j = kFindDivisibleByInT_Z(strat, h);
596  if (j < 0)
597  {
598  // over ZZ: cleanup coefficients by complete reduction with monomials
600  postReduceByMon(h, strat);
601  if(h->p == NULL)
602  {
603  if (h->lcm!=NULL) pLmDelete(h->lcm);
604  h->Clear();
605  return 0;
606  }
607  if(nIsZero(pGetCoeff(h->p))) return 2;
608  j = kFindDivisibleByInT(strat, h);
609  if(j < 0)
610  {
611  if(strat->tl >= 0)
612  h->i_r1 = strat->tl;
613  else
614  h->i_r1 = -1;
615  if (h->GetLmTailRing() == NULL)
616  {
617  if (h->lcm!=NULL) pLmDelete(h->lcm);
618  h->Clear();
619  return 0;
620  }
621  return 1;
622  }
623  } else {
624  /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
625  * => we try to cut down the lead coefficient at least */
626  /* first copy T[j] in order to multiply it with a coefficient later on */
627  number mult, rest;
628  TObject tj = strat->T[j];
629  tj.Copy();
630  /* tj.max_exp = strat->T[j].max_exp; */
631  /* compute division with remainder of lc(h) and lc(T[j]) */
632  mult = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p),
633  &rest, currRing->cf);
634  /* set corresponding new lead coefficient already. we do not
635  * remove the lead term in ksReducePolyLC, but only apply
636  * a lead coefficient reduction */
637  tj.Mult_nn(mult);
638  ksReducePolyLC(h, &tj, NULL, &rest, strat);
639  tj.Delete();
640  tj.Clear();
641  }
642  } else {
643  /* same lead monomial but lead coefficients do not divide each other:
644  * change the polys to h <- spoly(h,tj) and h2 <- gpoly(h,tj). */
645  LObject h2 = *h;
646  h2.Copy();
647 
648  ksReducePolyZ(h, &(strat->T[j]), NULL, NULL, strat);
649  ksReducePolyGCD(&h2, &(strat->T[j]), NULL, NULL, strat);
651  redtailBbaAlsoLC_Z(&h2, j, strat);
652  h2.pCleardenom();
653  }
654  /* replace h2 for tj in L (already generated pairs with tj), S and T */
655  replaceInLAndSAndT(h2, j, strat);
656  }
657  } else {
658  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat);
659  }
660  /* printf("\nAfter small red: ");pWrite(h->p); */
661  if (h->GetLmTailRing() == NULL)
662  {
663  if (h->lcm!=NULL) pLmDelete(h->lcm);
664 #ifdef KDEBUG
665  h->lcm=NULL;
666 #endif
667  h->Clear();
668  return 0;
669  }
670  h->SetShortExpVector();
671  d = h->SetpFDeg();
672  /*- try to reduce the s-polynomial -*/
673  pass++;
674  if (!TEST_OPT_REDTHROUGH &&
675  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
676  {
677  h->SetLmCurrRing();
678  if (strat->posInLDependsOnLength)
679  h->SetLength(strat->length_pLength);
680  at = strat->posInL(strat->L,strat->Ll,h,strat);
681  if (at <= strat->Ll)
682  {
683 #ifdef KDEBUG
684  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
685 #endif
686  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
687  h->Clear();
688  return -1;
689  }
690  }
691  if (d != reddeg)
692  {
693  if (d >= (long)strat->tailRing->bitmask)
694  {
695  if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
696  {
697  strat->overflow=TRUE;
698  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
699  h->GetP();
700  at = strat->posInL(strat->L,strat->Ll,h,strat);
701  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
702  h->Clear();
703  return -1;
704  }
705  }
706  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
707  {
708  Print(".%ld",d);mflush();
709  reddeg = d;
710  }
711  }
712  }
713 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
void replaceInLAndSAndT(LObject &p, int tj, kStrategy strat)
Definition: kutil.cc:9515
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:431
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition: kstd2.cc:139
#define Print
Definition: emacs.cc:80
class sLObject LObject
Definition: kutil.h:54
int kFindSameLMInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition: kstd2.cc:84
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
void redtailBbaAlsoLC_Z(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7711
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:185
int ksReducePolyZ(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:44
#define TEST_OPT_DEBUG
Definition: options.h:107
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:385
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
int ksReducePolyGCD(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:315
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:703
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
LSet L
Definition: kutil.h:323
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11135
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:402
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:387
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:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971
class sTObject TObject
Definition: kutil.h:53

◆ redSig()

int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 982 of file kstd2.cc.

983 {
984  if (strat->tl<0) return 1;
985  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
986  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
987  assume(h->FDeg == h->pFDeg());
988 //#if 1
989 #ifdef DEBUGF5
990  PrintS("------- IN REDSIG -------\n");
991  Print("p: ");
992  pWrite(pHead(h->p));
993  PrintS("p1: ");
994  pWrite(pHead(h->p1));
995  PrintS("p2: ");
996  pWrite(pHead(h->p2));
997  PrintS("---------------------------\n");
998 #endif
999  poly h_p;
1000  int i,j,at,pass, ii;
1001  int start=0;
1002  int sigSafe;
1003  unsigned long not_sev;
1004  // long reddeg,d;
1005 
1006  pass = j = 0;
1007  // d = reddeg = h->GetpFDeg();
1008  h->SetShortExpVector();
1009  int li;
1010  h_p = h->GetLmTailRing();
1011  not_sev = ~ h->sev;
1012  loop
1013  {
1014  j = kFindDivisibleByInT(strat, h, start);
1015  if (j < 0)
1016  {
1017  return 1;
1018  }
1019 
1020  li = strat->T[j].pLength;
1021  if (li<=0) li=strat->T[j].GetpLength();
1022  ii = j;
1023  /*
1024  * the polynomial to reduce with (up to the moment) is;
1025  * pi with length li
1026  */
1027  i = j;
1028 #if 1
1029  if (TEST_OPT_LENGTH)
1030  loop
1031  {
1032  /*- search the shortest possible with respect to length -*/
1033  i++;
1034  if (i > strat->tl)
1035  break;
1036  if (li==1)
1037  break;
1038  if ((strat->T[i].pLength < li)
1039  &&
1040  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1041  h_p, not_sev, strat->tailRing))
1042  {
1043  /*
1044  * the polynomial to reduce with is now;
1045  */
1046  li = strat->T[i].pLength;
1047  if (li<=0) li=strat->T[i].GetpLength();
1048  ii = i;
1049  }
1050  }
1051  start = ii+1;
1052 #endif
1053 
1054  /*
1055  * end of search: have to reduce with pi
1056  */
1057 #ifdef KDEBUG
1058  if (TEST_OPT_DEBUG)
1059  {
1060  PrintS("red:");
1061  h->wrp();
1062  PrintS(" with ");
1063  strat->T[ii].wrp();
1064  }
1065 #endif
1066  assume(strat->fromT == FALSE);
1067 //#if 1
1068 #ifdef DEBUGF5
1069  Print("BEFORE REDUCTION WITH %d:\n",ii);
1070  PrintS("--------------------------------\n");
1071  pWrite(h->sig);
1072  pWrite(strat->T[ii].sig);
1073  pWrite(h->GetLmCurrRing());
1074  pWrite(pHead(h->p1));
1075  pWrite(pHead(h->p2));
1076  pWrite(pHead(strat->T[ii].p));
1077  PrintS("--------------------------------\n");
1078  printf("INDEX OF REDUCER T: %d\n",ii);
1079 #endif
1080  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
1081 #if SBA_PRINT_REDUCTION_STEPS
1082  if (sigSafe != 3)
1083  sba_reduction_steps++;
1084 #endif
1085 #if SBA_PRINT_OPERATIONS
1086  if (sigSafe != 3)
1087  sba_operations += pLength(strat->T[ii].p);
1088 #endif
1089  // if reduction has taken place, i.e. the reduction was sig-safe
1090  // otherwise start is already at the next position and the loop
1091  // searching reducers in T goes on from index start
1092 //#if 1
1093 #ifdef DEBUGF5
1094  Print("SigSAFE: %d\n",sigSafe);
1095 #endif
1096  if (sigSafe != 3)
1097  {
1098  // start the next search for reducers in T from the beginning
1099  start = 0;
1100 #ifdef KDEBUG
1101  if (TEST_OPT_DEBUG)
1102  {
1103  PrintS("\nto ");
1104  h->wrp();
1105  PrintLn();
1106  }
1107 #endif
1108 
1109  h_p = h->GetLmTailRing();
1110  if (h_p == NULL)
1111  {
1112  kDeleteLcm(h);
1113  return 0;
1114  }
1115  h->SetShortExpVector();
1116  not_sev = ~ h->sev;
1117  /*
1118  * try to reduce the s-polynomial h
1119  *test first whether h should go to the lazyset L
1120  *-if the degree jumps
1121  *-if the number of pre-defined reductions jumps
1122  */
1123  pass++;
1124  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1125  {
1126  h->SetLmCurrRing();
1127  at = strat->posInL(strat->L,strat->Ll,h,strat);
1128  if (at <= strat->Ll)
1129  {
1130  int dummy=strat->sl;
1131  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1132  {
1133  return 1;
1134  }
1135  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1136 #ifdef KDEBUG
1137  if (TEST_OPT_DEBUG)
1138  Print(" lazy: -> L%d\n",at);
1139 #endif
1140  h->Clear();
1141  return -1;
1142  }
1143  }
1144  }
1145  }
1146 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:303
#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:1260
#define loop
Definition: structs.h:80
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:682
#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:1853
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:326
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971

◆ redSigRing()

int redSigRing ( LObject h,
kStrategy  strat 
)

Definition at line 1149 of file kstd2.cc.

1150 {
1151  //Since reduce is really bad for SBA we use the following idea:
1152  // We first check if we can build a gcd pair between h and S
1153  //where the sig remains the same and replace h by this gcd poly
1155  #if GCD_SBA
1156  while(sbaCheckGcdPair(h,strat))
1157  {
1158  h->sev = pGetShortExpVector(h->p);
1159  }
1160  #endif
1161  poly beforeredsig;
1162  beforeredsig = pCopy(h->sig);
1163 
1164  if (strat->tl<0) return 1;
1165  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1166  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
1167  assume(h->FDeg == h->pFDeg());
1168 //#if 1
1169 #ifdef DEBUGF5
1170  Print("------- IN REDSIG -------\n");
1171  Print("p: ");
1172  pWrite(pHead(h->p));
1173  Print("p1: ");
1174  pWrite(pHead(h->p1));
1175  Print("p2: ");
1176  pWrite(pHead(h->p2));
1177  Print("---------------------------\n");
1178 #endif
1179  poly h_p;
1180  int i,j,at,pass, ii;
1181  int start=0;
1182  int sigSafe;
1183  unsigned long not_sev;
1184  // long reddeg,d;
1185 
1186  pass = j = 0;
1187  // d = reddeg = h->GetpFDeg();
1188  h->SetShortExpVector();
1189  int li;
1190  h_p = h->GetLmTailRing();
1191  not_sev = ~ h->sev;
1192  loop
1193  {
1194  j = kFindDivisibleByInT(strat, h, start);
1195  if (j < 0)
1196  {
1197  #if GCD_SBA
1198  while(sbaCheckGcdPair(h,strat))
1199  {
1200  h->sev = pGetShortExpVector(h->p);
1201  h->is_redundant = FALSE;
1202  start = 0;
1203  }
1204  #endif
1205  // over ZZ: cleanup coefficients by complete reduction with monomials
1206  postReduceByMonSig(h, strat);
1207  if(h->p == NULL || nIsZero(pGetCoeff(h->p))) return 2;
1208  j = kFindDivisibleByInT(strat, h,start);
1209  if(j < 0)
1210  {
1211  if(strat->tl >= 0)
1212  h->i_r1 = strat->tl;
1213  else
1214  h->i_r1 = -1;
1215  if (h->GetLmTailRing() == NULL)
1216  {
1217  kDeleteLcm(h);
1218  h->Clear();
1219  return 0;
1220  }
1221  //Check for sigdrop after reduction
1222  if(pLtCmp(beforeredsig,h->sig) == 1)
1223  {
1224  strat->sigdrop = TRUE;
1225  //Reduce it as much as you can
1226  int red_result = redRing(h,strat);
1227  if(red_result == 0)
1228  {
1229  //It reduced to 0, cancel the sigdrop
1230  strat->sigdrop = FALSE;
1231  p_Delete(&h->sig,currRing);h->sig = NULL;
1232  return 0;
1233  }
1234  else
1235  {
1236  //strat->enterS(*h, strat->sl+1, strat, strat->tl);
1237  return 0;
1238  }
1239  }
1240  p_Delete(&beforeredsig,currRing);
1241  return 1;
1242  }
1243  }
1244 
1245  li = strat->T[j].pLength;
1246  if (li<=0) li=strat->T[j].GetpLength();
1247  ii = j;
1248  /*
1249  * the polynomial to reduce with (up to the moment) is;
1250  * pi with length li
1251  */
1252  i = j;
1253  if (TEST_OPT_LENGTH)
1254  loop
1255  {
1256  /*- search the shortest possible with respect to length -*/
1257  i++;
1258  if (i > strat->tl)
1259  break;
1260  if (li==1)
1261  break;
1262  if ((strat->T[i].pLength < li)
1263  && n_DivBy(pGetCoeff(h_p),pGetCoeff(strat->T[i].p),currRing->cf)
1264  && p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1265  h_p, not_sev, strat->tailRing))
1266  {
1267  /*
1268  * the polynomial to reduce with is now;
1269  */
1270  li = strat->T[i].pLength;
1271  if (li<=0) li=strat->T[i].GetpLength();
1272  ii = i;
1273  }
1274  }
1275 
1276  start = ii+1;
1277 
1278  /*
1279  * end of search: have to reduce with pi
1280  */
1281 #ifdef KDEBUG
1282  if (TEST_OPT_DEBUG)
1283  {
1284  PrintS("red:");
1285  h->wrp();
1286  PrintS(" with ");
1287  strat->T[ii].wrp();
1288  }
1289 #endif
1290  assume(strat->fromT == FALSE);
1291 //#if 1
1292 #ifdef DEBUGF5
1293  Print("BEFORE REDUCTION WITH %d:\n",ii);
1294  Print("--------------------------------\n");
1295  pWrite(h->sig);
1296  pWrite(strat->T[ii].sig);
1297  pWrite(h->GetLmCurrRing());
1298  pWrite(pHead(h->p1));
1299  pWrite(pHead(h->p2));
1300  pWrite(pHead(strat->T[ii].p));
1301  Print("--------------------------------\n");
1302  printf("INDEX OF REDUCER T: %d\n",ii);
1303 #endif
1304  sigSafe = ksReducePolySigRing(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
1305  if(h->p == NULL && h->sig == NULL)
1306  {
1307  //Trivial case catch
1308  strat->sigdrop = FALSE;
1309  }
1310  #if 0
1311  //If the reducer has the same lt (+ or -) as the other one, reduce it via redRing
1312  //In some cases this proves to be very bad
1313  if(rField_is_Ring(currRing) && h->p != NULL && pLmCmp(h->p,strat->T[ii].p)==0)
1314  {
1315  int red_result = redRing(h,strat);
1316  if(red_result == 0)
1317  {
1318  pDelete(&h->sig);h->sig = NULL;
1319  return 0;
1320  }
1321  else
1322  {
1323  strat->sigdrop = TRUE;
1324  return 1;
1325  }
1326  }
1327  #endif
1328  if(strat->sigdrop)
1329  return 1;
1330 #if SBA_PRINT_REDUCTION_STEPS
1331  if (sigSafe != 3)
1332  sba_reduction_steps++;
1333 #endif
1334 #if SBA_PRINT_OPERATIONS
1335  if (sigSafe != 3)
1336  sba_operations += pLength(strat->T[ii].p);
1337 #endif
1338  // if reduction has taken place, i.e. the reduction was sig-safe
1339  // otherwise start is already at the next position and the loop
1340  // searching reducers in T goes on from index start
1341 //#if 1
1342 #ifdef DEBUGF5
1343  Print("SigSAFE: %d\n",sigSafe);
1344 #endif
1345  if (sigSafe != 3)
1346  {
1347  // start the next search for reducers in T from the beginning
1348  start = 0;
1349 #ifdef KDEBUG
1350  if (TEST_OPT_DEBUG)
1351  {
1352  PrintS("\nto ");
1353  h->wrp();
1354  PrintLn();
1355  }
1356 #endif
1357 
1358  h_p = h->GetLmTailRing();
1359  if (h_p == NULL)
1360  {
1361  kDeleteLcm(h);
1362  return 0;
1363  }
1364  h->SetShortExpVector();
1365  not_sev = ~ h->sev;
1366  /*
1367  * try to reduce the s-polynomial h
1368  *test first whether h should go to the lazyset L
1369  *-if the degree jumps
1370  *-if the number of pre-defined reductions jumps
1371  */
1372  pass++;
1373  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1374  {
1375  h->SetLmCurrRing();
1376  at = strat->posInL(strat->L,strat->Ll,h,strat);
1377  if (at <= strat->Ll)
1378  {
1379  int dummy=strat->sl;
1380  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1381  {
1382  return 1;
1383  }
1384  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1385 #ifdef KDEBUG
1386  if (TEST_OPT_DEBUG)
1387  Print(" lazy: -> L%d\n",at);
1388 #endif
1389  h->Clear();
1390  return -1;
1391  }
1392  }
1393  }
1394  }
1395 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:377
int j
Definition: facHensel.cc:105
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
bool sigdrop
Definition: kutil.h:358
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition: kutil.cc:11203
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:340
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
Definition: kutil.cc:1676
int tl
Definition: kutil.h:348
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
static void kDeleteLcm(LObject *P)
Definition: kutil.h:876
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:303
#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:1260
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
#define assume(x)
Definition: mod2.h:390
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
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:326
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
#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:856
LSet L
Definition: kutil.h:323
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
#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:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:120
static Poly * h
Definition: janet.cc:971
#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:885

◆ redtail() [1/2]

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

Definition at line 7475 of file kutil.cc.

7476 {
7477  LObject L(p, currRing);
7478  return redtail(&L, end_pos, strat);
7479 }
class sLObject LObject
Definition: kutil.h:54
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ redtail() [2/2]

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

Definition at line 7405 of file kutil.cc.

7406 {
7407  poly h, hn;
7408  strat->redTailChange=FALSE;
7409 
7410  L->GetP();
7411  poly p = L->p;
7412  if (strat->noTailReduction || pNext(p) == NULL)
7413  return p;
7414 
7415  LObject Ln(strat->tailRing);
7416  TObject* With;
7417  // placeholder in case strat->tl < 0
7418  TObject With_s(strat->tailRing);
7419  h = p;
7420  hn = pNext(h);
7421  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7422  long e;
7423  int l;
7424  BOOLEAN save_HE=strat->kHEdgeFound;
7425  strat->kHEdgeFound |=
7426  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7427 
7428  while(hn != NULL)
7429  {
7430  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7431  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7432  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7433  loop
7434  {
7435  Ln.Set(hn, strat->tailRing);
7436  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7437  if (strat->kHEdgeFound)
7438  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7439  else
7440  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s, e);
7441  if (With == NULL) break;
7442  With->length=0;
7443  With->pLength=0;
7444  strat->redTailChange=TRUE;
7445  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7446  {
7447  // reducing the tail would violate the exp bound
7448  if (kStratChangeTailRing(strat, L))
7449  {
7450  strat->kHEdgeFound = save_HE;
7451  return redtail(L, end_pos, strat);
7452  }
7453  else
7454  return NULL;
7455  }
7456  hn = pNext(h);
7457  if (hn == NULL) goto all_done;
7458  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7459  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7460  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7461  }
7462  h = hn;
7463  hn = pNext(h);
7464  }
7465 
7466  all_done:
7467  if (strat->redTailChange)
7468  {
7469  L->pLength = 0;
7470  }
7471  strat->kHEdgeFound = save_HE;
7472  return p;
7473 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:116
char kHEdgeFound
Definition: kutil.h:374
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:80
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
int Kstd1_deg
Definition: kutil.cc:237
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4687
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
KINLINE poly kNoetherTail()
Definition: kInline.h:66
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
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 1158 of file kInline.h.

1159 {
1160  LObject L(p);
1161  return redtailBba(&L, pos, strat,FALSE, normalize);
1162 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026
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:1158
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 7481 of file kutil.cc.

7482 {
7483 #define REDTAIL_CANONICALIZE 100
7484  strat->redTailChange=FALSE;
7485  if (strat->noTailReduction) return L->GetLmCurrRing();
7486  poly h, p;
7487  p = h = L->GetLmTailRing();
7488  if ((h==NULL) || (pNext(h)==NULL))
7489  return L->GetLmCurrRing();
7490 
7491  TObject* With;
7492  // placeholder in case strat->tl < 0
7493  TObject With_s(strat->tailRing);
7494 
7495  LObject Ln(pNext(h), strat->tailRing);
7496  Ln.GetpLength();
7497 
7498  pNext(h) = NULL;
7499  if (L->p != NULL)
7500  {
7501  pNext(L->p) = NULL;
7502  if (L->t_p != NULL) pNext(L->t_p) = NULL;
7503  }
7504  L->pLength = 1;
7505 
7506  Ln.PrepareRed(strat->use_buckets);
7507 
7508  int cnt=REDTAIL_CANONICALIZE;
7509  while(!Ln.IsNull())
7510  {
7511  loop
7512  {
7513  if (TEST_OPT_IDLIFT)
7514  {
7515  if (Ln.p!=NULL)
7516  {
7517  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7518  }
7519  else
7520  {
7521  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7522  }
7523  }
7524  Ln.SetShortExpVector();
7525  if (withT)
7526  {
7527  int j;
7528  j = kFindDivisibleByInT(strat, &Ln);
7529  if (j < 0) break;
7530  With = &(strat->T[j]);
7531  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7532  }
7533  else
7534  {
7535  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7536  if (With == NULL) break;
7537  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7538  }
7539  cnt--;
7540  if (cnt==0)
7541  {
7543  /*poly tmp=*/Ln.CanonicalizeP();
7544  if (normalize)
7545  {
7546  Ln.Normalize();
7547  //pNormalize(tmp);
7548  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7549  }
7550  }
7551  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7552  {
7553  With->pNorm();
7554  }
7555  strat->redTailChange=TRUE;
7556  if (ksReducePolyTail(L, With, &Ln))
7557  {
7558  // reducing the tail would violate the exp bound
7559  // set a flag and hope for a retry (in bba)
7560  strat->completeReduce_retry=TRUE;
7561  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7562  do
7563  {
7564  pNext(h) = Ln.LmExtractAndIter();
7565  pIter(h);
7566  L->pLength++;
7567  } while (!Ln.IsNull());
7568  goto all_done;
7569  }
7570  if (Ln.IsNull()) goto all_done;
7571  if (! withT) With_s.Init(currRing);
7572  }
7573  pNext(h) = Ln.LmExtractAndIter();
7574  pIter(h);
7575  pNormalize(h);
7576  L->pLength++;
7577  }
7578 
7579  all_done:
7580  Ln.Delete();
7581  if (L->p != NULL) pNext(L->p) = pNext(p);
7582 
7583  if (strat->redTailChange)
7584  {
7585  L->length = 0;
7586  L->pLength = 0;
7587  }
7588 
7589  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7590  //L->Normalize(); // HANNES: should have a test
7591  kTest_L(L,strat->tailRing);
7592  return L->GetLmCurrRing();
7593 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
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:1026
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:312

◆ 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 1171 of file kInline.h.

1172 {
1173  LObject L(p, currRing, strat->tailRing);
1174  return redtailBba_Z(&L, pos, strat);
1175 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1171
class sLObject LObject
Definition: kutil.h:54
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019

◆ redtailBba_Z() [2/2]

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

Definition at line 7836 of file kutil.cc.

7838 {
7839  strat->redTailChange=FALSE;
7840  if (strat->noTailReduction) return L->GetLmCurrRing();
7841  poly h, p;
7842  p = h = L->GetLmTailRing();
7843  if ((h==NULL) || (pNext(h)==NULL))
7844  return L->GetLmCurrRing();
7845 
7846  TObject* With;
7847  // placeholder in case strat->tl < 0
7848  TObject With_s(strat->tailRing);
7849 
7850  LObject Ln(pNext(h), strat->tailRing);
7851  Ln.pLength = L->GetpLength() - 1;
7852 
7853  pNext(h) = NULL;
7854  if (L->p != NULL) pNext(L->p) = NULL;
7855  L->pLength = 1;
7856 
7857  Ln.PrepareRed(strat->use_buckets);
7858 
7859  int cnt=REDTAIL_CANONICALIZE;
7860  while(!Ln.IsNull())
7861  {
7862  loop
7863  {
7864  Ln.SetShortExpVector();
7865  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7866  if (With == NULL) break;
7867  cnt--;
7868  if (cnt==0)
7869  {
7871  /*poly tmp=*/Ln.CanonicalizeP();
7872  }
7873  // we are in Z, do not call pNorm
7874  strat->redTailChange=TRUE;
7875  // test divisibility of coefs:
7876  poly p_Ln=Ln.GetLmCurrRing();
7877  poly p_With=With->GetLmCurrRing();
7878  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7879  if (!nIsZero(z))
7880  {
7881  // subtract z*Ln, add z.Ln to L
7882  poly m=pHead(p_Ln);
7883  pSetCoeff(m,z);
7884  poly mm=pHead(m);
7885  pNext(h) = m;
7886  pIter(h);
7887  L->pLength++;
7888  mm=pNeg(mm);
7889  if (Ln.bucket!=NULL)
7890  {
7891  int dummy=1;
7892  kBucket_Add_q(Ln.bucket,mm,&dummy);
7893  }
7894  else
7895  {
7896  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7897  Ln.GetP();
7898  if (Ln.p!=NULL)
7899  {
7900  Ln.p=pAdd(Ln.p,mm);
7901  if (Ln.t_p!=NULL)
7902  {
7903  pNext(Ln.t_p)=NULL;
7904  p_LmDelete(Ln.t_p,strat->tailRing);
7905  }
7906  }
7907  }
7908  }
7909  else
7910  nDelete(&z);
7911 
7912  if (ksReducePolyTail(L, With, &Ln))
7913  {
7914  // reducing the tail would violate the exp bound
7915  // set a flag and hope for a retry (in bba)
7916  strat->completeReduce_retry=TRUE;
7917  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7918  do
7919  {
7920  pNext(h) = Ln.LmExtractAndIter();
7921  pIter(h);
7922  L->pLength++;
7923  } while (!Ln.IsNull());
7924  goto all_done;
7925  }
7926  if (Ln.IsNull()) goto all_done;
7927  With_s.Init(currRing);
7928  }
7929  pNext(h) = Ln.LmExtractAndIter();
7930  pIter(h);
7931  pNormalize(h);
7932  L->pLength++;
7933  }
7934 
7935  all_done:
7936  Ln.Delete();
7937  if (L->p != NULL) pNext(L->p) = pNext(p);
7938 
7939  if (strat->redTailChange)
7940  {
7941  L->length = 0;
7942  }
7943 
7944  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7945  //L->Normalize(); // HANNES: should have a test
7946  kTest_L(L,strat->tailRing);
7947  return L->GetLmCurrRing();
7948 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h: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:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#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:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define kTest_L(T, R)
Definition: kutil.h:657
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:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
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:654
#define pNormalize(p)
Definition: polys.h:312

◆ redtailBbaAlsoLC_Z()

void redtailBbaAlsoLC_Z ( LObject L,
int  end_pos,
kStrategy  strat 
)

Definition at line 7711 of file kutil.cc.

7713 {
7714  strat->redTailChange=FALSE;
7715 
7716  poly h, p;
7717  p = h = L->GetLmTailRing();
7718  if ((h==NULL) || (pNext(h)==NULL))
7719  return;
7720 
7721  TObject* With;
7722  LObject Ln(pNext(h), strat->tailRing);
7723  Ln.GetpLength();
7724 
7725  pNext(h) = NULL;
7726  if (L->p != NULL)
7727  {
7728  pNext(L->p) = NULL;
7729  if (L->t_p != NULL) pNext(L->t_p) = NULL;
7730  }
7731  L->pLength = 1;
7732 
7733  Ln.PrepareRed(strat->use_buckets);
7734 
7735  int cnt=REDTAIL_CANONICALIZE;
7736 
7737  while(!Ln.IsNull())
7738  {
7739  loop
7740  {
7741  if (TEST_OPT_IDLIFT)
7742  {
7743  if (Ln.p!=NULL)
7744  {
7745  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7746  }
7747  else
7748  {
7749  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7750  }
7751  }
7752  Ln.SetShortExpVector();
7753  int j;
7754  j = kFindDivisibleByInT(strat, &Ln);
7755  if (j < 0) {
7756  j = kFindDivisibleByInT_Z(strat, &Ln);
7757  if (j < 0) {
7758  break;
7759  } else {
7760  /* reduction not cancelling a tail term, but reducing its coefficient */
7761  With = &(strat->T[j]);
7762  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7763  cnt--;
7764  if (cnt==0)
7765  {
7767  /*poly tmp=*/Ln.CanonicalizeP();
7768  }
7769  strat->redTailChange=TRUE;
7770  /* reduction cancelling a tail term */
7771  if (ksReducePolyTailLC_Z(L, With, &Ln))
7772  {
7773  // reducing the tail would violate the exp bound
7774  // set a flag and hope for a retry (in bba)
7775  strat->completeReduce_retry=TRUE;
7776  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7777  do
7778  {
7779  pNext(h) = Ln.LmExtractAndIter();
7780  pIter(h);
7781  L->pLength++;
7782  } while (!Ln.IsNull());
7783  goto all_done;
7784  }
7785  /* we have to break since we did not cancel the term, but only decreased
7786  * its coefficient. */
7787  break;
7788  }
7789  } else {
7790  With = &(strat->T[j]);
7791  assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
7792  cnt--;
7793  if (cnt==0)
7794  {
7796  /*poly tmp=*/Ln.CanonicalizeP();
7797  }
7798  strat->redTailChange=TRUE;
7799  /* reduction cancelling a tail term */
7800  if (ksReducePolyTail_Z(L, With, &Ln))
7801  {
7802  // reducing the tail would violate the exp bound
7803  // set a flag and hope for a retry (in bba)
7804  strat->completeReduce_retry=TRUE;
7805  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7806  do
7807  {
7808  pNext(h) = Ln.LmExtractAndIter();
7809  pIter(h);
7810  L->pLength++;
7811  } while (!Ln.IsNull());
7812  goto all_done;
7813  }
7814  }
7815  if (Ln.IsNull()) goto all_done;
7816  }
7817  pNext(h) = Ln.LmExtractAndIter();
7818  pIter(h);
7819  L->pLength++;
7820  }
7821 
7822  all_done:
7823  Ln.Delete();
7824  if (L->p != NULL) pNext(L->p) = pNext(p);
7825 
7826  if (strat->redTailChange)
7827  {
7828  L->length = 0;
7829  L->pLength = 0;
7830  }
7831 
7832  kTest_L(L, strat->tailRing);
7833  return;
7834 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int j
Definition: facHensel.cc:105
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition: kstd2.cc:139
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
KINLINE int ksReducePolyTailLC_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:657
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
KINLINE int ksReducePolyTail_Z(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1073
char redTailChange
Definition: kutil.h:397
class sTObject TObject
Definition: kutil.h:53

◆ redtailBbaBound() [1/2]

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

Definition at line 1164 of file kInline.h.

1165 {
1166  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1167  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1168 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026
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:1164
ring tailRing
Definition: kutil.h:341
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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 7595 of file kutil.cc.

7596 {
7597  strat->redTailChange=FALSE;
7598  if (strat->noTailReduction) return L->GetLmCurrRing();
7599  poly h, p;
7600  p = h = L->GetLmTailRing();
7601  if ((h==NULL) || (pNext(h)==NULL))
7602  return L->GetLmCurrRing();
7603 
7604  TObject* With;
7605  // placeholder in case strat->tl < 0
7606  TObject With_s(strat->tailRing);
7607 
7608  LObject Ln(pNext(h), strat->tailRing);
7609  Ln.pLength = L->GetpLength() - 1;
7610 
7611  pNext(h) = NULL;
7612  if (L->p != NULL) pNext(L->p) = NULL;
7613  L->pLength = 1;
7614 
7615  Ln.PrepareRed(strat->use_buckets);
7616 
7617  int cnt=REDTAIL_CANONICALIZE;
7618  while(!Ln.IsNull())
7619  {
7620  loop
7621  {
7622  if (TEST_OPT_IDLIFT)
7623  {
7624  if (Ln.p!=NULL)
7625  {
7626  if (__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7627  }
7628  else
7629  {
7630  if (__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7631  }
7632  }
7633  Ln.SetShortExpVector();
7634  if (withT)
7635  {
7636  int j;
7637  j = kFindDivisibleByInT(strat, &Ln);
7638  if (j < 0) break;
7639  With = &(strat->T[j]);
7640  }
7641  else
7642  {
7643  With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
7644  if (With == NULL) break;
7645  }
7646  cnt--;
7647  if (cnt==0)
7648  {
7650  /*poly tmp=*/Ln.CanonicalizeP();
7651  if (normalize)
7652  {
7653  Ln.Normalize();
7654  //pNormalize(tmp);
7655  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7656  }
7657  }
7658  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7659  {
7660  With->pNorm();
7661  }
7662  strat->redTailChange=TRUE;
7663  if (ksReducePolyTail(L, With, &Ln))
7664  {
7665  // reducing the tail would violate the exp bound
7666  // set a flag and hope for a retry (in bba)
7667  strat->completeReduce_retry=TRUE;
7668  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7669  do
7670  {
7671  pNext(h) = Ln.LmExtractAndIter();
7672  pIter(h);
7673  L->pLength++;
7674  } while (!Ln.IsNull());
7675  goto all_done;
7676  }
7677  if(!Ln.IsNull())
7678  {
7679  Ln.GetP();
7680  Ln.p = pJet(Ln.p,bound);
7681  }
7682  if (Ln.IsNull())
7683  {
7684  goto all_done;
7685  }
7686  if (! withT) With_s.Init(currRing);
7687  }
7688  pNext(h) = Ln.LmExtractAndIter();
7689  pIter(h);
7690  pNormalize(h);
7691  L->pLength++;
7692  }
7693 
7694  all_done:
7695  Ln.Delete();
7696  if (L->p != NULL) pNext(L->p) = pNext(p);
7697 
7698  if (strat->redTailChange)
7699  {
7700  L->length = 0;
7701  L->pLength = 0;
7702  }
7703 
7704  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7705  //L->Normalize(); // HANNES: should have a test
7706  kTest_L(L,strat->tailRing);
7707  return L->GetLmCurrRing();
7708 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
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:1026
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T, R)
Definition: kutil.h:657
#define pJet(p, m)
Definition: polys.h:363
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:127
ring tailRing
Definition: kutil.h:341
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:312

◆ redtailBbaShift()

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

Definition at line 12782 of file kutil.cc.

12783 {
12784  /* for the shift case need to run it with withT = TRUE */
12785  strat->redTailChange=FALSE;
12786  if (strat->noTailReduction) return L->GetLmCurrRing();
12787  poly h, p;
12788  p = h = L->GetLmTailRing();
12789  if ((h==NULL) || (pNext(h)==NULL))
12790  return L->GetLmCurrRing();
12791 
12792  TObject* With;
12793  // placeholder in case strat->tl < 0
12794  TObject With_s(strat->tailRing);
12795 
12796  LObject Ln(pNext(h), strat->tailRing);
12797  Ln.pLength = L->GetpLength() - 1;
12798 
12799  pNext(h) = NULL;
12800  if (L->p != NULL) pNext(L->p) = NULL;
12801  L->pLength = 1;
12802 
12803  Ln.PrepareRed(strat->use_buckets);
12804 
12805  while(!Ln.IsNull())
12806  {
12807  loop
12808  {
12809  Ln.SetShortExpVector();
12810  if (withT)
12811  {
12812  int j;
12813  j = kFindDivisibleByInT(strat, &Ln);
12814  if (j < 0) break;
12815  With = &(strat->T[j]);
12816  }
12817  else
12818  {
12819  With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
12820  if (With == NULL) break;
12821  }
12822  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12823  {
12824  With->pNorm();
12825  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12826  }
12827  strat->redTailChange=TRUE;
12828  if (ksReducePolyTail(L, With, &Ln))
12829  {
12830  // reducing the tail would violate the exp bound
12831  // set a flag and hope for a retry (in bba)
12832  strat->completeReduce_retry=TRUE;
12833  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12834  do
12835  {
12836  pNext(h) = Ln.LmExtractAndIter();
12837  pIter(h);
12838  L->pLength++;
12839  } while (!Ln.IsNull());
12840  goto all_done;
12841  }
12842  if (Ln.IsNull()) goto all_done;
12843  if (! withT) With_s.Init(currRing);
12844  }
12845  pNext(h) = Ln.LmExtractAndIter();
12846  pIter(h);
12847  L->pLength++;
12848  }
12849 
12850  all_done:
12851  Ln.Delete();
12852  if (L->p != NULL) pNext(L->p) = pNext(p);
12853 
12854  if (strat->redTailChange)
12855  {
12856  L->length = 0;
12857  }
12858  L->Normalize(); // HANNES: should have a test
12859  kTest_L(L,strat->tailRing);
12860  return L->GetLmCurrRing();
12861 }
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:1026
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T, R)
Definition: kutil.h:657
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
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 1398 of file kstd2.cc.

1399 {
1400 #define REDTAIL_CANONICALIZE 100
1401  strat->redTailChange=FALSE;
1402  if (strat->noTailReduction) return L->GetLmCurrRing();
1403  poly h, p;
1404  p = h = L->GetLmTailRing();
1405  if ((h==NULL) || (pNext(h)==NULL))
1406  return L->GetLmCurrRing();
1407 
1408  TObject* With;
1409  // placeholder in case strat->tl < 0
1410  TObject With_s(strat->tailRing);
1411 
1412  LObject Ln(pNext(h), strat->tailRing);
1413  Ln.sig = L->sig;
1414  Ln.sevSig = L->sevSig;
1415  Ln.pLength = L->GetpLength() - 1;
1416 
1417  pNext(h) = NULL;
1418  if (L->p != NULL) pNext(L->p) = NULL;
1419  L->pLength = 1;
1420 
1421  Ln.PrepareRed(strat->use_buckets);
1422 
1423  int cnt=REDTAIL_CANONICALIZE;
1424  while(!Ln.IsNull())
1425  {
1426  loop
1427  {
1428  if(rField_is_Ring(currRing) && strat->sigdrop)
1429  break;
1430  Ln.SetShortExpVector();
1431  if (withT)
1432  {
1433  int j;
1434  j = kFindDivisibleByInT(strat, &Ln);
1435  if (j < 0) break;
1436  With = &(strat->T[j]);
1437  }
1438  else
1439  {
1440  With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
1441  if (With == NULL) break;
1442  }
1443  cnt--;
1444  if (cnt==0)
1445  {
1447  /*poly tmp=*/Ln.CanonicalizeP();
1449  {
1450  Ln.Normalize();
1451  //pNormalize(tmp);
1452  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1453  }
1454  }
1455  if (normalize && (!TEST_OPT_INTSTRATEGY) && !rField_is_Ring(currRing) && (!nIsOne(pGetCoeff(With->p))))
1456  {
1457  With->pNorm();
1458  }
1459  strat->redTailChange=TRUE;
1460  int ret = ksReducePolyTailSig(L, With, &Ln, strat);
1462  L->sig = Ln.sig;
1463  //Because Ln.sig is set to L->sig, but in ksReducePolyTailSig -> ksReducePolySig
1464  // I delete it an then set Ln.sig. Hence L->sig is lost
1465 #if SBA_PRINT_REDUCTION_STEPS
1466  if (ret != 3)
1467  sba_reduction_steps++;
1468 #endif
1469 #if SBA_PRINT_OPERATIONS
1470  if (ret != 3)
1471  sba_operations += pLength(With->p);
1472 #endif
1473  if (ret)
1474  {
1475  // reducing the tail would violate the exp bound
1476  // set a flag and hope for a retry (in bba)
1477  strat->completeReduce_retry=TRUE;
1478  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
1479  do
1480  {
1481  pNext(h) = Ln.LmExtractAndIter();
1482  pIter(h);
1483  L->pLength++;
1484  } while (!Ln.IsNull());
1485  goto all_done;
1486  }
1487  if (Ln.IsNull()) goto all_done;
1488  if (! withT) With_s.Init(currRing);
1489  if(rField_is_Ring(currRing) && strat->sigdrop)
1490  {
1491  //Cannot break the loop here so easily
1492  break;
1493  }
1494  }
1495  pNext(h) = Ln.LmExtractAndIter();
1496  pIter(h);
1497  if(!rField_is_Ring(currRing))
1498  pNormalize(h);
1499  L->pLength++;
1500  }
1501  all_done:
1502  Ln.Delete();
1503  if (L->p != NULL) pNext(L->p) = pNext(p);
1504 
1505  if (strat->redTailChange)
1506  {
1507  L->length = 0;
1508  }
1509  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
1510  //L->Normalize(); // HANNES: should have a test
1511  kTest_L(L,strat->tailRing);
1512  return L->GetLmCurrRing();
1513 }
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:1026
class sLObject LObject
Definition: kutil.h:54
bool sigdrop
Definition: kutil.h:358
#define FALSE
Definition: auxiliary.h:94
char noTailReduction
Definition: kutil.h:376
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
char use_buckets
Definition: kutil.h:381
char completeReduce_retry
Definition: kutil.h:401
#define pIter(p)
Definition: monomials.h:37
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define kTest_L(T, R)
Definition: kutil.h:657
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define REDTAIL_CANONICALIZE
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:216
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
Definition: kstd2.cc:944
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
char redTailChange
Definition: kutil.h:397
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7263
class sTObject TObject
Definition: kutil.h:53
#define pNormalize(p)
Definition: polys.h:312

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 4982 of file kutil.cc.

4983 {
4984  int i,j,at,ecart, s2r;
4985  int fq=0;
4986  unsigned long sev;
4987  poly p;
4988  int new_suc=strat->sl+1;
4989  i= *suc;
4990  if (i<0) i=0;
4991 
4992  for (; i<=strat->sl; i++)
4993  {
4994  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
4995  if (at != i)
4996  {
4997  if (new_suc > at) new_suc = at;
4998  p = strat->S[i];
4999  ecart = strat->ecartS[i];
5000  sev = strat->sevS[i];
5001  s2r = strat->S_2_R[i];
5002  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5003  for (j=i; j>=at+1; j--)
5004  {
5005  strat->S[j] = strat->S[j-1];
5006  strat->ecartS[j] = strat->ecartS[j-1];
5007  strat->sevS[j] = strat->sevS[j-1];
5008  strat->S_2_R[j] = strat->S_2_R[j-1];
5009  }
5010  strat->S[at] = p;
5011  strat->ecartS[at] = ecart;
5012  strat->sevS[at] = sev;
5013  strat->S_2_R[at] = s2r;
5014  if (strat->fromQ!=NULL)
5015  {
5016  for (j=i; j>=at+1; j--)
5017  {
5018  strat->fromQ[j] = strat->fromQ[j-1];
5019  }
5020  strat->fromQ[at]=fq;
5021  }
5022  }
5023  }
5024  if (new_suc <= strat->sl) *suc=new_suc;
5025  else *suc=-1;
5026 }
int j
Definition: facHensel.cc:105
int * S_2_R
Definition: kutil.h:340
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
int p
Definition: cfModGcd.cc:4019

◆ replaceInLAndSAndT()

void replaceInLAndSAndT ( LObject p,
int  tj,
kStrategy  strat 
)

Definition at line 9515 of file kutil.cc.

9516 {
9517  p.GetP(strat->lmBin);
9518  if (strat->homog) strat->initEcart(&p);
9519  strat->redTailChange=FALSE;
9521  p.pCleardenom();
9522  if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) {
9523  p.p = redtailBba(&p,strat->sl,strat, FALSE,!TEST_OPT_CONTENTSB);
9524  p.pCleardenom();
9525  if (strat->redTailChange)
9526  p.t_p=NULL;
9527  }
9528  }
9529 
9530  assume(strat->tailRing == p.tailRing);
9531  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9532 
9533  int i, j, pos;
9534  poly tp = strat->T[tj].p;
9535 
9536  /* enter p to T set */
9537  enterT(p, strat);
9538 
9539  for (j = 0; j <= strat->sl; ++j) {
9540  if (pLtCmp(tp, strat->S[j]) == 0) {
9541  break;
9542  }
9543  }
9544  /* it may be that the exchanged element
9545  * is until now only in T and not in S */
9546  if (j <= strat->sl) {
9547  deleteInS(j, strat);
9548  }
9549 
9550  pos = posInS(strat, strat->sl, p.p, p.ecart);
9551 
9552  pp_Test(p.p, currRing, p.tailRing);
9553  assume(p.FDeg == p.pFDeg());
9554 
9555  /* remove useless pairs from L set */
9556  for (i = 0; i <= strat->Ll; ++i) {
9557  if (strat->L[i].p1 != NULL && pLtCmp(tp, strat->L[i].p1) == 0) {
9558  deleteInL(strat->L, &(strat->Ll), i, strat);
9559  i--;
9560  continue;
9561  }
9562  if (strat->L[i].p2 != NULL && pLtCmp(tp, strat->L[i].p2) == 0) {
9563  deleteInL(strat->L, &(strat->Ll), i, strat);
9564  i--;
9565  }
9566  }
9567  /* generate new pairs with p, probably removing older, now useless pairs */
9568  superenterpairs(p.p, strat->sl, p.ecart, pos, strat, strat->tl);
9569  /* enter p to S set */
9570  strat->enterS(p, pos, strat, strat->tl);
9571 }
#define TEST_OPT_REDTAIL
Definition: options.h:115
int j
Definition: facHensel.cc:105
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
#define TEST_OPT_CONTENTSB
Definition: options.h:125
int tl
Definition: kutil.h:348
#define pLtCmp(p, q)
Definition: polys.h:123
#define TEST_OPT_REDSB
Definition: options.h:103
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
polyset S
Definition: kutil.h:302
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
char homog
Definition: kutil.h:370
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4831
ring tailRing
Definition: kutil.h:341
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
omBin lmBin
Definition: kutil.h:342
int p
Definition: cfModGcd.cc:4019
char redTailChange
Definition: kutil.h:397

◆ sba()

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

Definition at line 2536 of file kstd2.cc.

2537 {
2538  // ring order stuff:
2539  // in sba we have (until now) two possibilities:
2540  // 1. an incremental computation w.r.t. (C,monomial order)
2541  // 2. a (possibly non-incremental) computation w.r.t. the
2542  // induced Schreyer order.
2543  // The corresponding orders are computed in sbaRing(), depending
2544  // on the flag strat->sbaOrder
2545 #if SBA_PRINT_ZERO_REDUCTIONS
2546  long zeroreductions = 0;
2547 #endif
2548 #if SBA_PRINT_PRODUCT_CRITERION
2549  long product_criterion = 0;
2550 #endif
2551 #if SBA_PRINT_SIZE_G
2552  int size_g = 0;
2553  int size_g_non_red = 0;
2554 #endif
2555 #if SBA_PRINT_SIZE_SYZ
2556  long size_syz = 0;
2557 #endif
2558  // global variable
2559 #if SBA_PRINT_REDUCTION_STEPS
2560  sba_reduction_steps = 0;
2561  sba_interreduction_steps = 0;
2562 #endif
2563 #if SBA_PRINT_OPERATIONS
2564  sba_operations = 0;
2565  sba_interreduction_operations = 0;
2566 #endif
2567 
2568  ideal F1 = F0;
2569  ring sRing, currRingOld;
2570  currRingOld = currRing;
2571  if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
2572  {
2573  sRing = sbaRing(strat);
2574  if (sRing!=currRingOld)
2575  {
2576  rChangeCurrRing (sRing);
2577  F1 = idrMoveR (F0, currRingOld, currRing);
2578  }
2579  }
2580  ideal F;
2581  // sort ideal F
2582  //Put the SigDrop element on the correct position (think of sbaEnterS)
2583  //We also sort them
2584  if(rField_is_Ring(currRing) && strat->sigdrop)
2585  {
2586  #if 1
2587  F = idInit(IDELEMS(F1),F1->rank);
2588  for (int i=0; i<IDELEMS(F1);++i)
2589  F->m[i] = F1->m[i];
2590  if(strat->sbaEnterS >= 0)
2591  {
2592  poly dummy;
2593  dummy = pCopy(F->m[0]); //the sigdrop element
2594  for(int i = 0;i<strat->sbaEnterS;i++)
2595  F->m[i] = F->m[i+1];
2596  F->m[strat->sbaEnterS] = dummy;
2597  }
2598  #else
2599  F = idInit(1,F1->rank);
2600  //printf("\nBefore the initial block sorting:\n");idPrint(F1);
2601  F->m[0] = F1->m[0];
2602  int pos;
2603  if(strat->sbaEnterS >= 0)
2604  {
2605  for(int i=1;i<=strat->sbaEnterS;i++)
2606  {
2607  pos = posInIdealMonFirst(F,F1->m[i],1,strat->sbaEnterS);
2608  idInsertPolyOnPos(F,F1->m[i],pos);
2609  }
2610  for(int i=strat->sbaEnterS+1;i<IDELEMS(F1);i++)
2611  {
2612  pos = posInIdealMonFirst(F,F1->m[i],strat->sbaEnterS+1,IDELEMS(F));
2613  idInsertPolyOnPos(F,F1->m[i],pos);
2614  }
2615  poly dummy;
2616  dummy = pCopy(F->m[0]); //the sigdrop element
2617  for(int i = 0;i<strat->sbaEnterS;i++)
2618  F->m[i] = F->m[i+1];
2619  F->m[strat->sbaEnterS] = dummy;
2620  }
2621  else
2622  {
2623  for(int i=1;i<IDELEMS(F1);i++)
2624  {
2625  pos = posInIdealMonFirst(F,F1->m[i],1,IDELEMS(F));
2626  idInsertPolyOnPos(F,F1->m[i],pos);
2627  }
2628  }
2629  #endif
2630  //printf("\nAfter the initial block sorting:\n");idPrint(F);getchar();
2631  }
2632  else
2633  {
2634  F = idInit(IDELEMS(F1),F1->rank);
2635  intvec *sort = idSort(F1);
2636  for (int i=0; i<sort->length();++i)
2637  F->m[i] = F1->m[(*sort)[i]-1];
2639  {
2640  // put the monomials after the sbaEnterS polynomials
2641  //printf("\nThis is the ideal before sorting (sbaEnterS = %i)\n",strat->sbaEnterS);idPrint(F);
2642  int nrmon = 0;
2643  for(int i = IDELEMS(F)-1,j;i>strat->sbaEnterS+nrmon+1 ;i--)
2644  {
2645  //pWrite(F->m[i]);
2646  if(F->m[i] != NULL && pNext(F->m[i]) == NULL)
2647  {
2648  poly mon = F->m[i];
2649  for(j = i;j>strat->sbaEnterS+nrmon+1;j--)
2650  {
2651  F->m[j] = F->m[j-1];
2652  }
2653  F->m[j] = mon;
2654  nrmon++;
2655  }
2656  //idPrint(F);
2657  }
2658  }
2659  }
2660  //printf("\nThis is the ideal after sorting\n");idPrint(F);getchar();
2662  strat->sigdrop = FALSE;
2663  strat->nrsyzcrit = 0;
2664  strat->nrrewcrit = 0;
2666  F = kInterRed(F,NULL);
2667 #endif
2668 #if F5DEBUG
2669  printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2670  rWrite (currRing);
2671  printf("ordSgn = %d\n",currRing->OrdSgn);
2672  printf("\n");
2673 #endif
2674  int srmax,lrmax, red_result = 1;
2675  int olddeg,reduc;
2676  int hilbeledeg=1,hilbcount=0,minimcnt=0;
2677  LObject L;
2678  BOOLEAN withT = TRUE;
2679  strat->max_lower_index = 0;
2680  //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
2681  initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
2682  initSbaPos(strat);
2683  initHilbCrit(F,Q,&hilb,strat);
2684  initSba(F,strat);
2685  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2686  /*Shdl=*/initSbaBuchMora(F, Q,strat);
2687  idTest(strat->Shdl);
2688  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2689  srmax = strat->sl;
2690  reduc = olddeg = lrmax = 0;
2691 #ifndef NO_BUCKETS
2692  if (!TEST_OPT_NOT_BUCKETS)
2693  strat->use_buckets = 1;
2694 #endif
2695 
2696  // redtailBBa against T for inhomogenous input
2697  // if (!TEST_OPT_OLDSTD)
2698  // withT = ! strat->homog;
2699 
2700  // strat->posInT = posInT_pLength;
2701  kTest_TS(strat);
2702 
2703 #ifdef HAVE_TAIL_RING
2704  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2705  kStratInitChangeTailRing(strat);
2706 #endif
2707  if (BVERBOSE(23))
2708  {
2709  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
2710  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
2711  kDebugPrint(strat);
2712  }
2713  // We add the elements directly in S from the previous loop
2714  if(rField_is_Ring(currRing) && strat->sbaEnterS >= 0)
2715  {
2716  for(int i = 0;i<strat->sbaEnterS;i++)
2717  {
2718  //Update: now the element is at the corect place
2719  //i+1 because on the 0 position is the sigdrop element
2720  enterT(strat->L[strat->Ll-(i)],strat);
2721  strat->enterS(strat->L[strat->Ll-(i)], strat->sl+1, strat, strat->tl);
2722  }
2723  strat->Ll = strat->Ll - strat->sbaEnterS;
2724  strat->sbaEnterS = -1;
2725  }
2726  kTest_TS(strat);
2727 #ifdef KDEBUG
2728  //kDebugPrint(strat);
2729 #endif
2730  /* compute------------------------------------------------------- */
2731  while (strat->Ll >= 0)
2732  {
2733  if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
2734  #ifdef KDEBUG
2735  if (TEST_OPT_DEBUG) messageSets(strat);
2736  #endif
2737  if (strat->Ll== 0) strat->interpt=TRUE;
2738  /*
2739  if (TEST_OPT_DEGBOUND
2740  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2741  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2742  {
2743 
2744  //stops computation if
2745  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2746  //a predefined number Kstd1_deg
2747  while ((strat->Ll >= 0)
2748  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2749  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2750  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2751  )
2752  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2753  if (strat->Ll<0) break;
2754  else strat->noClearS=TRUE;
2755  }
2756  */
2757  if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
2758  {
2759  strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
2760 #if F5C
2761  // 1. interreduction of the current standard basis
2762  // 2. generation of new principal syzygy rules for syzCriterion
2763  f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2764  lrmax, reduc, Q, w, hilb );
2765 #endif
2766  // initialize new syzygy rules for the next iteration step
2767  initSyzRules(strat);
2768  }
2769  /*********************************************************************
2770  * interrreduction step is done, we can go on with the next iteration
2771  * step of the signature-based algorithm
2772  ********************************************************************/
2773  /* picks the last element from the lazyset L */
2774  strat->P = strat->L[strat->Ll];
2775  strat->Ll--;
2776 
2778  strat->sbaEnterS = pGetComp(strat->P.sig) - 1;
2779  /* reduction of the element chosen from L */
2780  if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1))
2781  {
2782  //#if 1
2783 #ifdef DEBUGF5
2784  PrintS("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2785  PrintS("-------------------------------------------------\n");
2786  pWrite(strat->P.sig);
2787  pWrite(pHead(strat->P.p));
2788  pWrite(pHead(strat->P.p1));
2789  pWrite(pHead(strat->P.p2));
2790  PrintS("-------------------------------------------------\n");
2791 #endif
2792  if (pNext(strat->P.p) == strat->tail)
2793  {
2794  // deletes the short spoly
2795  /*
2796  if (rField_is_Ring(currRing))
2797  pLmDelete(strat->P.p);
2798  else
2799  pLmFree(strat->P.p);
2800 */
2801  // TODO: needs some masking
2802  // TODO: masking needs to vanish once the signature
2803  // sutff is completely implemented
2804  strat->P.p = NULL;
2805  poly m1 = NULL, m2 = NULL;
2806 
2807  // check that spoly creation is ok
2808  while (strat->tailRing != currRing &&
2809  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2810  {
2811  assume(m1 == NULL && m2 == NULL);
2812  // if not, change to a ring where exponents are at least
2813  // large enough
2814  if (!kStratChangeTailRing(strat))
2815  {
2816  WerrorS("OVERFLOW...");
2817  break;
2818  }
2819  }
2820  // create the real one
2821  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2822  strat->tailRing, m1, m2, strat->R);
2823 
2824  }
2825  else if (strat->P.p1 == NULL)
2826  {
2827  if (strat->minim > 0)
2828  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2829  // for input polys, prepare reduction
2830  if(!rField_is_Ring(currRing))
2831  strat->P.PrepareRed(strat->use_buckets);
2832  }
2833  if (strat->P.p == NULL && strat->P.t_p == NULL)
2834  {
2835  red_result = 0;
2836  }
2837  else
2838  {
2839  //#if 1
2840 #ifdef DEBUGF5
2841  PrintS("Poly before red: ");
2842  pWrite(pHead(strat->P.p));
2843  pWrite(strat->P.sig);
2844 #endif
2845 #if SBA_PRODUCT_CRITERION
2846  if (strat->P.prod_crit)
2847  {
2848 #if SBA_PRINT_PRODUCT_CRITERION
2849  product_criterion++;
2850 #endif
2851  int pos = posInSyz(strat, strat->P.sig);
2852  enterSyz(strat->P, strat, pos);
2853  kDeleteLcm(&strat->P);
2854  red_result = 2;
2855  }
2856  else
2857  {
2858  red_result = strat->red(&strat->P,strat);
2859  }
2860 #else
2861  red_result = strat->red(&strat->P,strat);
2862 #endif
2863  }
2864  }
2865  else
2866  {
2867  /*
2868  if (strat->P.lcm != NULL)
2869  pLmFree(strat->P.lcm);
2870  */
2871  red_result = 2;
2872  }
2874  {
2875  if(strat->P.sig!= NULL && !nGreaterZero(pGetCoeff(strat->P.sig)))
2876  {
2877  strat->P.p = pNeg(strat->P.p);
2878  strat->P.sig = pNeg(strat->P.sig);
2879  }
2880  strat->P.pLength = pLength(strat->P.p);
2881  if(strat->P.sig != NULL)
2882  strat->P.sevSig = pGetShortExpVector(strat->P.sig);
2883  if(strat->P.p != NULL)
2884  strat->P.sev = pGetShortExpVector(strat->P.p);
2885  }
2886  //sigdrop case
2887  if(rField_is_Ring(currRing) && strat->sigdrop)
2888  {
2889  //First reduce it as much as one can
2890  red_result = redRing(&strat->P,strat);
2891  if(red_result == 0)
2892  {
2893  strat->sigdrop = FALSE;
2894  pDelete(&strat->P.sig);
2895  strat->P.sig = NULL;
2896  }
2897  else
2898  {
2899  strat->enterS(strat->P, 0, strat, strat->tl);
2900  if (TEST_OPT_PROT)
2901  PrintS("-");
2902  break;
2903  }
2904  }
2905  if(rField_is_Ring(currRing) && strat->blockred > strat->blockredmax)
2906  {
2907  strat->sigdrop = TRUE;
2908  break;
2909  }
2910 
2911  if (errorreported) break;
2912 
2913 //#if 1
2914 #ifdef DEBUGF5
2915  if (red_result != 0)
2916  {
2917  PrintS("Poly after red: ");
2918  pWrite(pHead(strat->P.p));
2919  pWrite(strat->P.GetLmCurrRing());
2920  pWrite(strat->P.sig);
2921  printf("%d\n",red_result);
2922  }
2923 #endif
2924  if (TEST_OPT_PROT)
2925  {
2926  if(strat->P.p != NULL)
2927  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2928  &olddeg,&reduc,strat, red_result);
2929  else
2930  message((strat->honey ? strat->P.ecart : 0),
2931  &olddeg,&reduc,strat, red_result);
2932  }
2933 
2934  if (strat->overflow)
2935  {
2936  if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2937  }
2938  // reduction to non-zero new poly
2939  if (red_result == 1)
2940  {
2941  // get the polynomial (canonicalize bucket, make sure P.p is set)
2942  strat->P.GetP(strat->lmBin);
2943 
2944  // sig-safe computations may lead to wrong FDeg computation, thus we need
2945  // to recompute it to make sure everything is alright
2946  (strat->P).FDeg = (strat->P).pFDeg();
2947  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2948  // but now, for entering S, T, we reset it
2949  // in the inhomogeneous case: FDeg == pFDeg
2950  if (strat->homog) strat->initEcart(&(strat->P));
2951 
2952  /* statistic */
2953  if (TEST_OPT_PROT) PrintS("s");
2954 
2955  //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2956  // in F5E we know that the last reduced element is already the
2957  // the one with highest signature
2958  int pos = strat->sl+1;
2959 
2960  // reduce the tail and normalize poly
2961  // in the ring case we cannot expect LC(f) = 1,
2962  // therefore we call pCleardenom instead of pNorm
2963  #ifdef HAVE_RINGS
2964  poly beforetailred;
2966  beforetailred = pCopy(strat->P.sig);
2967  #endif
2968 #if SBA_TAIL_RED
2970  {
2972  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2973  }
2974  else
2975  {
2976  if (strat->sbaOrder != 2)
2977  {
2979  {
2980  strat->P.pCleardenom();
2982  {
2983  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2984  strat->P.pCleardenom();
2985  }
2986  }
2987  else
2988  {
2989  strat->P.pNorm();
2991  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
2992  }
2993  }
2994  }
2995  // It may happen that we have lost the sig in redtailsba
2996  // It cannot reduce to 0 since here we are doing just tail reduction.
2997  // Best case scenerio: remains the leading term
2998  if(rField_is_Ring(currRing) && strat->sigdrop)
2999  {
3000  strat->enterS(strat->P, 0, strat, strat->tl);
3001  break;
3002  }
3003 #endif
3005  {
3006  if(strat->P.sig == NULL || pLtCmp(beforetailred,strat->P.sig) == 1)
3007  {
3008  strat->sigdrop = TRUE;
3009  //Reduce it as much as you can
3010  red_result = redRing(&strat->P,strat);
3011  if(red_result == 0)
3012  {
3013  //It reduced to 0, cancel the sigdrop
3014  strat->sigdrop = FALSE;
3015  p_Delete(&strat->P.sig,currRing);strat->P.sig = NULL;
3016  }
3017  else
3018  {
3019  strat->enterS(strat->P, 0, strat, strat->tl);
3020  break;
3021  }
3022  }
3023  p_Delete(&beforetailred,currRing);
3024  // strat->P.p = NULL may appear if we had a sigdrop above and reduced to 0 via redRing
3025  if(strat->P.p == NULL)
3026  goto case_when_red_result_changed;
3027  }
3028  // remove sigsafe label since it is no longer valid for the next element to
3029  // be reduced
3030  if (strat->sbaOrder == 1)
3031  {
3032  for (int jj = 0; jj<strat->tl+1; jj++)
3033  {
3034  if (pGetComp(strat->T[jj].sig) == strat->currIdx)
3035  {
3036  strat->T[jj].is_sigsafe = FALSE;
3037  }
3038  }
3039  }
3040  else
3041  {
3042  for (int jj = 0; jj<strat->tl+1; jj++)
3043  {
3044  strat->T[jj].is_sigsafe = FALSE;
3045  }
3046  }
3047 #ifdef KDEBUG
3048  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3049 #endif /* KDEBUG */
3050 
3051  // min_std stuff
3052  if ((strat->P.p1==NULL) && (strat->minim>0))
3053  {
3054  if (strat->minim==1)
3055  {
3056  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3057  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3058  }
3059  else
3060  {
3061  strat->M->m[minimcnt]=strat->P.p2;
3062  strat->P.p2=NULL;
3063  }
3064  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3065  pNext(strat->M->m[minimcnt])
3066  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3067  strat->tailRing, currRing,
3068  currRing->PolyBin);
3069  minimcnt++;
3070  }
3071 
3072  // enter into S, L, and T
3073  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3074  enterT(strat->P, strat);
3075  strat->T[strat->tl].is_sigsafe = FALSE;
3076  /*
3077  printf("hier\n");
3078  pWrite(strat->P.GetLmCurrRing());
3079  pWrite(strat->P.sig);
3080  */
3081  if (rField_is_Ring(currRing))
3082  superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
3083  else
3084  enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
3085  if(rField_is_Ring(currRing) && strat->sigdrop)
3086  break;
3088  strat->P.sevSig = p_GetShortExpVector(strat->P.sig,currRing);
3089  strat->enterS(strat->P, pos, strat, strat->tl);
3090  if(strat->sbaOrder != 1)
3091  {
3092  BOOLEAN overwrite = FALSE;
3093  for (int tk=0; tk<strat->sl+1; tk++)
3094  {
3095  if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
3096  {
3097  //printf("TK %d / %d\n",tk,strat->sl);
3098  overwrite = FALSE;
3099  break;
3100  }
3101  }
3102  //printf("OVERWRITE %d\n",overwrite);
3103  if (overwrite)
3104  {
3105  int cmp = pGetComp(strat->P.sig);
3106  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
3107  p_GetExpV (strat->P.p,vv,currRing);
3108  p_SetExpV (strat->P.sig, vv,currRing);
3109  p_SetComp (strat->P.sig,cmp,currRing);
3110 
3111  strat->P.sevSig = pGetShortExpVector (strat->P.sig);
3112  int i;
3113  LObject Q;
3114  for(int ps=0;ps<strat->sl+1;ps++)
3115  {
3116 
3117  strat->newt = TRUE;
3118  if (strat->syzl == strat->syzmax)
3119  {
3120  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
3121  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
3122  (strat->syzmax)*sizeof(unsigned long),
3123  ((strat->syzmax)+setmaxTinc)
3124  *sizeof(unsigned long));
3125  strat->syzmax += setmaxTinc;
3126  }
3127  Q.sig = pCopy(strat->P.sig);
3128  // add LM(F->m[i]) to the signature to get a Schreyer order
3129  // without changing the underlying polynomial ring at all
3130  if (strat->sbaOrder == 0)
3131  p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
3132  // since p_Add_q() destroys all input
3133  // data we need to recreate help
3134  // each time
3135  // ----------------------------------------------------------
3136  // in the Schreyer order we always know that the multiplied
3137  // module monomial strat->P.sig gives the leading monomial of
3138  // the corresponding principal syzygy
3139  // => we do not need to compute the "real" syzygy completely
3140  poly help = p_Copy(strat->sig[ps],currRing);
3141  p_ExpVectorAdd (help,strat->P.p,currRing);
3142  Q.sig = p_Add_q(Q.sig,help,currRing);
3143  //printf("%d. SYZ ",i+1);
3144  //pWrite(strat->syz[i]);
3145  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
3146  i = posInSyz(strat, Q.sig);
3147  enterSyz(Q, strat, i);
3148  }
3149  }
3150  }
3151  // deg - idx - lp/rp
3152  // => we need to add syzygies with indices > pGetComp(strat->P.sig)
3153  if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
3154  {
3155  int cmp = pGetComp(strat->P.sig);
3156  unsigned max_cmp = IDELEMS(F);
3157  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
3158  p_GetExpV (strat->P.p,vv,currRing);
3159  LObject Q;
3160  int pos;
3161  int idx = __p_GetComp(strat->P.sig,currRing);
3162  //printf("++ -- adding syzygies -- ++\n");
3163  // if new element is the first one in this index
3164  if (strat->currIdx < idx)
3165  {
3166  for (int i=0; i<strat->sl; ++i)
3167  {
3168  Q.sig = p_Copy(strat->P.sig,currRing);
3169  p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
3170  poly help = p_Copy(strat->sig[i],currRing);
3171  p_ExpVectorAdd(help,strat->P.p,currRing);
3172  Q.sig = p_Add_q(Q.sig,help,currRing);
3173  //pWrite(Q.sig);
3174  pos = posInSyz(strat, Q.sig);
3175  enterSyz(Q, strat, pos);
3176  }
3177  strat->currIdx = idx;
3178  }
3179  else
3180  {
3181  // if the element is not the first one in the given index we build all
3182  // possible syzygies with elements of higher index
3183  for (unsigned i=cmp+1; i<=max_cmp; ++i)
3184  {
3185  pos = -1;
3186  for (int j=0; j<strat->sl; ++j)
3187  {
3188  if (__p_GetComp(strat->sig[j],currRing) == i)
3189  {
3190  pos = j;
3191  break;
3192  }
3193  }
3194  if (pos != -1)
3195  {
3196  Q.sig = p_One(currRing);
3197  p_SetExpV(Q.sig, vv, currRing);
3198  // F->m[i-1] corresponds to index i
3199  p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
3200  p_SetComp(Q.sig, i, currRing);
3201  poly help = p_Copy(strat->P.sig,currRing);
3202  p_ExpVectorAdd(help,strat->S[pos],currRing);
3203  Q.sig = p_Add_q(Q.sig,help,currRing);
3204  if (strat->sbaOrder == 0)
3205  {
3206  if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn)
3207  {
3208  pos = posInSyz(strat, Q.sig);
3209  enterSyz(Q, strat, pos);
3210  }
3211  }
3212  else
3213  {
3214  pos = posInSyz(strat, Q.sig);
3215  enterSyz(Q, strat, pos);
3216  }
3217  }
3218  }
3219  //printf("++ -- done adding syzygies -- ++\n");
3220  }
3221  }
3222 //#if 1
3223 #if DEBUGF50
3224  printf("---------------------------\n");
3225  Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
3226  PrintS("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
3227  PrintS("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
3228 #endif
3229  /*
3230  if (newrules)
3231  {
3232  newrules = FALSE;
3233  }
3234  */
3235 #if 0
3236  int pl=pLength(strat->P.p);
3237  if (pl==1)
3238  {
3239  //if (TEST_OPT_PROT)
3240  //PrintS("<1>");
3241  }
3242  else if (pl==2)
3243  {
3244  //if (TEST_OPT_PROT)
3245  //PrintS("<2>");
3246  }
3247 #endif
3248  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3249 // Print("[%d]",hilbeledeg);
3250  kDeleteLcm(&strat->P);
3251  if (strat->sl>srmax) srmax = strat->sl;
3252  }
3253  else
3254  {
3255  case_when_red_result_changed:
3256  // adds signature of the zero reduction to
3257  // strat->syz. This is the leading term of
3258  // syzygy and can be used in syzCriterion()
3259  // the signature is added if and only if the
3260  // pair was not detected by the rewritten criterion in strat->red = redSig
3261  if (red_result!=2)
3262  {
3263 #if SBA_PRINT_ZERO_REDUCTIONS
3264  zeroreductions++;
3265 #endif
3266  if(rField_is_Ring(currRing) && strat->P.p == NULL && strat->P.sig == NULL)
3267  {
3268  //Catch the case when p = 0, sig = 0
3269  }
3270  else
3271  {
3272  int pos = posInSyz(strat, strat->P.sig);
3273  enterSyz(strat->P, strat, pos);
3274  //#if 1
3275  #ifdef DEBUGF5
3276  Print("ADDING STUFF TO SYZ : ");
3277  //pWrite(strat->P.p);
3278  pWrite(strat->P.sig);
3279  #endif
3280  }
3281  }
3282  if (strat->P.p1 == NULL && strat->minim > 0)
3283  {
3284  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3285  }
3286  }
3287 
3288 #ifdef KDEBUG
3289  memset(&(strat->P), 0, sizeof(strat->P));
3290 #endif /* KDEBUG */
3291  kTest_TS(strat);
3292  }
3293  #if 0
3294  if(strat->sigdrop)
3295  printf("\nSigDrop!\n");
3296  else
3297  printf("\nEnded with no SigDrop\n");
3298  #endif
3299 // Clean strat->P for the next sba call
3300  if(rField_is_Ring(currRing) && strat->sigdrop)
3301  {
3302  //This is used to know how many elements can we directly add to S in the next run
3303  if(strat->P.sig != NULL)
3304  strat->sbaEnterS = pGetComp(strat->P.sig)-1;
3305  //else we already set it at the beggining of the loop
3306  #ifdef KDEBUG
3307  memset(&(strat->P), 0, sizeof(strat->P));
3308  #endif /* KDEBUG */
3309  }
3310 #ifdef KDEBUG
3311  if (TEST_OPT_DEBUG) messageSets(strat);
3312 #endif /* KDEBUG */
3313 
3314  if (TEST_OPT_SB_1)
3315  {
3316  if(!rField_is_Ring(currRing))
3317  {
3318  int k=1;
3319  int j;
3320  while(k<=strat->sl)
3321  {
3322  j=0;
3323  loop
3324  {
3325  if (j>=k) break;
3326  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3327  j++;
3328  }
3329  k++;
3330  }
3331  }
3332  }
3333  /* complete reduction of the standard basis--------- */
3334  if (TEST_OPT_REDSB)
3335  {
3336  completeReduce(strat);
3337  if (strat->completeReduce_retry)
3338  {
3339  // completeReduce needed larger exponents, retry
3340  // to reduce with S (instead of T)
3341  // and in currRing (instead of strat->tailRing)
3342 #ifdef HAVE_TAIL_RING
3343  if(currRing->bitmask>strat->tailRing->bitmask)
3344  {
3345  strat->completeReduce_retry=FALSE;
3346  cleanT(strat);strat->tailRing=currRing;
3347  int i;
3348  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3349  completeReduce(strat);
3350  }
3351  if (strat->completeReduce_retry)
3352 #endif
3353  Werror("exponent bound is %ld",currRing->bitmask);
3354  }
3355  }
3356  else if (TEST_OPT_PROT) PrintLn();
3357 
3358 #if SBA_PRINT_SIZE_SYZ
3359  // that is correct, syzl is counting one too far
3360  size_syz = strat->syzl;
3361 #endif
3362 // if (TEST_OPT_WEIGHTM)
3363 // {
3364 // pRestoreDegProcs(pFDegOld, pLDegOld);
3365 // if (ecartWeights)
3366 // {
3367 // omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
3368 // ecartWeights=NULL;
3369 // }
3370 // }
3371  if (TEST_OPT_PROT) messageStatSBA(hilbcount,strat);
3372  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3373 #if SBA_PRINT_SIZE_G
3374  size_g_non_red = IDELEMS(strat->Shdl);
3375 #endif
3376  if(!rField_is_Ring(currRing))
3377  exitSba(strat);
3378  // I have to add the initial input polynomials which where not used (p1 and p2 = NULL)
3379  #ifdef HAVE_RINGS
3380  int k;
3382  {
3383  //for(k = strat->sl;k>=0;k--)
3384  // {printf("\nS[%i] = %p\n",k,strat->Shdl->m[k]);pWrite(strat->Shdl->m[k]);}
3385  k = strat->Ll;
3386  #if 1
3387  // 1 - adds just the unused ones, 0 - adds everthing
3388  for(;k>=0 && (strat->L[k].p1 != NULL || strat->L[k].p2 != NULL);k--)
3389  {
3390  //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);
3391  deleteInL(strat->L,&strat->Ll,k,strat);
3392  }
3393  #endif
3394  //for(int kk = strat->sl;kk>=0;kk--)
3395  // {printf("\nS[%i] = %p\n",kk,strat->Shdl->m[kk]);pWrite(strat->Shdl->m[kk]);}
3396  //idPrint(strat->Shdl);
3397  //printf("\nk = %i\n",k);
3398  for(;k>=0 && strat->L[k].p1 == NULL && strat->L[k].p2 == NULL;k--)
3399  {
3400  //printf("\nAdded k = %i\n",k);
3401  strat->enterS(strat->L[k], strat->sl+1, strat, strat->tl);
3402  //printf("\nThis elements was added from L on pos %i\n",strat->sl);pWrite(strat->S[strat->sl]);pWrite(strat->sig[strat->sl]);
3403  }
3404  }
3405  // 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
3406  #if 0
3407  if(strat->sigdrop && rField_is_Ring(currRing))
3408  {
3409  for(k=strat->sl;k>=0;k--)
3410  {
3411  printf("\nsig[%i] = ",i);pWrite(strat->sig[k]);
3412  if(strat->sig[k] == NULL)
3413  strat->sig[k] = pCopy(strat->sig[k-1]);
3414  }
3415  }
3416  #endif
3417  #endif
3418  //Never do this - you will damage S
3419  //idSkipZeroes(strat->Shdl);
3420  //idPrint(strat->Shdl);
3421 
3422  if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
3423  {
3424  rChangeCurrRing (currRingOld);
3425  F0 = idrMoveR (F1, sRing, currRing);
3426  strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
3427  rChangeCurrRing (sRing);
3429  exitSba(strat);
3430  rChangeCurrRing (currRingOld);
3431  if(strat->tailRing == sRing)
3432  strat->tailRing = currRing;
3433  rDelete (sRing);
3434  }
3435  if(rField_is_Ring(currRing) && !strat->sigdrop)
3436  id_DelDiv(strat->Shdl, currRing);
3437  if(!rField_is_Ring(currRing))
3438  id_DelDiv(strat->Shdl, currRing);
3439  idSkipZeroes(strat->Shdl);
3440  idTest(strat->Shdl);
3441 
3442 #if SBA_PRINT_SIZE_G
3443  size_g = IDELEMS(strat->Shdl);
3444 #endif
3445 #ifdef DEBUGF5
3446  printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
3447  int oo = 0;
3448  while (oo<IDELEMS(strat->Shdl))
3449  {
3450  printf(" %d. ",oo+1);
3451  pWrite(pHead(strat->Shdl->m[oo]));
3452  oo++;
3453  }
3454 #endif
3455 #if SBA_PRINT_ZERO_REDUCTIONS
3456  printf("----------------------------------------------------------\n");
3457  printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3458  zeroreductions = 0;
3459 #endif
3460 #if SBA_PRINT_REDUCTION_STEPS
3461  printf("----------------------------------------------------------\n");
3462  printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3463 #endif
3464 #if SBA_PRINT_OPERATIONS
3465  printf("OPERATIONS: %ld\n",sba_operations);
3466 #endif
3467 #if SBA_PRINT_REDUCTION_STEPS
3468  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3469  printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3470 #endif
3471 #if SBA_PRINT_OPERATIONS
3472  printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3473 #endif
3474 #if SBA_PRINT_REDUCTION_STEPS
3475  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3476  printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3477  sba_interreduction_steps = 0;
3478  sba_reduction_steps = 0;
3479 #endif
3480 #if SBA_PRINT_OPERATIONS
3481  printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3482  sba_interreduction_operations = 0;
3483  sba_operations = 0;
3484 #endif
3485 #if SBA_PRINT_SIZE_G
3486  printf("----------------------------------------------------------\n");
3487  printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3488  size_g = 0;
3489  size_g_non_red = 0;
3490 #endif
3491 #if SBA_PRINT_SIZE_SYZ
3492  printf("SIZE OF SYZ: %ld\n",size_syz);
3493  printf("----------------------------------------------------------\n");
3494  size_syz = 0;
3495 #endif
3496 #if SBA_PRINT_PRODUCT_CRITERION
3497  printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3498  product_criterion = 0;
3499 #endif
3500  return (strat->Shdl);
3501 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#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:280
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void initSbaPos(kStrategy strat)
Definition: kutil.cc:10292
int j
Definition: facHensel.cc:105
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
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:7954
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:358
#define TEST_OPT_PROT
Definition: options.h:102
int Ll
Definition: kutil.h:349
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Definition: kutil.cc:5213
#define FALSE
Definition: auxiliary.h:94
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int sbaEnterS
Definition: kutil.h:361
char interpt
Definition: kutil.h:369
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1455
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:290
void initSba(ideal F, kStrategy strat)
Definition: kstd1.cc:1390
#define pNeg(p)
Definition: polys.h:193
void initSyzRules(kStrategy strat)
Definition: kutil.cc:8416
int tl
Definition: kutil.h:348
#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:876
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:11503
void pWrite(poly p)
Definition: polys.h:303
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:10394
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:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int currIdx
Definition: kutil.h:313
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4885
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:356
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1470
char use_buckets
Definition: kutil.h:381
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11476
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
int blockredmax
Definition: kutil.h:364
int nrsyzcrit
Definition: kutil.h:359
int nrrewcrit
Definition: kutil.h:360
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
Definition: intvec.h:19
#define kTest_TS(A)
Definition: kutil.h:654
poly p_One(const ring r)
Definition: p_polys.cc:1303
int max_lower_index
Definition: kutil.h:314
#define nGreaterZero(n)
Definition: numbers.h:27
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9856
#define assume(x)
Definition: mod2.h:390
#define messageSets(s)
Definition: kutil.h:540
void messageStatSBA(int hilbcount, kStrategy strat)
Definition: kutil.cc:8008
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1145
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3398
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:247
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11377
LObject P
Definition: kutil.h:298
ideal M
Definition: kutil.h:301
unsigned sbaOrder
Definition: kutil.h:312
void exitSba(kStrategy strat)
Definition: kutil.cc:10467
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4841
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1346
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:3848
TObject ** R
Definition: kutil.h:338
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:226
static unsigned pLength(poly a)
Definition: p_polys.h:191
#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:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
short errorreported
Definition: feFopen.cc:23
#define help
Definition: libparse.cc:1228
void rChangeCurrRing(ring r)
Definition: polys.cc:14
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10905
#define BVERBOSE(a)
Definition: options.h:35
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:4687
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void cleanT(kStrategy strat)
Definition: kutil.cc:538
#define SBA_INTERRED_START
Definition: kstd2.cc:37
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3656
int length() const
Definition: intvec.h:94
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6283
ring tailRing
Definition: kutil.h:341
#define TEST_OPT_SB_1
Definition: options.h:117
int blockred
Definition: kutil.h:363
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:9938
#define pDelete(p_ptr)
Definition: polys.h:181
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10719
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
#define setmaxTinc
Definition: kutil.h:34
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10507
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1178
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:80
int sl
Definition: kutil.h:346
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:891
ideal Shdl
Definition: kutil.h:299
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kstd2.cc:1398
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:11923
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9778
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:260
#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 1676 of file kutil.cc.

1677 {
1678  if(strat->sl < 0) return FALSE;
1679  int i;
1680  for(i=0;i<strat->sl;i++)
1681  {
1682  //Construct the gcd pair between h and S[i]
1683  number d, s, t;
1684  poly m1, m2, gcd;
1685  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1686  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1687  {
1688  nDelete(&d);
1689  nDelete(&s);
1690  nDelete(&t);
1691  }
1692  else
1693  {
1694  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1695  pSetCoeff0(m1, s);
1696  pSetCoeff0(m2, t);
1697  pSetCoeff0(gcd, d);
1698  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);
1699  poly pSigMult = p_Copy(h->sig,currRing);
1700  poly sSigMult = p_Copy(strat->sig[i],currRing);
1701  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1702  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1703  p_LmDelete(m1, strat->tailRing);
1704  p_LmDelete(m2, strat->tailRing);
1705  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1706  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1707  {
1708  pDelete(&h->p);
1709  h->p = gcd;
1710  pDelete(&h->sig);
1711  h->sig = pairsig;
1712  pNext(h->sig) = NULL;
1713  strat->initEcart(h);
1714  h->sev = pGetShortExpVector(h->p);
1715  h->sevSig = pGetShortExpVector(h->sig);
1716  h->i_r1 = -1;h->i_r2 = -1;
1717  if(h->lcm != NULL)
1718  {
1719  pLmDelete(h->lcm);
1720  h->lcm = NULL;
1721  }
1722  if (currRing!=strat->tailRing)
1723  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1724  return TRUE;
1725  }
1726  //Delete what you didn't use
1727  pDelete(&gcd);
1728  pDelete(&pairsig);
1729  }
1730  }
1731  return FALSE;
1732 }
polyset sig
Definition: kutil.h:304
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:996
#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:986
#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:44
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void(* initEcart)(TObject *L)
Definition: kutil.h:276
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:693
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:836
#define pDelete(p_ptr)
Definition: polys.h:181
#define pNext(p)
Definition: monomials.h:36
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition: kInline.h:1007
int sl
Definition: kutil.h:346
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971

◆ sbaRing()

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

Definition at line 11503 of file kutil.cc.

11504 {
11505  int n = rBlocks(r); // Including trailing zero!
11506  // if sbaOrder == 1 => use (C,monomial order from r)
11507  if (strat->sbaOrder == 1)
11508  {
11509  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11510  {
11511  return r;
11512  }
11513  ring res = rCopy0(r, TRUE, FALSE);
11514  res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
11515  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11516  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11517  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11518  res->wvhdl = wvhdl;
11519  for (int i=1; i<n; i++)
11520  {
11521  res->order[i] = r->order[i-1];
11522  res->block0[i] = r->block0[i-1];
11523  res->block1[i] = r->block1[i-1];
11524  res->wvhdl[i] = r->wvhdl[i-1];
11525  }
11526 
11527  // new 1st block
11528  res->order[0] = ringorder_C; // Prefix
11529  // removes useless secondary component order if defined in old ring
11530  for (int i=rBlocks(res); i>0; --i)
11531  {
11532  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11533  {
11534  res->order[i] = (rRingOrder_t)0;
11535  }
11536  }
11537  rComplete(res, 1);
11538 #ifdef HAVE_PLURAL
11539  if (rIsPluralRing(r))
11540  {
11541  if ( nc_rComplete(r, res, false) ) // no qideal!
11542  {
11543 #ifndef SING_NDEBUG
11544  WarnS("error in nc_rComplete");
11545 #endif
11546  // cleanup?
11547 
11548  // rDelete(res);
11549  // return r;
11550 
11551  // just go on..
11552  }
11553  }
11554 #endif
11555  strat->tailRing = res;
11556  return (res);
11557  }
11558  // if sbaOrder == 3 => degree - position - ring order
11559  if (strat->sbaOrder == 3)
11560  {
11561  ring res = rCopy0(r, TRUE, FALSE);
11562  res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
11563  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11564  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11565  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11566  res->wvhdl = wvhdl;
11567  for (int i=2; i<n+2; i++)
11568  {
11569  res->order[i] = r->order[i-2];
11570  res->block0[i] = r->block0[i-2];
11571  res->block1[i] = r->block1[i-2];
11572  res->wvhdl[i] = r->wvhdl[i-2];
11573  }
11574 
11575  // new 1st block
11576  res->order[0] = ringorder_a; // Prefix
11577  res->block0[0] = 1;
11578  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11579  for (int i=0; i<res->N; ++i)
11580  res->wvhdl[0][i] = 1;
11581  res->block1[0] = si_min(res->N, rVar(res));
11582  // new 2nd block
11583  res->order[1] = ringorder_C; // Prefix
11584  res->wvhdl[1] = NULL;
11585  // removes useless secondary component order if defined in old ring
11586  for (int i=rBlocks(res); i>1; --i)
11587  {
11588  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11589  {
11590  res->order[i] = (rRingOrder_t)0;
11591  }
11592  }
11593  rComplete(res, 1);
11594 #ifdef HAVE_PLURAL
11595  if (rIsPluralRing(r))
11596  {
11597  if ( nc_rComplete(r, res, false) ) // no qideal!
11598  {
11599 #ifndef SING_NDEBUG
11600  WarnS("error in nc_rComplete");
11601 #endif
11602  // cleanup?
11603 
11604  // rDelete(res);
11605  // return r;
11606 
11607  // just go on..
11608  }
11609  }
11610 #endif
11611  strat->tailRing = res;
11612  return (res);
11613  }
11614 
11615  // not sbaOrder == 1 => use Schreyer order
11616  // this is done by a trick when initializing the signatures
11617  // in initSLSba():
11618  // Instead of using the signature 1e_i for F->m[i], we start
11619  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11620  // Schreyer order w.r.t. the underlying monomial order.
11621  // => we do not need to change the underlying polynomial ring at all!
11622 
11623  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11624 
11625  /*
11626  else
11627  {
11628  ring res = rCopy0(r, FALSE, FALSE);
11629  // Create 2 more blocks for prefix/suffix:
11630  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11631  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11632  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11633  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11634 
11635  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11636  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11637 
11638  // new 1st block
11639  int j = 0;
11640  res->order[j] = ringorder_IS; // Prefix
11641  res->block0[j] = res->block1[j] = 0;
11642  // wvhdl[j] = NULL;
11643  j++;
11644 
11645  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11646  {
11647  res->order [j] = r->order [i];
11648  res->block0[j] = r->block0[i];
11649  res->block1[j] = r->block1[i];
11650 
11651  if (r->wvhdl[i] != NULL)
11652  {
11653  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11654  } // else wvhdl[j] = NULL;
11655  }
11656 
11657  // new last block
11658  res->order [j] = ringorder_IS; // Suffix
11659  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11660  // wvhdl[j] = NULL;
11661  j++;
11662 
11663  // res->order [j] = 0; // The End!
11664  res->wvhdl = wvhdl;
11665 
11666  // j == the last zero block now!
11667  assume(j == (n+1));
11668  assume(res->order[0]==ringorder_IS);
11669  assume(res->order[j-1]==ringorder_IS);
11670  assume(res->order[j]==0);
11671 
11672  if (complete)
11673  {
11674  rComplete(res, 1);
11675 
11676 #ifdef HAVE_PLURAL
11677  if (rIsPluralRing(r))
11678  {
11679  if ( nc_rComplete(r, res, false) ) // no qideal!
11680  {
11681  }
11682  }
11683  assume(rIsPluralRing(r) == rIsPluralRing(res));
11684 #endif
11685 
11686 
11687 #ifdef HAVE_PLURAL
11688  ring old_ring = r;
11689 
11690 #endif
11691 
11692  if (r->qideal!=NULL)
11693  {
11694  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11695 
11696  assume(idRankFreeModule(res->qideal, res) == 0);
11697 
11698 #ifdef HAVE_PLURAL
11699  if( rIsPluralRing(res) )
11700  if( nc_SetupQuotient(res, r, true) )
11701  {
11702  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11703  }
11704 
11705 #endif
11706  assume(idRankFreeModule(res->qideal, res) == 0);
11707  }
11708 
11709 #ifdef HAVE_PLURAL
11710  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11711  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11712  assume(rIsSCA(res) == rIsSCA(old_ring));
11713  assume(ncRingType(res) == ncRingType(old_ring));
11714 #endif
11715  }
11716  strat->tailRing = res;
11717  return res;
11718  }
11719  */
11720 
11721  assume(FALSE);
11722  return(NULL);
11723 }
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:5563
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#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:562
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:3394
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1365
rRingOrder_t
order stuff
Definition: ring.h:67
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ superenterpairs()

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

Definition at line 4831 of file kutil.cc.

4832 {
4834  // enter also zero divisor * poly, if this is non zero and of smaller degree
4835  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4836  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4837  initenterpairs(h, k, ecart, 0, strat, atR);
4838  clearSbatch(h, k, pos, strat);
4839 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4805
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3769
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4522
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:482
int k
Definition: cfEzgcd.cc:92
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4604
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971

◆ superenterpairsSig()

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

Definition at line 4841 of file kutil.cc.

4842 {
4844  // enter also zero divisor * poly, if this is non zero and of smaller degree
4845  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4846  if(strat->sigdrop) return;
4847  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4848  if(strat->sigdrop) return;
4849  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4850  if(strat->sigdrop) return;
4851  clearSbatch(h, k, pos, strat);
4852 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4805
bool sigdrop
Definition: kutil.h:358
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3894
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:482
int k
Definition: cfEzgcd.cc:92
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition: kutil.cc:4687
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4577
static Poly * h
Definition: janet.cc:971

◆ syzCriterion()

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

Definition at line 7045 of file kutil.cc.

7046 {
7047 //#if 1
7048 #ifdef DEBUGF5
7049  PrintS("syzygy criterion checks: ");
7050  pWrite(sig);
7051 #endif
7052  for (int k=0; k<strat->syzl; k++)
7053  {
7054  //printf("-%d",k);
7055 //#if 1
7056 #ifdef DEBUGF5
7057  Print("checking with: %d / %d -- \n",k,strat->syzl);
7058  pWrite(pHead(strat->syz[k]));
7059 #endif
7060  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7061  && (!rField_is_Ring(currRing) ||
7062  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7063  {
7064 //#if 1
7065 #ifdef DEBUGF5
7066  PrintS("DELETE!\n");
7067 #endif
7068  strat->nrsyzcrit++;
7069  //printf("- T -\n\n");
7070  return TRUE;
7071  }
7072  }
7073  //printf("- F -\n\n");
7074  return FALSE;
7075 }
#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:303
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:44
int nrsyzcrit
Definition: kutil.h:359
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
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:479
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

◆ syzCriterionInc()

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

Definition at line 7080 of file kutil.cc.

7081 {
7082 //#if 1
7083  if(sig == NULL)
7084  return FALSE;
7085 #ifdef DEBUGF5
7086  PrintS("--- syzygy criterion checks: ");
7087  pWrite(sig);
7088 #endif
7089  int comp = __p_GetComp(sig, currRing);
7090  int min, max;
7091  if (comp<=1)
7092  return FALSE;
7093  else
7094  {
7095  min = strat->syzIdx[comp-2];
7096  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7097  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7098  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7099  if (comp == strat->currIdx)
7100  {
7101  max = strat->syzl;
7102  }
7103  else
7104  {
7105  max = strat->syzIdx[comp-1];
7106  }
7107  for (int k=min; k<max; k++)
7108  {
7109 #ifdef F5DEBUG
7110  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7111  Print("checking with: %d -- ",k);
7112  pWrite(pHead(strat->syz[k]));
7113 #endif
7114  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7115  && (!rField_is_Ring(currRing) ||
7116  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7117  {
7118  strat->nrsyzcrit++;
7119  return TRUE;
7120  }
7121  }
7122  return FALSE;
7123  }
7124 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#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:303
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:44
int currIdx
Definition: kutil.h:313
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
int nrsyzcrit
Definition: kutil.h:359
static int max(int a, int b)
Definition: fast_mult.cc:264
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h: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:1853
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:479
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347
intset syzIdx
Definition: kutil.h:309

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4138 of file kutil.cc.

4139 {
4140  return 1L << arg;
4141 }

◆ updateResult()

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

Definition at line 10507 of file kutil.cc.

10508 {
10509  int l;
10510  if (strat->ak>0)
10511  {
10512  for (l=IDELEMS(r)-1;l>=0;l--)
10513  {
10514  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10515  {
10516  pDelete(&r->m[l]); // and set it to NULL
10517  }
10518  }
10519  int q;
10520  poly p;
10521  if(!rField_is_Ring(currRing))
10522  {
10523  for (l=IDELEMS(r)-1;l>=0;l--)
10524  {
10525  if ((r->m[l]!=NULL)
10526  //&& (strat->syzComp>0)
10527  //&& (pGetComp(r->m[l])<=strat->syzComp)
10528  )
10529  {
10530  for(q=IDELEMS(Q)-1; q>=0;q--)
10531  {
10532  if ((Q->m[q]!=NULL)
10533  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10534  {
10535  if (TEST_OPT_REDSB)
10536  {
10537  p=r->m[l];
10538  r->m[l]=kNF(Q,NULL,p);
10539  pDelete(&p);
10540  }
10541  else
10542  {
10543  pDelete(&r->m[l]); // and set it to NULL
10544  }
10545  break;
10546  }
10547  }
10548  }
10549  }
10550  }
10551  #ifdef HAVE_RINGS
10552  else
10553  {
10554  for (l=IDELEMS(r)-1;l>=0;l--)
10555  {
10556  if ((r->m[l]!=NULL)
10557  //&& (strat->syzComp>0)
10558  //&& (pGetComp(r->m[l])<=strat->syzComp)
10559  )
10560  {
10561  for(q=IDELEMS(Q)-1; q>=0;q--)
10562  {
10563  if ((Q->m[q]!=NULL)
10564  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10565  {
10566  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10567  {
10568  if (TEST_OPT_REDSB)
10569  {
10570  p=r->m[l];
10571  r->m[l]=kNF(Q,NULL,p);
10572  pDelete(&p);
10573  }
10574  else
10575  {
10576  pDelete(&r->m[l]); // and set it to NULL
10577  }
10578  break;
10579  }
10580  }
10581  }
10582  }
10583  }
10584  }
10585  #endif
10586  }
10587  else
10588  {
10589  int q;
10590  poly p;
10591  BOOLEAN reduction_found=FALSE;
10592  if (!rField_is_Ring(currRing))
10593  {
10594  for (l=IDELEMS(r)-1;l>=0;l--)
10595  {
10596  if (r->m[l]!=NULL)
10597  {
10598  for(q=IDELEMS(Q)-1; q>=0;q--)
10599  {
10600  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10601  {
10602  if (TEST_OPT_REDSB)
10603  {
10604  p=r->m[l];
10605  r->m[l]=kNF(Q,NULL,p);
10606  pDelete(&p);
10607  reduction_found=TRUE;
10608  }
10609  else
10610  {
10611  pDelete(&r->m[l]); // and set it to NULL
10612  }
10613  break;
10614  }
10615  }
10616  }
10617  }
10618  }
10619  #ifdef HAVE_RINGS
10620  //Also need divisibility of the leading coefficients
10621  else
10622  {
10623  for (l=IDELEMS(r)-1;l>=0;l--)
10624  {
10625  if (r->m[l]!=NULL)
10626  {
10627  for(q=IDELEMS(Q)-1; q>=0;q--)
10628  {
10629  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10630  {
10631  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10632  {
10633  if (TEST_OPT_REDSB)
10634  {
10635  p=r->m[l];
10636  r->m[l]=kNF(Q,NULL,p);
10637  pDelete(&p);
10638  reduction_found=TRUE;
10639  }
10640  else
10641  {
10642  pDelete(&r->m[l]); // and set it to NULL
10643  }
10644  break;
10645  }
10646  }
10647  }
10648  }
10649  }
10650  }
10651  #endif
10652  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10653  {
10654  #ifdef HAVE_RINGS
10656  {
10657  for (l=IDELEMS(r)-1;l>=0;l--)
10658  {
10659  if (r->m[l]!=NULL)
10660  {
10661  for(q=IDELEMS(r)-1;q>=0;q--)
10662  {
10663  if ((l!=q)
10664  && (r->m[q]!=NULL)
10665  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10666  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10667  )
10668  {
10669  //If they are equal then take the one with the smallest length
10670  if(pLmDivisibleBy(r->m[q],r->m[l])
10671  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10672  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10673  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10674  {
10675  pDelete(&r->m[l]);
10676  break;
10677  }
10678  else
10679  pDelete(&r->m[q]);
10680  }
10681  }
10682  }
10683  }
10684  }
10685  else
10686  #endif
10687  {
10688  for (l=IDELEMS(r)-1;l>=0;l--)
10689  {
10690  if (r->m[l]!=NULL)
10691  {
10692  for(q=IDELEMS(r)-1;q>=0;q--)
10693  {
10694  if ((l!=q)
10695  && (r->m[q]!=NULL)
10696  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10697  )
10698  {
10699  //If they are equal then take the one with the smallest length
10700  if(pLmDivisibleBy(r->m[q],r->m[l])
10701  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10702  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10703  {
10704  pDelete(&r->m[l]);
10705  break;
10706  }
10707  else
10708  pDelete(&r->m[q]);
10709  }
10710  }
10711  }
10712  }
10713  }
10714  }
10715  }
10716  idSkipZeroes(r);
10717 }
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:351
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
#define pGetComp(p)
Component.
Definition: polys.h:37
#define nGreaterZero(n)
Definition: numbers.h:27
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define IDELEMS(i)
Definition: simpleideals.h:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#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:12
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 9034 of file kutil.cc.

9035 {
9036  LObject h;
9037  int i, suc=0;
9038  poly redSi=NULL;
9039  BOOLEAN change,any_change;
9040 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9041 // for (i=0; i<=(strat->sl); i++)
9042 // {
9043 // Print("s%d:",i);
9044 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9045 // pWrite(strat->S[i]);
9046 // }
9047 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9048  any_change=FALSE;
9050  {
9051  while (suc != -1)
9052  {
9053  i=suc+1;
9054  while (i<=strat->sl)
9055  {
9056  change=FALSE;
9058  any_change = FALSE;
9059  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9060  {
9061  redSi = pHead(strat->S[i]);
9062  strat->S[i] = redBba(strat->S[i],i-1,strat);
9063  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9064  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9065  if (pCmp(redSi,strat->S[i])!=0)
9066  {
9067  change=TRUE;
9068  any_change=TRUE;
9069  #ifdef KDEBUG
9070  if (TEST_OPT_DEBUG)
9071  {
9072  PrintS("reduce:");
9073  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9074  }
9075  #endif
9076  if (TEST_OPT_PROT)
9077  {
9078  if (strat->S[i]==NULL)
9079  PrintS("V");
9080  else
9081  PrintS("v");
9082  mflush();
9083  }
9084  }
9085  pLmDelete(&redSi);
9086  if (strat->S[i]==NULL)
9087  {
9088  deleteInS(i,strat);
9089  i--;
9090  }
9091  else if (change)
9092  {
9094  {
9095  if (TEST_OPT_CONTENTSB)
9096  {
9097  number n;
9098  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
9099  if (!nIsOne(n))
9100  {
9102  denom->n=nInvers(n);
9103  denom->next=DENOMINATOR_LIST;
9104  DENOMINATOR_LIST=denom;
9105  }
9106  nDelete(&n);
9107  }
9108  else
9109  {
9110  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
9111  }
9112  }
9113  else
9114  {
9115  pNorm(strat->S[i]);
9116  }
9117  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9118  }
9119  }
9120  i++;
9121  }
9122  if (any_change) reorderS(&suc,strat);
9123  else break;
9124  }
9125  if (toT)
9126  {
9127  for (i=0; i<=strat->sl; i++)
9128  {
9129  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9130  {
9131  h.p = redtailBba(strat->S[i],i-1,strat);
9133  {
9134  h.pCleardenom();// also does remove Content
9135  }
9136  }
9137  else
9138  {
9139  h.p = strat->S[i];
9140  }
9141  strat->initEcart(&h);
9142  if (strat->honey)
9143  {
9144  strat->ecartS[i] = h.ecart;
9145  }
9146  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9147  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9148  h.sev = strat->sevS[i];
9149  /*puts the elements of S also to T*/
9150  strat->initEcart(&h);
9151  enterT(h,strat);
9152  strat->S_2_R[i] = strat->tl;
9153  }
9154  }
9155  }
9156  else
9157  {
9158  while (suc != -1)
9159  {
9160  i=suc;
9161  while (i<=strat->sl)
9162  {
9163  change=FALSE;
9164  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9165  {
9166  redSi=pHead((strat->S)[i]);
9167  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9168  if ((strat->S)[i]==NULL)
9169  {
9170  deleteInS(i,strat);
9171  i--;
9172  }
9173  else if (pCmp((strat->S)[i],redSi)!=0)
9174  {
9175  any_change=TRUE;
9176  h.p = strat->S[i];
9177  strat->initEcart(&h);
9178  strat->ecartS[i] = h.ecart;
9180  {
9181  if (TEST_OPT_CONTENTSB)
9182  {
9183  number n;
9184  p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
9185  if (!nIsOne(n))
9186  {
9188  denom->n=nInvers(n);
9189  denom->next=DENOMINATOR_LIST;
9190  DENOMINATOR_LIST=denom;
9191  }
9192  nDelete(&n);
9193  }
9194  else
9195  {
9196  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
9197  }
9198  }
9199  else
9200  {
9201  pNorm(strat->S[i]); // == h.p
9202  }
9203  h.sev = pGetShortExpVector(h.p);
9204  strat->sevS[i] = h.sev;
9205  }
9206  pLmDelete(&redSi);
9207  kTest(strat);
9208  }
9209  i++;
9210  }
9211 #ifdef KDEBUG
9212  kTest(strat);
9213 #endif
9214  if (any_change) reorderS(&suc,strat);
9215  else { suc=-1; break; }
9216  if (h.p!=NULL)
9217  {
9218  if (!strat->kHEdgeFound)
9219  {
9220  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9221  }
9222  if (strat->kHEdgeFound)
9223  newHEdge(strat);
9224  }
9225  }
9226  for (i=0; i<=strat->sl; i++)
9227  {
9228  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9229  {
9230  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9231  strat->initEcart(&h);
9232  strat->ecartS[i] = h.ecart;
9233  h.sev = pGetShortExpVector(h.p);
9234  strat->sevS[i] = h.sev;
9235  }
9236  else
9237  {
9238  h.p = strat->S[i];
9239  h.ecart=strat->ecartS[i];
9240  h.sev = strat->sevS[i];
9241  h.length = h.pLength = pLength(h.p);
9242  }
9243  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9244  cancelunit1(&h,&suc,strat->sl,strat);
9245  h.SetpFDeg();
9246  /*puts the elements of S also to T*/
9247  enterT(h,strat);
9248  strat->S_2_R[i] = strat->tl;
9249  }
9250  if (suc!= -1) updateS(toT,strat);
9251  }
9252 #ifdef KDEBUG
9253  kTest(strat);
9254 #endif
9255 }
denominator_list_s * denominator_list
Definition: kutil.h:59
char kHEdgeFound
Definition: kutil.h:374
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:340
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8877
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:4982
#define TEST_OPT_CONTENTSB
Definition: options.h:125
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:88
#define kTest(A)
Definition: kutil.h:653
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
#define TEST_OPT_DEBUG
Definition: options.h:107
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:468
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8965
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9576
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2900
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7481
#define nInvers(a)
Definition: numbers.h:33
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:358
denominator_list next
Definition: kutil.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9034
unsigned long * sevS
Definition: kutil.h:318
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char honey
Definition: kutil.h:375
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8989
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10841
void wrp(poly p)
Definition: polys.h:305
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2791

◆ updateSShift()

void updateSShift ( kStrategy  strat)

Definition at line 12183 of file kutil.cc.

12184 {
12185  /* to use after updateS(toT=FALSE,strat) */
12186  /* fills T with shifted elt's of S */
12187  int i;
12188  LObject h;
12189  int atT = -1; // or figure out smth better
12190  strat->tl = -1; // init
12191  for (i=0; i<=strat->sl; i++)
12192  {
12193  memset(&h,0,sizeof(h));
12194  h.p = strat->S[i];
12195  strat->initEcart(&h);
12196  h.sev = strat->sevS[i];
12197  h.t_p = NULL;
12198  h.GetTP(); // creates correct t_p
12199  /*puts the elements of S with their shifts to T*/
12200  // int atT, int uptodeg, int lV)
12201  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12202  // need a small check for above; we insert >=1 elements
12203  // insert this check into kTest_TS ?
12204  enterTShift(h,strat,atT);
12205  }
12206  /* what about setting strat->tl? */
12207 }
void enterTShift(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:12759
class sLObject LObject
Definition: kutil.h:54
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int i
Definition: cfEzgcd.cc:125
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:12
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static Poly * h
Definition: janet.cc:971

Variable Documentation

◆ DENOMINATOR_LIST

denominator_list DENOMINATOR_LIST

Definition at line 88 of file kutil.cc.

◆ HCord

int HCord

Definition at line 236 of file kutil.cc.

◆ strat_nr

int strat_nr

Definition at line 21 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.