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

324 {
325  if (level < 0 || p == NULL) return TRUE;
326  poly pnext = pNext(p);
327  pNext(p) = NULL;
328  BOOLEAN test_res = _p_Test(p, r, level);
329  pNext(p) = pnext;
330  return test_res;
331 }
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
int level(const CanonicalForm &f)
int p
Definition: cfModGcd.cc:4078
#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:212

◆ _p_Test()

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

Definition at line 212 of file pDebug.cc.

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

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

◆ 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");
52  #ifdef HAVE_OMALLOC
53  omPrintCurrentBackTraceMax(stderr, 8);
54  #endif
55  if (p != NULL)
56  {
57  fprintf(stderr, " occurred for poly: ");
58  p_wrp(p, r);
59  omPrintAddrInfo(stderr, p, " ");
60  }
61  dErrorBreak();
63  return FALSE;
64 }
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:270
#define omPrintCurrentBackTraceMax(A, B)
Definition: xalloc.h:265

◆ p_CheckIsFromRing()

BOOLEAN p_CheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 102 of file pDebug.cc.

103 {
104  while (p!=NULL)
105  {
107  pIter(p);
108  }
109  return TRUE;
110 }

◆ p_CheckPolyRing()

BOOLEAN p_CheckPolyRing ( poly  p,
ring  r 
)

Definition at line 112 of file pDebug.cc.

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

◆ p_CheckRing()

BOOLEAN p_CheckRing ( ring  r)

Definition at line 128 of file pDebug.cc.

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

◆ p_DebugInit()

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

Definition at line 195 of file pDebug.cc.

196 {
197  poly d_p = p_Init(dest_ring);
198  int i;
199  assume(dest_ring->N == src_ring->N);
200 
201  for (i=1; i<= src_ring->N; i++)
202  {
203  p_SetExp(d_p, i, p_GetExp(p, i, src_ring), dest_ring);
204  }
205  if (rRing_has_Comp(dest_ring))
206  p_SetComp(d_p, p_GetComp(p, src_ring), dest_ring);
207 
208  p_Setm_General(d_p, dest_ring);
209  return d_p;
210 }
#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:1322

◆ p_DebugLmDivisibleByNoComp()

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

Definition at line 141 of file pDebug.cc.

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

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

◆ p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing ( poly  p,
ring  r 
)

Definition at line 120 of file pDebug.cc.

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

◆ p_Setm_General()

void p_Setm_General ( poly  p,
ring  r 
)

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

Definition at line 158 of file p_polys.cc.

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

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

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

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

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

◆ pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms ( poly  p,
poly  q 
)

Definition at line 175 of file pDebug.cc.

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

◆ pIsMonomOf()

BOOLEAN pIsMonomOf ( poly  p,
poly  m 
)

Definition at line 165 of file pDebug.cc.

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

◆ pPrintDivisbleByStat()

void pPrintDivisbleByStat ( )

Definition at line 413 of file pDebug.cc.

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

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

◆ pDivisibleBy_number

STATIC_VAR unsigned long pDivisibleBy_number = 1

Definition at line 362 of file pDebug.cc.

◆ pDivisibleBy_ShortFalse

STATIC_VAR unsigned long pDivisibleBy_ShortFalse = 1

Definition at line 364 of file pDebug.cc.