Loading...
Searching...
No Matches
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 322 of file pDebug.cc.

{
if (level < 0 || p == NULL) return TRUE;
poly pnext = pNext(p);
pNext(p) = NULL;
BOOLEAN test_res = _p_Test(p, r, level);
pNext(p) = pnext;
return test_res;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
level
int level(const CanonicalForm &f)
Definition canonicalform.h:331
p
int p
Definition cfModGcd.cc:4086
pNext
#define pNext(p)
Definition monomials.h:36
NULL
#define NULL
Definition omList.c:12
_p_Test
BOOLEAN _p_Test(poly p, ring r, int level)
Definition pDebug.cc:211

## _p_Test()

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

Definition at line 211 of file pDebug.cc.

{
assume(r->cf !=NULL);
if (PDEBUG > level) level = PDEBUG;
if (level < 0 || p == NULL) return TRUE;
poly p_prev = NULL;
#ifndef OM_NDEBUG
#ifndef X_OMALLOC
// check addr with level+1 so as to check bin/page of addr
_pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, level+1)
== omError_NoError, "memory error",p,r);
#endif
#endif
pFalseReturn(p_CheckRing(r));
// this checks that p does not contain a loop: rather expensive O(length^2)
#ifndef OM_NDEBUG
if (level > 1)
pFalseReturn(omTestList(p, level) == omError_NoError);
#endif
int ismod = p_GetComp(p, r) != 0;
while (p != NULL)
{
// ring check
pFalseReturn(p_LmCheckIsFromRing(p, r));
#ifndef OM_NDEBUG
#ifndef X_OMALLOC
// omAddr check
_pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, 1)
== omError_NoError, "memory error",p,r);
#endif
#endif
// number/coef check
_pPolyAssumeReturnMsg(p->coef != NULL || (n_GetChar(r->cf) >= 2), "NULL coef",p,r);
#ifdef LDEBUG
_pPolyAssumeReturnMsg(n_Test(p->coef,r->cf),"coeff err",p,r);
#endif
_pPolyAssumeReturnMsg(!n_IsZero(p->coef, r->cf), "Zero coef",p,r);
// check for valid comp
_pPolyAssumeReturnMsg(p_GetComp(p, r) >= 0 && (p_GetComp(p, r)<65000), "component out of range ?",p,r);
// check for mix poly/vec representation
_pPolyAssumeReturnMsg(ismod == (p_GetComp(p, r) != 0), "mixed poly/vector",p,r);
// special check for ringorder_s/S
if ((r->typ!=NULL) && (r->typ[0].ord_typ == ro_syzcomp))
{
long c1, cc1, ccc1, ec1;
sro_ord* o = &(r->typ[0]);
c1 = p_GetComp(p, r);
if (o->data.syzcomp.Components!=NULL)
{
cc1 = o->data.syzcomp.Components[c1];
ccc1 = o->data.syzcomp.ShiftedComponents[cc1];
}
else { cc1=0; ccc1=0; }
_pPolyAssumeReturnMsg(c1 == 0 || cc1 != 0, "Component <-> TrueComponent zero mismatch",p,r);
_pPolyAssumeReturnMsg(c1 == 0 || ccc1 != 0,"Component <-> ShiftedComponent zero mismatch",p,r);
ec1 = p->exp[o->data.syzcomp.place];
//pPolyAssumeReturnMsg(ec1 == ccc1, "Shifted comp out of sync. should %d, is %d");
if (ec1 != ccc1)
{
dPolyReportError(p,r,"Shifted comp out of sync. should %d, is %d",ccc1,ec1);
return FALSE;
}
}
// check that p_Setm works ok
if (level > 0)
{
poly p_should_equal = p_DebugInit(p, r, r);
_pPolyAssumeReturnMsg(p_ExpVectorEqual(p, p_should_equal, r), "p_Setm field(s) out of sync",p,r);
p_LmFree(p_should_equal, r);
}
// check order
if (p_prev != NULL)
{
int cmp = p_LmCmp(p_prev, p, r);
if (cmp == 0)
{
_pPolyAssumeReturnMsg(0, "monoms p and p->next are equal", p_prev, r);
}
else
_pPolyAssumeReturnMsg(p_LmCmp(p_prev, p, r) == 1, "wrong order", p_prev, r);
// check that compare worked sensibly
if (level > 1 && p_GetComp(p_prev, r) == p_GetComp(p, r))
{
int i;
for (i=r->N; i>0; i--)
{
if (p_GetExp(p_prev, i, r) != p_GetExp(p, i, r)) break;
}
_pPolyAssumeReturnMsg(i > 0, "Exponents equal but compare different", p_prev, r);
}
}
p_prev = p;
pIter(p);
}
return TRUE;
}
FALSE
#define FALSE
Definition auxiliary.h:97
PDEBUG
#define PDEBUG
Definition auxiliary.h:171
i
int i
Definition cfEzgcd.cc:132
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r).
Definition coeffs.h:715
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
n_GetChar
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:450
assume
#define assume(x)
Definition mod2.h:389
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
pFalseReturn
#define pFalseReturn(cond)
Definition monomials.h:139
pIter
#define pIter(p)
Definition monomials.h:37
_pPolyAssumeReturnMsg
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition monomials.h:124
omSizeWOfBin
#define omSizeWOfBin(bin_ptr)
Definition omAllocPrivate.h:100
omError_NoError
@ omError_NoError
Definition omError.h:18
omTestList
#define omTestList(ptr, level)
Definition omList.h:81
p_DebugInit
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition pDebug.cc:194
dPolyReportError
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition pDebug.cc:43
p_CheckRing
BOOLEAN p_CheckRing(ring r)
Definition pDebug.cc:131
p_LmCheckIsFromRing
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition pDebug.cc:74
p_ExpVectorEqual
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition p_polys.cc:4680
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition p_polys.h:1601
p_GetExp
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
p_LmFree
static void p_LmFree(poly p, ring)
Definition p_polys.h:685
ro_syzcomp
@ ro_syzcomp
Definition ring.h:60
sro_ord::data
union sro_ord::@006200034235045362245112336324125006204215012002 data
sro_ord
Definition ring.h:225
omTestBinAddrSize
#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 332 of file pDebug.cc.

