My Project
Loading...
Searching...
No Matches
pDebug.cc File Reference
#include <stdarg.h>
#include <stdio.h>
#include "misc/auxiliary.h"
#include "misc/distrib.h"
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "coeffs/coeffs.h"

Go to the source code of this file.

Macros

#define PDEBUG_CC
 

Functions

BOOLEAN dPolyReportError (poly p, ring r, const char *fmt,...)
 
BOOLEAN p_LmCheckIsFromRing (poly p, ring r)
 
BOOLEAN p_CheckIsFromRing (poly p, ring r)
 
BOOLEAN p_CheckPolyRing (poly p, ring r)
 
BOOLEAN p_LmCheckPolyRing (poly p, ring r)
 
BOOLEAN p_CheckRing (ring r)
 
BOOLEAN p_DebugLmDivisibleByNoComp (poly a, poly b, ring r)
 
BOOLEAN pIsMonomOf (poly p, poly m)
 
BOOLEAN pHaveCommonMonoms (poly p, poly q)
 
void p_Setm_General (poly p, ring r)
 
static poly p_DebugInit (poly p, ring src_ring, ring dest_ring)
 
BOOLEAN _p_Test (poly p, ring r, int level)
 
BOOLEAN _p_LmTest (poly p, ring r, int level)
 
BOOLEAN _pp_Test (poly p, ring lmRing, ring tailRing, int level)
 

Variables

STATIC_VAR BOOLEAN d_poly_error_reporting = FALSE
 

Macro Definition Documentation

◆ PDEBUG_CC

#define PDEBUG_CC

Definition at line 12 of file pDebug.cc.

Function Documentation

◆ _p_LmTest()

BOOLEAN _p_LmTest ( poly p,
ring r,
int level )

Definition at line 322 of file pDebug.cc.

323{
324 if (level < 0 || p == NULL) return TRUE;
325 poly pnext = pNext(p);
326 pNext(p) = NULL;
327 BOOLEAN test_res = _p_Test(p, r, level);
328 pNext(p) = pnext;
329 return test_res;
330}
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
int level(const CanonicalForm &f)
int p
Definition cfModGcd.cc:4086
#define pNext(p)
Definition monomials.h:36
#define NULL
Definition omList.c:12
BOOLEAN _p_Test(poly p, ring r, int level)
Definition pDebug.cc:211

◆ _p_Test()

BOOLEAN _p_Test ( poly p,
ring r,
int level )

Definition at line 211 of file pDebug.cc.

