source: git/kernel/kutil.h @ d5564f8

fieker-DuValspielwiese
Last change on this file since d5564f8 was d5564f8, checked in by Hans Schönemann <hannes@…>, 15 years ago
*hannes: expoent overflow stuff git-svn-id: file:///usr/local/Singular/svn/trunk@11972 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 22.8 KB
Line 
1#ifndef KUTIL_H
2#define KUTIL_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: kutil.h,v 1.48 2009-07-10 15:13:57 Singular Exp $ */
7/*
8* ABSTRACT: kernel: utils for kStd
9*/
10
11
12#include <string.h>
13#include <mylimits.h>
14
15#include "structs.h"
16#include "omalloc.h"
17#include "ring.h"
18#include "structs.h"
19#include "pShallowCopyDelete.h"
20
21#if 1
22#define setmax 16
23#define setmaxL ((4096-12)/sizeof(LObject))
24#define setmaxLinc ((4096)/sizeof(LObject))
25
26#define setmaxT 64
27#define setmaxTinc 32
28#else
29#define setmax 16
30#define setmaxL 16
31#define setmaxLinc 16
32#define setmaxT 16
33#define setmaxTinc 16
34#endif
35
36// define if you want std computations as in Singular version < 2
37// This disbales RedThrough, tailReductions against T (bba),
38// sets posInT = posInT15 (bba, strat->honey), and enables redFirst with LDeg
39// NOTE: the same effect can be achieved with option(oldStd)
40// #define HAVE_OLD_STD
41
42#ifdef HAVE_OLD_STD
43#define K_TEST_OPT_REDTHROUGH 0
44#define K_TEST_OPT_OLDSTD 1
45#else
46#define K_TEST_OPT_REDTHROUGH TEST_OPT_REDTHROUGH
47#define K_TEST_OPT_OLDSTD     TEST_OPT_OLDSTD
48#endif
49
50#undef NO_KINLINE
51#if !defined(KDEBUG) && !defined(NO_INLINE)
52#define KINLINE inline
53#else
54#define KINLINE
55#define NO_KINLINE 1
56#endif
57
58typedef int* intset;
59typedef int64  wlen_type;
60typedef wlen_type* wlen_set;
61
62typedef class sTObject TObject;
63typedef class sLObject LObject;
64typedef TObject * TSet;
65typedef LObject * LSet;
66
67class sTObject
68{
69public:
70  poly p;       // Lm(p) \in currRing Tail(p) \in tailRing
71  poly t_p;     // t_p \in tailRing: as monomials Lm(t_p) == Lm(p)
72  poly max;     // p_GetMaxExpP(pNext(p))
73  ring tailRing;
74  long FDeg;    // pFDeg(p)
75  int ecart,
76    length,     // as of pLDeg
77    pLength,    // either == 0, or == pLength(p)
78    i_r;        // index of TObject in R set, or -1 if not in T
79  BOOLEAN is_normalized; // true, if pNorm was called on p, false otherwise
80
81  // initialization
82  KINLINE void Init(ring r = currRing);
83  KINLINE sTObject(ring tailRing = currRing);
84  KINLINE sTObject(poly p, ring tailRing = currRing);
85  KINLINE sTObject(poly p, ring c_r, ring tailRing);
86  KINLINE sTObject(sTObject* T, int copy);
87
88  KINLINE void Set(ring r=currRing);
89  KINLINE void Set(poly p_in, ring r=currRing);
90  KINLINE void Set(poly p_in, ring c_r, ring t_r);
91
92  // Frees the polys of T
93  KINLINE void Delete();
94  // Sets polys to NULL
95  KINLINE void Clear();
96  // makes a copy of the poly of T
97  KINLINE void Copy();
98
99  // ring-dependent Lm access: these might result in allocation of monomials
100  KINLINE poly GetLmCurrRing();
101  KINLINE poly GetLmTailRing();
102  KINLINE poly GetLm(ring r);
103  // this returns Lm and ring r (preferably from tailRing), but does not
104  // allocate a new poly
105  KINLINE void GetLm(poly &p, ring &r) const;
106
107#ifdef OLIVER_PRIVAT_LT
108  // routines for calc. with rings
109  KINLINE poly GetLtCurrRing();
110  KINLINE poly GetLtTailRing();
111  KINLINE poly GetLt(ring r);
112  KINLINE void GetLt(poly &p, ring &r) const;
113#endif
114
115  KINLINE BOOLEAN IsNull() const;
116
117  KINLINE int GetpLength();
118
119  // makes sure that T.p exists
120  KINLINE void SetLmCurrRing();
121
122  // Iterations
123  // simply get the next monomial
124  KINLINE poly Next();
125  KINLINE void LmDeleteAndIter();
126
127  // deg stuff
128  // compute pTotalDegree
129  KINLINE long pTotalDeg() const;
130  // computes pFDeg
131  KINLINE long pFDeg() const;
132  // computes and sets FDeg
133  KINLINE long SetpFDeg();
134  // gets stored FDeg
135  KINLINE long GetpFDeg() const;
136
137  // computes pLDeg
138  KINLINE long pLDeg();
139  // sets length, FDeg, returns LDeg
140  KINLINE long SetDegStuffReturnLDeg();
141
142  // arithmetic
143  KINLINE void Mult_nn(number n);
144  KINLINE void ShallowCopyDelete(ring new_tailRing, omBin new_tailBin,
145                                 pShallowCopyDeleteProc p_shallow_copy_delete,
146                                 BOOLEAN set_max = TRUE);
147  // manipulations
148  KINLINE void pNorm();
149  KINLINE void pCleardenom();
150
151#ifdef KDEBUG
152  void wrp();
153#endif
154};
155
156#ifndef NDEBUG
157extern int strat_nr;
158extern int strat_fac_debug;
159#endif
160
161class sLObject : public sTObject
162{
163
164public:
165  unsigned long sev;
166  poly  p1,p2; /*- the pair p comes from,
167                 lm(pi) in currRing, tail(pi) in tailring -*/
168
169  poly  lcm;   /*- the lcm of p1,p2 -*/
170  poly last;   // pLast(p) during reductions
171  kBucket_pt bucket;
172  int   i_r1, i_r2;
173
174  // initialization
175  KINLINE void Init(ring tailRing = currRing);
176  KINLINE sLObject(ring tailRing = currRing);
177  KINLINE sLObject(poly p, ring tailRing = currRing);
178  KINLINE sLObject(poly p, ring c_r, ring tailRing);
179
180  // Frees the polys of L
181  KINLINE void Delete();
182  KINLINE void Clear();
183
184  // Iterations
185  KINLINE void LmDeleteAndIter();
186  KINLINE poly LmExtractAndIter();
187
188  // spoly related things
189  // preparation for reduction if not spoly
190  KINLINE void PrepareRed(BOOLEAN use_bucket);
191  KINLINE void SetLmTail(poly lm, poly new_p, int length,
192                         int use_bucket, ring r, poly last);
193  KINLINE void Tail_Minus_mm_Mult_qq(poly m, poly qq, int lq, poly spNoether);
194  KINLINE void Tail_Mult_nn(number n);
195  // deletes bucket, makes sure that p and t_p exists
196  KINLINE poly GetP(omBin lmBin = NULL);
197  // similar, except that only t_p exists
198  KINLINE poly GetTP();
199
200  // does not delete bucket, just canonicalizes it
201  // returned poly is such that Lm(p) \in currRing, Tail(p) \in tailRing
202  KINLINE poly CanonicalizeP();
203
204  // makes a copy of the poly of L
205  KINLINE void Copy();
206  // gets the poly and makes a copy of it
207  KINLINE poly CopyGetP();
208
209  KINLINE int GetpLength();
210  KINLINE long pLDeg(BOOLEAN use_last);
211  KINLINE long pLDeg();
212  KINLINE int SetLength(BOOLEAN lengt_pLength = FALSE);
213  KINLINE long SetDegStuffReturnLDeg();
214  KINLINE long SetDegStuffReturnLDeg(BOOLEAN use_last);
215
216  // returns minimal component of p
217  KINLINE long MinComp();
218  // returns component of p
219  KINLINE long Comp();
220
221  KINLINE void ShallowCopyDelete(ring new_tailRing,
222                                 pShallowCopyDeleteProc p_shallow_copy_delete);
223
224  // sets sev
225  KINLINE void SetShortExpVector();
226
227  // enable assignment from TObject
228  KINLINE sLObject& operator=(const sTObject&);
229
230  // get T's corresponding to p1, p2: they might return NULL
231  KINLINE TObject* T_1(const skStrategy* strat);
232  KINLINE TObject* T_2(const skStrategy* strat);
233  KINLINE void     T_1_2(const skStrategy* strat,
234                         TObject* &T_1, TObject* &T_2);
235
236  // simplify coefficients
237  KINLINE void Normalize();
238  KINLINE void HeadNormalize();
239};
240
241
242extern int HCord;
243
244class skStrategy;
245typedef skStrategy * kStrategy;
246class skStrategy
247{
248public:
249  kStrategy next;
250  int (*red)(LObject * L,kStrategy strat);
251  void (*initEcart)(LObject * L);
252  int (*posInT)(const TSet T,const int tl,LObject &h);
253  int (*posInL)(const LSet set, const int length,
254                LObject* L,const kStrategy strat);
255  void (*enterS)(LObject h, int pos,kStrategy strat, int atR/* =-1*/ );
256  void (*initEcartPair)(LObject * h, poly f, poly g, int ecartF, int ecartG);
257  int (*posInLOld)(const LSet Ls,const int Ll,
258                   LObject* Lo,const kStrategy strat);
259  void (*enterOnePair) (int i,poly p,int ecart, int isFromQ,kStrategy strat, int atR /*= -1*/);
260  void (*chainCrit) (poly p,int ecart,kStrategy strat);
261  pFDegProc pOrigFDeg;
262  pLDegProc pOrigLDeg;
263  pFDegProc pOrigFDeg_TailRing;
264  pLDegProc pOrigLDeg_TailRing;
265
266  LObject P;
267  ideal Shdl;
268  ideal D; /*V(S) is in D(D)*/
269  ideal M; /*set of minimal generators*/
270  polyset S;
271  intset ecartS;
272  intset lenS;
273  wlen_set lenSw; /* for tgb.ccc */
274  intset fromQ;
275  unsigned long* sevS;
276  unsigned long* sevT;
277  TSet T;
278  LSet L;
279  LSet    B;
280  poly    kHEdge;
281  poly    kNoether;
282  poly    t_kHEdge; // same polys in tailring
283  KINLINE poly    kNoetherTail();
284  poly    t_kNoether;
285  BOOLEAN * NotUsedAxis;
286  BOOLEAN * pairtest;/*used for enterOnePair*/
287  poly tail;
288  leftv kIdeal;
289  intvec * kModW;
290  intvec * kHomW;
291  // procedure for ShalloCopy from tailRing  to currRing
292  pShallowCopyDeleteProc p_shallow_copy_delete;
293  // pointers to Tobjects R[i] is ith Tobject which is generated
294  TObject**  R;
295  // S_2_R[i] yields Tobject which corresponds to S[i]
296  int*      S_2_R;
297  ring tailRing;
298  omBin lmBin;
299  omBin tailBin;
300#ifndef NDEBUG
301  int nr;
302#endif
303  int cp,c3;
304  int cv; // in shift bases: counting V criterion
305  int sl,mu;
306  int tl,tmax;
307  int Ll,Lmax;
308  int Bl,Bmax;
309  int ak,LazyDegree,LazyPass;
310  int syzComp;
311  int HCord;
312  int lastAxis;
313  int newIdeal;
314  int minim;
315  #ifdef HAVE_SHIFTBBA
316  int lV;
317  #endif
318  BOOLEAN interpt;
319  BOOLEAN homog;
320#ifdef HAVE_PLURAL
321  BOOLEAN z2homog; // Z_2 - homogeneous input allows product criterion in commutative and SCA cases!
322#endif
323  BOOLEAN kHEdgeFound;
324  BOOLEAN honey,sugarCrit;
325  BOOLEAN Gebauer,noTailReduction;
326  BOOLEAN fromT;
327  BOOLEAN noetherSet;
328  BOOLEAN update;
329  BOOLEAN posInLOldFlag;
330  BOOLEAN use_buckets;
331  BOOLEAN interred_flag;
332  // if set, pLDeg(p, l) == (pFDeg(pLast(p), pLength)
333  BOOLEAN LDegLast;
334  // if set, then L.length == L.pLength
335  BOOLEAN length_pLength;
336  // if set, then posInL does not depend on L.length
337  BOOLEAN posInLDependsOnLength;
338  /*FALSE, if posInL == posInL10*/
339#ifdef HAVE_PLURAL
340  // set this flag to 1 to stop the product criteria
341  // use ALLOW_PROD_CRIT(strat) to test
342  BOOLEAN no_prod_crit;
343#define ALLOW_PROD_CRIT(A) (!(A)->no_prod_crit)
344#else
345#define ALLOW_PROD_CRIT(A) (1)
346#endif
347  char    redTailChange;
348  char    news;
349  char    newt;/*used for messageSets*/
350  char    noClearS;
351  char    completeReduce_retry;
352  char    overflow;
353
354  skStrategy();
355  ~skStrategy();
356
357  // return TObject corresponding to S[i]: assume that it exists
358  // i.e. no error checking is done
359  KINLINE TObject* S_2_T(int i);
360  // like S_2_T, except that NULL is returned if it can not be found
361  KINLINE TObject* s_2_t(int i);
362};
363
364void deleteHC(poly *p, int *e, int *l, kStrategy strat);
365void deleteHC(LObject* L, kStrategy strat, BOOLEAN fromNext = FALSE);
366void deleteInS (int i,kStrategy strat);
367void cleanT (kStrategy strat);
368static inline LSet initL (int nr=setmaxL)
369{ return (LSet)omAlloc(nr*sizeof(LObject)); };
370void deleteInL(LSet set, int *length, int j,kStrategy strat);
371void enterL (LSet *set,int *length, int *LSetmax, LObject p,int at);
372void enterSBba (LObject p,int atS,kStrategy strat, int atR = -1);
373void initEcartPairBba (LObject* Lp,poly f,poly g,int ecartF,int ecartG);
374void initEcartPairMora (LObject* Lp,poly f,poly g,int ecartF,int ecartG);
375int posInS (const kStrategy strat, const int length, const poly p, 
376            const int ecart_p);
377int posInT0 (const TSet set,const int length,LObject &p);
378int posInT1 (const TSet set,const int length,LObject &p);
379int posInT2 (const TSet set,const int length,LObject &p);
380int posInT11 (const TSet set,const int length,LObject &p);
381int posInT110 (const TSet set,const int length,LObject &p);
382int posInT13 (const TSet set,const int length,LObject &p);
383int posInT15 (const TSet set,const int length,LObject &p);
384int posInT17 (const TSet set,const int length,LObject &p);
385int posInT19 (const TSet set,const int length,LObject &p);
386int posInT_EcartpLength(const TSet set,const int length,LObject &p);
387
388#ifdef HAVE_MORE_POS_IN_T
389int posInT_EcartFDegpLength(const TSet set,const int length,LObject &p);
390int posInT_FDegpLength(const TSet set,const int length,LObject &p);
391int posInT_pLength(const TSet set,const int length,LObject &p);
392#endif
393
394
395void reorderS (int* suc,kStrategy strat);
396int posInL0 (const LSet set, const int length,
397             LObject* L,const kStrategy strat);
398int posInL11 (const LSet set, const int length,
399             LObject* L,const kStrategy strat);
400int posInL13 (const LSet set, const int length,
401             LObject* L,const kStrategy strat);
402int posInL15 (const LSet set, const int length,
403             LObject* L,const kStrategy strat);
404int posInL17 (const LSet set, const int length,
405             LObject* L,const kStrategy strat);
406int posInL10 (const LSet set, const int length,
407             LObject* L,const kStrategy strat);
408KINLINE poly redtailBba (poly p,int pos,kStrategy strat,BOOLEAN normalize=FALSE);
409#ifdef HAVE_RINGS
410KINLINE poly redtailBba_Z (poly p,int pos,kStrategy strat);
411poly redtailBba_Z (LObject* L, int pos, kStrategy strat );
412#endif
413poly redtailBba (LObject *L, int pos,kStrategy strat,
414                 BOOLEAN withT = FALSE,BOOLEAN normalize=FALSE);
415poly redtailBba (TObject *T, int pos,kStrategy strat);
416poly redtail (poly p,int pos,kStrategy strat);
417poly redtail (LObject *L,int pos,kStrategy strat);
418poly redNF (poly h,int & max_ind,int nonorm,kStrategy strat);
419int redNF0 (LObject *P,kStrategy strat);
420poly redNFTail (poly h,const int sl,kStrategy strat);
421int redHoney (LObject* h, kStrategy strat);
422#ifdef HAVE_RINGS
423int redRing (LObject* h,kStrategy strat);
424void enterExtendedSpoly(poly h,kStrategy strat);
425void superenterpairs (poly h,int k,int ecart,int pos,kStrategy strat, int atR = -1);
426poly kCreateZeroPoly(long exp[], long cabsind, poly* t_p, ring leadRing, ring tailRing);
427long ind2(long arg);
428
429long ind_fact_2(long arg);
430long twoPow(long arg);
431ideal createG0();
432#endif
433int redLazy (LObject* h,kStrategy strat);
434int redHomog (LObject* h,kStrategy strat);
435void enterpairs (poly h, int k, int ec, int pos,kStrategy strat, int atR = -1);
436void entersets (LObject h);
437void pairs ();
438void message (int i,int* reduc,int* olddeg,kStrategy strat,int red_result);
439void messageStat (int srmax,int lrmax,int hilbcount,kStrategy strat);
440#ifdef KDEBUG
441void messageSets (kStrategy strat);
442#else
443#define messageSets(s)  ((void) 0)
444#endif
445
446void initEcartNormal (LObject* h);
447void initEcartBBA (LObject* h);
448void initS (ideal F, ideal Q,kStrategy strat);
449void initSL (ideal F, ideal Q,kStrategy strat);
450void updateS(BOOLEAN toT,kStrategy strat);
451void enterT (LObject p,kStrategy strat, int atT = -1);
452void cancelunit (LObject* p,BOOLEAN inNF=FALSE);
453void HEckeTest (poly pp,kStrategy strat);
454void initBuchMoraCrit(kStrategy strat);
455void initHilbCrit(ideal F, ideal Q, intvec **hilb,kStrategy strat);
456void initBuchMoraPos(kStrategy strat);
457void initBuchMora (ideal F, ideal Q,kStrategy strat);
458void exitBuchMora (kStrategy strat);
459void updateResult(ideal r,ideal Q,kStrategy strat);
460void completeReduce (kStrategy strat, BOOLEAN withT=FALSE);
461void kFreeStrat(kStrategy strat);
462void enterOnePairNormal (int i,poly p,int ecart, int isFromQ,kStrategy strat, int atR);
463void chainCritNormal (poly p,int ecart,kStrategy strat);
464BOOLEAN homogTest(polyset F, int Fmax);
465BOOLEAN newHEdge(polyset S, kStrategy strat);
466// returns index of p in TSet, or -1 if not found
467int kFindInT(poly p, TSet T, int tlength);
468
469// return -1 if no divisor is found
470//        number of first divisor, otherwise
471int kFindDivisibleByInT(const TSet &T, const unsigned long* sevT,
472                        const int tl, const LObject* L, const int start=0);
473// same with S
474int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject* L);
475
476int kFindNextDivisibleByInS(const kStrategy strat, int start,int max_ind, LObject* L);
477TObject*
478kFindDivisibleByInS(kStrategy strat, int pos, LObject* L, TObject *T,
479                    long ecart = LONG_MAX);
480
481/***************************************************************
482 *
483 * stuff to be inlined
484 *
485 ***************************************************************/
486
487KINLINE TSet initT ();
488KINLINE TObject** initR();
489KINLINE unsigned long* initsevT();
490KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin bin);
491KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin bin);
492KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin bin);
493KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing,  omBin bin);
494
495KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing);
496KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing);
497KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing);
498KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing);
499
500// if exp bound is not violated, return TRUE and
501//                               get m1 = LCM(LM(p1), LM(p2))/LM(p1)
502//                                   m2 = LCM(LM(p1), LM(p2))/LM(p2)
503// return FALSE and m1 == NULL, m2 == NULL     , otherwise
504KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r,
505                               poly &m1, poly &m2, const ring m_r);
506#ifdef HAVE_RINGS
507KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing,
508                               poly &m1, poly &m2, poly &lcm, const ring taiRing);
509#endif
510#ifdef KDEBUG
511// test strat
512BOOLEAN kTest(kStrategy strat);
513// test strat, and test that S is contained in T
514BOOLEAN kTest_TS(kStrategy strat);
515// test LObject
516BOOLEAN kTest_L(LObject* L, ring tailRing = NULL,
517                 BOOLEAN testp = FALSE, int lpos = -1,
518                 TSet T = NULL, int tlength = -1);
519// test TObject
520BOOLEAN kTest_T(TObject* T, ring tailRing = NULL, int tpos = -1, char TN = '?');
521// test set strat->SevS
522BOOLEAN kTest_S(kStrategy strat);
523#else
524#define kTest(A)        ((void)0)
525#define kTest_TS(A)     ((void)0)
526#define kTest_T(T)      ((void)0)
527#define kTest_S(T)      ((void)0)
528#define kTest_L(T)      ((void)0)
529#endif
530
531
532/***************************************************************
533 *
534 * From kstd2.cc
535 *
536 ***************************************************************/
537poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing);
538ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat);
539poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce);
540ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce);
541void initBba(ideal F,kStrategy strat);
542
543/***************************************************************
544 *
545 * From kSpolys.cc
546 *
547 ***************************************************************/
548// Reduces PR with PW
549// Assumes PR != NULL, PW != NULL, Lm(PW) divides Lm(PR)
550// Changes: PR
551// Const:   PW
552// If coef != NULL, then *coef is a/gcd(a,b), where a = LC(PR), b = LC(PW)
553// If strat != NULL, tailRing is changed if reduction would violate exp bound
554// of tailRing
555// Returns: 0 everything ok, no tailRing change
556//          1 tailRing has successfully changed (strat != NULL)
557//          2 no reduction performed, tailRing needs to be changed first
558//            (strat == NULL)
559//         -1 tailRing change could not be performed due to exceeding exp
560//            bound of currRing
561int ksReducePoly(LObject* PR,
562                 TObject* PW,
563                 poly spNoether = NULL,
564                 number *coef = NULL,
565                 kStrategy strat = NULL);
566
567// Reduces PR at Current->next with PW
568// Assumes PR != NULL, Current contained in PR
569//         Current->next != NULL, LM(PW) devides LM(Current->next)
570// Changes: PR
571// Const:   PW
572// Return: see ksReducePoly
573int ksReducePolyTail(LObject* PR,
574                     TObject* PW,
575                     poly Current,
576                     poly spNoether = NULL);
577
578KINLINE int ksReducePolyTail(LObject* PR, TObject* PW, LObject* Red);
579
580// Creates S-Poly of Pair
581// Const:   Pair->p1, Pair->p2
582// Changes: Pair->p == S-Poly of p1, p2
583// Assume:  Pair->p1 != NULL && Pair->p2
584void ksCreateSpoly(LObject* Pair, poly spNoether = NULL,
585                   int use_buckets=0, ring tailRing=currRing,
586                   poly m1 = NULL, poly m2 = NULL, TObject** R = NULL);
587
588/*2
589* creates the leading term of the S-polynomial of p1 and p2
590* do not destroy p1 and p2
591* remarks:
592*   1. the coefficient is 0 (nNew)
593*   2. pNext is undefined
594*/
595poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing);
596
597
598/*
599* input - output: a, b
600* returns:
601*   a := a/gcd(a,b), b := b/gcd(a,b)
602*   and return value
603*       0  ->  a != 1,  b != 1
604*       1  ->  a == 1,  b != 1
605*       2  ->  a != 1,  b == 1
606*       3  ->  a == 1,  b == 1
607*   this value is used to control the spolys
608*/
609int ksCheckCoeff(number *a, number *b);
610
611// old stuff
612KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether = NULL);
613KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether = NULL);
614KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether = NULL, ring r = currRing);
615KINLINE void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether, ring r = currRing);
616
617/***************************************************************
618 *
619 * Routines related for ring changes during std computations
620 *
621 ***************************************************************/
622// return TRUE and set m1, m2 to k_GetLcmTerms,
623//             if spoly creation of strat->P does not violate
624//             exponent bound of strat->tailRing
625//      FALSE, otherwise
626BOOLEAN kCheckSpolyCreation(LObject* L, kStrategy strat, poly &m1, poly &m2);
627#ifdef HAVE_RINGS
628// return TRUE if gcdpoly creation of R[atR] and S[atS] does not violate
629//             exponent bound of strat->tailRing
630//      FALSE, otherwise
631BOOLEAN kCheckStrongCreation(int atR, poly m1, int atS, poly m2, kStrategy strat);
632#endif
633// change strat->tailRing and adjust all data in strat, L, and T:
634// new tailRing has larger exponent bound
635// do nothing and return FALSE if exponent bound increase would result in
636// larger exponent bound that that of currRing
637BOOLEAN kStratChangeTailRing(kStrategy strat,
638                             LObject* L = NULL, TObject* T = NULL,
639                             // take this as new_expbound: if 0
640                             // new expbound is 2*expbound of tailRing
641                             unsigned long new_expbound = 0);
642// initiate a change of the tailRing of strat -- should be called
643// right before main loop in bba
644void kStratInitChangeTailRing(kStrategy strat);
645
646KINLINE void clearS (poly p, unsigned long p_sev, int* at, int* k,
647  kStrategy strat);
648#include "kInline.cc"
649
650/* shiftgb stuff */
651#include "shiftgb.h"
652
653poly pMove2CurrTail(poly p, kStrategy strat);
654
655poly pMoveCurrTail2poly(poly p, kStrategy strat);
656
657poly pCopyL2p(LObject h, kStrategy strat);
658
659void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV);
660
661void initBuchMoraShift (ideal F,ideal Q,kStrategy strat);
662
663void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); // ok
664
665void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV);
666
667void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int uptodeg, int lV); // ok
668
669void enterpairsShift (poly h,int k,int ecart,int pos,kStrategy strat, int atR,int uptodeg, int lV);
670
671void initenterpairsShift (poly h,int k,int ecart,int isFromQ,kStrategy strat, int atR,int uptodeg, int lV); 
672
673void updateSShift(kStrategy strat,int uptodeg,int lV);
674
675void initBbaShift(ideal F,kStrategy strat);
676
677poly redtailBbaShift (LObject* L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize);
678
679int redFirstShift (LObject* h,kStrategy strat); // ok
680
681ideal freegb(ideal I, int uptodeg, int lVblock);
682
683ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV);
684// test syz strategy: // will be removed soon
685extern  int (*test_PosInT)(const TSet T,const int tl,LObject &h);
686extern  int (*test_PosInL)(const LSet set, const int length,
687                LObject* L,const kStrategy strat);
688#endif
Note: See TracBrowser for help on using the repository browser.