My Project
Macros | Functions | Variables
pDebug.cc File Reference
#include <stdarg.h>
#include <stdio.h>
#include "misc/auxiliary.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)
 
BOOLEAN pDebugLmShortDivisibleBy (poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
 
BOOLEAN pDebugLmShortDivisibleByNoComp (poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
 
void pPrintDivisbleByStat ()
 

Variables

STATIC_VAR BOOLEAN d_poly_error_reporting = FALSE
 
STATIC_VAR unsigned long pDivisibleBy_number = 1
 
STATIC_VAR unsigned long pDivisibleBy_FALSE = 1
 
STATIC_VAR unsigned long pDivisibleBy_ShortFalse = 1
 

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 321 of file pDebug.cc.

322{
323 if (level < 0 || p == NULL) return TRUE;
324 poly pnext = pNext(p);
325 pNext(p) = NULL;
326 BOOLEAN test_res = _p_Test(p, r, level);
327 pNext(p) = pnext;
328 return test_res;
329}
#define NULL
Definition: auxiliary.h:104
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
int level(const CanonicalForm &f)
int p
Definition: cfModGcd.cc:4080
#define pNext(p)
Definition: monomials.h:36
BOOLEAN _p_Test(poly p, ring r, int level)
Definition: pDebug.cc:210

◆ _p_Test()

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

Definition at line 210 of file pDebug.cc.

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

◆ _pp_Test()

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

Definition at line 331 of file pDebug.cc.

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

◆ dPolyReportError()

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

Definition at line 42 of file pDebug.cc.

43{
44 if (d_poly_error_reporting) return FALSE;
46 va_list ap;
47 va_start(ap, fmt);
48
49 fprintf(stderr, "\n// ***dPolyReportError: ");
50 vfprintf(stderr, fmt, ap);
51 fprintf(stderr, "\n occurred at\n");
53 if (p != NULL)
54 {
55 fprintf(stderr, " occurred for poly: ");
56 p_wrp(p, r);
57 omPrintAddrInfo(stderr, p, " ");
58 }
61 return FALSE;
62}
void dErrorBreak()
Definition: dError.cc:139
Definition: ap.h:40
STATIC_VAR BOOLEAN d_poly_error_reporting
Definition: pDebug.cc:41
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:373
#define omPrintAddrInfo(A, B, C)
Definition: xalloc.h:318
#define omPrintCurrentBackTraceMax(A, B)
Definition: xalloc.h:313

◆ p_CheckIsFromRing()

BOOLEAN p_CheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 100 of file pDebug.cc.

101{
102 while (p!=NULL)
103 {
105 pIter(p);
106 }
107 return TRUE;
108}

◆ p_CheckPolyRing()

BOOLEAN p_CheckPolyRing ( poly  p,
ring  r 
)

Definition at line 110 of file pDebug.cc.

111{
112 #ifndef X_OMALLOC
113 pAssumeReturn(r != NULL && r->PolyBin != NULL);
114 #endif
115 return p_CheckIsFromRing(p, r);
116}
#define pAssumeReturn(cond)
Definition: monomials.h:78
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:100

◆ p_CheckRing()

BOOLEAN p_CheckRing ( ring  r)

Definition at line 126 of file pDebug.cc.

127{
128 #ifndef X_OMALLOC
129 pAssumeReturn(r != NULL && r->PolyBin != NULL);
130 #endif
131 return TRUE;
132}

◆ p_DebugInit()

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

Definition at line 193 of file pDebug.cc.

194{
195 poly d_p = p_Init(dest_ring);
196 int i;
197 assume(dest_ring->N == src_ring->N);
198
199 for (i=1; i<= src_ring->N; i++)
200 {
201 p_SetExp(d_p, i, p_GetExp(p, i, src_ring), dest_ring);
202 }
203 if (rRing_has_Comp(dest_ring))
204 p_SetComp(d_p, p_GetComp(p, src_ring), dest_ring);
205
206 p_Setm_General(d_p, dest_ring);
207 return d_p;
208}
#define rRing_has_Comp(r)
Definition: monomials.h:266
void p_Setm_General(poly p, ring r)
Definition: p_polys.cc:157
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:488
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:247
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1280

◆ p_DebugLmDivisibleByNoComp()

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

Definition at line 139 of file pDebug.cc.

140{
141 int i=r->N;
142
143 do
144 {
145 if (p_GetExp(a,i,r) > p_GetExp(b,i,r))
146 return FALSE;
147 i--;
148 }
149 while (i);
150#ifdef HAVE_RINGS
151 return n_DivBy(pGetCoeff(b), pGetCoeff(a), r->cf);
152#else
153 return TRUE;
154#endif
155 }
CanonicalForm b
Definition: cfModGcd.cc:4105
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:777
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 69 of file pDebug.cc.

70{
71 if (p != NULL)
72 {
73 #if (OM_TRACK > 0) && defined(OM_TRACK_CUSTOM)
74 void* custom = omGetCustomOfAddr(p);
75 if (custom != NULL)
76 {
77 pPolyAssumeReturnMsg(custom == r ||
78 // be more sloppy for qrings
79 (r->qideal != NULL &&
81 omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin)) ||
82 rSamePolyRep((ring) custom, r),
83 "monomial not from specified ring",p,r);
84 return TRUE;
85 }
86 else
87 #endif
88 #ifndef X_OMALLOC
89 {
92 return TRUE;
93 }
94 return FALSE;
95 #endif
96 }
97 return TRUE;
98}
#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:1713
#define omSizeWOfAddr(P)
Definition: xalloc.h:262

◆ p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing ( poly  p,
ring  r 
)

Definition at line 118 of file pDebug.cc.

119{
120 #ifndef X_OMALLOC
121 pAssumeReturn(r != NULL && r->PolyBin != NULL);
122 #endif
123 pAssumeReturn(p != NULL);
124 return p_LmCheckIsFromRing(p, r);
125}

◆ p_Setm_General()

void p_Setm_General ( poly  p,
ring  r 
)

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

Definition at line 157 of file p_polys.cc.

158{
160 int pos=0;
161 if (r->typ!=NULL)
162 {
163 loop
164 {
165 unsigned long ord=0;
166 sro_ord* o=&(r->typ[pos]);
167 switch(o->ord_typ)
168 {
169 case ro_dp:
170 {
171 int a,e;
172 a=o->data.dp.start;
173 e=o->data.dp.end;
174 for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r);
175 p->exp[o->data.dp.place]=ord;
176 break;
177 }
178 case ro_wp_neg:
180 // 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 int64 mask=(int64)0x7fffffff;
277 long a_0=(long)(ord&mask); //2^31
278 long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/
279
280 //Print("mask: %x, ord: %d, a_0: %d, a_1: %d\n"
281 //,(int)mask,(int)ord,(int)a_0,(int)a_1);
282 //Print("mask: %d",mask);
283
284 p->exp[o->data.wp64.place]=a_1;
285 p->exp[o->data.wp64.place+1]=a_0;
286// if(p_Setm_error) PrintS("***************************\n"
287// "***************************\n"
288// "**WARNING: overflow error**\n"
289// "***************************\n"
290// "***************************\n");
291 break;
292 }
293 case ro_cp:
294 {
295 int a,e;
296 a=o->data.cp.start;
297 e=o->data.cp.end;
298 int pl=o->data.cp.place;
299 for(int i=a;i<=e;i++) { p->exp[pl]=p_GetExp(p,i,r); pl++; }
300 break;
301 }
302 case ro_syzcomp:
303 {
304 long c=__p_GetComp(p,r);
305 long sc = c;
306 int* Components = (_componentsExternal ? _components :
307 o->data.syzcomp.Components);
308 long* ShiftedComponents = (_componentsExternal ? _componentsShifted:
309 o->data.syzcomp.ShiftedComponents);
310 if (ShiftedComponents != NULL)
311 {
312 assume(Components != NULL);
313 assume(c == 0 || Components[c] != 0);
314 sc = ShiftedComponents[Components[c]];
315 assume(c == 0 || sc != 0);
316 }
317 p->exp[o->data.syzcomp.place]=sc;
318 break;
319 }
320 case ro_syz:
321 {
322 const unsigned long c = __p_GetComp(p, r);
323 const short place = o->data.syz.place;
324 const int limit = o->data.syz.limit;
325
326 if (c > (unsigned long)limit)
327 p->exp[place] = o->data.syz.curr_index;
328 else if (c > 0)
329 {
330 assume( (1 <= c) && (c <= (unsigned long)limit) );
331 p->exp[place]= o->data.syz.syz_index[c];
332 }
333 else
334 {
335 assume(c == 0);
336 p->exp[place]= 0;
337 }
338 break;
339 }
340 // Prefix for Induced Schreyer ordering
341 case ro_isTemp: // Do nothing?? (to be removed into suffix later on...?)
342 {
343 assume(p != NULL);
344
345#ifndef SING_NDEBUG
346#if MYTEST
347 Print("p_Setm_General: ro_isTemp ord: pos: %d, p: ", pos); p_wrp(p, r);
348#endif
349#endif
350 int c = p_GetComp(p, r);
351
352 assume( c >= 0 );
353
354 // Let's simulate case ro_syz above....
355 // Should accumulate (by Suffix) and be a level indicator
356 const int* const pVarOffset = o->data.isTemp.pVarOffset;
357
358 assume( pVarOffset != NULL );
359
360 // TODO: Can this be done in the suffix???
361 for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
362 {
363 const int vo = pVarOffset[i];
364 if( vo != -1) // TODO: optimize: can be done once!
365 {
366 // Hans! Please don't break it again! p_SetExp(p, ..., r, vo) is correct:
367 p_SetExp(p, p_GetExp(p, i, r), r, vo); // copy put them verbatim
368 // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
369 assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
370 }
371 }
372#ifndef SING_NDEBUG
373 for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
374 {
375 const int vo = pVarOffset[i];
376 if( vo != -1) // TODO: optimize: can be done once!
377 {
378 // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
379 assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
380 }
381 }
382#if MYTEST
383// if( p->exp[o->data.isTemp.start] > 0 )
384 PrintS("after Values: "); p_wrp(p, r);
385#endif
386#endif
387 break;
388 }
389
390 // Suffix for Induced Schreyer ordering
391 case ro_is:
392 {
393#ifndef SING_NDEBUG
394#if MYTEST
395 Print("p_Setm_General: ro_is ord: pos: %d, p: ", pos); p_wrp(p, r);
396#endif
397#endif
398
399 assume(p != NULL);
400
401 int c = p_GetComp(p, r);
402
403 assume( c >= 0 );
404 const ideal F = o->data.is.F;
405 const int limit = o->data.is.limit;
406 assume( limit >= 0 );
407 const int start = o->data.is.start;
408
409 if( F != NULL && c > limit )
410 {
411#ifndef SING_NDEBUG
412#if MYTEST
413 Print("p_Setm_General: ro_is : in rSetm: pos: %d, c: %d > limit: %d\n", c, pos, limit);
414 PrintS("preComputed Values: ");
415 p_wrp(p, r);
416#endif
417#endif
418// if( c > limit ) // BUG???
419 p->exp[start] = 1;
420// else
421// p->exp[start] = 0;
422
423
424 c -= limit;
425 assume( c > 0 );
426 c--;
427
428 if( c >= IDELEMS(F) )
429 break;
430
431 assume( c < IDELEMS(F) ); // What about others???
432
433 const poly pp = F->m[c]; // get reference monomial!!!
434
435 if(pp == NULL)
436 break;
437
438 assume(pp != NULL);
439
440#ifndef SING_NDEBUG
441#if MYTEST
442 Print("Respective F[c - %d: %d] pp: ", limit, c);
443 p_wrp(pp, r);
444#endif
445#endif
446
447 const int end = o->data.is.end;
448 assume(start <= end);
449
450
451// const int st = o->data.isTemp.start;
452
453#ifndef SING_NDEBUG
454#if MYTEST
455 Print("p_Setm_General: is(-Temp-) :: c: %d, limit: %d, [st:%d] ===>>> %ld\n", c, limit, start, p->exp[start]);
456#endif
457#endif
458
459 // p_ExpVectorAdd(p, pp, r);
460
461 for( int i = start; i <= end; i++) // v[0] may be here...
462 p->exp[i] += pp->exp[i]; // !!!!!!!! ADD corresponding LT(F)
463
464 // p_MemAddAdjust(p, ri);
465 if (r->NegWeightL_Offset != NULL)
466 {
467 for (int i=r->NegWeightL_Size-1; i>=0; i--)
468 {
469 const int _i = r->NegWeightL_Offset[i];
470 if( start <= _i && _i <= end )
471 p->exp[_i] -= POLY_NEGWEIGHT_OFFSET;
472 }
473 }
474
475
476#ifndef SING_NDEBUG
477 const int* const pVarOffset = o->data.is.pVarOffset;
478
479 assume( pVarOffset != NULL );
480
481 for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
482 {
483 const int vo = pVarOffset[i];
484 if( vo != -1) // TODO: optimize: can be done once!
485 // Hans! Please don't break it again! p_GetExp(p/pp, r, vo) is correct:
486 assume( p_GetExp(p, r, vo) == (p_GetExp(p, i, r) + p_GetExp(pp, r, vo)) );
487 }
488 // TODO: how to check this for computed values???
489#if MYTEST
490 PrintS("Computed Values: "); p_wrp(p, r);
491#endif
492#endif
493 } else
494 {
495 p->exp[start] = 0; //!!!!????? where?????
496
497 const int* const pVarOffset = o->data.is.pVarOffset;
498
499 // What about v[0] - component: it will be added later by
500 // suffix!!!
501 // TODO: Test it!
502 const int vo = pVarOffset[0];
503 if( vo != -1 )
504 p->exp[vo] = c; // initial component v[0]!
505
506#ifndef SING_NDEBUG
507#if MYTEST
508 Print("ELSE p_Setm_General: ro_is :: c: %d <= limit: %d, vo: %d, exp: %d\n", c, limit, vo, p->exp[vo]);
509 p_wrp(p, r);
510#endif
511#endif
512 }
513
514 break;
515 }
516 default:
517 dReportError("wrong ord in rSetm:%d\n",o->ord_typ);
518 return;
519 }
520 pos++;
521 if (pos == r->OrdSize) return;
522 }
523 }
524}
long int64
Definition: auxiliary.h:68
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
if(both_non_zero==0)
Definition: cfEzgcd.cc:91
#define Print
Definition: emacs.cc:80
const CanonicalForm & w
Definition: facAbsFact.cc:51
int dReportError(const char *fmt,...)
Definition: dError.cc:43
#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:147
STATIC_VAR long * _componentsShifted
Definition: p_polys.cc:146
VAR BOOLEAN pSetm_error
Definition: p_polys.cc:149
STATIC_VAR int * _components
Definition: p_polys.cc:145
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118
void PrintS(const char *s)
Definition: reporter.cc:284
ro_typ ord_typ
Definition: ring.h:220
@ ro_wp64
Definition: ring.h:55
@ ro_syz
Definition: ring.h:60
@ ro_cp
Definition: ring.h:58
@ ro_dp
Definition: ring.h:52
@ ro_is
Definition: ring.h:61
@ ro_wp_neg
Definition: ring.h:56
@ ro_wp
Definition: ring.h:53
@ ro_isTemp
Definition: ring.h:61
@ ro_am
Definition: ring.h:54
#define IDELEMS(i)
Definition: simpleideals.h:23
#define loop
Definition: structs.h:80

