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

Go to the source code of this file.

Macros

#define PDEBUG_CC
 

Functions

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

Variables

STATIC_VAR BOOLEAN d_poly_error_reporting = FALSE
 

Macro Definition Documentation

◆ PDEBUG_CC

#define PDEBUG_CC

Definition at line 12 of file pDebug.cc.

Function Documentation

◆ _p_LmTest()

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

Definition at line 326 of file pDebug.cc.

327{
328 if (level < 0 || p == NULL) return TRUE;
329 poly pnext = pNext(p);
330 pNext(p) = NULL;
331 BOOLEAN test_res = _p_Test(p, r, level);
332 pNext(p) = pnext;
333 return test_res;
334}
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:215

◆ _p_Test()

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

Definition at line 215 of file pDebug.cc.

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

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

◆ dPolyReportError()

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

Definition at line 43 of file pDebug.cc.

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

◆ p_CheckIsFromRing()

BOOLEAN p_CheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 105 of file pDebug.cc.

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

◆ p_CheckPolyRing()

BOOLEAN p_CheckPolyRing ( poly  p,
ring  r 
)

Definition at line 115 of file pDebug.cc.

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

◆ p_CheckRing()

BOOLEAN p_CheckRing ( ring  r)

Definition at line 131 of file pDebug.cc.

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

◆ p_DebugInit()

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

Definition at line 198 of file pDebug.cc.

199{
200 poly d_p = p_Init(dest_ring);
201 int i;
202 assume(dest_ring->N == src_ring->N);
203
204 for (i=1; i<= src_ring->N; i++)
205 {
206 p_SetExp(d_p, i, p_GetExp(p, i, src_ring), dest_ring);
207 }
208 if (rRing_has_Comp(dest_ring))
209 p_SetComp(d_p, p_GetComp(p, src_ring), dest_ring);
210
211 p_Setm_General(d_p, dest_ring);
212 return d_p;
213}
#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:486
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:245
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1318

◆ p_DebugLmDivisibleByNoComp()

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

Definition at line 144 of file pDebug.cc.

145{
146 int i=r->N;
147
148 do
149 {
150 if (p_GetExp(a,i,r) > p_GetExp(b,i,r))
151 return FALSE;
152 i--;
153 }
154 while (i);
155#ifdef HAVE_RINGS
156 return n_DivBy(pGetCoeff(b), pGetCoeff(a), r->cf);
157#else
158 return TRUE;
159#endif
160 }
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:750
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44

◆ p_LmCheckIsFromRing()

BOOLEAN p_LmCheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 74 of file pDebug.cc.

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

◆ p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing ( poly  p,
ring  r 
)

Definition at line 123 of file pDebug.cc.

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

◆ p_Setm_General()

void p_Setm_General ( poly  p,
ring  r 
)

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

Definition at line 158 of file p_polys.cc.

159{
161 int pos=0;
162 if (r->typ!=NULL)
163 {
164 loop
165 {
166 unsigned long ord=0;
167 sro_ord* o=&(r->typ[pos]);
168 switch(o->ord_typ)
169 {
170 case ro_dp:
171 {
172 int a,e;
173 a=o->data.dp.start;
174 e=o->data.dp.end;
175 for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r);
176 p->exp[o->data.dp.place]=ord;
177 break;
178 }
179 case ro_wp_neg:
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 {
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:44
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:236
#define __p_GetComp(p, r)
Definition: monomials.h:63
STATIC_VAR int _componentsExternal
Definition: p_polys.cc:148
STATIC_VAR long * _componentsShifted
Definition: p_polys.cc:147
VAR BOOLEAN pSetm_error
Definition: p_polys.cc:150
STATIC_VAR int * _components
Definition: p_polys.cc:146
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
ro_typ ord_typ
Definition: ring.h: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

◆ pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms ( poly  p,
poly  q 
)

Definition at line 178 of file pDebug.cc.

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

◆ pIsMonomOf()

BOOLEAN pIsMonomOf ( poly  p,
poly  m 
)

Definition at line 168 of file pDebug.cc.

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

Variable Documentation

◆ d_poly_error_reporting

STATIC_VAR BOOLEAN d_poly_error_reporting = FALSE

Definition at line 42 of file pDebug.cc.