{
if (PDEBUG > level) level = PDEBUG;
if (level < 0 || p == NULL) return TRUE;
if (pNext(p) == NULL || lmRing == tailRing) return _p_Test(p, lmRing, level);
pFalseReturn(_p_LmTest(p, lmRing, level));
pFalseReturn(_p_Test(pNext(p), tailRing, level));
// check that lm > Lm(tail)
if (level > 1)
{
poly lm = p;
poly tail = p_DebugInit(pNext(p), tailRing, lmRing);
poly pnext = pNext(lm);
pNext(lm) = tail;
BOOLEAN cmp = p_LmCmp(lm, tail, lmRing);
if (cmp != 1)
dPolyReportError(lm, lmRing, "wrong order: lm <= Lm(tail)");
p_LmFree(tail, lmRing);
pNext(lm) = pnext;
return (cmp == 1);
}
return TRUE;
}
_p_LmTest
BOOLEAN _p_LmTest(poly p, ring r, int level)
Definition pDebug.cc:322

## dPolyReportError()

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

Definition at line 43 of file pDebug.cc.

{
if (d_poly_error_reporting) return FALSE;
d_poly_error_reporting = TRUE;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "\n// ***dPolyReportError: ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n occurred at\n");
#ifdef HAVE_OMALLOC
omPrintCurrentBackTraceMax(stderr, 8);
#endif
if (p != NULL)
{
fprintf(stderr, " occurred for poly: ");
p_wrp(p, r);
omPrintAddrInfo(stderr, p, " ");
}
#ifndef MAKE_DISTRIBUTION
dErrorBreak();
#endif
d_poly_error_reporting = FALSE;
return FALSE;
}
dErrorBreak
void dErrorBreak(void)
Definition dError.cc:140
ap
Definition ap.h:40
d_poly_error_reporting
STATIC_VAR BOOLEAN d_poly_error_reporting
Definition pDebug.cc:42
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373
omPrintAddrInfo
#define omPrintAddrInfo(A, B, C)
Definition xalloc.h:270
omPrintCurrentBackTraceMax
#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.

