1 | #ifndef KUTIL_H |
---|
2 | #define KUTIL_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: kutil.h,v 1.51 2000-12-19 18:31:42 obachman Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: kernel: utils for kStd |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | #include <string.h> |
---|
13 | #include "mod2.h" |
---|
14 | |
---|
15 | #include "structs.h" |
---|
16 | #include "omalloc.h" |
---|
17 | #include "ring.h" |
---|
18 | #include "tok.h" |
---|
19 | #include "pShallowCopyDelete.h" |
---|
20 | |
---|
21 | #define setmax 16 |
---|
22 | |
---|
23 | // define if you want std computations as in Singular version < 2 |
---|
24 | // This disbales RedThrough, tailReductions against T (bba), |
---|
25 | // sets posInT = posInT15 (bba, strat->honey), and enables redFirst with LDeg |
---|
26 | // NOTE: the same effect can be achieved with option(oldStd) |
---|
27 | // #define HAVE_OLD_STD |
---|
28 | |
---|
29 | #ifdef HAVE_OLD_STD |
---|
30 | #define K_TEST_OPT_REDTHROUGH 0 |
---|
31 | #define K_TEST_OPT_OLDSTD 1 |
---|
32 | #else |
---|
33 | #define K_TEST_OPT_REDTHROUGH TEST_OPT_REDTHROUGH |
---|
34 | #define K_TEST_OPT_OLDSTD TEST_OPT_OLDSTD |
---|
35 | #endif |
---|
36 | |
---|
37 | #undef NO_KINLINE |
---|
38 | #if !defined(KDEBUG) && !defined(NO_INLINE) |
---|
39 | #define KINLINE inline |
---|
40 | #else |
---|
41 | #define KINLINE |
---|
42 | #define NO_KINLINE 1 |
---|
43 | #endif |
---|
44 | |
---|
45 | typedef int* intset; |
---|
46 | typedef class sTObject TObject; |
---|
47 | typedef class sLObject LObject; |
---|
48 | typedef TObject * TSet; |
---|
49 | typedef LObject * LSet; |
---|
50 | |
---|
51 | class sTObject |
---|
52 | { |
---|
53 | public: |
---|
54 | poly p; // Lm(p) \in currRing Tail(p) \in tailRing |
---|
55 | poly t_p; // t_p \in tailRing: as monomials Lm(t_p) == Lm(p) |
---|
56 | ring tailRing; |
---|
57 | poly max; // p_MaxExpP(pNext(p)) |
---|
58 | long FDeg; // pFDeg(p) |
---|
59 | int ecart, |
---|
60 | length, // as of pLDeg |
---|
61 | pLength, // either == 0, or == pLength(p) |
---|
62 | i_r; // index of TObject in R set, or -1 if not in T |
---|
63 | BOOLEAN is_normalized; // true, if pNorm was called on p, false otherwise |
---|
64 | |
---|
65 | // initialization |
---|
66 | KINLINE void Init(ring r = currRing); |
---|
67 | KINLINE sTObject(ring tailRing = currRing); |
---|
68 | KINLINE sTObject(poly p, ring tailRing = currRing); |
---|
69 | KINLINE sTObject(poly p, ring c_r, ring tailRing); |
---|
70 | KINLINE sTObject(sTObject* T, int copy); |
---|
71 | |
---|
72 | KINLINE void Set(ring r=currRing); |
---|
73 | KINLINE void Set(poly p_in, ring r=currRing); |
---|
74 | KINLINE void Set(poly p_in, ring c_r, ring t_r); |
---|
75 | |
---|
76 | // Frees the polys of T |
---|
77 | KINLINE void Delete(); |
---|
78 | // Sets polys to NULL |
---|
79 | KINLINE void Clear(); |
---|
80 | // makes a copy of the poly of T |
---|
81 | KINLINE void Copy(); |
---|
82 | |
---|
83 | // ring-dependent Lm access: these might result in allocation of monomials |
---|
84 | KINLINE poly GetLmCurrRing(); |
---|
85 | KINLINE poly GetLmTailRing(); |
---|
86 | KINLINE poly GetLm(ring r); |
---|
87 | // this returns Lm and ring r (preferably from tailRing), but does not |
---|
88 | // allocate a new poly |
---|
89 | KINLINE void GetLm(poly &p, ring &r) const; |
---|
90 | KINLINE BOOLEAN IsNull() const; |
---|
91 | |
---|
92 | KINLINE int GetpLength(); |
---|
93 | |
---|
94 | // makes sure that T.p exists |
---|
95 | KINLINE void SetLmCurrRing(); |
---|
96 | |
---|
97 | // Iterations |
---|
98 | KINLINE void LmDeleteAndIter(); |
---|
99 | |
---|
100 | // deg stuff |
---|
101 | // computes pFDeg |
---|
102 | KINLINE long pFDeg() const; |
---|
103 | // computes and sets FDeg |
---|
104 | KINLINE long SetpFDeg(); |
---|
105 | // gets stored FDeg |
---|
106 | KINLINE long GetpFDeg() const; |
---|
107 | |
---|
108 | // computes pLDeg |
---|
109 | KINLINE long pLDeg(); |
---|
110 | // sets length, FDeg, returns LDeg |
---|
111 | KINLINE long SetDegStuffReturnLDeg(); |
---|
112 | |
---|
113 | // arithmetic |
---|
114 | KINLINE void Mult_nn(number n); |
---|
115 | KINLINE void ShallowCopyDelete(ring new_tailRing, omBin new_tailBin, |
---|
116 | pShallowCopyDeleteProc p_shallow_copy_delete, |
---|
117 | BOOLEAN set_max = TRUE); |
---|
118 | // manipulations |
---|
119 | KINLINE void pNorm(); |
---|
120 | KINLINE void pCleardenom(); |
---|
121 | |
---|
122 | #ifdef KDEBUG |
---|
123 | void wrp(); |
---|
124 | #endif |
---|
125 | }; |
---|
126 | |
---|
127 | class sLObject : public sTObject |
---|
128 | { |
---|
129 | |
---|
130 | public: |
---|
131 | unsigned long sev; |
---|
132 | poly p1,p2; /*- the pair p comes from -*/ |
---|
133 | |
---|
134 | poly lcm; /*- the lcm of p1,p2 -*/ |
---|
135 | poly last; // pLast(p) during reductions |
---|
136 | kBucket_pt bucket; |
---|
137 | int i_r1, i_r2; |
---|
138 | |
---|
139 | // initialization |
---|
140 | KINLINE void Init(ring tailRing = currRing); |
---|
141 | KINLINE sLObject(ring tailRing = currRing); |
---|
142 | KINLINE sLObject(poly p, ring tailRing = currRing); |
---|
143 | KINLINE sLObject(poly p, ring c_r, ring tailRing); |
---|
144 | |
---|
145 | KINLINE void Clear(); |
---|
146 | |
---|
147 | // Iterations |
---|
148 | KINLINE void LmDeleteAndIter(); |
---|
149 | KINLINE poly LmExtractAndIter(); |
---|
150 | |
---|
151 | // spoly related things |
---|
152 | // preparation for reduction if not spoly |
---|
153 | KINLINE void PrepareRed(BOOLEAN use_bucket); |
---|
154 | KINLINE void SetLmTail(poly lm, poly new_p, int length, |
---|
155 | int use_bucket, ring r, poly last); |
---|
156 | KINLINE void Tail_Minus_mm_Mult_qq(poly m, poly qq, int lq, poly spNoether); |
---|
157 | KINLINE void Tail_Mult_nn(number n); |
---|
158 | // deletes bucket, makes sure that p and t_p exists |
---|
159 | KINLINE poly GetP(omBin lmBin = NULL); |
---|
160 | // similar, except that only t_p exists |
---|
161 | KINLINE poly GetTP(); |
---|
162 | |
---|
163 | // does not delete bucket, just canonicalizes it |
---|
164 | // returned poly is such that Lm(p) \in currRing, Tail(p) \in tailRing |
---|
165 | KINLINE poly CanonicalizeP(); |
---|
166 | |
---|
167 | // makes a copy of the poly of L |
---|
168 | KINLINE void Copy(); |
---|
169 | // gets the poly and makes a copy of it |
---|
170 | KINLINE poly CopyGetP(); |
---|
171 | |
---|
172 | KINLINE int GetpLength(); |
---|
173 | KINLINE long pLDeg(BOOLEAN use_last); |
---|
174 | KINLINE long pLDeg(); |
---|
175 | KINLINE int SetLength(BOOLEAN lengt_pLength = FALSE); |
---|
176 | KINLINE long SetDegStuffReturnLDeg(); |
---|
177 | KINLINE long SetDegStuffReturnLDeg(BOOLEAN use_last); |
---|
178 | |
---|
179 | // returns minimal component of p |
---|
180 | KINLINE long MinComp(); |
---|
181 | // returns component of p |
---|
182 | KINLINE long Comp(); |
---|
183 | |
---|
184 | KINLINE void ShallowCopyDelete(ring new_tailRing, |
---|
185 | pShallowCopyDeleteProc p_shallow_copy_delete); |
---|
186 | |
---|
187 | // sets sev |
---|
188 | KINLINE void SetShortExpVector(); |
---|
189 | |
---|
190 | // enable assignment from TObject |
---|
191 | KINLINE sLObject& operator=(const sTObject&); |
---|
192 | |
---|
193 | // get T's corresponding to p1, p2: they might return NULL |
---|
194 | KINLINE TObject* T_1(const skStrategy* strat); |
---|
195 | KINLINE TObject* T_2(const skStrategy* strat); |
---|
196 | KINLINE void T_1_2(const skStrategy* strat, |
---|
197 | TObject* &T_1, TObject* &T_2); |
---|
198 | }; |
---|
199 | |
---|
200 | |
---|
201 | extern int HCord; |
---|
202 | |
---|
203 | class skStrategy; |
---|
204 | typedef skStrategy * kStrategy; |
---|
205 | class skStrategy |
---|
206 | { |
---|
207 | public: |
---|
208 | kStrategy next; |
---|
209 | int (*red)(LObject * L,kStrategy strat); |
---|
210 | void (*initEcart)(LObject * L); |
---|
211 | int (*posInT)(const TSet T,const int tl,LObject &h); |
---|
212 | int (*posInL)(const LSet set, const int length, |
---|
213 | LObject* L,const kStrategy strat); |
---|
214 | void (*enterS)(LObject h, int pos,kStrategy strat, int atR = -1); |
---|
215 | void (*initEcartPair)(LObject * h, poly f, poly g, int ecartF, int ecartG); |
---|
216 | int (*posInLOld)(const LSet Ls,const int Ll, |
---|
217 | LObject* Lo,const kStrategy strat); |
---|
218 | pFDegProc pOrigFDeg; |
---|
219 | pLDegProc pOrigLDeg; |
---|
220 | pFDegProc pOldFDeg; |
---|
221 | ideal Shdl; |
---|
222 | ideal D; /*V(S) is in D(D)*/ |
---|
223 | ideal M; /*set of minimal generators*/ |
---|
224 | polyset S; |
---|
225 | intset ecartS; |
---|
226 | intset fromQ; |
---|
227 | unsigned long* sevS; |
---|
228 | unsigned long* sevT; |
---|
229 | TSet T; |
---|
230 | LSet L; |
---|
231 | LSet B; |
---|
232 | poly kHEdge; |
---|
233 | poly kNoether; |
---|
234 | BOOLEAN * NotUsedAxis; |
---|
235 | LObject P; |
---|
236 | poly tail; |
---|
237 | leftv kIdeal; |
---|
238 | intvec * kModW; |
---|
239 | intvec * kHomW; |
---|
240 | // procedure for ShalloCopy from tailRing to currRing |
---|
241 | pShallowCopyDeleteProc p_shallow_copy_delete; |
---|
242 | BOOLEAN *pairtest;/*used for enterOnePair*/ |
---|
243 | // if set, pLDeg(p, l) == (pFDeg(pLast(p), pLength) |
---|
244 | BOOLEAN LDegLast; |
---|
245 | // if set, then L.length == L.pLength |
---|
246 | BOOLEAN length_pLength; |
---|
247 | // if set, then posInL does not depend on L.length |
---|
248 | BOOLEAN posInLDependsOnLength; |
---|
249 | int cp,c3; |
---|
250 | int sl,mu; |
---|
251 | int tl,tmax; |
---|
252 | int Ll,Lmax; |
---|
253 | int Bl,Bmax; |
---|
254 | int ak,LazyDegree,LazyPass; |
---|
255 | int syzComp; |
---|
256 | int HCord; |
---|
257 | int lastAxis; |
---|
258 | int newIdeal; |
---|
259 | int minim; |
---|
260 | BOOLEAN interpt; |
---|
261 | BOOLEAN homog; |
---|
262 | BOOLEAN kHEdgeFound; |
---|
263 | BOOLEAN honey,sugarCrit; |
---|
264 | BOOLEAN Gebauer,noTailReduction; |
---|
265 | BOOLEAN fromT; |
---|
266 | BOOLEAN noetherSet; |
---|
267 | BOOLEAN update; |
---|
268 | BOOLEAN posInLOldFlag; |
---|
269 | BOOLEAN use_buckets; |
---|
270 | ring tailRing; |
---|
271 | omBin lmBin; |
---|
272 | omBin tailBin; |
---|
273 | /*FALSE, if posInL == posInL10*/ |
---|
274 | char redTailChange; |
---|
275 | char news; |
---|
276 | char newt;/*used for messageSets*/ |
---|
277 | |
---|
278 | // pointers to Tobjects R[i] is ith Tobject which is generated |
---|
279 | TObject** R; |
---|
280 | // S_2_R[i] yields Tobject which corresponds to S[i] |
---|
281 | int* S_2_R; |
---|
282 | |
---|
283 | KINLINE skStrategy(); |
---|
284 | KINLINE ~skStrategy(); |
---|
285 | |
---|
286 | // return TObject corresponding to S[i]: assume that it exists |
---|
287 | // i.e. no error checking is done |
---|
288 | KINLINE TObject* S_2_T(int i); |
---|
289 | // like S_2_T, except that NULL is returned if it can not be found |
---|
290 | KINLINE TObject* s_2_t(int i); |
---|
291 | }; |
---|
292 | |
---|
293 | void deleteHC(poly *p, int *e, int *l, kStrategy strat); |
---|
294 | void deleteHC(LObject* L, kStrategy strat, BOOLEAN fromNext = FALSE); |
---|
295 | void deleteInS (int i,kStrategy strat); |
---|
296 | void cleanT (kStrategy strat); |
---|
297 | LSet initL (); |
---|
298 | void deleteInL(LSet set, int *length, int j,kStrategy strat); |
---|
299 | void enterL (LSet *set,int *length, int *LSetmax, LObject p,int at); |
---|
300 | void enterSBba (LObject p,int atS,kStrategy strat, int atR = -1); |
---|
301 | void initEcartPairBba (LObject* Lp,poly f,poly g,int ecartF,int ecartG); |
---|
302 | void initEcartPairMora (LObject* Lp,poly f,poly g,int ecartF,int ecartG); |
---|
303 | int posInS (polyset set,int length,poly p); |
---|
304 | int posInT0 (const TSet set,const int length,LObject &p); |
---|
305 | int posInT1 (const TSet set,const int length,LObject &p); |
---|
306 | int posInT2 (const TSet set,const int length,LObject &p); |
---|
307 | int posInT11 (const TSet set,const int length,LObject &p); |
---|
308 | int posInT13 (const TSet set,const int length,LObject &p); |
---|
309 | int posInT15 (const TSet set,const int length,LObject &p); |
---|
310 | int posInT17 (const TSet set,const int length,LObject &p); |
---|
311 | int posInT19 (const TSet set,const int length,LObject &p); |
---|
312 | int posInT_EcartpLength(const TSet set,const int length,LObject &p); |
---|
313 | |
---|
314 | #ifdef HAVE_MORE_POS_IN_T |
---|
315 | int posInT_EcartFDegpLength(const TSet set,const int length,LObject &p); |
---|
316 | int posInT_FDegpLength(const TSet set,const int length,LObject &p); |
---|
317 | int posInT_pLength(const TSet set,const int length,LObject &p); |
---|
318 | #endif |
---|
319 | |
---|
320 | |
---|
321 | void reorderS (int* suc,kStrategy strat); |
---|
322 | int posInL0 (const LSet set, const int length, |
---|
323 | LObject* L,const kStrategy strat); |
---|
324 | int posInL11 (const LSet set, const int length, |
---|
325 | LObject* L,const kStrategy strat); |
---|
326 | int posInL13 (const LSet set, const int length, |
---|
327 | LObject* L,const kStrategy strat); |
---|
328 | int posInL15 (const LSet set, const int length, |
---|
329 | LObject* L,const kStrategy strat); |
---|
330 | int posInL17 (const LSet set, const int length, |
---|
331 | LObject* L,const kStrategy strat); |
---|
332 | int posInL10 (const LSet set, const int length, |
---|
333 | LObject* L,const kStrategy strat); |
---|
334 | KINLINE poly redtailBba (poly p,int pos,kStrategy strat); |
---|
335 | poly redtailBba (LObject *L, int pos,kStrategy strat, BOOLEAN withT = FALSE); |
---|
336 | poly redtailBba (TObject *T, int pos,kStrategy strat, BOOLEAN withT = FALSE); |
---|
337 | poly redtail (poly p,int pos,kStrategy strat); |
---|
338 | poly redtail (LObject *L,int pos,kStrategy strat); |
---|
339 | void enterpairs (poly h, int k, int ec, int pos,kStrategy strat, int atR = -1); |
---|
340 | void entersets (LObject h); |
---|
341 | void pairs (); |
---|
342 | void message (int i,int* reduc,int* olddeg,kStrategy strat,int red_result); |
---|
343 | void messageStat (int srmax,int lrmax,int hilbcount,kStrategy strat); |
---|
344 | #ifdef KDEBUG |
---|
345 | void messageSets (kStrategy strat); |
---|
346 | #else |
---|
347 | #define messageSets(s) ((void) 0) |
---|
348 | #endif |
---|
349 | |
---|
350 | void initEcartNormal (LObject* h); |
---|
351 | void initEcartBBA (LObject* h); |
---|
352 | void initS (ideal F, ideal Q,kStrategy strat); |
---|
353 | void initSL (ideal F, ideal Q,kStrategy strat); |
---|
354 | void updateS(BOOLEAN toT,kStrategy strat); |
---|
355 | void enterT (LObject p,kStrategy strat, int atT = -1); |
---|
356 | void cancelunit (LObject* p); |
---|
357 | void HEckeTest (poly pp,kStrategy strat); |
---|
358 | void initBuchMoraCrit(kStrategy strat); |
---|
359 | void initHilbCrit(ideal F, ideal Q, intvec **hilb,kStrategy strat); |
---|
360 | void initBuchMoraPos(kStrategy strat); |
---|
361 | void initBuchMora (ideal F, ideal Q,kStrategy strat); |
---|
362 | void exitBuchMora (kStrategy strat); |
---|
363 | void updateResult(ideal r,ideal Q,kStrategy strat); |
---|
364 | void completeReduce (kStrategy strat); |
---|
365 | void kFreeStrat(kStrategy strat); |
---|
366 | BOOLEAN homogTest(polyset F, int Fmax); |
---|
367 | BOOLEAN newHEdge(polyset S, int ak,kStrategy strat); |
---|
368 | // returns index of p in TSet, or -1 if not found |
---|
369 | int kFindInT(poly p, TSet T, int tlength); |
---|
370 | |
---|
371 | // return -1 if no divisor is found |
---|
372 | // number of first divisor, otherwise |
---|
373 | int kFindDivisibleByInT(const TSet &T, const unsigned long* sevT, |
---|
374 | const int tl, const LObject* L, const int start=0); |
---|
375 | // same with S |
---|
376 | int kFindDivisibleByInS(const polyset &S, const unsigned long* sev, |
---|
377 | const int sl, LObject* L); |
---|
378 | |
---|
379 | |
---|
380 | |
---|
381 | /*************************************************************** |
---|
382 | * |
---|
383 | * stuff to be inlined |
---|
384 | * |
---|
385 | ***************************************************************/ |
---|
386 | |
---|
387 | KINLINE TSet initT (); |
---|
388 | KINLINE TObject** initR(); |
---|
389 | KINLINE unsigned long* initsevT(); |
---|
390 | KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin bin); |
---|
391 | KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing, omBin bin); |
---|
392 | KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin bin); |
---|
393 | KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin bin); |
---|
394 | |
---|
395 | KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing); |
---|
396 | KINLINE poly k_LmInit_tailRing_2_currRing(poly p, ring tailRing); |
---|
397 | KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing); |
---|
398 | KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing); |
---|
399 | |
---|
400 | // if exp bound is not violated, return TRUE and |
---|
401 | // get m1 = LCM(LM(p1), LM(p2))/LM(p1) |
---|
402 | // m2 = LCM(LM(p1), LM(p2))/LM(p2) |
---|
403 | // return FALSE and m1 == NULL, m2 == NULL , otherwise |
---|
404 | KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, |
---|
405 | poly &m1, poly &m2, const ring m_r); |
---|
406 | #ifdef KDEBUG |
---|
407 | // test strat |
---|
408 | BOOLEAN kTest(kStrategy strat); |
---|
409 | // test strat, and test that S is contained in T |
---|
410 | BOOLEAN kTest_TS(kStrategy strat); |
---|
411 | // test LObject |
---|
412 | BOOLEAN kTest_L(LObject* L, ring tailRing = NULL, |
---|
413 | BOOLEAN testp = FALSE, int lpos = -1, |
---|
414 | TSet T = NULL, int tlength = -1); |
---|
415 | // test TObject |
---|
416 | BOOLEAN kTest_T(TObject* T, ring tailRing = NULL, int tpos = -1, char T = '?'); |
---|
417 | // test set strat->SevS |
---|
418 | BOOLEAN kTest_S(kStrategy strat); |
---|
419 | #else |
---|
420 | #define kTest(A) ((void)0) |
---|
421 | #define kTest_TS(A) ((void)0) |
---|
422 | #define kTest_T(T) ((void)0) |
---|
423 | #define kTest_S(T) ((void)0) |
---|
424 | #define kTest_L(T) ((void)0) |
---|
425 | #endif |
---|
426 | |
---|
427 | |
---|
428 | /*************************************************************** |
---|
429 | * |
---|
430 | * From kstd2.cc |
---|
431 | * |
---|
432 | ***************************************************************/ |
---|
433 | ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat); |
---|
434 | poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce); |
---|
435 | ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce); |
---|
436 | void initBba(ideal F,kStrategy strat); |
---|
437 | |
---|
438 | /*************************************************************** |
---|
439 | * |
---|
440 | * From kSpolys.cc |
---|
441 | * |
---|
442 | ***************************************************************/ |
---|
443 | // Reduces PR with PW |
---|
444 | // Assumes PR != NULL, PW != NULL, Lm(PW) divides Lm(PR) |
---|
445 | // Changes: PR |
---|
446 | // Const: PW |
---|
447 | // If coef != NULL, then *coef is a/gcd(a,b), where a = LC(PR), b = LC(PW) |
---|
448 | // If strat != NULL, tailRing is changed if reduction would violate exp bound |
---|
449 | // of tailRing |
---|
450 | // Returns: 0 everything ok, no tailRing change |
---|
451 | // 1 tailRing has successfully changed (strat != NULL) |
---|
452 | // 2 no reduction performed, tailRing needs to be changed first |
---|
453 | // (strat == NULL) |
---|
454 | // -1 tailRing change could not be performed due to exceeding exp |
---|
455 | // bound of currRing |
---|
456 | int ksReducePoly(LObject* PR, |
---|
457 | TObject* PW, |
---|
458 | poly spNoether = NULL, |
---|
459 | number *coef = NULL, |
---|
460 | kStrategy strat = NULL); |
---|
461 | |
---|
462 | // Reduces PR at Current->next with PW |
---|
463 | // Assumes PR != NULL, Current contained in PR |
---|
464 | // Current->next != NULL, LM(PW) devides LM(Current->next) |
---|
465 | // Changes: PR |
---|
466 | // Const: PW |
---|
467 | // Return: see ksReducePoly |
---|
468 | int ksReducePolyTail(LObject* PR, |
---|
469 | TObject* PW, |
---|
470 | poly Current, |
---|
471 | poly spNoether = NULL); |
---|
472 | |
---|
473 | KINLINE int ksReducePolyTail(LObject* PR, TObject* PW, LObject* Red); |
---|
474 | |
---|
475 | // Creates S-Poly of Pair |
---|
476 | // Const: Pair->p1, Pair->p2 |
---|
477 | // Changes: Pair->p == S-Poly of p1, p2 |
---|
478 | // Assume: Pair->p1 != NULL && Pair->p2 |
---|
479 | void ksCreateSpoly(LObject* Pair, poly spNoether = NULL, |
---|
480 | int use_buckets=0, ring tailRing=currRing, |
---|
481 | poly m1 = NULL, poly m2 = NULL, TObject** R = NULL); |
---|
482 | |
---|
483 | /*2 |
---|
484 | * creates the leading term of the S-polynomial of p1 and p2 |
---|
485 | * do not destroy p1 and p2 |
---|
486 | * remarks: |
---|
487 | * 1. the coefficient is 0 (nNew) |
---|
488 | * 2. pNext is undefined |
---|
489 | */ |
---|
490 | poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing); |
---|
491 | |
---|
492 | |
---|
493 | /* |
---|
494 | * input - output: a, b |
---|
495 | * returns: |
---|
496 | * a := a/gcd(a,b), b := b/gcd(a,b) |
---|
497 | * and return value |
---|
498 | * 0 -> a != 1, b != 1 |
---|
499 | * 1 -> a == 1, b != 1 |
---|
500 | * 2 -> a != 1, b == 1 |
---|
501 | * 3 -> a == 1, b == 1 |
---|
502 | * this value is used to control the spolys |
---|
503 | */ |
---|
504 | int ksCheckCoeff(number *a, number *b); |
---|
505 | |
---|
506 | // old stuff |
---|
507 | KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether = NULL); |
---|
508 | KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether = NULL); |
---|
509 | KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether = NULL, ring r = currRing); |
---|
510 | KINLINE void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether, ring r = currRing); |
---|
511 | |
---|
512 | /*************************************************************** |
---|
513 | * |
---|
514 | * Routines related for ring changes during std computations |
---|
515 | * |
---|
516 | ***************************************************************/ |
---|
517 | // return TRUE and set m1, m2 to k_GetLcmTerms, |
---|
518 | // if spoly creation of strat->P does not violate |
---|
519 | // exponent bound of strat->tailRing |
---|
520 | // FALSE, otherwise |
---|
521 | BOOLEAN kCheckSpolyCreation(LObject* L, kStrategy strat, poly &m1, poly &m2); |
---|
522 | // change strat->tailRing and adjust all data in strat, L, and T: |
---|
523 | // new tailRing has larger exponent bound |
---|
524 | // do nothing and return FALSE if exponent bound increase would result in |
---|
525 | // larger exponent bound that that of currRing |
---|
526 | BOOLEAN kStratChangeTailRing(kStrategy strat, |
---|
527 | LObject* L = NULL, TObject* T = NULL, |
---|
528 | // take this as new_expbound: if 0 |
---|
529 | // new expbound is 2*expbound of tailRing |
---|
530 | unsigned long new_expbound = 0); |
---|
531 | // initiate a change of the tailRing of strat -- should be called |
---|
532 | // right before main loop in bba |
---|
533 | void kStratInitChangeTailRing(kStrategy strat); |
---|
534 | |
---|
535 | #include "kInline.cc" |
---|
536 | |
---|
537 | |
---|
538 | #endif |
---|