◆ pDebugLmShortDivisibleBy()

BOOLEAN pDebugLmShortDivisibleBy ( poly  p1,
unsigned long  sev_1,
ring  r_1,
poly  p2,
unsigned long  not_sev_2,
ring  r_2 
)

Definition at line 364 of file pDebug.cc.

366{
367 _pPolyAssume(p_GetShortExpVector(p1, r_1) == sev_1, p1, r_1);
368 _pPolyAssume(p_GetShortExpVector(p2, r_2) == ~ not_sev_2, p2, r_2);
369
371 BOOLEAN ret;
372 if (r_1 == r_2)
373 ret = p_LmDivisibleBy(p1, p2, r_1);
374 else
375 ret = p_LmDivisibleBy(p1, r_1, p2, r_2);
376
377 if (! ret) pDivisibleBy_FALSE++;
378 if (sev_1 & not_sev_2)
379 {
381 if (ret)
382 dReportError("p1 divides p2, but sev's are wrong");
383 }
384 return ret;
385}
#define _pPolyAssume(cond, p, r)
Definition: monomials.h:113
STATIC_VAR unsigned long pDivisibleBy_number
Definition: pDebug.cc:360
STATIC_VAR unsigned long pDivisibleBy_ShortFalse
Definition: pDebug.cc:362
STATIC_VAR unsigned long pDivisibleBy_FALSE
Definition: pDebug.cc:361
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4809
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1863

