My Project  debian-1:4.1.1-p2+ds-4build4
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

◆ 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:85
#define TRUE
Definition: auxiliary.h:98
int level(const CanonicalForm &f)
int p
Definition: cfModGcd.cc:4019
#define pNext(p)
Definition: monomials.h:43
#define NULL
Definition: omList.c:10
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:94
#define PDEBUG
Definition: auxiliary.h:184
int i
Definition: cfEzgcd.cc:125
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:739
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:390
#define p_GetComp(p, r)
Definition: monomials.h:71
#define pFalseReturn(cond)
Definition: monomials.h:146
#define pIter(p)
Definition: monomials.h:44
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition: monomials.h:131
omError_t omTestBinAddrSize(void *addr, size_t size, int check_level)
Definition: omDebug.c:44
#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:44
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:4410
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1507
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:66
union sro_ord::@0 data
Definition: ring.h:226

◆ _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 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 }
void dErrorBreak()
Definition: dError.cc:141
Definition: ap.h:40
void omPrintAddrInfo(FILE *fd, void *addr, const char *s)
Definition: omDebugCheck.c:453
int omPrintCurrentBackTraceMax(FILE *fd, int max)
Definition: omRet2Info.c:165
static BOOLEAN d_poly_error_reporting
Definition: pDebug.cc:43
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235

◆ 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:85
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:273
void p_Setm_General(poly p, ring r)
Definition: p_polys.cc:154
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:1266

◆ 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:4044
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:784
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

◆ 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:144
#define _pPolyAssumeReturn(cond, p, r)
Definition: monomials.h:108
size_t omSizeWOfAddr(void *addr)
#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:1668

◆ 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 154 of file p_polys.cc.

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

◆ 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:120
static unsigned long pDivisibleBy_number
Definition: pDebug.cc:362
static unsigned long pDivisibleBy_ShortFalse
Definition: pDebug.cc:364
static unsigned long pDivisibleBy_FALSE
Definition: pDebug.cc:363
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4665
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1815

◆ 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:1801

◆ 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:121

◆ 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

BOOLEAN d_poly_error_reporting = FALSE
static

Definition at line 43 of file pDebug.cc.

◆ pDivisibleBy_FALSE

unsigned long pDivisibleBy_FALSE = 1
static

Definition at line 363 of file pDebug.cc.

◆ pDivisibleBy_number

unsigned long pDivisibleBy_number = 1
static

Definition at line 362 of file pDebug.cc.

◆ pDivisibleBy_ShortFalse

unsigned long pDivisibleBy_ShortFalse = 1
static

Definition at line 364 of file pDebug.cc.