1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /*************************************************************** |
---|
5 | * File: p_polys.h |
---|
6 | * Purpose: declaration of poly stuf which are independent of |
---|
7 | * currRing |
---|
8 | * Author: obachman (Olaf Bachmann) |
---|
9 | * Created: 9/00 |
---|
10 | * Version: $Id$ |
---|
11 | *******************************************************************/ |
---|
12 | #ifndef P_POLYS_H |
---|
13 | #define P_POLYS_H |
---|
14 | |
---|
15 | #include <kernel/structs.h> |
---|
16 | #include <kernel/polys-impl.h> |
---|
17 | /* |
---|
18 | Some general remarks: |
---|
19 | We divide poly operations into roughly 4 categories: |
---|
20 | Level 2: operations on monomials/polynomials with constant time, |
---|
21 | or operations which are just dispatchers to other |
---|
22 | poly routines |
---|
23 | - implemented in: pInline2.h |
---|
24 | - debugging only if PDEBUG >= 2 |
---|
25 | - normally inlined, unless PDEBUG >= 2 || NO_INLINE2 |
---|
26 | Level 1: operations on monomials with time proportional to length |
---|
27 | - implemented in: pInline1.h |
---|
28 | - debugging only if PDEBUG >= 1 |
---|
29 | - normally inlined, unless PDEBUG >= 1 || NO_INLINE1 |
---|
30 | Level 0: short operations on polynomials with time proportional to |
---|
31 | length of poly |
---|
32 | - implemented in pInline0.cc |
---|
33 | - debugging if PDEBUG |
---|
34 | - normally _not_ inlined: can be forced with |
---|
35 | #define DO_PINLINE0 |
---|
36 | #include "pInline0.h" |
---|
37 | Misc : operations on polynomials which do not fit in any of the |
---|
38 | above categories |
---|
39 | - implemented in: polys*.cc |
---|
40 | - never inlined |
---|
41 | - debugging if PDEBUG >= 0 |
---|
42 | |
---|
43 | You can set PDEBUG on a per-file basis, before including "mod2.h" like |
---|
44 | #define PDEBUG 2 |
---|
45 | #include "mod2.h" |
---|
46 | However, PDEBUG will only be in effect, if !NDEBUG. |
---|
47 | */ |
---|
48 | |
---|
49 | /*************************************************************** |
---|
50 | * |
---|
51 | * Primitives for accessing and setting fields of a poly |
---|
52 | * poly must be != NULL |
---|
53 | * |
---|
54 | ***************************************************************/ |
---|
55 | // next |
---|
56 | #define pNext(p) ((p)->next) |
---|
57 | #define pIter(p) ((p) = (p)->next) |
---|
58 | |
---|
59 | // coeff |
---|
60 | #define pGetCoeff(p) ((p)->coef) |
---|
61 | // deletes old coeff before setting the new one |
---|
62 | #define pSetCoeff0(p,n) (p)->coef=(n) |
---|
63 | #define p_GetCoeff(p,r) pGetCoeff(p) |
---|
64 | #define p_SetCoeff0(p,n,r) pSetCoeff0(p,n) |
---|
65 | // deletes old p->coef and sets new one |
---|
66 | PINLINE2 number p_SetCoeff(poly p, number n, ring r); |
---|
67 | |
---|
68 | // get Order |
---|
69 | PINLINE2 long p_GetOrder(poly p, ring r); |
---|
70 | |
---|
71 | // Component |
---|
72 | #define p_GetComp(p, r) _p_GetComp(p, r) |
---|
73 | PINLINE2 unsigned long p_SetComp(poly p, unsigned long c, ring r); |
---|
74 | PINLINE2 unsigned long p_AddComp(poly p, unsigned long v, ring r); |
---|
75 | PINLINE2 unsigned long p_SubComp(poly p, unsigned long v, ring r); |
---|
76 | |
---|
77 | // Exponent |
---|
78 | PINLINE2 long p_GetExp(poly p, int v, ring r); |
---|
79 | PINLINE2 long p_SetExp(poly p, int v, long e, ring r); |
---|
80 | PINLINE2 long p_IncrExp(poly p, int v, ring r); |
---|
81 | PINLINE2 long p_DecrExp(poly p, int v, ring r); |
---|
82 | PINLINE2 long p_AddExp(poly p, int v, long ee, ring r); |
---|
83 | PINLINE2 long p_SubExp(poly p, int v, long ee, ring r); |
---|
84 | PINLINE2 long p_MultExp(poly p, int v, long ee, ring r); |
---|
85 | PINLINE2 long p_GetExpSum(poly p1, poly p2, int i, ring r); |
---|
86 | PINLINE2 long p_GetExpDiff(poly p1, poly p2, int i, ring r); |
---|
87 | |
---|
88 | /*************************************************************** |
---|
89 | * |
---|
90 | * Allocation/Initalization/Deletion |
---|
91 | * except for pHead, all polys must be != NULL |
---|
92 | * |
---|
93 | ***************************************************************/ |
---|
94 | PINLINE2 poly p_New(ring r); |
---|
95 | PINLINE2 poly p_New(ring r, omBin bin); |
---|
96 | PINLINE1 poly p_Init(ring r); |
---|
97 | PINLINE1 poly p_Init(ring r, omBin bin); |
---|
98 | PINLINE1 poly p_LmInit(poly p, ring r); |
---|
99 | PINLINE1 poly p_LmInit(poly s_p, ring s_r, ring d_p); |
---|
100 | PINLINE1 poly p_LmInit(poly s_p, ring s_r, ring d_p, omBin d_bin); |
---|
101 | PINLINE1 poly p_Head(poly p, ring r); |
---|
102 | PINLINE2 void p_LmFree(poly p, ring r); |
---|
103 | PINLINE2 void p_LmFree(poly *p, ring r); |
---|
104 | PINLINE2 poly p_LmFreeAndNext(poly p, ring r); |
---|
105 | PINLINE2 void p_LmDelete(poly p, ring r); |
---|
106 | PINLINE2 void p_LmDelete(poly *p, ring r); |
---|
107 | PINLINE2 poly p_LmDeleteAndNext(poly p, ring r); |
---|
108 | |
---|
109 | /*************************************************************** |
---|
110 | * |
---|
111 | * Operation on ExpVectors: assumes polys != NULL |
---|
112 | * |
---|
113 | ***************************************************************/ |
---|
114 | // ExpVextor(d_p) = ExpVector(s_p) |
---|
115 | PINLINE1 void p_ExpVectorCopy(poly d_p, poly s_p, ring r); |
---|
116 | // adjustments for negative weights |
---|
117 | PINLINE1 void p_MemAdd_NegWeightAdjust(poly p, ring r); |
---|
118 | PINLINE1 void p_MemSub_NegWeightAdjust(poly p, ring r); |
---|
119 | // ExpVector(p1) += ExpVector(p2) |
---|
120 | PINLINE1 void p_ExpVectorAdd(poly p1, poly p2, ring r); |
---|
121 | // ExpVector(p1) -= ExpVector(p2) |
---|
122 | PINLINE1 void p_ExpVectorSub(poly p1, poly p2, ring r); |
---|
123 | // ExpVector(p1) += ExpVector(p2) - ExpVector(p3) |
---|
124 | PINLINE1 void p_ExpVectorAddSub(poly p1, poly p2, poly p3, ring r); |
---|
125 | // ExpVector(pr) = ExpVector(p1) + ExpVector(p2) |
---|
126 | PINLINE1 void p_ExpVectorSum(poly pr, poly p1, poly p2, ring r); |
---|
127 | // ExpVector(pr) = ExpVector(p1) + ExpVector(p2) |
---|
128 | PINLINE1 void p_ExpVectorDiff(poly pr, poly p1, poly p2, ring r); |
---|
129 | // returns TRUE if ExpVector(p1) == ExpVector(p2), FALSE, otherwise |
---|
130 | PINLINE1 BOOLEAN p_ExpVectorEqual(poly p1, poly p2, ring r); |
---|
131 | // returns sum of all exponents of p |
---|
132 | PINLINE1 long p_Totaldegree(poly p, ring r); |
---|
133 | |
---|
134 | PINLINE1 void p_GetExpV(poly p, int *ev, ring r); |
---|
135 | PINLINE1 void p_SetExpV(poly p, int *ev, ring r); |
---|
136 | |
---|
137 | |
---|
138 | /*************************************************************** |
---|
139 | * |
---|
140 | * Comparisons: they are all done without regarding coeffs |
---|
141 | * |
---|
142 | ***************************************************************/ |
---|
143 | PINLINE1 int p_LmCmp(poly p, poly q, ring r); |
---|
144 | #define p_LmCmpAction(p, q, r, actionE, actionG, actionS) \ |
---|
145 | _p_LmCmpAction(p, q, r, actionE, actionG, actionS) |
---|
146 | |
---|
147 | // returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !! |
---|
148 | #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r) |
---|
149 | |
---|
150 | // pCmp: args may be NULL |
---|
151 | // returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) |
---|
152 | PINLINE2 int p_Cmp(poly p1, poly p2, ring r); |
---|
153 | |
---|
154 | |
---|
155 | /*************************************************************** |
---|
156 | * |
---|
157 | * Divisiblity tests, args must be != NULL, except for |
---|
158 | * pDivisbleBy |
---|
159 | * |
---|
160 | ***************************************************************/ |
---|
161 | PINLINE1 BOOLEAN p_DivisibleBy(poly a, poly b, ring r); |
---|
162 | PINLINE1 BOOLEAN p_LmDivisibleBy(poly a, poly b, ring r); |
---|
163 | PINLINE1 BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, ring r); |
---|
164 | unsigned long p_GetShortExpVector(poly a, ring r); |
---|
165 | PINLINE1 BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, |
---|
166 | poly b, unsigned long not_sev_b, ring r); |
---|
167 | |
---|
168 | PINLINE1 BOOLEAN p_DivisibleBy(poly a, ring r_a, poly b, ring r_b); |
---|
169 | PINLINE1 BOOLEAN p_LmDivisibleBy(poly a, ring r_a, poly b, ring r_b); |
---|
170 | PINLINE1 BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, ring r_a, |
---|
171 | poly b, unsigned long not_sev_b, ring r_b); |
---|
172 | |
---|
173 | /*************************************************************** |
---|
174 | * |
---|
175 | * Misc things on Lm |
---|
176 | * |
---|
177 | ***************************************************************/ |
---|
178 | // test if the monomial is a constant as a vector component |
---|
179 | // i.e., test if all exponents are zero |
---|
180 | PINLINE1 BOOLEAN p_LmIsConstantComp(const poly p, const ring r); |
---|
181 | PINLINE1 BOOLEAN p_LmIsConstant(const poly p, const ring r); |
---|
182 | |
---|
183 | // return TRUE, if p_LmExpVectorAdd stays within ExpBound of ring r, |
---|
184 | // FALSE, otherwise |
---|
185 | PINLINE1 BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, ring r); |
---|
186 | |
---|
187 | /*************************************************************** |
---|
188 | * |
---|
189 | * Misc things on polys |
---|
190 | * |
---|
191 | ***************************************************************/ |
---|
192 | // return the maximal exponent of p |
---|
193 | PINLINE2 unsigned long p_GetMaxExp(poly p, ring r); |
---|
194 | // return the maximal exponent of p in form of the maximal long var |
---|
195 | unsigned long p_GetMaxExpL(poly p, ring r, unsigned long l_max = 0); |
---|
196 | // return monomial r such that GetExp(r,i) is maximum of all |
---|
197 | // monomials in p; coeff == 0, next == NULL, ord is not set |
---|
198 | poly p_GetMaxExpP(poly p, ring r); |
---|
199 | |
---|
200 | // suppose that l is a long var in r, return maximal exponent of l |
---|
201 | PINLINE2 unsigned long p_GetMaxExp(unsigned long l, ring r); |
---|
202 | // similar, except assume that l constains number_of_exps exponents |
---|
203 | PINLINE2 unsigned long p_GetMaxExp(const unsigned long l, const ring r, const int number_of_exps); |
---|
204 | |
---|
205 | // return the TotalDegree of the long var l |
---|
206 | PINLINE2 unsigned long p_GetTotalDegree(const unsigned long l, const ring r); |
---|
207 | // return the total degree of the long var l containing number_of_exp exponents |
---|
208 | PINLINE2 unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps); |
---|
209 | |
---|
210 | |
---|
211 | // like the respective p_LmIs* routines, except that p might be empty |
---|
212 | PINLINE1 BOOLEAN p_IsConstantComp(const poly p, const ring r); |
---|
213 | PINLINE1 BOOLEAN p_IsConstant(const poly p, const ring r); |
---|
214 | PINLINE0 BOOLEAN p_IsConstantPoly(const poly p, const ring r); |
---|
215 | |
---|
216 | // return TRUE if all monoms have the same component |
---|
217 | BOOLEAN p_OneComp(poly p, ring r); |
---|
218 | |
---|
219 | // return i, if head depends only on var(i) |
---|
220 | int p_IsPurePower(const poly p, const ring r); |
---|
221 | |
---|
222 | // return i, if poly depends only on var(i) |
---|
223 | int p_IsUnivariate(poly p, const ring r); |
---|
224 | |
---|
225 | // set entry e[i] to 1 if var(i) occurs in p, ignore var(j) if e[j]>0 |
---|
226 | // return #(e[i]>0) |
---|
227 | int p_GetVariables(poly p, int * e, const ring r); |
---|
228 | |
---|
229 | // returns the poly representing the integer i |
---|
230 | poly p_ISet(int i, ring r); |
---|
231 | |
---|
232 | // returns the poly representing the number n, destroys n |
---|
233 | poly p_NSet(number n, ring r); |
---|
234 | |
---|
235 | /*************************************************************** |
---|
236 | * |
---|
237 | * Copying/Deletion of polys: args may be NULL |
---|
238 | * |
---|
239 | ***************************************************************/ |
---|
240 | // returns a copy of p |
---|
241 | PINLINE2 poly p_Copy(poly p, const ring r); |
---|
242 | // returns a copy of p with Lm(p) from lmRing and Tail(p) from tailRing |
---|
243 | PINLINE2 poly p_Copy(poly p, const ring lmRing, const ring tailRing); |
---|
244 | // deletes *p, and sets *p to NULL |
---|
245 | PINLINE2 void p_Delete(poly *p, const ring r); |
---|
246 | PINLINE2 void p_Delete(poly *p, const ring lmRing, const ring tailRing); |
---|
247 | |
---|
248 | // copys monomials of p, allocates new monomials from bin, |
---|
249 | // deletes monomoals of p |
---|
250 | PINLINE2 poly p_ShallowCopyDelete(poly p, const ring r, omBin bin); |
---|
251 | // simial but does it only for leading monomial |
---|
252 | PINLINE1 poly p_LmShallowCopyDelete(poly p, const ring r, omBin bin); |
---|
253 | // simply deletes monomials, does not free coeffs |
---|
254 | void p_ShallowDelete(poly *p, const ring r); |
---|
255 | |
---|
256 | |
---|
257 | |
---|
258 | /*************************************************************** |
---|
259 | * |
---|
260 | * Copying/Deleteion of polys: args may be NULL |
---|
261 | * - p/q as arg mean a poly |
---|
262 | * - m a monomial |
---|
263 | * - n a number |
---|
264 | * - pp (resp. qq, mm, nn) means arg is constant |
---|
265 | * - p (resp, q, m, n) means arg is destroyed |
---|
266 | * |
---|
267 | ***************************************************************/ |
---|
268 | // returns -p, p is destroyed |
---|
269 | PINLINE2 poly p_Neg(poly p, const ring r); |
---|
270 | |
---|
271 | // returns p*n, p is const (i.e. copied) |
---|
272 | PINLINE2 poly pp_Mult_nn(poly p, number n, const ring r); |
---|
273 | // returns p*n, destroys p |
---|
274 | PINLINE2 poly p_Mult_nn(poly p, number n, const ring r); |
---|
275 | PINLINE2 poly p_Mult_nn(poly p, number n, const ring lmRing, const ring tailRing); |
---|
276 | |
---|
277 | // returns p*m, does neither destroy p nor m |
---|
278 | PINLINE2 poly pp_Mult_mm(poly p, poly m, const ring r); |
---|
279 | // returns p*m, destroys p, const: m |
---|
280 | PINLINE2 poly p_Mult_mm(poly p, poly m, const ring r); |
---|
281 | |
---|
282 | // returns p+q, destroys p and q |
---|
283 | PINLINE2 poly p_Add_q(poly p, poly q, const ring r); |
---|
284 | // like p_Add_q, except that if lp == pLength(lp) lq == pLength(lq) |
---|
285 | // then lp == pLength(p+q) |
---|
286 | PINLINE2 poly p_Add_q(poly p, poly q, int &lp, int lq, const ring r); |
---|
287 | |
---|
288 | // return p - m*q, destroys p; const: q,m |
---|
289 | PINLINE2 poly p_Minus_mm_Mult_qq(poly p, poly m, poly q, const ring r); |
---|
290 | // like p_Minus_mm_Mult_qq, except that if lp == pLength(lp) lq == pLength(lq) |
---|
291 | // then lp == pLength(p -m*q) |
---|
292 | PINLINE2 poly p_Minus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, |
---|
293 | poly spNoether, const ring r); |
---|
294 | // returns p + m*q destroys p, const: q, m |
---|
295 | PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, const ring r); |
---|
296 | |
---|
297 | // returns p + m*q destroys p, const: q, m |
---|
298 | PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, |
---|
299 | const ring r); |
---|
300 | |
---|
301 | // returns p*q, destroys p and q |
---|
302 | PINLINE2 poly p_Mult_q(poly p, poly q, const ring r); |
---|
303 | // returns p*q, does neither destroy p nor q |
---|
304 | PINLINE2 poly pp_Mult_qq(poly p, poly q, const ring r); |
---|
305 | |
---|
306 | // returns p*Coeff(m) for such monomials pm of p, for which m is divisble by pm |
---|
307 | PINLINE2 poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, const ring r); |
---|
308 | |
---|
309 | // returns p*Coeff(m) for such monomials pm of p, for which m is divisble by pm |
---|
310 | // if lp is length of p on input then lp is length of returned poly on output |
---|
311 | PINLINE2 poly pp_Mult_Coeff_mm_DivSelect(poly p, int &lp, const poly m, const ring r); |
---|
312 | |
---|
313 | // returns merged p and q, assumes p and q have no monomials which are equal |
---|
314 | PINLINE2 poly p_Merge_q(poly p, poly c, const ring r); |
---|
315 | // sorts p using bucket sort: returns sorted poly |
---|
316 | // assumes that monomials of p are all different |
---|
317 | // reverses it first, if revert == TRUE, use this if input p is "almost" sorted |
---|
318 | // correctly |
---|
319 | PINLINE2 poly p_SortMerge(poly p, const ring r, BOOLEAN revert = FALSE); |
---|
320 | // like SortMerge, except that p may have equal monimals |
---|
321 | PINLINE2 poly p_SortAdd(poly p, const ring r, BOOLEAN revert = FALSE); |
---|
322 | |
---|
323 | /*************************************************************** |
---|
324 | * |
---|
325 | * Misc stuff |
---|
326 | * |
---|
327 | ***************************************************************/ |
---|
328 | PINLINE2 void p_Setm(poly p, const ring r); |
---|
329 | p_SetmProc p_GetSetmProc(ring r); |
---|
330 | |
---|
331 | // TODO: |
---|
332 | #define p_SetmComp p_Setm |
---|
333 | |
---|
334 | // sets component of poly a to i, returns length of a |
---|
335 | PINLINE0 int p_SetCompP(poly a, int i, ring r); |
---|
336 | PINLINE0 int p_SetCompP(poly a, int i, ring lmRing, ring tailRing); |
---|
337 | PINLINE0 long p_MaxComp(poly p, ring lmRing, ring tailRing); |
---|
338 | inline long p_MaxComp(poly p,ring lmRing) {return p_MaxComp(p,lmRing,lmRing);} |
---|
339 | PINLINE0 long p_MinComp(poly p, ring lmRing, ring tailRing); |
---|
340 | inline long p_MinComp(poly p,ring lmRing) {return p_MinComp(p,lmRing,lmRing);} |
---|
341 | |
---|
342 | /*************************************************************** |
---|
343 | * |
---|
344 | * poly things which are independent of ring |
---|
345 | * |
---|
346 | ***************************************************************/ |
---|
347 | PINLINE0 int pLength(poly a); |
---|
348 | PINLINE0 poly pLast(poly a, int &length); |
---|
349 | inline poly pLast(poly a) { int l; return pLast(a, l);} |
---|
350 | PINLINE0 poly pReverse(poly p); |
---|
351 | |
---|
352 | |
---|
353 | /*************************************************************** |
---|
354 | * |
---|
355 | * I/O |
---|
356 | * |
---|
357 | ***************************************************************/ |
---|
358 | char* p_String(poly p, ring lmRing, ring tailRing); |
---|
359 | char* p_String0(poly p, ring lmRing, ring tailRing); |
---|
360 | void p_Write(poly p, ring lmRing, ring tailRing); |
---|
361 | void p_Write0(poly p, ring lmRing, ring tailRing); |
---|
362 | void p_wrp(poly p, ring lmRing, ring tailRing); |
---|
363 | |
---|
364 | PINLINE2 char* p_String(poly p, ring p_ring); |
---|
365 | PINLINE2 char* p_String0(poly p, ring p_ring); |
---|
366 | PINLINE2 void p_Write(poly p, ring p_ring); |
---|
367 | PINLINE2 void p_Write0(poly p, ring p_ring); |
---|
368 | PINLINE2 void p_wrp(poly p, ring p_ring); |
---|
369 | |
---|
370 | |
---|
371 | /*************************************************************** |
---|
372 | * |
---|
373 | * Degree stuff -- see p_polys.cc for explainations |
---|
374 | * |
---|
375 | ***************************************************************/ |
---|
376 | extern pLDegProc pLDeg; |
---|
377 | extern pFDegProc pFDeg; |
---|
378 | int pWeight(int i, ring r); |
---|
379 | long pDeg(poly p, ring r); |
---|
380 | long pWFirstTotalDegree(poly p, ring r); |
---|
381 | long pWTotaldegree(poly p, ring r); |
---|
382 | long pWDegree(poly p, ring r); |
---|
383 | long pLDeg0(poly p,int *l, ring r); |
---|
384 | long pLDeg0c(poly p,int *l, ring r); |
---|
385 | long pLDegb(poly p,int *l, ring r); |
---|
386 | long pLDeg1(poly p,int *l, ring r); |
---|
387 | long pLDeg1c(poly p,int *l, ring r); |
---|
388 | long pLDeg1_Deg(poly p,int *l, ring r); |
---|
389 | long pLDeg1c_Deg(poly p,int *l, ring r); |
---|
390 | long pLDeg1_Totaldegree(poly p,int *l, ring r); |
---|
391 | long pLDeg1c_Totaldegree(poly p,int *l, ring r); |
---|
392 | long pLDeg1_WFirstTotalDegree(poly p,int *l, ring r); |
---|
393 | long pLDeg1c_WFirstTotalDegree(poly p,int *l, ring r); |
---|
394 | BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r); |
---|
395 | /*************************************************************** |
---|
396 | * |
---|
397 | * PDEBUG stuff |
---|
398 | * |
---|
399 | ***************************************************************/ |
---|
400 | #ifdef PDEBUG |
---|
401 | // Returns TRUE if m is monom of p, FALSE otherwise |
---|
402 | BOOLEAN pIsMonomOf(poly p, poly m); |
---|
403 | // Returns TRUE if p and q have common monoms |
---|
404 | BOOLEAN pHaveCommonMonoms(poly p, poly q); |
---|
405 | |
---|
406 | // p_Check* routines return TRUE if everything is ok, |
---|
407 | // else, they report error message and return false |
---|
408 | |
---|
409 | // check if Lm(p) is from ring r |
---|
410 | BOOLEAN p_LmCheckIsFromRing(poly p, ring r); |
---|
411 | // check if Lm(p) != NULL, r != NULL and initialized && Lm(p) is from r |
---|
412 | BOOLEAN p_LmCheckPolyRing(poly p, ring r); |
---|
413 | // check if all monoms of p are from ring r |
---|
414 | BOOLEAN p_CheckIsFromRing(poly p, ring r); |
---|
415 | // check r != NULL and initialized && all monoms of p are from r |
---|
416 | BOOLEAN p_CheckPolyRing(poly p, ring r); |
---|
417 | // check if r != NULL and initialized |
---|
418 | BOOLEAN p_CheckRing(ring r); |
---|
419 | // only do check if cond |
---|
420 | |
---|
421 | |
---|
422 | #define pIfThen(cond, check) do {if (cond) {check;}} while (0) |
---|
423 | |
---|
424 | BOOLEAN _p_Test(poly p, ring r, int level); |
---|
425 | BOOLEAN _p_LmTest(poly p, ring r, int level); |
---|
426 | BOOLEAN _pp_Test(poly p, ring lmRing, ring tailRing, int level); |
---|
427 | |
---|
428 | #define p_Test(p,r) _p_Test(p, r, PDEBUG) |
---|
429 | #define p_LmTest(p,r) _p_LmTest(p, r, PDEBUG) |
---|
430 | #define pp_Test(p, lmRing, tailRing) _pp_Test(p, lmRing, tailRing, PDEBUG) |
---|
431 | |
---|
432 | #else // ! PDEBUG |
---|
433 | |
---|
434 | #define pIsMonomOf(p, q) (TRUE) |
---|
435 | #define pHaveCommonMonoms(p, q) (TRUE) |
---|
436 | #define p_LmCheckIsFromRing(p,r) ((void)0) |
---|
437 | #define p_LmCheckPolyRing(p,r) ((void)0) |
---|
438 | #define p_CheckIsFromRing(p,r) ((void)0) |
---|
439 | #define p_CheckPolyRing(p,r) ((void)0) |
---|
440 | #define p_CheckRing(r) ((void)0) |
---|
441 | #define P_CheckIf(cond, check) ((void)0) |
---|
442 | |
---|
443 | #define p_Test(p,r) (1) |
---|
444 | #define p_LmTest(p,r) (1) |
---|
445 | #define pp_Test(p, lmRing, tailRing) (1) |
---|
446 | |
---|
447 | #endif |
---|
448 | |
---|
449 | #include <kernel/pInline2.h> |
---|
450 | #include <kernel/pInline1.h> |
---|
451 | |
---|
452 | #endif // P_POLYS_H |
---|
453 | |
---|