◆ pDebugLmShortDivisibleByNoComp()

BOOLEAN pDebugLmShortDivisibleByNoComp ( poly  p1,
unsigned long  sev_1,
ring  r_1,
poly  p2,
unsigned long  not_sev_2,
ring  r_2 
)

Definition at line 387 of file pDebug.cc.

389{
390// _pPolyAssume((p_GetComp(p1, r_1) == p_GetComp(p2, r_2)) || (p_GetComp(p1, r_1) == 0));
391 _pPolyAssume(p_GetShortExpVector(p1, r_1) == sev_1, p1, r_1);
392 _pPolyAssume(p_GetShortExpVector(p2, r_2) == ~ not_sev_2, p2, r_2);
393
395 BOOLEAN ret;
396 if (r_1 == r_2)
397 ret = p_LmDivisibleByNoComp(p1, p2, r_1);
398 else
399 ret = p_LmDivisibleByNoComp(p1, r_1, p2, r_2);
400
401 if (! ret) pDivisibleBy_FALSE++;
402 if (sev_1 & not_sev_2)
403 {
405 if (ret)
406 dReportError("p1 divides p2, but sev's are wrong");
407 }
408 return ret;
409}
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1849

◆ pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms ( poly  p,
poly  q 
)

Definition at line 173 of file pDebug.cc.

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