212{
213 assume(r->cf !=NULL);
214
215 if (PDEBUG > level) level = PDEBUG;
216 if (level < 0 || p == NULL) return TRUE;
217
218 poly p_prev = NULL;
219
220 #ifndef OM_NDEBUG
221 #ifndef X_OMALLOC
222 // check addr with level+1 so as to check bin/page of addr
223 _pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, level+1)
224 == omError_NoError, "memory error",p,r);
225 #endif
226 #endif
227
229
230 // this checks that p does not contain a loop: rather expensive O(length^2)
231 #ifndef OM_NDEBUG
232 if (level > 1)
234 #endif
235
236 int ismod = p_GetComp(p, r) != 0;
237
238 while (p != NULL)
239 {
240 // ring check
242 #ifndef OM_NDEBUG
243 #ifndef X_OMALLOC
244 // omAddr check
245 _pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, 1)
246 == omError_NoError, "memory error",p,r);
247 #endif
248 #endif
249 // number/coef check
250 _pPolyAssumeReturnMsg(p->coef != NULL || (n_GetChar(r->cf) >= 2), "NULL coef",p,r);
251
252 #ifdef LDEBUG
253 _pPolyAssumeReturnMsg(n_Test(p->coef,r->cf),"coeff err",p,r);
254 #endif
255 _pPolyAssumeReturnMsg(!n_IsZero(p->coef, r->cf), "Zero coef",p,r);
256
257 // check for valid comp
258 _pPolyAssumeReturnMsg(p_GetComp(p, r) >= 0 && (p_GetComp(p, r)<65000), "component out of range ?",p,r);
259 // check for mix poly/vec representation
260 _pPolyAssumeReturnMsg(ismod == (p_GetComp(p, r) != 0), "mixed poly/vector",p,r);
261
262 // special check for ringorder_s/S
263 if ((r->typ!=NULL) && (r->typ[0].ord_typ == ro_syzcomp))
264 {
265 long c1, cc1, ccc1, ec1;
266 sro_ord* o = &(r->typ[0]);
267
268 c1 = p_GetComp(p, r);
269 if (o->data.syzcomp.Components!=NULL)
270 {
271 cc1 = o->data.syzcomp.Components[c1];
272 ccc1 = o->data.syzcomp.ShiftedComponents[cc1];
273 }
274 else { cc1=0; ccc1=0; }
275 _pPolyAssumeReturnMsg(c1 == 0 || cc1 != 0, "Component <-> TrueComponent zero mismatch",p,r);
276 _pPolyAssumeReturnMsg(c1 == 0 || ccc1 != 0,"Component <-> ShiftedComponent zero mismatch",p,r);
277 ec1 = p->exp[o->data.syzcomp.place];
278 //pPolyAssumeReturnMsg(ec1 == ccc1, "Shifted comp out of sync. should %d, is %d");
279 if (ec1 != ccc1)
280 {
281 dPolyReportError(p,r,"Shifted comp out of sync. should %d, is %d",ccc1,ec1);
282 return FALSE;
283 }
284 }
285
286 // check that p_Setm works ok
287 if (level > 0)
288 {
289 poly p_should_equal = p_DebugInit(p, r, r);
290 _pPolyAssumeReturnMsg(p_ExpVectorEqual(p, p_should_equal, r), "p_Setm field(s) out of sync",p,r);
291 p_LmFree(p_should_equal, r);
292 }
293
294 // check order
295 if (p_prev != NULL)
296 {
297 int cmp = p_LmCmp(p_prev, p, r);
298 if (cmp == 0)
299 {
300 _pPolyAssumeReturnMsg(0, "monoms p and p->next are equal", p_prev, r);
301 }
302 else
303 _pPolyAssumeReturnMsg(p_LmCmp(p_prev, p, r) == 1, "wrong order", p_prev, r);
304
305 // check that compare worked sensibly
306 if (level > 1 && p_GetComp(p_prev, r) == p_GetComp(p, r))
307 {
308 int i;
309 for (i=r->N; i>0; i--)
310 {
311 if (p_GetExp(p_prev, i, r) != p_GetExp(p, i, r)) break;
312 }
313 _pPolyAssumeReturnMsg(i > 0, "Exponents equal but compare different", p_prev, r);
314 }
315 }
316 p_prev = p;
317 pIter(p);
318 }
319 return TRUE;
320}
#define FALSE
Definition auxiliary.h:97
#define PDEBUG
Definition auxiliary.h:171
int i
Definition cfEzgcd.cc:132
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition coeffs.h:713
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:468
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:448
#define assume(x)
Definition mod2.h:389
#define p_GetComp(p, r)
Definition monomials.h:64
#define pFalseReturn(cond)
Definition monomials.h:139
#define pIter(p)
Definition monomials.h:37
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition monomials.h:124
#define omSizeWOfBin(bin_ptr)
@ omError_NoError
Definition omError.h:18
#define omTestList(ptr, level)
Definition omList.h:81
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition pDebug.cc:194
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition pDebug.cc:43
BOOLEAN p_CheckRing(ring r)
Definition pDebug.cc:131
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition pDebug.cc:74
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition p_polys.cc:4635
static int p_LmCmp(poly p, poly q, const ring r)
Definition p_polys.h:1596
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471
static void p_LmFree(poly p, ring)
Definition p_polys.h:685
@ ro_syzcomp
Definition ring.h:60
union sro_ord::@006200034235045362245112336324125006204215012002 data
#define omTestBinAddrSize(A, B, C)
Definition xalloc.h:272

◆ _pp_Test()

BOOLEAN _pp_Test ( poly p,
ring lmRing,
ring tailRing,
int level )

Definition at line 332 of file pDebug.cc.

