Macros | Functions | Variables
pDebug.cc File Reference
#include <stdarg.h>
#include <stdio.h>
#include <misc/auxiliary.h>
#include <omalloc/omalloc.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 BOOLEAN d_poly_error_reporting = FALSE
 
static unsigned long pDivisibleBy_number = 1
 
static unsigned long pDivisibleBy_FALSE = 1
 
static unsigned long pDivisibleBy_ShortFalse = 1
 

Macro Definition Documentation

#define PDEBUG_CC

Definition at line 12 of file pDebug.cc.

Function Documentation

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 level(const CanonicalForm &f)
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
BOOLEAN _p_Test(poly p, ring r, int level)
Definition: pDebug.cc:211
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
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 }
int level(const CanonicalForm &f)
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition: pDebug.cc:194
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define omTestList(ptr, level)
Definition: omList.h:81
#define p_GetComp(p, r)
Definition: monomials.h:72
omError_t omTestBinAddrSize(void *addr, size_t size, int check_level)
Definition: omDebug.c:44
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:445
#define TRUE
Definition: auxiliary.h:144
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:44
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
union sro_ord::@0 data
#define pIter(p)
Definition: monomials.h:44
#define pFalseReturn(cond)
Definition: monomials.h:147
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define assume(x)
Definition: mod2.h:405
#define PDEBUG
Definition: auxiliary.h:227
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:923
Definition: ring.h:180
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:465
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:127
#define NULL
Definition: omList.c:10
#define omSizeWOfBin(bin_ptr)
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4303
polyrec * poly
Definition: hilb.h:10
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition: monomials.h:132
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 
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 }
int level(const CanonicalForm &f)
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition: pDebug.cc:194
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define TRUE
Definition: auxiliary.h:144
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:44
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
BOOLEAN _p_LmTest(poly p, ring r, int level)
Definition: pDebug.cc:322
#define pFalseReturn(cond)
Definition: monomials.h:147
#define PDEBUG
Definition: auxiliary.h:227
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
BOOLEAN _p_Test(poly p, ring r, int level)
Definition: pDebug.cc:211
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN dPolyReportError ( poly  p,
ring  r,
const char *  fmt,
  ... 
)

Definition at line 44 of file pDebug.cc.

45 {
46  if (d_poly_error_reporting) return FALSE;
48  va_list ap;
49  va_start(ap, fmt);
50 
51  fprintf(stderr, "\n// ***dPolyReportError: ");
52  vfprintf(stderr, fmt, ap);
53  fprintf(stderr, "\n occurred at\n");
54  omPrintCurrentBackTraceMax(stderr, 8);
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 }
int omPrintCurrentBackTraceMax(FILE *fd, int max)
Definition: omRet2Info.c:165
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
void omPrintAddrInfo(FILE *fd, void *addr, const char *s)
Definition: omDebugCheck.c:445
const ring r
Definition: syzextra.cc:208
static BOOLEAN d_poly_error_reporting
Definition: pDebug.cc:43
#define NULL
Definition: omList.c:10
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void dErrorBreak()
Definition: dError.cc:141
BOOLEAN p_CheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 101 of file pDebug.cc.

102 {
103  while (p!=NULL)
104  {
106  pIter(p);
107  }
108  return TRUE;
109 }
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#define pIter(p)
Definition: monomials.h:44
#define pFalseReturn(cond)
Definition: monomials.h:147
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
BOOLEAN p_CheckPolyRing ( poly  p,
ring  r 
)

Definition at line 111 of file pDebug.cc.

112 {
113  #ifndef X_OMALLOC
114  pAssumeReturn(r != NULL && r->PolyBin != NULL);
115  #endif
116  return p_CheckIsFromRing(p, r);
117 }
return P p
Definition: myNF.cc:203
#define pAssumeReturn(cond)
Definition: monomials.h:86
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
BOOLEAN p_CheckRing ( ring  r)

Definition at line 127 of file pDebug.cc.

128 {
129  #ifndef X_OMALLOC
130  pAssumeReturn(r != NULL && r->PolyBin != NULL);
131  #endif
132  return TRUE;
133 }
#define TRUE
Definition: auxiliary.h:144
#define pAssumeReturn(cond)
Definition: monomials.h:86
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
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 }
void p_Setm_General(poly p, ring r)
Definition: p_polys.cc:163
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#define p_GetComp(p, r)
Definition: monomials.h:72
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
#define rRing_has_Comp(r)
Definition: monomials.h:274
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
BOOLEAN p_DebugLmDivisibleByNoComp ( poly  a,
poly  b,
ring  r 
)