◆ pIsMonomOf()

BOOLEAN pIsMonomOf ( poly  p,
poly  m 
)

Definition at line 163 of file pDebug.cc.

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

◆ pPrintDivisbleByStat()

void pPrintDivisbleByStat ( )

Definition at line 411 of file pDebug.cc.

412{
413 Print("#Tests: %ld; #FALSE %ld(%ld); #SHORT %ld(%ld)\n",
415 pDivisibleBy_FALSE, (unsigned long) ((double)pDivisibleBy_FALSE*((double) 100)/(double)pDivisibleBy_number),
416 pDivisibleBy_ShortFalse, (unsigned long) ((double)pDivisibleBy_ShortFalse*((double)100)/(double)pDivisibleBy_FALSE));
417}

Variable Documentation

◆ d_poly_error_reporting

STATIC_VAR BOOLEAN d_poly_error_reporting = FALSE

Definition at line 41 of file pDebug.cc.

◆ pDivisibleBy_FALSE

STATIC_VAR unsigned long pDivisibleBy_FALSE = 1

Definition at line 361 of file pDebug.cc.

◆ pDivisibleBy_number

STATIC_VAR unsigned long pDivisibleBy_number = 1

Definition at line 360 of file pDebug.cc.

◆ pDivisibleBy_ShortFalse

STATIC_VAR unsigned long pDivisibleBy_ShortFalse = 1

Definition at line 362 of file pDebug.cc.