333{
334 if (PDEBUG > level) level = PDEBUG;
335 if (level < 0 || p == NULL) return TRUE;
336 if (pNext(p) == NULL || lmRing == tailRing) return _p_Test(p, lmRing, level);
337
338 pFalseReturn(_p_LmTest(p, lmRing, level));
339 pFalseReturn(_p_Test(pNext(p), tailRing, level));
340
341 // check that lm > Lm(tail)
342 if (level > 1)
343 {
344 poly lm = p;
345 poly tail = p_DebugInit(pNext(p), tailRing, lmRing);
346 poly pnext = pNext(lm);
347 pNext(lm) = tail;
348 BOOLEAN cmp = p_LmCmp(lm, tail, lmRing);
349 if (cmp != 1)
350 dPolyReportError(lm, lmRing, "wrong order: lm <= Lm(tail)");
351 p_LmFree(tail, lmRing);
352 pNext(lm) = pnext;
353 return (cmp == 1);
354 }
355 return TRUE;
356}
BOOLEAN _p_LmTest(poly p, ring r, int level)
Definition pDebug.cc:322

◆ dPolyReportError()

BOOLEAN dPolyReportError ( poly p,
ring r,
const char * fmt,
... )

Definition at line 43 of file pDebug.cc.

44{
45 if (d_poly_error_reporting) return FALSE;
47 va_list ap;
48 va_start(ap, fmt);
49
50 fprintf(stderr, "\n// ***dPolyReportError: ");
51 vfprintf(stderr, fmt, ap);
52 fprintf(stderr, "\n occurred at\n");
53 #ifdef HAVE_OMALLOC
55 #endif
56 if (p != NULL)
57 {
58 fprintf(stderr, " occurred for poly: ");
59 p_wrp(p, r);
60 omPrintAddrInfo(stderr, p, " ");
61 }
62 #ifndef MAKE_DISTRIBUTION
64 #endif
66 return FALSE;
67}
void dErrorBreak(void)
Definition ap.h:40
STATIC_VAR BOOLEAN d_poly_error_reporting
Definition pDebug.cc:42
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373
#define omPrintAddrInfo(A, B, C)
Definition xalloc.h:270
#define omPrintCurrentBackTraceMax(A, B)
Definition xalloc.h:265

◆ p_CheckIsFromRing()

BOOLEAN p_CheckIsFromRing ( poly p,
ring r )

Definition at line 105 of file pDebug.cc.

106{
107 while (p!=NULL)
108 {
110 pIter(p);
111 }
112 return TRUE;
113}

◆ p_CheckPolyRing()

BOOLEAN p_CheckPolyRing ( poly p,
ring r )

Definition at line 115 of file pDebug.cc.

116{
117 #ifndef X_OMALLOC
118 pAssumeReturn(r != NULL && r->PolyBin != NULL);
119 #endif
120 return p_CheckIsFromRing(p, r);
121}
#define pAssumeReturn(cond)
Definition monomials.h:78
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition pDebug.cc:105

◆ p_CheckRing()

BOOLEAN p_CheckRing ( ring r)

Definition at line 131 of file pDebug.cc.

132{
133 #ifndef X_OMALLOC
134 pAssumeReturn(r != NULL && r->PolyBin != NULL);
135 #endif
136 return TRUE;
137}

◆ p_DebugInit()

static poly p_DebugInit ( poly p,
ring src_ring,
ring dest_ring )
static

Definition at line 194 of file pDebug.cc.

195{
196 poly d_p = p_Init(dest_ring);
197 int i;
198 assume(dest_ring->N == src_ring->N);
199
200 for (i=1; i<= src_ring->N; i++)
201 {
202 p_SetExp(d_p, i, p_GetExp(p, i, src_ring), dest_ring);
203 }
204 if (rRing_has_Comp(dest_ring))
205 p_SetComp(d_p, p_GetComp(p, src_ring), dest_ring);
206
207 p_Setm_General(d_p, dest_ring);
208 return d_p;
209}
#define rRing_has_Comp(r)
Definition monomials.h:266
void p_Setm_General(poly p, ring r)
Definition p_polys.cc:158
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1336