Definition at line 140 of file pDebug.cc.

141 {
142  int i=r->N;
143 
144  do
145  {
146  if (p_GetExp(a,i,r) > p_GetExp(b,i,r))
147  return FALSE;
148  i--;
149  }
150  while (i);
151 #ifdef HAVE_RINGS
152  return n_DivBy(pGetCoeff(b), pGetCoeff(a), r->cf);
153 #else
154  return TRUE;
155 #endif
156  }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:771
int i
Definition: cfEzgcd.cc:123
const poly b
Definition: syzextra.cc:213
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  {
93  return TRUE;
94  }
95  return FALSE;
96  #endif
97  }
98  return TRUE;
99 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
size_t omSizeWOfAddr(void *addr)
#define _pPolyAssumeReturn(cond, p, r)
Definition: monomials.h:109
const ring r
Definition: syzextra.cc:208
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:1681
#define NULL
Definition: omList.c:10
#define omIsBinPageAddr(addr)
Definition: omBinPage.h:71
#define omSizeWOfBin(bin_ptr)
#define pPolyAssumeReturnMsg(cond, msg)
Definition: monomials.h:145
BOOLEAN p_LmCheckPolyRing ( poly  p,
ring  r 
)

Definition at line 119 of file pDebug.cc.

120 {
121  #ifndef X_OMALLOC
122  pAssumeReturn(r != NULL && r->PolyBin != NULL);
123  #endif
124  pAssumeReturn(p != NULL);
125  return p_LmCheckIsFromRing(p, r);
126 }
return P p
Definition: myNF.cc:203
#define pAssumeReturn(cond)
Definition: monomials.h:86
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
void p_Setm_General ( poly  p,
ring  r 
)

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

Definition at line 163 of file p_polys.cc.

