source: git/kernel/kutil.h @ 737a68

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