◆ p_DebugLmDivisibleByNoComp()

BOOLEAN p_DebugLmDivisibleByNoComp ( poly a,
poly b,
ring r )

Definition at line 144 of file pDebug.cc.

145{
146 int i=r->N;
147
148 do
149 {
150 if (p_GetExp(a,i,r) > p_GetExp(b,i,r))
151 return FALSE;
152 i--;
153 }
154 while (i);
155 return n_DivBy(pGetCoeff(b), pGetCoeff(a), r->cf);
156}
CanonicalForm b
Definition cfModGcd.cc:4111
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition coeffs.h:748
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44

◆ p_LmCheckIsFromRing()

BOOLEAN p_LmCheckIsFromRing ( poly p,
ring r )

Definition at line 74 of file pDebug.cc.

75{
76 if (p != NULL)
77 {
78 #if (OM_TRACK > 0) && defined(OM_TRACK_CUSTOM)
79 void* custom = omGetCustomOfAddr(p);
80 if (custom != NULL)
81 {
82 pPolyAssumeReturnMsg(custom == r ||
83 // be more sloppy for qrings
84 (r->qideal != NULL &&
86 omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin)) ||
87 rSamePolyRep((ring) custom, r),
88 "monomial not from specified ring",p,r);
89 return TRUE;
90 }
91 else
92 #endif
93 #ifndef X_OMALLOC
94 {
97 return TRUE;
98 }
99 return FALSE;
100 #endif
101 }
102 return TRUE;
103}
#define pPolyAssumeReturnMsg(cond, msg)
Definition monomials.h:137
#define _pPolyAssumeReturn(cond, p, r)
Definition monomials.h:101
#define omIsBinPageAddr(addr)
Definition omBinPage.h:68
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition ring.cc:1804
#define omSizeWOfAddr(P)
Definition xalloc.h:223

◆ p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing ( poly p,
ring r )

Definition at line 123 of file pDebug.cc.

124{
125 #ifndef X_OMALLOC
126 pAssumeReturn(r != NULL && r->PolyBin != NULL);
127 #endif
128 pAssumeReturn(p != NULL);
129 return p_LmCheckIsFromRing(p, r);
130}

◆ p_Setm_General()

void p_Setm_General ( poly p,
ring r )
extern

!!!????? where?????

Definition at line 158 of file p_polys.cc.