164 {
166  int pos=0;
167  if (r->typ!=NULL)
168  {
169  loop
170  {
171  unsigned long ord=0;
172  sro_ord* o=&(r->typ[pos]);
173  switch(o->ord_typ)
174  {
175  case ro_dp:
176  {
177  int a,e;
178  a=o->data.dp.start;
179  e=o->data.dp.end;
180  for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r);
181  p->exp[o->data.dp.place]=ord;
182  break;
183  }
184  case ro_wp_neg:
186  // no break;
187  case ro_wp:
188  {
189  int a,e;
190  a=o->data.wp.start;
191  e=o->data.wp.end;
192  int *w=o->data.wp.weights;
193 #if 1
194  for(int i=a;i<=e;i++) ord+=((unsigned long)p_GetExp(p,i,r))*((unsigned long)w[i-a]);
195 #else
196  long ai;
197  int ei,wi;
198  for(int i=a;i<=e;i++)
199  {
200  ei=p_GetExp(p,i,r);
201  wi=w[i-a];
202  ai=ei*wi;
203  if (ai/ei!=wi) pSetm_error=TRUE;
204  ord+=ai;
205  if (ord<ai) pSetm_error=TRUE;
206  }
207 #endif
208  p->exp[o->data.wp.place]=ord;
209  break;
210  }
211  case ro_am:
212  {
213  ord = POLY_NEGWEIGHT_OFFSET;
214  const short a=o->data.am.start;
215  const short e=o->data.am.end;
216  const int * w=o->data.am.weights;
217 #if 1
218  for(short i=a; i<=e; i++, w++)
219  ord += ((*w) * p_GetExp(p,i,r));
220 #else
221  long ai;
222  int ei,wi;
223  for(short i=a;i<=e;i++)
224  {
225  ei=p_GetExp(p,i,r);
226  wi=w[i-a];
227  ai=ei*wi;
228  if (ai/ei!=wi) pSetm_error=TRUE;
229  ord += ai;
230  if (ord<ai) pSetm_error=TRUE;
231  }
232 #endif
233  const int c = p_GetComp(p,r);
234 
235  const short len_gen= o->data.am.len_gen;
236 
237  if ((c > 0) && (c <= len_gen))
238  {
239  assume( w == o->data.am.weights_m );
240  assume( w[0] == len_gen );
241  ord += w[c];
242  }
243 
244  p->exp[o->data.am.place] = ord;
245  break;
246  }
247  case ro_wp64:
248  {
249  int64 ord=0;
250  int a,e;
251  a=o->data.wp64.start;
252  e=o->data.wp64.end;
253  int64 *w=o->data.wp64.weights64;
254  int64 ei,wi,ai;
255  for(int i=a;i<=e;i++)
256  {
257  //Print("exp %d w %d \n",p_GetExp(p,i,r),(int)w[i-a]);
258  //ord+=((int64)p_GetExp(p,i,r))*w[i-a];
259  ei=(int64)p_GetExp(p,i,r);
260  wi=w[i-a];
261  ai=ei*wi;
262  if(ei!=0 && ai/ei!=wi)
263  {
265  #if SIZEOF_LONG == 4
266  Print("ai %lld, wi %lld\n",ai,wi);
267  #else
268  Print("ai %ld, wi %ld\n",ai,wi);
269  #endif
270  }
271  ord+=ai;
272  if (ord<ai)
273  {
275  #if SIZEOF_LONG == 4
276  Print("ai %lld, ord %lld\n",ai,ord);
277  #else
278  Print("ai %ld, ord %ld\n",ai,ord);
279  #endif
280  }
281  }
282  int64 mask=(int64)0x7fffffff;
283  long a_0=(long)(ord&mask); //2^31
284  long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/
285 
286  //Print("mask: %x, ord: %d, a_0: %d, a_1: %d\n"
287  //,(int)mask,(int)ord,(int)a_0,(int)a_1);
288  //Print("mask: %d",mask);
289 
290  p->exp[o->data.wp64.place]=a_1;
291  p->exp[o->data.wp64.place+1]=a_0;
292 // if(p_Setm_error) Print("***************************\n
293 // ***************************\n
294 // **WARNING: overflow error**\n
295 // ***************************\n
296 // ***************************\n");
297  break;
298  }
299  case ro_cp:
300  {
301  int a,e;
302  a=o->data.cp.start;
303  e=o->data.cp.end;
304  int pl=o->data.cp.place;
305  for(int i=a;i<=e;i++) { p->exp[pl]=p_GetExp(p,i,r); pl++; }
306  break;
307  }
308  case ro_syzcomp:
309  {
310  long c=p_GetComp(p,r);
311  long sc = c;
312  int* Components = (_componentsExternal ? _components :
313  o->data.syzcomp.Components);
314  long* ShiftedComponents = (_componentsExternal ? _componentsShifted:
315  o->data.syzcomp.ShiftedComponents);
316  if (ShiftedComponents != NULL)
317  {
318  assume(Components != NULL);
319  assume(c == 0 || Components[c] != 0);
320  sc = ShiftedComponents[Components[c]];
321  assume(c == 0 || sc != 0);
322  }
323  p->exp[o->data.syzcomp.place]=sc;
324  break;
325  }
326  case ro_syz:
327  {
328  const unsigned long c = p_GetComp(p, r);
329  const short place = o->data.syz.place;
330  const int limit = o->data.syz.limit;
331 
332  if (c > (unsigned long)limit)
333  p->exp[place] = o->data.syz.curr_index;
334  else if (c > 0)
335  {
336  assume( (1 <= c) && (c <= (unsigned long)limit) );
337  p->exp[place]= o->data.syz.syz_index[c];
338  }
339  else
340  {
341  assume(c == 0);
342  p->exp[place]= 0;
343  }
344  break;
345  }
346  // Prefix for Induced Schreyer ordering
347  case ro_isTemp: // Do nothing?? (to be removed into suffix later on...?)
348  {
349  assume(p != NULL);
350 
351 #ifndef SING_NDEBUG
352 #if MYTEST
353  Print("p_Setm_General: ro_isTemp ord: pos: %d, p: ", pos); p_wrp(p, r);
354 #endif
355 #endif
356  int c = p_GetComp(p, r);
357 
358  assume( c >= 0 );
359 
360  // Let's simulate case ro_syz above....
361  // Should accumulate (by Suffix) and be a level indicator
362  const int* const pVarOffset = o->data.isTemp.pVarOffset;
363 
364  assume( pVarOffset != NULL );
365 
366  // TODO: Can this be done in the suffix???
367  for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
368  {
369  const int vo = pVarOffset[i];
370  if( vo != -1) // TODO: optimize: can be done once!
371  {
372  // Hans! Please don't break it again! p_SetExp(p, ..., r, vo) is correct:
373  p_SetExp(p, p_GetExp(p, i, r), r, vo); // copy put them verbatim
374  // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
375  assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
376  }
377  }
378 #ifndef SING_NDEBUG
379  for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
380  {
381  const int vo = pVarOffset[i];
382  if( vo != -1) // TODO: optimize: can be done once!
383  {
384  // Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
385  assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
386  }
387  }
388 #if MYTEST
389 // if( p->exp[o->data.isTemp.start] > 0 )
390  PrintS("after Values: "); p_wrp(p, r);
391 #endif
392 #endif
393  break;
394  }
395 
396  // Suffix for Induced Schreyer ordering
397  case ro_is:
398  {
399 #ifndef SING_NDEBUG
400 #if MYTEST
401  Print("p_Setm_General: ro_is ord: pos: %d, p: ", pos); p_wrp(p, r);
402 #endif
403 #endif
404 
405  assume(p != NULL);
406 
407  int c = p_GetComp(p, r);
408 
409  assume( c >= 0 );
410  const ideal F = o->data.is.F;
411  const int limit = o->data.is.limit;
412  assume( limit >= 0 );
413  const int start = o->data.is.start;
414 
415  if( F != NULL && c > limit )
416  {
417 #ifndef SING_NDEBUG
418 #if MYTEST
419  Print("p_Setm_General: ro_is : in rSetm: pos: %d, c: %d > limit: %d\n", c, pos, limit);
420  PrintS("preComputed Values: ");
421  p_wrp(p, r);
422 #endif
423 #endif
424 // if( c > limit ) // BUG???
425  p->exp[start] = 1;
426 // else
427 // p->exp[start] = 0;
428 
429 
430  c -= limit;
431  assume( c > 0 );
432  c--;
433 
434  if( c >= IDELEMS(F) )
435  break;
436 
437  assume( c < IDELEMS(F) ); // What about others???
438 
439  const poly pp = F->m[c]; // get reference monomial!!!
440 
441  if(pp == NULL)
442  break;
443 
444  assume(pp != NULL);
445 
446 #ifndef SING_NDEBUG
447 #if MYTEST
448  Print("Respective F[c - %d: %d] pp: ", limit, c);
449  p_wrp(pp, r);
450 #endif
451 #endif
452 
453  const int end = o->data.is.end;
454  assume(start <= end);
455 
456 
457 // const int st = o->data.isTemp.start;
458 
459 #ifndef SING_NDEBUG
460  Print("p_Setm_General: is(-Temp-) :: c: %d, limit: %d, [st:%d] ===>>> %ld\n", c, limit, start, p->exp[start]);
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 }
Definition: ring.h:68
const poly a
Definition: syzextra.cc:212
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:244
#define Print
Definition: emacs.cc:83
Definition: ring.h:61
loop
Definition: myNF.cc:98
if(0 > strat->sl)
Definition: myNF.cc:73
return P p
Definition: myNF.cc:203
static int _componentsExternal
Definition: p_polys.cc:153
#define p_GetComp(p, r)
Definition: monomials.h:72
long int64
Definition: auxiliary.h:112
#define TRUE
Definition: auxiliary.h:144
Definition: ring.h:66
Definition: ring.h:64
union sro_ord::@0 data
poly pp
Definition: myNF.cc:296
ro_typ ord_typ
Definition: ring.h:182
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define assume(x)
Definition: mod2.h:405
Definition: ring.h:180
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN pSetm_error
Definition: p_polys.cc:155
#define IDELEMS(i)
Definition: simpleideals.h:24
Definition: ring.h:69
Definition: ring.h:69
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
static int * _components
Definition: p_polys.cc:151
const CanonicalForm & w
Definition: facAbsFact.cc:55
Definition: ring.h:63
Definition: ring.h:60
Definition: ring.h:62
int dReportError(const char *fmt,...)
Definition: dError.cc:45
static long * _componentsShifted
Definition: p_polys.cc:152
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
BOOLEAN pDebugLmShortDivisibleBy ( poly  p1,
unsigned long  sev_1,
ring  r_1,
poly  p2,
unsigned long  not_sev_2,
ring  r_2 
)

Definition at line 365 of file pDebug.cc.

367 {
368  _pPolyAssume(p_GetShortExpVector(p1, r_1) == sev_1, p1, r_1);
369  _pPolyAssume(p_GetShortExpVector(p2, r_2) == ~ not_sev_2, p2, r_2);
370 
372  BOOLEAN ret;
373  if (r_1 == r_2)
374  ret = p_LmDivisibleBy(p1, p2, r_1);
375  else
376  ret = p_LmDivisibleBy(p1, r_1, p2, r_2);
377 
378  if (! ret) pDivisibleBy_FALSE++;
379  if (sev_1 & not_sev_2)
380  {
382  if (ret)
383  dReportError("p1 divides p2, but sev's are wrong");
384  }
385  return ret;
386 }
static unsigned long pDivisibleBy_FALSE
Definition: pDebug.cc:362
static unsigned long pDivisibleBy_number
Definition: pDebug.cc:361
static unsigned long pDivisibleBy_ShortFalse
Definition: pDebug.cc:363
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1676
#define _pPolyAssume(cond, p, r)
Definition: monomials.h:121
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
int dReportError(const char *fmt,...)
Definition: dError.cc:45
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN pDebugLmShortDivisibleByNoComp ( poly  p1,
unsigned long  sev_1,
ring  r_1,
poly  p2,
unsigned long  not_sev_2,
ring  r_2 
)

Definition at line 388 of file pDebug.cc.

390 {
391 // _pPolyAssume((p_GetComp(p1, r_1) == p_GetComp(p2, r_2)) || (p_GetComp(p1, r_1) == 0));
392  _pPolyAssume(p_GetShortExpVector(p1, r_1) == sev_1, p1, r_1);
393  _pPolyAssume(p_GetShortExpVector(p2, r_2) == ~ not_sev_2, p2, r_2);
394 
396  BOOLEAN ret;
397  if (r_1 == r_2)
398  ret = p_LmDivisibleByNoComp(p1, p2, r_1);
399  else
400  ret = p_LmDivisibleByNoComp(p1, r_1, p2, r_2);
401 
402  if (! ret) pDivisibleBy_FALSE++;
403  if (sev_1 & not_sev_2)
404  {
406  if (ret)
407  dReportError("p1 divides p2, but sev's are wrong");
408  }
409  return ret;
410 }
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1662
static unsigned long pDivisibleBy_FALSE
Definition: pDebug.cc:362
static unsigned long pDivisibleBy_number
Definition: pDebug.cc:361
static unsigned long pDivisibleBy_ShortFalse
Definition: pDebug.cc:363
#define _pPolyAssume(cond, p, r)
Definition: monomials.h:121
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4557
int dReportError(const char *fmt,...)
Definition: dError.cc:45
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
int BOOLEAN
Definition: auxiliary.h:131
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 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#define pIter(p)
Definition: monomials.h:44
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:164
#define NULL
Definition: omList.c:10
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 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#define pIter(p)
Definition: monomials.h:44
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
void pPrintDivisbleByStat ( )

Definition at line 412 of file pDebug.cc.

413 {
414  Print("#Tests: %ld; #FALSE %ld(%ld); #SHORT %ld(%ld)\n",
416  pDivisibleBy_FALSE, (unsigned long) ((double)pDivisibleBy_FALSE*((double) 100)/(double)pDivisibleBy_number),
417  pDivisibleBy_ShortFalse, (unsigned long) ((double)pDivisibleBy_ShortFalse*((double)100)/(double)pDivisibleBy_FALSE));
418 }
#define Print
Definition: emacs.cc:83
static unsigned long pDivisibleBy_FALSE
Definition: pDebug.cc:362
static unsigned long pDivisibleBy_number
Definition: pDebug.cc:361
static unsigned long pDivisibleBy_ShortFalse
Definition: pDebug.cc:363

Variable Documentation

BOOLEAN d_poly_error_reporting = FALSE
static

Definition at line 43 of file pDebug.cc.

unsigned long pDivisibleBy_FALSE = 1
static

Definition at line 362 of file pDebug.cc.

unsigned long pDivisibleBy_number = 1
static

Definition at line 361 of file pDebug.cc.

unsigned long pDivisibleBy_ShortFalse = 1
static

Definition at line 363 of file pDebug.cc.