source: git/kernel/kutil.h @ c6474a

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