159{
161 int pos=0;
162 if (r->typ!=NULL)
163 {
164 loop
165 {
166 unsigned long ord=0;
167 sro_ord* o=&(r->typ[pos]);
168 switch(o->ord_typ)
169 {
170 case ro_dp:
171 {
172 int a,e;
173 a=o->data.dp.start;
174 e=o->data.dp.end;
175 for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r);
176 p->exp[o->data.dp.place]=ord;
177 break;
178 }
179 case ro_wp_neg:
180 ord=POLY_NEGWEIGHT_OFFSET; // no break;
181 case ro_wp:
182 {
183 int a,e;
184 a=o->data.wp.start;
185 e=o->data.wp.end;
186 int *w=o->data.wp.weights;
187#if 1
188 for(int i=a;i<=e;i++) ord+=((unsigned long)p_GetExp(p,i,r))*((unsigned long)w[i-a]);
189#else
190 long ai;
191 int ei,wi;
192 for(int i=a;i<=e;i++)
193 {
194 ei=p_GetExp(p,i,r);
195 wi=w[i-a];
196 ai=ei*wi;
197 if (ai/ei!=wi) pSetm_error=TRUE;
198 ord+=ai;
199 if (ord<ai) pSetm_error=TRUE;
200 }
201#endif
202 p->exp[o->data.wp.place]=ord;
203 break;
204 }
205 case ro_am:
206 {
208 const short a=o->data.am.start;
209 const short e=o->data.am.end;
210 const int * w=o->data.am.weights;
211#if 1
212 for(short i=a; i<=e; i++, w++)
213 ord += ((*w) * p_GetExp(p,i,r));
214#else
215 long ai;
216 int ei,wi;
217 for(short i=a;i<=e;i++)
218 {
219 ei=p_GetExp(p,i,r);
220 wi=w[i-a];
221 ai=ei*wi;
222 if (ai/ei!=wi) pSetm_error=TRUE;
223 ord += ai;
224 if (ord<ai) pSetm_error=TRUE;
225 }
226#endif
227 const int c = p_GetComp(p,r);
228
229 const short len_gen= o->data.am.len_gen;
230
231 if ((c > 0) && (c <= len_gen))
232 {
233 assume( w == o->data.am.weights_m );
234 assume( w[0] == len_gen );
235 ord += w[c];
236 }
237
238 p->exp[o->data.am.place] = ord;
239 break;
240 }
241 case ro_wp64:
242 {
243 int64 ord=0;
244 int a,e;
245 a=o->data.wp64.start;
246 e=o->data.wp64.end;
247 int64 *w=o->data.wp64.weights64;
248 int64 ei,wi,ai;
249 for(int i=a;i<=e;i++)
250 {
251 //Print("exp %d w %d \n",p_GetExp(p,i,r),(int)w[i-a]);
252 //ord+=((int64)p_GetExp(p,i,r))*w[i-a];
253 ei=(int64)p_GetExp(p,i,r);
254 wi=w[i-a];
255 ai=ei*wi;
256 if(ei!=0 && ai/ei!=wi)
257 {
259 #if SIZEOF_LONG == 4
260 Print("ai %lld, wi %lld\n",ai,wi);
261 #else
262 Print("ai %ld, wi %ld\n",ai,wi);
263 #endif
264 }
265 ord+=ai;
266 if (ord<ai)
267 {
269 #if SIZEOF_LONG == 4
270 Print("ai %lld, ord %lld\n",ai,ord);
271 #else
272 Print("ai %ld, ord %ld\n",ai,ord);
273 #endif
274 }
275 }
276 #if SIZEOF_LONG == 4
277 int64 mask=(int64)0x7fffffff;
278 long a_0=(long)(ord&mask); //2^31
279 long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/
280
281 //Print("mask: %x, ord: %d, a_0: %d, a_1: %d\n"
282 //,(int)mask,(int)ord,(int)a_0,(int)a_1);
283 //Print("mask: %d",mask);
284
285 p->exp[o->data.wp64.place]=a_1;
286 p->exp[o->data.wp64.place+1]=a_0;
287 #elif SIZEOF_LONG == 8
288 p->exp[o->data.wp64.place]=ord;
289 #endif
290// if(p_Setm_error) PrintS("***************************\n"
291// "***************************\n"
292// "**WARNING: overflow error**\n"
293// "***************************\n"
294// "***************************\n");
295 break;
296 }
297 case ro_cp:
298 {
299 int a,e;
300 a=o->data.cp.start;
301 e=o->data.cp.end;
302 int pl=o->data.cp.place;
303 for(int i=a;i<=e;i++) { p->exp[pl]=p_GetExp(p,i,r); pl++; }
304 break;
305 }
306 case ro_syzcomp:
307 {
308 long c=__p_GetComp(p,r);
309 long sc = c;
310 int* Components = (_componentsExternal ? _components :
311 o->data.syzcomp.Components);
312 long* ShiftedComponents = (_componentsExternal ? _componentsShifted:
313 o->data.syzcomp.ShiftedComponents);
314 if (ShiftedComponents != NULL)
315 {
316 assume(Components != NULL);
317 assume(c == 0 || Components[c] != 0);
318 sc = ShiftedComponents[Components[c]];
319 assume(c == 0 || sc != 0);
320 }
321 p->exp[o->data.syzcomp.place]=sc;
322 break;
323 }
324 case ro_syz:
325 {
326 const unsigned long c = __p_GetComp(p, r);
327 const short place = o->data.syz.place;
328 const int limit = o->data.syz.limit;
329
330 if (c > (unsigned long)limit)
331 p->exp[place] = o->data.syz.curr_index;
332 else if (c > 0)
333 {
334 assume( (1 <= c) && (c <= (unsigned long)limit) );
335 p->exp[place]= o->data.syz.syz_index[c];
336 }
337 else
338 {
339 assume(c == 0);
340 p->exp[place]= 0;
341 }
342 break;
343 }
344 // Prefix for Induced Schreyer ordering
345 case ro_isTemp: // Do nothing?? (to be removed into suffix later on...?)
346 {
347 assume(p != NULL);
348
349#ifndef SING_NDEBUG
350#if MYTEST
351 Print("p_Setm_General: ro_isTemp ord: pos: %d, p: ", pos); p_wrp(p, r);
352#endif
353#endif
354 int c = p_GetComp(p, r);
355
356 assume( c >= 0 );
357
358 // Let's simulate case ro_syz above....
359 // Should accumulate (by Suffix) and be a level indicator
360 const int* const pVarOffset = o->data.isTemp.pVarOffset;
361
362 assume( pVarOffset != NULL );
363
364 // TODO: Can this be done in the suffix???
365 for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
366 {
367 const int vo = pVarOffset[i];
368 if( vo != -1) // TODO: optimize: can be done once!
369 {
370 // Hans! Please don't break it again! p_SetExp(p, ..., r, vo) is correct:
371 p_SetExp(p, p_GetExp(p, i, r), r, vo); // copy put them verbatim
372 // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
373 assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
374 }
375 }
376#ifndef SING_NDEBUG
377 for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
378 {
379 const int vo = pVarOffset[i];
380 if( vo != -1) // TODO: optimize: can be done once!
381 {
382 // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
383 assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
384 }
385 }
386#if MYTEST
387// if( p->exp[o->data.isTemp.start] > 0 )
388 PrintS("after Values: "); p_wrp(p, r);
389#endif
390#endif
391 break;
392 }
393
394 // Suffix for Induced Schreyer ordering
395 case ro_is:
396 {
397#ifndef SING_NDEBUG
398#if MYTEST
399 Print("p_Setm_General: ro_is ord: pos: %d, p: ", pos); p_wrp(p, r);
400#endif
401#endif
402
403 assume(p != NULL);
404
405 int c = p_GetComp(p, r);
406
407 assume( c >= 0 );
408 const ideal F = o->data.is.F;
409 const int limit = o->data.is.limit;
410 assume( limit >= 0 );
411 const int start = o->data.is.start;
412
413 if( F != NULL && c > limit )
414 {
415#ifndef SING_NDEBUG
416#if MYTEST
417 Print("p_Setm_General: ro_is : in rSetm: pos: %d, c: %d > limit: %d\n", c, pos, limit);
418 PrintS("preComputed Values: ");
419 p_wrp(p, r);
420#endif
421#endif
422// if( c > limit ) // BUG???
423 p->exp[start] = 1;
424// else
425// p->exp[start] = 0;
426
427
428 c -= limit;
429 assume( c > 0 );
430 c--;
431
432 if( c >= IDELEMS(F) )
433 break;
434
435 assume( c < IDELEMS(F) ); // What about others???
436
437 const poly pp = F->m[c]; // get reference monomial!!!
438
439 if(pp == NULL)
440 break;
441
442 assume(pp != NULL);
443
444#ifndef SING_NDEBUG
445#if MYTEST
446 Print("Respective F[c - %d: %d] pp: ", limit, c);
447 p_wrp(pp, r);
448#endif
449#endif
450
451 const int end = o->data.is.end;
452 assume(start <= end);
453
454
455// const int st = o->data.isTemp.start;
456
457#ifndef SING_NDEBUG
458#if MYTEST
459 Print("p_Setm_General: is(-Temp-) :: c: %d, limit: %d, [st:%d] ===>>> %ld\n", c, limit, start, p->exp[start]);
460#endif
461#endif
462
463 // p_ExpVectorAdd(p, pp, r);
464
465 for( int i = start; i <= end; i++) // v[0] may be here...
466 p->exp[i] += pp->exp[i]; // !!!!!!!! ADD corresponding LT(F)
467
468 // p_MemAddAdjust(p, ri);
469 if (r->NegWeightL_Offset != NULL)
470 {
471 for (int i=r->NegWeightL_Size-1; i>=0; i--)
472 {
473 const int _i = r->NegWeightL_Offset[i];
474 if( start <= _i && _i <= end )
475 p->exp[_i] -= POLY_NEGWEIGHT_OFFSET;
476 }
477 }
478
479
480#ifndef SING_NDEBUG
481 const int* const pVarOffset = o->data.is.pVarOffset;
482
483 assume( pVarOffset != NULL );
484
485 for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
486 {
487 const int vo = pVarOffset[i];
488 if( vo != -1) // TODO: optimize: can be done once!
489 // Hans! Please don't break it again! p_GetExp(p/pp, r, vo) is correct:
490 assume( p_GetExp(p, r, vo) == (p_GetExp(p, i, r) + p_GetExp(pp, r, vo)) );
491 }
492 // TODO: how to check this for computed values???
493#if MYTEST
494 PrintS("Computed Values: "); p_wrp(p, r);
495#endif
496#endif
497 } else
498 {
499 p->exp[start] = 0; //!!!!????? where?????
500
501 const int* const pVarOffset = o->data.is.pVarOffset;
502
503 // What about v[0] - component: it will be added later by
504 // suffix!!!
505 // TODO: Test it!
506 const int vo = pVarOffset[0];
507 if( vo != -1 )
508 p->exp[vo] = c; // initial component v[0]!
509
510#ifndef SING_NDEBUG
511#if MYTEST
512 Print("ELSE p_Setm_General: ro_is :: c: %d <= limit: %d, vo: %d, exp: %d\n", c, limit, vo, p->exp[vo]);
513 p_wrp(p, r);
514#endif
515#endif
516 }
517
518 break;
519 }
520 default:
521 dReportError("wrong ord in rSetm:%d\n",o->ord_typ);
522 return;
523 }
524 pos++;
525 if (pos == r->OrdSize) return;
526 }
527 }
528}
long int64
Definition auxiliary.h:68
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
#define Print
Definition emacs.cc:80
const CanonicalForm & w
Definition facAbsFact.cc:51
int dReportError(const char *fmt,...)
Definition dError.cc:44
#define POLY_NEGWEIGHT_OFFSET
Definition monomials.h:236
#define __p_GetComp(p, r)
Definition monomials.h:63
STATIC_VAR int _componentsExternal
Definition p_polys.cc:148
STATIC_VAR long * _componentsShifted
Definition p_polys.cc:147
VAR BOOLEAN pSetm_error
Definition p_polys.cc:150
STATIC_VAR int * _components
Definition p_polys.cc:146
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition pDebug.cc:123
void PrintS(const char *s)
Definition reporter.cc:284
ro_typ ord_typ
Definition ring.h:226
@ ro_wp64
Definition ring.h:56
@ ro_syz
Definition ring.h:61
@ ro_cp
Definition ring.h:59
@ ro_dp
Definition ring.h:53
@ ro_is
Definition ring.h:62
@ ro_wp_neg
Definition ring.h:57
@ ro_wp
Definition ring.h:54
@ ro_isTemp
Definition ring.h:62
@ ro_am
Definition ring.h:55
#define IDELEMS(i)
#define loop
Definition structs.h:71

◆ pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms ( poly p,
poly q )

Definition at line 174 of file pDebug.cc.

175{
176 while (p != NULL)
177 {
178 if (pIsMonomOf(q, p))
179 {
180 return TRUE;
181 }
182 pIter(p);
183 }
184 return FALSE;
185}
BOOLEAN pIsMonomOf(poly p, poly m)
Definition pDebug.cc:164

◆ pIsMonomOf()

BOOLEAN pIsMonomOf ( poly p,
poly m )

Definition at line 164 of file pDebug.cc.

165{
166 if (m == NULL) return TRUE;
167 while (p != NULL)
168 {
169 if (p == m) return TRUE;
170 pIter(p);
171 }
172 return FALSE;
173}
int m
Definition cfEzgcd.cc:128

Variable Documentation

◆ d_poly_error_reporting

STATIC_VAR BOOLEAN d_poly_error_reporting = FALSE

Definition at line 42 of file pDebug.cc.