{
while (p!=NULL)
{
pFalseReturn(p_LmCheckIsFromRing(p, r));
pIter(p);
}
return TRUE;
}

## p_CheckPolyRing()

BOOLEAN p_CheckPolyRing | ( | poly | p,
|  | ring | r )

Definition at line 115 of file pDebug.cc.

{
#ifndef X_OMALLOC
pAssumeReturn(r != NULL && r->PolyBin != NULL);
#endif
return p_CheckIsFromRing(p, r);
}
pAssumeReturn
#define pAssumeReturn(cond)
Definition monomials.h:78
p_CheckIsFromRing
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.

{
#ifndef X_OMALLOC
pAssumeReturn(r != NULL && r->PolyBin != NULL);
#endif
return TRUE;
}

## p_DebugInit()

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

static

Definition at line 194 of file pDebug.cc.

{
poly d_p = p_Init(dest_ring);
int i;
assume(dest_ring->N == src_ring->N);
for (i=1; i<= src_ring->N; i++)
{
p_SetExp(d_p, i, p_GetExp(p, i, src_ring), dest_ring);
}
if (rRing_has_Comp(dest_ring))
p_SetComp(d_p, p_GetComp(p, src_ring), dest_ring);
p_Setm_General(d_p, dest_ring);
return d_p;
}
rRing_has_Comp
#define rRing_has_Comp(r)
Definition monomials.h:266
p_Setm_General
void p_Setm_General(poly p, ring r)
Definition p_polys.cc:158
p_SetExp
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
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
p_Init
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1341

## p_DebugLmDivisibleByNoComp()

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

Definition at line 144 of file pDebug.cc.

{
int i=r->N;
do
{
if (p_GetExp(a,i,r) > p_GetExp(b,i,r))
return FALSE;
i--;
}
while (i);
return n_DivBy(pGetCoeff(b), pGetCoeff(a), r->cf);
}
b
CanonicalForm b
Definition cfModGcd.cc:4111
n_DivBy
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
pGetCoeff
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.

{
if (p != NULL)
{
#if (OM_TRACK > 0) && defined(OM_TRACK_CUSTOM)
void* custom = omGetCustomOfAddr(p);
if (custom != NULL)
{
pPolyAssumeReturnMsg(custom == r ||
// be more sloppy for qrings
(r->qideal != NULL &&
omIsBinPageAddr(p) &&
omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin)) ||
rSamePolyRep((ring) custom, r),
"monomial not from specified ring",p,r);
return TRUE;
}
else
#endif
#ifndef X_OMALLOC
{
_pPolyAssumeReturn(omIsBinPageAddr(p),p,r);
_pPolyAssumeReturn(omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin),p,r);
return TRUE;
}
return FALSE;
#endif
}
return TRUE;
}
pPolyAssumeReturnMsg
#define pPolyAssumeReturnMsg(cond, msg)
Definition monomials.h:137
_pPolyAssumeReturn
#define _pPolyAssumeReturn(cond, p, r)
Definition monomials.h:101
omIsBinPageAddr
#define omIsBinPageAddr(addr)
Definition omBinPage.h:68
rSamePolyRep
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:1805
omSizeWOfAddr
#define omSizeWOfAddr(P)
Definition xalloc.h:223

## p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing | ( | poly | p,
|  | ring | r )

Definition at line 123 of file pDebug.cc.

{
#ifndef X_OMALLOC
pAssumeReturn(r != NULL && r->PolyBin != NULL);
#endif
pAssumeReturn(p != NULL);
return p_LmCheckIsFromRing(p, r);
}

## p_Setm_General()

void p_Setm_General | ( | poly | p,
|  | ring | r )

extern

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

Definition at line 158 of file p_polys.cc.

{
p_LmCheckPolyRing(p, r);
int pos=0;
if (r->typ!=NULL)
{
loop
{
unsigned long ord=0;
sro_ord* o=&(r->typ[pos]);
switch(o->ord_typ)
{
case ro_dp:
{
int a,e;
a=o->data.dp.start;
e=o->data.dp.end;
for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r);
p->exp[o->data.dp.place]=ord;
break;
}
case ro_wp_neg:
ord=POLY_NEGWEIGHT_OFFSET; // no break;
case ro_wp:
{
int a,e;
a=o->data.wp.start;
e=o->data.wp.end;
int *w=o->data.wp.weights;
#if 1
for(int i=a;i<=e;i++) ord+=((unsigned long)p_GetExp(p,i,r))*((unsigned long)w[i-a]);
#else
long ai;
int ei,wi;
for(int i=a;i<=e;i++)
{
ei=p_GetExp(p,i,r);
wi=w[i-a];
ai=ei*wi;
if (ai/ei!=wi) pSetm_error=TRUE;
ord+=ai;
if (ord<ai) pSetm_error=TRUE;
}
#endif
p->exp[o->data.wp.place]=ord;
break;
}
case ro_am:
{
ord = POLY_NEGWEIGHT_OFFSET;
const short a=o->data.am.start;
const short e=o->data.am.end;
const int * w=o->data.am.weights;
#if 1
for(short i=a; i<=e; i++, w++)
ord += ((*w) * p_GetExp(p,i,r));
#else
long ai;
int ei,wi;
for(short i=a;i<=e;i++)
{
ei=p_GetExp(p,i,r);
wi=w[i-a];
ai=ei*wi;
if (ai/ei!=wi) pSetm_error=TRUE;
ord += ai;
if (ord<ai) pSetm_error=TRUE;
}
#endif
const int c = p_GetComp(p,r);
const short len_gen= o->data.am.len_gen;
if ((c > 0) && (c <= len_gen))
{
assume( w == o->data.am.weights_m );
assume( w[0] == len_gen );
ord += w[c];
}
p->exp[o->data.am.place] = ord;
break;
}
case ro_wp64:
{
int64 ord=0;
int a,e;
a=o->data.wp64.start;
e=o->data.wp64.end;
int64 *w=o->data.wp64.weights64;
int64 ei,wi,ai;
for(int i=a;i<=e;i++)
{
//Print("exp %d w %d \n",p_GetExp(p,i,r),(int)w[i-a]);
//ord+=((int64)p_GetExp(p,i,r))*w[i-a];
ei=(int64)p_GetExp(p,i,r);
wi=w[i-a];
ai=ei*wi;
if(ei!=0 && ai/ei!=wi)
{
pSetm_error=TRUE;
#if SIZEOF_LONG == 4
Print("ai %lld, wi %lld\n",ai,wi);
#else
Print("ai %ld, wi %ld\n",ai,wi);
#endif
}
ord+=ai;
if (ord<ai)
{
pSetm_error=TRUE;
#if SIZEOF_LONG == 4
Print("ai %lld, ord %lld\n",ai,ord);
#else
Print("ai %ld, ord %ld\n",ai,ord);
#endif
}
}
#if SIZEOF_LONG == 4
int64 mask=(int64)0x7fffffff;
long a_0=(long)(ord&mask); //2^31
long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/
//Print("mask: %x, ord: %d, a_0: %d, a_1: %d\n"
//,(int)mask,(int)ord,(int)a_0,(int)a_1);
//Print("mask: %d",mask);
p->exp[o->data.wp64.place]=a_1;
p->exp[o->data.wp64.place+1]=a_0;
#elif SIZEOF_LONG == 8
p->exp[o->data.wp64.place]=ord;
#endif
// if(p_Setm_error) PrintS("***************************\n"
// "***************************\n"
// "**WARNING: overflow error**\n"
// "***************************\n"
// "***************************\n");
break;
}
case ro_cp:
{
int a,e;
a=o->data.cp.start;
e=o->data.cp.end;
int pl=o->data.cp.place;
for(int i=a;i<=e;i++) { p->exp[pl]=p_GetExp(p,i,r); pl++; }
break;
}
case ro_syzcomp:
{
long c=__p_GetComp(p,r);
long sc = c;
int* Components = (_componentsExternal ? _components :
o->data.syzcomp.Components);
long* ShiftedComponents = (_componentsExternal ? _componentsShifted:
o->data.syzcomp.ShiftedComponents);
if (ShiftedComponents != NULL)
{
assume(Components != NULL);
assume(c == 0 || Components[c] != 0);
sc = ShiftedComponents[Components[c]];
assume(c == 0 || sc != 0);
}
p->exp[o->data.syzcomp.place]=sc;
break;
}
case ro_syz:
{
const unsigned long c = __p_GetComp(p, r);
const short place = o->data.syz.place;
const int limit = o->data.syz.limit;
if (c > (unsigned long)limit)
p->exp[place] = o->data.syz.curr_index;
else if (c > 0)
{
assume( (1 <= c) && (c <= (unsigned long)limit) );
p->exp[place]= o->data.syz.syz_index[c];
}
else
{
assume(c == 0);
p->exp[place]= 0;
}
break;
}
// Prefix for Induced Schreyer ordering
case ro_isTemp: // Do nothing?? (to be removed into suffix later on...?)
{
assume(p != NULL);
#ifndef SING_NDEBUG
#if MYTEST
Print("p_Setm_General: ro_isTemp ord: pos: %d, p: ", pos); p_wrp(p, r);
#endif
#endif
int c = p_GetComp(p, r);
assume( c >= 0 );
// Let's simulate case ro_syz above....
// Should accumulate (by Suffix) and be a level indicator
const int* const pVarOffset = o->data.isTemp.pVarOffset;
assume( pVarOffset != NULL );
// TODO: Can this be done in the suffix???
for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
{
const int vo = pVarOffset[i];
if( vo != -1) // TODO: optimize: can be done once!
{
// Hans! Please don't break it again! p_SetExp(p, ..., r, vo) is correct:
p_SetExp(p, p_GetExp(p, i, r), r, vo); // copy put them verbatim
// Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
}
}
#ifndef SING_NDEBUG
for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
{
const int vo = pVarOffset[i];
if( vo != -1) // TODO: optimize: can be done once!
{
// Hans! Please don't break it again! p_GetExp(p, r, vo) is correct:
assume( p_GetExp(p, r, vo) == p_GetExp(p, i, r) ); // copy put them verbatim
}
}
#if MYTEST
// if( p->exp[o->data.isTemp.start] > 0 )
PrintS("after Values: "); p_wrp(p, r);
#endif
#endif
break;
}
// Suffix for Induced Schreyer ordering
case ro_is:
{
#ifndef SING_NDEBUG
#if MYTEST
Print("p_Setm_General: ro_is ord: pos: %d, p: ", pos); p_wrp(p, r);
#endif
#endif
assume(p != NULL);
int c = p_GetComp(p, r);
assume( c >= 0 );
const ideal F = o->data.is.F;
const int limit = o->data.is.limit;
assume( limit >= 0 );
const int start = o->data.is.start;
if( F != NULL && c > limit )
{
#ifndef SING_NDEBUG
#if MYTEST
Print("p_Setm_General: ro_is : in rSetm: pos: %d, c: %d > limit: %d\n", c, pos, limit);
PrintS("preComputed Values: ");
p_wrp(p, r);
#endif
#endif
// if( c > limit ) // BUG???
p->exp[start] = 1;
// else
// p->exp[start] = 0;
c -= limit;
assume( c > 0 );
c--;
if( c >= IDELEMS(F) )
break;
assume( c < IDELEMS(F) ); // What about others???
const poly pp = F->m[c]; // get reference monomial!!!
if(pp == NULL)
break;
assume(pp != NULL);
#ifndef SING_NDEBUG
#if MYTEST
Print("Respective F[c - %d: %d] pp: ", limit, c);
p_wrp(pp, r);
#endif
#endif
const int end = o->data.is.end;
assume(start <= end);
// const int st = o->data.isTemp.start;
#ifndef SING_NDEBUG
#if MYTEST
Print("p_Setm_General: is(-Temp-) :: c: %d, limit: %d, [st:%d] ===>>> %ld\n", c, limit, start, p->exp[start]);
#endif
#endif
// p_ExpVectorAdd(p, pp, r);
for( int i = start; i <= end; i++) // v[0] may be here...
p->exp[i] += pp->exp[i]; // !!!!!!!! ADD corresponding LT(F)
// p_MemAddAdjust(p, ri);
if (r->NegWeightL_Offset != NULL)
{
for (int i=r->NegWeightL_Size-1; i>=0; i--)
{
const int _i = r->NegWeightL_Offset[i];
if( start <= _i && _i <= end )
p->exp[_i] -= POLY_NEGWEIGHT_OFFSET;
}
}
#ifndef SING_NDEBUG
const int* const pVarOffset = o->data.is.pVarOffset;
assume( pVarOffset != NULL );
for( int i = 1; i <= r->N; i++ ) // No v[0] here!!!
{
const int vo = pVarOffset[i];
if( vo != -1) // TODO: optimize: can be done once!
// Hans! Please don't break it again! p_GetExp(p/pp, r, vo) is correct:
assume( p_GetExp(p, r, vo) == (p_GetExp(p, i, r) + p_GetExp(pp, r, vo)) );
}
// TODO: how to check this for computed values???
#if MYTEST
PrintS("Computed Values: "); p_wrp(p, r);
#endif
#endif
} else
{
p->exp[start] = 0; //!!!!????? where?????
const int* const pVarOffset = o->data.is.pVarOffset;
// What about v[0] - component: it will be added later by
// suffix!!!
// TODO: Test it!
const int vo = pVarOffset[0];
if( vo != -1 )
p->exp[vo] = c; // initial component v[0]!
#ifndef SING_NDEBUG
#if MYTEST
Print("ELSE p_Setm_General: ro_is :: c: %d <= limit: %d, vo: %d, exp: %d\n", c, limit, vo, p->exp[vo]);
p_wrp(p, r);
#endif
#endif
}
break;
}
default:
dReportError("wrong ord in rSetm:%d\n",o->ord_typ);
return;
}
pos++;
if (pos == r->OrdSize) return;
}
}
}
int64
long int64
Definition auxiliary.h:68
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
Print
#define Print
Definition emacs.cc:80
w
const CanonicalForm & w
Definition facAbsFact.cc:51
dReportError
int dReportError(const char *fmt,...)
Definition dError.cc:44
POLY_NEGWEIGHT_OFFSET
#define POLY_NEGWEIGHT_OFFSET
Definition monomials.h:236
__p_GetComp
#define __p_GetComp(p, r)
Definition monomials.h:63
_componentsExternal
STATIC_VAR int _componentsExternal
Definition p_polys.cc:148
_componentsShifted
STATIC_VAR long * _componentsShifted
Definition p_polys.cc:147
pSetm_error
VAR BOOLEAN pSetm_error
Definition p_polys.cc:150
_components
STATIC_VAR int * _components
Definition p_polys.cc:146
p_LmCheckPolyRing
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition pDebug.cc:123
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
sro_ord::ord_typ
ro_typ ord_typ
Definition ring.h:226
ro_wp64
@ ro_wp64
Definition ring.h:56
ro_syz
@ ro_syz
Definition ring.h:61
ro_cp
@ ro_cp
Definition ring.h:59
ro_dp
@ ro_dp
Definition ring.h:53
ro_is
@ ro_is
Definition ring.h:62
ro_wp_neg
@ ro_wp_neg
Definition ring.h:57
ro_wp
@ ro_wp
Definition ring.h:54
ro_isTemp
@ ro_isTemp
Definition ring.h:62
ro_am
@ ro_am
Definition ring.h:55
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
loop
#define loop
Definition structs.h:71

## pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms | ( | poly | p,
|  | poly | q )

Definition at line 174 of file pDebug.cc.

{
while (p != NULL)
{
if (pIsMonomOf(q, p))
{
return TRUE;
}
pIter(p);
}
return FALSE;
}
pIsMonomOf
BOOLEAN pIsMonomOf(poly p, poly m)
Definition pDebug.cc:164

## pIsMonomOf()

BOOLEAN pIsMonomOf | ( | poly | p,
|  | poly | m )

Definition at line 164 of file pDebug.cc.

{
if (m == NULL) return TRUE;
while (p != NULL)
{
if (p == m) return TRUE;
pIter(p);
}
return FALSE;
}
m
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.