Macros | Functions
p_polys.h File Reference
#include <omalloc/omalloc.h>
#include <misc/mylimits.h>
#include <misc/intvec.h>
#include <coeffs/coeffs.h>
#include <polys/monomials/monomials.h>
#include <polys/monomials/ring.h>
#include <polys/templates/p_MemAdd.h>
#include <polys/templates/p_MemCmp.h>
#include <polys/templates/p_Procs.h>
#include <polys/sbuckets.h>
#include <polys/nc/nc.h>

Go to the source code of this file.

Macros

#define pIfThen(cond, check)   do {if (cond) {check;}} while (0)
 
#define p_Test(p, r)   _p_Test(p, r, PDEBUG)
 
#define p_LmTest(p, r)   _p_LmTest(p, r, PDEBUG)
 
#define pp_Test(p, lmRing, tailRing)   _pp_Test(p, lmRing, tailRing, PDEBUG)
 
#define p_SetmComp   p_Setm
 
#define _p_LmCmpAction(p, q, r, actionE, actionG, actionS)
 
#define pDivAssume(x)   do {} while (0)
 
#define p_LmCmpAction(p, q, r, actionE, actionG, actionS)   _p_LmCmpAction(p, q, r, actionE, actionG, actionS)
 
#define p_LmEqual(p1, p2, r)   p_ExpVectorEqual(p1, p2, r)
 

Functions

poly p_Farey (poly p, number N, const ring r)
 
poly p_ChineseRemainder (poly *xx, number *x, number *q, int rl, CFArray &inv_cache, const ring R)
 
unsigned long p_GetShortExpVector (const poly a, const ring r)
 
unsigned long p_GetShortExpVector (const poly p, const poly pp, const ring r)
 p_GetShortExpVector of p * pp More...
 
BOOLEAN p_DivisibleByRingCase (poly f, poly g, const ring r)
 divisibility check over ground ring (which may contain zero divisors); TRUE iff LT(f) divides LT(g), i.e., LT(f)*c*m = LT(g), for some coefficient c and some monomial m; does not take components into account More...
 
poly p_One (const ring r)
 
int p_MinDeg (poly p, intvec *w, const ring R)
 
long p_DegW (poly p, const short *w, const ring R)
 
BOOLEAN p_OneComp (poly p, const ring r)
 return TRUE if all monoms have the same component More...
 
int p_IsPurePower (const poly p, const ring r)
 return i, if head depends only on var(i) More...
 
int p_IsUnivariate (poly p, const ring r)
 return i, if poly depends only on var(i) More...
 
int p_GetVariables (poly p, int *e, const ring r)
 set entry e[i] to 1 if var(i) occurs in p, ignore var(j) if e[j]>0 return #(e[i]>0) More...
 
poly p_ISet (long i, const ring r)
 returns the poly representing the integer i More...
 
poly p_NSet (number n, const ring r)
 returns the poly representing the number n, destroys n More...
 
void p_Vec2Polys (poly v, poly **p, int *len, const ring r)
 
void p_ShallowDelete (poly *p, const ring r)
 
poly p_Sub (poly a, poly b, const ring r)
 
poly p_Power (poly p, int i, const ring r)
 
BOOLEAN pIsMonomOf (poly p, poly m)
 
BOOLEAN pHaveCommonMonoms (poly p, poly q)
 
BOOLEAN p_LmCheckIsFromRing (poly p, ring r)
 
BOOLEAN p_LmCheckPolyRing (poly p, ring r)
 
BOOLEAN p_CheckIsFromRing (poly p, ring r)
 
BOOLEAN p_CheckPolyRing (poly p, ring r)
 
BOOLEAN p_CheckRing (ring r)
 
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)
 
static unsigned pLength (poly a)
 
poly p_Last (const poly a, int &l, const ring r)
 
void p_Norm (poly p1, const ring r)
 
void p_Normalize (poly p, const ring r)
 
void p_ProjectiveUnique (poly p, const ring r)
 
void p_Content (poly p, const ring r)
 
void p_SimpleContent (poly p, int s, const ring r)
 
poly p_Cleardenom (poly p, const ring r)
 
void p_Cleardenom_n (poly p, const ring r, number &c)
 
int p_Size (poly p, const ring r)
 
poly p_Homogen (poly p, int varnum, const ring r)
 
BOOLEAN p_IsHomogeneous (poly p, const ring r)
 
static void p_Setm (poly p, const ring r)
 
p_SetmProc p_GetSetmProc (const ring r)
 
poly p_Subst (poly p, int n, poly e, const ring r)
 
static unsigned long p_SetComp (poly p, unsigned long c, ring r)
 
static void p_SetCompP (poly p, int i, ring r)
 
static void p_SetCompP (poly p, int i, ring lmRing, ring tailRing)
 
static long p_MaxComp (poly p, ring lmRing, ring tailRing)
 
static long p_MaxComp (poly p, ring lmRing)
 
static long p_MinComp (poly p, ring lmRing, ring tailRing)
 
static long p_MinComp (poly p, ring lmRing)
 
static poly pReverse (poly p)
 
void pEnlargeSet (poly **p, int length, int increment)
 
void p_String0 (poly p, ring lmRing, ring tailRing)
 print p according to ShortOut in lmRing & tailRing More...
 
char * p_String (poly p, ring lmRing, ring tailRing)
 
void p_Write (poly p, ring lmRing, ring tailRing)
 
void p_Write0 (poly p, ring lmRing, ring tailRing)
 
void p_wrp (poly p, ring lmRing, ring tailRing)
 
void p_String0Short (const poly p, ring lmRing, ring tailRing)
 print p in a short way, if possible More...
 
void p_String0Long (const poly p, ring lmRing, ring tailRing)
 print p in a long way More...
 
static long p_FDeg (const poly p, const ring r)
 
static long p_LDeg (const poly p, int *l, const ring r)
 
long p_WFirstTotalDegree (poly p, ring r)
 
long p_WTotaldegree (poly p, const ring r)
 
long p_WDegree (poly p, const ring r)
 
long pLDeg0 (poly p, int *l, ring r)
 
long pLDeg0c (poly p, int *l, ring r)
 
long pLDegb (poly p, int *l, ring r)
 
long pLDeg1 (poly p, int *l, ring r)
 
long pLDeg1c (poly p, int *l, ring r)
 
long pLDeg1_Deg (poly p, int *l, ring r)
 
long pLDeg1c_Deg (poly p, int *l, ring r)
 
long pLDeg1_Totaldegree (poly p, int *l, ring r)
 
long pLDeg1c_Totaldegree (poly p, int *l, ring r)
 
long pLDeg1_WFirstTotalDegree (poly p, int *l, ring r)
 
long pLDeg1c_WFirstTotalDegree (poly p, int *l, ring r)
 
BOOLEAN p_EqualPolys (poly p1, poly p2, const ring r)
 
BOOLEAN p_EqualPolys (poly p1, poly p2, const ring r1, const ring r2)
 same as the usual p_EqualPolys for polys belonging to equal rings More...
 
long p_Deg (poly a, const ring r)
 
static number p_SetCoeff (poly p, number n, ring r)
 
static long p_GetOrder (poly p, ring r)
 
static unsigned long p_AddComp (poly p, unsigned long v, ring r)
 
static unsigned long p_SubComp (poly p, unsigned long v, ring r)
 
static long p_GetExp (const poly p, const unsigned long iBitmask, const int VarOffset)
 get a single variable exponent : the integer VarOffset encodes: More...
 
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 More...
 
static long p_GetExp (const poly p, const ring r, const int VarOffset)
 
static long p_SetExp (poly p, const long e, const ring r, const int VarOffset)
 
static long p_GetExp (const poly p, const int v, const ring r)
 get v^th exponent for a monomial More...
 
static long p_SetExp (poly p, const int v, const long e, const ring r)
 set v^th exponent for a monomial More...
 
static long p_IncrExp (poly p, int v, ring r)
 
static long p_DecrExp (poly p, int v, ring r)
 
static long p_AddExp (poly p, int v, long ee, ring r)
 
static long p_SubExp (poly p, int v, long ee, ring r)
 
static long p_MultExp (poly p, int v, long ee, ring r)
 
static long p_GetExpSum (poly p1, poly p2, int i, ring r)
 
static long p_GetExpDiff (poly p1, poly p2, int i, ring r)
 
static int p_Comp_k_n (poly a, poly b, int k, ring r)
 
static poly p_New (const ring, omBin bin)
 
static poly p_New (ring r)
 
static void p_LmFree (poly p, ring)
 
static void p_LmFree (poly *p, ring)
 
static poly p_LmFreeAndNext (poly p, ring)
 
static void p_LmDelete (poly p, const ring r)
 
static void p_LmDelete (poly *p, const ring r)
 
static poly p_LmDeleteAndNext (poly p, const ring r)
 
unsigned long p_GetMaxExpL (poly p, const ring r, unsigned long l_max=0)
 return the maximal exponent of p in form of the maximal long var More...
 
poly p_GetMaxExpP (poly p, ring r)
 return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0, next == NULL, ord is not set More...
 
static unsigned long p_GetMaxExp (const unsigned long l, const ring r)
 
static unsigned long p_GetMaxExp (const poly p, const ring r)
 
static unsigned long p_GetTotalDegree (const unsigned long l, const ring r, const int number_of_exps)
 
static poly p_Copy_noCheck (poly p, const ring r)
 returns a copy of p (without any additional testing) More...
 
static poly p_Copy (poly p, const ring r)
 returns a copy of p More...
 
static poly p_Head (poly p, const ring r)
 
static poly p_Copy (poly p, const ring lmRing, const ring tailRing)
 
static void p_Delete (poly *p, const ring r)
 
static void p_Delete (poly *p, const ring lmRing, const ring tailRing)
 
static poly p_ShallowCopyDelete (poly p, const ring r, omBin bin)
 
static poly p_Add_q (poly p, poly q, const ring r)
 
static poly p_Add_q (poly p, poly q, int &lp, int lq, const ring r)
 like p_Add_q, except that if lp == pLength(lp) lq == pLength(lq) then lp == pLength(p+q) More...
 
static poly p_Mult_nn (poly p, number n, const ring r)
 
static poly p_Mult_nn (poly p, number n, const ring lmRing, const ring tailRing)
 
static poly pp_Mult_nn (poly p, number n, const ring r)
 
static BOOLEAN p_LmIsConstantComp (const poly p, const ring r)
 
static BOOLEAN p_LmIsConstant (const poly p, const ring r)
 
static poly pp_Mult_mm (poly p, poly m, const ring r)
 
static poly p_Mult_mm (poly p, poly m, const ring r)
 
static poly p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, int lq, const poly spNoether, const ring r)
 
static poly p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, const ring r)
 
static poly pp_Mult_Coeff_mm_DivSelect (poly p, const poly m, const ring r)
 
static poly pp_Mult_Coeff_mm_DivSelect (poly p, int &lp, const poly m, const ring r)
 
static poly p_Neg (poly p, const ring r)
 
poly _p_Mult_q (poly p, poly q, const int copy, const ring r)
 Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2. More...
 
static poly p_Mult_q (poly p, poly q, const ring r)
 
static poly pp_Mult_qq (poly p, poly q, const ring r)
 
static poly p_Plus_mm_Mult_qq (poly p, poly m, poly q, int &lp, int lq, const ring r)
 
static poly p_Plus_mm_Mult_qq (poly p, poly m, poly q, const ring r)
 
static poly p_Merge_q (poly p, poly q, const ring r)
 
static poly p_SortAdd (poly p, const ring r, BOOLEAN revert=FALSE)
 
static poly p_SortMerge (poly p, const ring r, BOOLEAN revert=FALSE)
 
static char * p_String (poly p, ring p_ring)
 
static void p_String0 (poly p, ring p_ring)
 
static void p_Write (poly p, ring p_ring)
 
static void p_Write0 (poly p, ring p_ring)
 
static void p_wrp (poly p, ring p_ring)
 
static void p_MemAdd_NegWeightAdjust (poly p, const ring r)
 
static void p_MemSub_NegWeightAdjust (poly p, const ring r)
 
static void p_ExpVectorCopy (poly d_p, poly s_p, const ring r)
 
static poly p_Init (const ring r, omBin bin)
 
static poly p_Init (const ring r)
 
static poly p_LmInit (poly p, const ring r)
 
static poly p_LmInit (poly s_p, const ring s_r, const ring d_r, omBin d_bin)
 
static poly p_LmInit (poly s_p, const ring s_r, const ring d_r)
 
static poly p_GetExp_k_n (poly p, int l, int k, const ring r)
 
static poly p_LmShallowCopyDelete (poly p, const ring r)
 
static void p_ExpVectorAdd (poly p1, poly p2, const ring r)
 
static void p_ExpVectorSum (poly pr, poly p1, poly p2, const ring r)
 
static void p_ExpVectorSub (poly p1, poly p2, const ring r)
 
static void p_ExpVectorAddSub (poly p1, poly p2, poly p3, const ring r)
 
static void p_ExpVectorDiff (poly pr, poly p1, poly p2, const ring r)
 
static BOOLEAN p_ExpVectorEqual (poly p1, poly p2, const ring r)
 
static long p_Totaldegree (poly p, const ring r)
 
static void p_GetExpV (poly p, int *ev, const ring r)
 
static void p_SetExpV (poly p, int *ev, const ring r)
 
static int p_LmCmp (poly p, poly q, const ring r)
 
static int p_LtCmp (poly p, poly q, const ring r)
 
static int p_LtCmpNoAbs (poly p, poly q, const ring r)
 
static int p_LtCmpOrdSgnDiffM (poly p, poly q, const ring r)
 
static int p_LtCmpOrdSgnDiffP (poly p, poly q, const ring r)
 
static int p_LtCmpOrdSgnEqM (poly p, poly q, const ring r)
 
static int p_LtCmpOrdSgnEqP (poly p, poly q, const ring r)
 
BOOLEAN p_ComparePolys (poly p1, poly p2, const ring r)
 returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL More...
 
static int p_Cmp (poly p1, poly p2, ring r)
 
static BOOLEAN _p_LmDivisibleByNoComp (poly a, poly b, const ring r)
 return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long vars, instead of single exponents (2) Clearly, if la > lb, then FALSE (3) Suppose la <= lb, and consider first bits of single exponents in l: if TRUE, then value of these bits is la ^ lb if FALSE, then la-lb causes an "overflow" into one of those bits, i.e., la ^ lb != la - lb More...
 
static BOOLEAN _p_LmDivisibleByNoComp (poly a, const ring r_a, poly b, const ring r_b)
 
static BOOLEAN _p_LmDivisibleByNoCompPart (poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
 
static BOOLEAN _p_LmDivisibleByPart (poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
 
static BOOLEAN p_LmDivisibleByPart (poly a, poly b, const ring r, const int start, const int end)
 
static BOOLEAN _p_LmDivisibleBy (poly a, poly b, const ring r)
 
static BOOLEAN _p_LmDivisibleBy (poly a, const ring r_a, poly b, const ring r_b)
 
static BOOLEAN p_LmDivisibleByNoComp (poly a, poly b, const ring r)
 
static BOOLEAN p_LmDivisibleByNoComp (poly a, const ring ra, poly b, const ring rb)
 
static BOOLEAN p_LmDivisibleBy (poly a, poly b, const ring r)
 
static BOOLEAN p_DivisibleBy (poly a, poly b, const ring r)
 
static BOOLEAN p_DivisibleBy (poly a, const ring r_a, poly b, const ring r_b)
 
static BOOLEAN p_LmDivisibleBy (poly a, const ring r_a, poly b, const ring r_b)
 
static BOOLEAN p_LmShortDivisibleBy (poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
 
static BOOLEAN p_LmShortDivisibleByNoComp (poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
 
static BOOLEAN p_LmShortDivisibleBy (poly a, unsigned long sev_a, const ring r_a, poly b, unsigned long not_sev_b, const ring r_b)
 
static BOOLEAN p_IsConstantComp (const poly p, const ring r)
 
static BOOLEAN p_IsConstant (const poly p, const ring r)
 
static BOOLEAN p_IsOne (const poly p, const ring R)
 either poly(1) or gen(k)?! More...
 
static BOOLEAN p_IsConstantPoly (const poly p, const ring r)
 
static BOOLEAN p_IsUnit (const poly p, const ring r)
 
static BOOLEAN p_LmExpVectorAddIsOk (const poly p1, const poly p2, const ring r)
 
void p_Split (poly p, poly *r)
 
BOOLEAN p_HasNotCF (poly p1, poly p2, const ring r)
 
poly p_mInit (const char *s, BOOLEAN &ok, const ring r)
 
const char * p_Read (const char *s, poly &p, const ring r)
 
poly p_Divide (poly a, poly b, const ring r)
 
poly p_DivideM (poly a, poly b, const ring r)
 
poly p_Div_nn (poly p, const number n, const ring r)
 
void p_Lcm (const poly a, const poly b, poly m, const ring r)
 
poly p_Lcm (const poly a, const poly b, const ring r)
 
poly p_LcmRat (const poly a, const poly b, const long lCompM, const ring r)
 
poly p_GetCoeffRat (poly p, int ishift, ring r)
 
void p_LmDeleteAndNextRat (poly *p, int ishift, ring r)
 
void p_ContentRat (poly &ph, const ring r)
 
poly p_Diff (poly a, int k, const ring r)
 
poly p_DiffOp (poly a, poly b, BOOLEAN multiply, const ring r)
 
int p_Weight (int c, const ring r)
 
poly p_PolyDiv (poly &p, const poly divisor, const BOOLEAN needResult, const ring r)
 assumes that p and divisor are univariate polynomials in r, mentioning the same variable; assumes divisor != NULL; p may be NULL; assumes a global monomial ordering in r; performs polynomial division of p by divisor: More...
 
BOOLEAN p_VectorHasUnitB (poly p, int *k, const ring r)
 
void p_VectorHasUnit (poly p, int *k, int *len, const ring r)
 
poly p_TakeOutComp1 (poly *p, int k, const ring r)
 
void p_TakeOutComp (poly *p, long comp, poly *q, int *lq, const ring r)
 
poly p_TakeOutComp (poly *p, int k, const ring r)
 
void p_DeleteComp (poly *p, int k, const ring r)
 
void pSetDegProcs (ring r, pFDegProc new_FDeg, pLDegProc new_lDeg=NULL)
 
void pRestoreDegProcs (ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
 
void p_SetModDeg (intvec *w, ring r)
 
poly pp_Jet (poly p, int m, const ring R)
 
poly p_Jet (poly p, int m, const ring R)
 
poly pp_JetW (poly p, int m, short *w, const ring R)
 
poly p_JetW (poly p, int m, short *w, const ring R)
 
poly n_PermNumber (const number z, const int *par_perm, const int OldPar, const ring src, const ring dst)
 
poly p_PermPoly (poly p, const int *perm, const ring OldRing, const ring dst, nMapFunc nMap, const int *par_perm=NULL, int OldPar=0, BOOLEAN use_mult=FALSE)
 
poly p_Series (int n, poly p, poly u, intvec *w, const ring R)
 
poly p_Invers (int n, poly u, intvec *w, const ring R)
 
int p_Var (poly mi, const ring r)
 
int p_LowVar (poly p, const ring r)
 the minimal index of used variables - 1 More...
 
void p_Shift (poly *p, int i, const ring r)
 shifts components of the vector p by i More...
 
int p_Compare (const poly a, const poly b, const ring R)
 
poly p_GcdMon (poly f, poly g, const ring r)
 polynomial gcd for f=mon More...
 
poly p_Div_mm (poly p, const poly m, const ring r)
 divide polynomial by monomial More...
 

Macro Definition Documentation

◆ _p_LmCmpAction

#define _p_LmCmpAction (   p,
  q,
  r,
  actionE,
  actionG,
  actionS 
)
Value:
p_MemCmp_LengthGeneral_OrdGeneral(p->exp, q->exp, r->CmpL_Size, r->ordsgn, \
actionE, actionG, actionS)
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define p_MemCmp_LengthGeneral_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS)
Definition: p_MemCmp.h:719

Definition at line 1199 of file p_polys.h.

◆ p_LmCmpAction

#define p_LmCmpAction (   p,
  q,
  r,
  actionE,
  actionG,
  actionS 
)    _p_LmCmpAction(p, q, r, actionE, actionG, actionS)

Definition at line 1607 of file p_polys.h.

◆ p_LmEqual

#define p_LmEqual (   p1,
  p2,
  r 
)    p_ExpVectorEqual(p1, p2, r)

Definition at line 1611 of file p_polys.h.

◆ p_LmTest

#define p_LmTest (   p,
  r 
)    _p_LmTest(p, r, PDEBUG)

Definition at line 161 of file p_polys.h.

◆ p_SetmComp

#define p_SetmComp   p_Setm

Definition at line 239 of file p_polys.h.

◆ p_Test

#define p_Test (   p,
  r 
)    _p_Test(p, r, PDEBUG)

Definition at line 160 of file p_polys.h.

◆ pDivAssume

#define pDivAssume (   x)    do {} while (0)

Definition at line 1205 of file p_polys.h.

◆ pIfThen

#define pIfThen (   cond,
  check 
)    do {if (cond) {check;}} while (0)

Definition at line 154 of file p_polys.h.

◆ pp_Test

#define pp_Test (   p,
  lmRing,
  tailRing 
)    _pp_Test(p, lmRing, tailRing, PDEBUG)

Definition at line 162 of file p_polys.h.

Function Documentation

◆ _p_LmDivisibleBy() [1/2]

static BOOLEAN _p_LmDivisibleBy ( poly  a,
poly  b,
const ring  r 
)
inlinestatic

Definition at line 1742 of file p_polys.h.

1743 {
1744  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1745  return _p_LmDivisibleByNoComp(a, b, r);
1746  return FALSE;
1747 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
const ring r
Definition: syzextra.cc:208
const poly b
Definition: syzextra.cc:213

◆ _p_LmDivisibleBy() [2/2]

static BOOLEAN _p_LmDivisibleBy ( poly  a,
const ring  r_a,
poly  b,
const ring  r_b 
)
inlinestatic

Definition at line 1748 of file p_polys.h.

1749 {
1750  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
1751  return _p_LmDivisibleByNoComp(a, r_a, b, r_b);
1752  return FALSE;
1753 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
const poly b
Definition: syzextra.cc:213

◆ _p_LmDivisibleByNoComp() [1/2]

static BOOLEAN _p_LmDivisibleByNoComp ( poly  a,
poly  b,
const ring  r 
)
inlinestatic

return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long vars, instead of single exponents (2) Clearly, if la > lb, then FALSE (3) Suppose la <= lb, and consider first bits of single exponents in l: if TRUE, then value of these bits is la ^ lb if FALSE, then la-lb causes an "overflow" into one of those bits, i.e., la ^ lb != la - lb

Definition at line 1638 of file p_polys.h.

1639 {
1640  int i=r->VarL_Size - 1;
1641  unsigned long divmask = r->divmask;
1642  unsigned long la, lb;
1643 
1644  if (r->VarL_LowIndex >= 0)
1645  {
1646  i += r->VarL_LowIndex;
1647  do
1648  {
1649  la = a->exp[i];
1650  lb = b->exp[i];
1651  if ((la > lb) ||
1652  (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1653  {
1655  return FALSE;
1656  }
1657  i--;
1658  }
1659  while (i>=r->VarL_LowIndex);
1660  }
1661  else
1662  {
1663  do
1664  {
1665  la = a->exp[r->VarL_Offset[i]];
1666  lb = b->exp[r->VarL_Offset[i]];
1667  if ((la > lb) ||
1668  (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1669  {
1671  return FALSE;
1672  }
1673  i--;
1674  }
1675  while (i>=0);
1676  }
1677 /*#ifdef HAVE_RINGS
1678  pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf));
1679  return (!rField_is_Ring(r)) || n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf);
1680 #else
1681 */
1683  return TRUE;
1684 //#endif
1685 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
BOOLEAN p_DebugLmDivisibleByNoComp(poly a, poly b, ring r)
Definition: pDebug.cc:140
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define pDivAssume(x)
Definition: p_polys.h:1205
const poly b
Definition: syzextra.cc:213

◆ _p_LmDivisibleByNoComp() [2/2]

static BOOLEAN _p_LmDivisibleByNoComp ( poly  a,
const ring  r_a,
poly  b,
const ring  r_b 
)
inlinestatic

Definition at line 1687 of file p_polys.h.

1688 {
1689  int i=r_a->N;
1690  pAssume1(r_a->N == r_b->N);
1691 
1692  do
1693  {
1694  if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
1695  return FALSE;
1696  i--;
1697  }
1698  while (i);
1699 /*#ifdef HAVE_RINGS
1700  return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
1701 #else
1702 */
1703  return TRUE;
1704 //#endif
1705 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
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:464
int i
Definition: cfEzgcd.cc:123
#define pAssume1(cond)
Definition: monomials.h:179
const poly b
Definition: syzextra.cc:213

◆ _p_LmDivisibleByNoCompPart()

static BOOLEAN _p_LmDivisibleByNoCompPart ( poly  a,
const ring  r_a,
poly  b,
const ring  r_b,
const int  start,
const int  end 
)
inlinestatic

Definition at line 1708 of file p_polys.h.

1709 {
1710  int i=end;
1711  pAssume1(r_a->N == r_b->N);
1712 
1713  do
1714  {
1715  if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
1716  return FALSE;
1717  i--;
1718  }
1719  while (i>=start);
1720 /*#ifdef HAVE_RINGS
1721  return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
1722 #else
1723 */
1724  return TRUE;
1725 //#endif
1726 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
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:464
int i
Definition: cfEzgcd.cc:123
#define pAssume1(cond)
Definition: monomials.h:179
const poly b
Definition: syzextra.cc:213

◆ _p_LmDivisibleByPart()

static BOOLEAN _p_LmDivisibleByPart ( poly  a,
const ring  r_a,
poly  b,
const ring  r_b,
const int  start,
const int  end 
)
inlinestatic

Definition at line 1727 of file p_polys.h.

1728 {
1729  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
1730  return _p_LmDivisibleByNoCompPart(a, r_a, b, r_b,start,end);
1731  return FALSE;
1732 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN _p_LmDivisibleByNoCompPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition: p_polys.h:1708
const poly b
Definition: syzextra.cc:213

◆ _p_LmTest()

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:98
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:85

◆ _p_Mult_q()

poly _p_Mult_q ( poly  p,
poly  q,
const int  copy,
const ring  r 
)

Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2.

Definition at line 271 of file p_Mult_q.cc.

272 {
273  assume(r != NULL);
274 #ifdef HAVE_RINGS
275  if (!nCoeff_is_Domain(r->cf))
276  return _p_Mult_q_Normal_ZeroDiv(p, q, copy, r);
277 #endif
278  int lp, lq, l;
279  poly pt;
280 
281  pqLength(p, q, lp, lq, MIN_LENGTH_BUCKET);
282 
283  if (lp < lq)
284  {
285  pt = p;
286  p = q;
287  q = pt;
288  l = lp;
289  lp = lq;
290  lq = l;
291  }
293  return _p_Mult_q_Normal(p, q, copy, r);
294  else
295  {
296  assume(lp == pLength(p));
297  assume(lq == pLength(q));
298  return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
299  }
300 }
CFArray copy(const CFList &list)
write elements of list into an array
return P p
Definition: myNF.cc:203
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:22
static poly _p_Mult_q_Normal_ZeroDiv(poly p, poly q, const int copy, const ring r)
Definition: p_Mult_q.cc:161
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
static poly _p_Mult_q_Normal(poly p, poly q, const int copy, const ring r)
Definition: p_Mult_q.cc:189
static unsigned pLength(poly a)
Definition: p_polys.h:189
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
Definition: p_Mult_q.cc:27
static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
Definition: coeffs.h:773
#define NULL
Definition: omList.c:10
static poly _p_Mult_q_Bucket(poly p, const int lp, poly q, const int lq, const int copy, const ring r)
Definition: p_Mult_q.cc:66
polyrec * poly
Definition: hilb.h:10
int l
Definition: cfEzgcd.cc:94

◆ _p_Test()

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:94
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:448
#define TRUE
Definition: auxiliary.h:98
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:44
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
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:464
#define assume(x)
Definition: mod2.h:394
#define PDEBUG
Definition: auxiliary.h:169
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:742
Definition: ring.h:226
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
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:468
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:4381
polyrec * poly
Definition: hilb.h:10
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition: monomials.h:132

◆ _pp_Test()

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:98
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:44
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
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:169
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
#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:85

◆ n_PermNumber()

poly n_PermNumber ( const number  z,
const int *  par_perm,
const int  OldPar,
const ring  src,
const ring  dst 
)

Definition at line 3881 of file p_polys.cc.

3882 {
3883 #if 0
3884  PrintS("\nSource Ring: \n");
3885  rWrite(src);
3886 
3887  if(0)
3888  {
3889  number zz = n_Copy(z, src->cf);
3890  PrintS("z: "); n_Write(zz, src);
3891  n_Delete(&zz, src->cf);
3892  }
3893 
3894  PrintS("\nDestination Ring: \n");
3895  rWrite(dst);
3896 
3897  /*Print("\nOldPar: %d\n", OldPar);
3898  for( int i = 1; i <= OldPar; i++ )
3899  {
3900  Print("par(%d) -> par/var (%d)\n", i, par_perm[i-1]);
3901  }*/
3902 #endif
3903  if( z == NULL )
3904  return NULL;
3905 
3906  const coeffs srcCf = src->cf;
3907  assume( srcCf != NULL );
3908 
3909  assume( !nCoeff_is_GF(srcCf) );
3910  assume( src->cf->extRing!=NULL );
3911 
3912  poly zz = NULL;
3913 
3914  const ring srcExtRing = srcCf->extRing;
3915  assume( srcExtRing != NULL );
3916 
3917  const coeffs dstCf = dst->cf;
3918  assume( dstCf != NULL );
3919 
3920  if( nCoeff_is_algExt(srcCf) ) // nCoeff_is_GF(srcCf)?
3921  {
3922  zz = (poly) z;
3923  if( zz == NULL ) return NULL;
3924  }
3925  else if (nCoeff_is_transExt(srcCf))
3926  {
3927  assume( !IS0(z) );
3928 
3929  zz = NUM((fraction)z);
3930  p_Test (zz, srcExtRing);
3931 
3932  if( zz == NULL ) return NULL;
3933  if( !DENIS1((fraction)z) )
3934  {
3935  if (!p_IsConstant(DEN((fraction)z),srcExtRing))
3936  WarnS("Not defined: Cannot map a rational fraction and make a polynomial out of it! Ignoring the denominator.");
3937  }
3938  }
3939  else
3940  {
3941  assume (FALSE);
3942  WerrorS("Number permutation is not implemented for this data yet!");
3943  return NULL;
3944  }
3945 
3946  assume( zz != NULL );
3947  p_Test (zz, srcExtRing);
3948 
3949  nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf);
3950 
3951  assume( nMap != NULL );
3952 
3953  poly qq;
3954  if ((par_perm == NULL) && (rPar(dst) != 0 && rVar (srcExtRing) > 0))
3955  {
3956  int* perm;
3957  perm=(int *)omAlloc0((rVar(srcExtRing)+1)*sizeof(int));
3958  perm[0]= 0;
3959  for(int i=si_min(rVar(srcExtRing),rPar(dst));i>0;i--)
3960  perm[i]=-i;
3961  qq = p_PermPoly(zz, perm, srcExtRing, dst, nMap, NULL, rVar(srcExtRing)-1);
3962  omFreeSize ((ADDRESS)perm, (rVar(srcExtRing)+1)*sizeof(int));
3963  }
3964  else
3965  qq = p_PermPoly(zz, par_perm-1, srcExtRing, dst, nMap, NULL, rVar (srcExtRing)-1);
3966 
3967  if(nCoeff_is_transExt(srcCf)
3968  && (!DENIS1((fraction)z))
3969  && p_IsConstant(DEN((fraction)z),srcExtRing))
3970  {
3971  number n=nMap(pGetCoeff(DEN((fraction)z)),srcExtRing->cf, dstCf);
3972  qq=p_Div_nn(qq,n,dst);
3973  n_Delete(&n,dstCf);
3974  p_Normalize(qq,dst);
3975  }
3976  p_Test (qq, dst);
3977 
3978  return qq;
3979 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
#define FALSE
Definition: auxiliary.h:94
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:590
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1476
void * ADDRESS
Definition: auxiliary.h:115
void WerrorS(const char *s)
Definition: feFopen.cc:24
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
#define WarnS
Definition: emacs.cc:81
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:3985
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:927
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:595
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:935
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:856
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:725
#define p_Test(p, r)
Definition: p_polys.h:160
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3680
#define NULL
Definition: omList.c:10
Definition: readcf.cc:156
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ p_Add_q() [1/2]

static poly p_Add_q ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 877 of file p_polys.h.

878 {
879  assume( (p != q) || (p == NULL && q == NULL) );
880  int shorter;
881  return r->p_Procs->p_Add_q(p, q, shorter, r);
882 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10

◆ p_Add_q() [2/2]

static poly p_Add_q ( poly  p,
poly  q,
int &  lp,
int  lq,
const ring  r 
)
inlinestatic

like p_Add_q, except that if lp == pLength(lp) lq == pLength(lq) then lp == pLength(p+q)

Definition at line 885 of file p_polys.h.

886 {
887  assume( (p != q) || (p == NULL && q == NULL) );
888  int shorter;
889  poly res = r->p_Procs->p_Add_q(p, q, shorter, r);
890  lp = (lp + lq) - shorter;
891  return res;
892 }
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ p_AddComp()

static unsigned long p_AddComp ( poly  p,
unsigned long  v,
ring  r 
)
inlinestatic

Definition at line 442 of file p_polys.h.

443 {
446  return __p_GetComp(p,r) += v;
447 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
#define __p_GetComp(p, r)
Definition: monomials.h:71
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
#define rRing_has_Comp(r)
Definition: monomials.h:274
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37

◆ p_AddExp()

static long p_AddExp ( poly  p,
int  v,
long  ee,
ring  r 
)
inlinestatic

Definition at line 601 of file p_polys.h.

602 {
604  int e = p_GetExp(p,v,r);
605  e += ee;
606  return p_SetExp(p,v,e,r);
607 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
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:464
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
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:483

◆ p_CheckIsFromRing()

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:98
#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

◆ p_CheckPolyRing()

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

◆ p_CheckRing()

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:98
#define pAssumeReturn(cond)
Definition: monomials.h:86
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10

◆ p_ChineseRemainder()

poly p_ChineseRemainder ( poly xx,
number *  x,
number *  q,
int  rl,
CFArray inv_cache,
const ring  R 
)

Definition at line 94 of file p_polys.cc.

95 {
96  poly r,h,hh;
97  int j;
98  poly res_p=NULL;
99  loop
100  {
101  /* search the lead term */
102  r=NULL;
103  for(j=rl-1;j>=0;j--)
104  {
105  h=xx[j];
106  if ((h!=NULL)
107  &&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
108  r=h;
109  }
110  /* nothing found -> return */
111  if (r==NULL) break;
112  /* create the monomial in h */
113  h=p_Head(r,R);
114  /* collect the coeffs in x[..]*/
115  for(j=rl-1;j>=0;j--)
116  {
117  hh=xx[j];
118  if ((hh!=NULL) && (p_LmCmp(h,hh,R)==0))
119  {
120  x[j]=pGetCoeff(hh);
121  hh=p_LmFreeAndNext(hh,R);
122  xx[j]=hh;
123  }
124  else
125  x[j]=n_Init(0, R->cf);
126  }
127  number n=n_ChineseRemainderSym(x,q,rl,TRUE,inv_cache,R->cf);
128  for(j=rl-1;j>=0;j--)
129  {
130  x[j]=NULL; // n_Init(0...) takes no memory
131  }
132  if (n_IsZero(n,R->cf)) p_Delete(&h,R);
133  else
134  {
135  //Print("new mon:");pWrite(h);
136  p_SetCoeff(h,n,R);
137  pNext(h)=res_p;
138  res_p=h; // building res_p in reverse order!
139  }
140  }
141  res_p=pReverse(res_p);
142  p_Test(res_p, R);
143  return res_p;
144 }
loop
Definition: myNF.cc:98
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
#define TRUE
Definition: auxiliary.h:98
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:798
const ring R
Definition: DebugPrint.cc:36
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:698
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
static poly pReverse(poly p)
Definition: p_polys.h:330
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ p_Cleardenom()

poly p_Cleardenom ( poly  p,
const ring  r 
)

Definition at line 2755 of file p_polys.cc.

2756 {
2757  if( p == NULL )
2758  return NULL;
2759 
2760  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
2761 
2762 #if CLEARENUMERATORS
2763  if( 0 )
2764  {
2765  CPolyCoeffsEnumerator itr(p);
2766 
2767  n_ClearDenominators(itr, C);
2768 
2769  n_ClearContent(itr, C); // divide out the content
2770 
2771  p_Test(p, r); n_Test(pGetCoeff(p), C);
2772  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2773 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2774 
2775  return p;
2776  }
2777 #endif
2778 
2779 
2780  number d, h;
2781 
2782  if (rField_is_Ring(r))
2783  {
2784  p_Content(p,r);
2785  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2786  return p;
2787  }
2788 
2790  {
2791  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2792  return p;
2793  }
2794 
2795  assume(p != NULL);
2796 
2797  if(pNext(p)==NULL)
2798  {
2799  if (!TEST_OPT_CONTENTSB
2800  && !rField_is_Ring(r))
2801  p_SetCoeff(p,n_Init(1,r->cf),r);
2802  else if(!n_GreaterZero(pGetCoeff(p),C))
2803  p = p_Neg(p,r);
2804  return p;
2805  }
2806 
2807  assume(pNext(p)!=NULL);
2808  poly start=p;
2809 
2810 #if 0 && CLEARENUMERATORS
2811 //CF: does not seem to work that well..
2812 
2813  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2814  {
2815  CPolyCoeffsEnumerator itr(p);
2816 
2817  n_ClearDenominators(itr, C);
2818 
2819  n_ClearContent(itr, C); // divide out the content
2820 
2821  p_Test(p, r); n_Test(pGetCoeff(p), C);
2822  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2823 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2824 
2825  return start;
2826  }
2827 #endif
2828 
2829  if(1)
2830  {
2831  h = n_Init(1,r->cf);
2832  while (p!=NULL)
2833  {
2834  n_Normalize(pGetCoeff(p),r->cf);
2835  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2836  n_Delete(&h,r->cf);
2837  h=d;
2838  pIter(p);
2839  }
2840  /* contains the 1/lcm of all denominators */
2841  if(!n_IsOne(h,r->cf))
2842  {
2843  p = start;
2844  while (p!=NULL)
2845  {
2846  /* should be: // NOTE: don't use ->coef!!!!
2847  * number hh;
2848  * nGetDenom(p->coef,&hh);
2849  * nMult(&h,&hh,&d);
2850  * nNormalize(d);
2851  * nDelete(&hh);
2852  * nMult(d,p->coef,&hh);
2853  * nDelete(&d);
2854  * nDelete(&(p->coef));
2855  * p->coef =hh;
2856  */
2857  d=n_Mult(h,pGetCoeff(p),r->cf);
2858  n_Normalize(d,r->cf);
2859  p_SetCoeff(p,d,r);
2860  pIter(p);
2861  }
2862  n_Delete(&h,r->cf);
2863  }
2864  n_Delete(&h,r->cf);
2865  p=start;
2866 
2867  p_Content(p,r);
2868 #ifdef HAVE_RATGRING
2869  if (rIsRatGRing(r))
2870  {
2871  /* quick unit detection in the rational case is done in gr_nc_bba */
2872  p_ContentRat(p, r);
2873  start=p;
2874  }
2875 #endif
2876  }
2877 
2878  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2879 
2880  return start;
2881 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
#define TEST_OPT_CONTENTSB
Definition: options.h:121
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1...
Definition: coeffs.h:721
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:840
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:902
#define pIter(p)
Definition: monomials.h:44
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
void p_ContentRat(poly &ph, const ring r)
Definition: p_polys.cc:1705
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:945
const ring r
Definition: syzextra.cc:208
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:742
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2255
#define p_Test(p, r)
Definition: p_polys.h:160
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition: coeffs.h:952

◆ p_Cleardenom_n()

void p_Cleardenom_n ( poly  p,
const ring  r,
number &  c 
)

Definition at line 2883 of file p_polys.cc.

2884 {
2885  const coeffs C = r->cf;
2886  number d, h;
2887 
2888  assume( ph != NULL );
2889 
2890  poly p = ph;
2891 
2892 #if CLEARENUMERATORS
2893  if( 0 )
2894  {
2895  CPolyCoeffsEnumerator itr(ph);
2896 
2897  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2898  n_ClearContent(itr, h, C); // divide by the content h
2899 
2900  c = n_Div(d, h, C); // d/h
2901 
2902  n_Delete(&d, C);
2903  n_Delete(&h, C);
2904 
2905  n_Test(c, C);
2906 
2907  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2908  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2909 /*
2910  if(!n_GreaterZero(pGetCoeff(ph),C))
2911  {
2912  ph = p_Neg(ph,r);
2913  c = n_InpNeg(c, C);
2914  }
2915 */
2916  return;
2917  }
2918 #endif
2919 
2920 
2921  if( pNext(p) == NULL )
2922  {
2923  if(!TEST_OPT_CONTENTSB)
2924  {
2925  c=n_Invers(pGetCoeff(p), C);
2926  p_SetCoeff(p, n_Init(1, C), r);
2927  }
2928  else
2929  {
2930  c=n_Init(1,C);
2931  }
2932 
2933  if(!n_GreaterZero(pGetCoeff(ph),C))
2934  {
2935  ph = p_Neg(ph,r);
2936  c = n_InpNeg(c, C);
2937  }
2938 
2939  return;
2940  }
2941  if (TEST_OPT_CONTENTSB) { c=n_Init(1,C); return; }
2942 
2943  assume( pNext(p) != NULL );
2944 
2945 #if CLEARENUMERATORS
2946  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2947  {
2948  CPolyCoeffsEnumerator itr(ph);
2949 
2950  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2951  n_ClearContent(itr, h, C); // divide by the content h
2952 
2953  c = n_Div(d, h, C); // d/h
2954 
2955  n_Delete(&d, C);
2956  n_Delete(&h, C);
2957 
2958  n_Test(c, C);
2959 
2960  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2961  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2962 /*
2963  if(!n_GreaterZero(pGetCoeff(ph),C))
2964  {
2965  ph = p_Neg(ph,r);
2966  c = n_InpNeg(c, C);
2967  }
2968 */
2969  return;
2970  }
2971 #endif
2972 
2973 
2974 
2975 
2976  if(1)
2977  {
2978  h = n_Init(1,r->cf);
2979  while (p!=NULL)
2980  {
2981  n_Normalize(pGetCoeff(p),r->cf);
2982  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2983  n_Delete(&h,r->cf);
2984  h=d;
2985  pIter(p);
2986  }
2987  c=h;
2988  /* contains the 1/lcm of all denominators */
2989  if(!n_IsOne(h,r->cf))
2990  {
2991  p = ph;
2992  while (p!=NULL)
2993  {
2994  /* should be: // NOTE: don't use ->coef!!!!
2995  * number hh;
2996  * nGetDenom(p->coef,&hh);
2997  * nMult(&h,&hh,&d);
2998  * nNormalize(d);
2999  * nDelete(&hh);
3000  * nMult(d,p->coef,&hh);
3001  * nDelete(&d);
3002  * nDelete(&(p->coef));
3003  * p->coef =hh;
3004  */
3005  d=n_Mult(h,pGetCoeff(p),r->cf);
3006  n_Normalize(d,r->cf);
3007  p_SetCoeff(p,d,r);
3008  pIter(p);
3009  }
3010  if (rField_is_Q_a(r))
3011  {
3012  loop
3013  {
3014  h = n_Init(1,r->cf);
3015  p=ph;
3016  while (p!=NULL)
3017  {
3018  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
3019  n_Delete(&h,r->cf);
3020  h=d;
3021  pIter(p);
3022  }
3023  /* contains the 1/lcm of all denominators */
3024  if(!n_IsOne(h,r->cf))
3025  {
3026  p = ph;
3027  while (p!=NULL)
3028  {
3029  /* should be: // NOTE: don't use ->coef!!!!
3030  * number hh;
3031  * nGetDenom(p->coef,&hh);
3032  * nMult(&h,&hh,&d);
3033  * nNormalize(d);
3034  * nDelete(&hh);
3035  * nMult(d,p->coef,&hh);
3036  * nDelete(&d);
3037  * nDelete(&(p->coef));
3038  * p->coef =hh;
3039  */
3040  d=n_Mult(h,pGetCoeff(p),r->cf);
3041  n_Normalize(d,r->cf);
3042  p_SetCoeff(p,d,r);
3043  pIter(p);
3044  }
3045  number t=n_Mult(c,h,r->cf);
3046  n_Delete(&c,r->cf);
3047  c=t;
3048  }
3049  else
3050  {
3051  break;
3052  }
3053  n_Delete(&h,r->cf);
3054  }
3055  }
3056  }
3057  }
3058 
3059  if(!n_GreaterZero(pGetCoeff(ph),C))
3060  {
3061  ph = p_Neg(ph,r);
3062  c = n_InpNeg(c, C);
3063  }
3064 
3065 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define TEST_OPT_CONTENTSB
Definition: options.h:121
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:531
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1...
Definition: coeffs.h:721
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:840
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:902
#define pIter(p)
Definition: monomials.h:44
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:945
const ring r
Definition: syzextra.cc:208
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:742
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:568
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
#define pNext(p)
Definition: monomials.h:43
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition: coeffs.h:952

◆ p_Cmp()

static int p_Cmp ( poly  p1,
poly  p2,
ring  r 
)
inlinestatic

Definition at line 1615 of file p_polys.h.

1616 {
1617  if (p2==NULL)
1618  return 1;
1619  if (p1==NULL)
1620  return -1;
1621  return p_LmCmp(p1,p2,r);
1622 }
const ring r
Definition: syzextra.cc:208
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
#define NULL
Definition: omList.c:10
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_Comp_k_n()

static int p_Comp_k_n ( poly  a,
poly  b,
int  k,
ring  r 
)
inlinestatic

Definition at line 635 of file p_polys.h.

636 {
637  if ((a==NULL) || (b==NULL) ) return FALSE;
640  pAssume2(k > 0 && k <= r->N);
641  int i=k;
642  for(;i<=r->N;i++)
643  {
644  if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE;
645  // if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;
646  }
647  return TRUE;
648 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
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:464
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213

◆ p_Compare()

int p_Compare ( const poly  a,
const poly  b,
const ring  R 
)

Definition at line 4760 of file p_polys.cc.

4761 {
4762  int r=p_Cmp(a,b,R);
4763  if ((r==0)&&(a!=NULL))
4764  {
4765  number h=n_Sub(pGetCoeff(a),pGetCoeff(b),R->cf);
4766  /* compare lead coeffs */
4767  r = -1+n_IsZero(h,R->cf)+2*n_GreaterZero(h,R->cf); /* -1: <, 0:==, 1: > */
4768  n_Delete(&h,R->cf);
4769  }
4770  else if (a==NULL)
4771  {
4772  if (b==NULL)
4773  {
4774  /* compare 0, 0 */
4775  r=0;
4776  }
4777  else if(p_IsConstant(b,R))
4778  {
4779  /* compare 0, const */
4780  r = 1-2*n_GreaterZero(pGetCoeff(b),R->cf); /* -1: <, 1: > */
4781  }
4782  }
4783  else if (b==NULL)
4784  {
4785  if (p_IsConstant(a,R))
4786  {
4787  /* compare const, 0 */
4788  r = -1+2*n_GreaterZero(pGetCoeff(a),R->cf); /* -1: <, 1: > */
4789  }
4790  }
4791  return(r);
4792 }
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of &#39;a&#39; and &#39;b&#39;, i.e., a-b
Definition: coeffs.h:673
const poly a
Definition: syzextra.cc:212
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1615
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 BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
const ring R
Definition: DebugPrint.cc:36
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define NULL
Definition: omList.c:10
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213

◆ p_ComparePolys()

BOOLEAN p_ComparePolys ( poly  p1,
poly  p2,
const ring  r 
)

returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL

Definition at line 4431 of file p_polys.cc.

4432 {
4433  number n,nn;
4434  pAssume(p1 != NULL && p2 != NULL);
4435 
4436  if (!p_LmEqual(p1,p2,r)) //compare leading mons
4437  return FALSE;
4438  if ((pNext(p1)==NULL) && (pNext(p2)!=NULL))
4439  return FALSE;
4440  if ((pNext(p2)==NULL) && (pNext(p1)!=NULL))
4441  return FALSE;
4442  if (pLength(p1) != pLength(p2))
4443  return FALSE;
4444  #ifdef HAVE_RINGS
4445  if (rField_is_Ring(r))
4446  {
4447  if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf)) return FALSE;
4448  }
4449  #endif
4450  n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf);
4451  while ((p1 != NULL) /*&& (p2 != NULL)*/)
4452  {
4453  if ( ! p_LmEqual(p1, p2,r))
4454  {
4455  n_Delete(&n, r->cf);
4456  return FALSE;
4457  }
4458  if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf))
4459  {
4460  n_Delete(&n, r->cf);
4461  n_Delete(&nn, r->cf);
4462  return FALSE;
4463  }
4464  n_Delete(&nn, r->cf);
4465  pIter(p1);
4466  pIter(p2);
4467  }
4468  n_Delete(&n, r->cf);
4469  return TRUE;
4470 }
#define FALSE
Definition: auxiliary.h:94
#define pAssume(cond)
Definition: monomials.h:98
#define TRUE
Definition: auxiliary.h:98
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
#define pIter(p)
Definition: monomials.h:44
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
const ring r
Definition: syzextra.cc:208
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:787
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1611
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:464
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459

◆ p_Content()

void p_Content ( poly  p,
const ring  r 
)

Definition at line 2255 of file p_polys.cc.

2256 {
2257  assume( ph != NULL );
2258 
2259  assume( r != NULL ); assume( r->cf != NULL );
2260 
2261 
2262 #if CLEARENUMERATORS
2263  if( 0 )
2264  {
2265  const coeffs C = r->cf;
2266  // experimentall (recursive enumerator treatment) of alg. Ext!
2267  CPolyCoeffsEnumerator itr(ph);
2268  n_ClearContent(itr, r->cf);
2269 
2270  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2271  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2272 
2273  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2274  return;
2275  }
2276 #endif
2277 
2278 
2279 #ifdef HAVE_RINGS
2280  if (rField_is_Ring(r))
2281  {
2282  if (rField_has_Units(r))
2283  {
2284  number k = n_GetUnit(pGetCoeff(ph),r->cf);
2285  if (!n_IsOne(k,r->cf))
2286  {
2287  number tmpGMP = k;
2288  k = n_Invers(k,r->cf);
2289  n_Delete(&tmpGMP,r->cf);
2290  poly h = pNext(ph);
2291  p_SetCoeff(ph, n_Mult(pGetCoeff(ph), k,r->cf),r);
2292  while (h != NULL)
2293  {
2294  p_SetCoeff(h, n_Mult(pGetCoeff(h), k,r->cf),r);
2295  pIter(h);
2296  }
2297 // assume( n_GreaterZero(pGetCoeff(ph),r->cf) );
2298 // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2299  }
2300  n_Delete(&k,r->cf);
2301  }
2302  return;
2303  }
2304 #endif
2305  number h,d;
2306  poly p;
2307 
2308  if(TEST_OPT_CONTENTSB) return;
2309  if(pNext(ph)==NULL)
2310  {
2311  p_SetCoeff(ph,n_Init(1,r->cf),r);
2312  }
2313  else
2314  {
2315  assume( pNext(ph) != NULL );
2316 #if CLEARENUMERATORS
2317  if( nCoeff_is_Q(r->cf) )
2318  {
2319  // experimentall (recursive enumerator treatment) of alg. Ext!
2320  CPolyCoeffsEnumerator itr(ph);
2321  n_ClearContent(itr, r->cf);
2322 
2323  p_Test(ph, r); n_Test(pGetCoeff(ph), r->cf);
2324  assume(n_GreaterZero(pGetCoeff(ph), r->cf)); // ??
2325 
2326  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2327  return;
2328  }
2329 #endif
2330 
2331  n_Normalize(pGetCoeff(ph),r->cf);
2332  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2333  if (rField_is_Q(r)||(getCoeffType(r->cf)==n_transExt)) // should not be used anymore if CLEARENUMERATORS is 1
2334  {
2335  h=p_InitContent(ph,r);
2336  p=ph;
2337  }
2338  else
2339  {
2340  h=n_Copy(pGetCoeff(ph),r->cf);
2341  p = pNext(ph);
2342  }
2343  while (p!=NULL)
2344  {
2345  n_Normalize(pGetCoeff(p),r->cf);
2346  d=n_SubringGcd(h,pGetCoeff(p),r->cf);
2347  n_Delete(&h,r->cf);
2348  h = d;
2349  if(n_IsOne(h,r->cf))
2350  {
2351  break;
2352  }
2353  pIter(p);
2354  }
2355  p = ph;
2356  //number tmp;
2357  if(!n_IsOne(h,r->cf))
2358  {
2359  while (p!=NULL)
2360  {
2361  //d = nDiv(pGetCoeff(p),h);
2362  //tmp = nExactDiv(pGetCoeff(p),h);
2363  //if (!nEqual(d,tmp))
2364  //{
2365  // StringSetS("** div0:");nWrite(pGetCoeff(p));StringAppendS("/");
2366  // nWrite(h);StringAppendS("=");nWrite(d);StringAppendS(" int:");
2367  // nWrite(tmp);Print(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
2368  //}
2369  //nDelete(&tmp);
2370  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2371  p_SetCoeff(p,d,r);
2372  pIter(p);
2373  }
2374  }
2375  n_Delete(&h,r->cf);
2376  if (rField_is_Q_a(r))
2377  {
2378  // special handling for alg. ext.:
2379  if (getCoeffType(r->cf)==n_algExt)
2380  {
2381  h = n_Init(1, r->cf->extRing->cf);
2382  p=ph;
2383  while (p!=NULL)
2384  { // each monom: coeff in Q_a
2385  poly c_n_n=(poly)pGetCoeff(p);
2386  poly c_n=c_n_n;
2387  while (c_n!=NULL)
2388  { // each monom: coeff in Q
2389  d=n_NormalizeHelper(h,pGetCoeff(c_n),r->cf->extRing->cf);
2390  n_Delete(&h,r->cf->extRing->cf);
2391  h=d;
2392  pIter(c_n);
2393  }
2394  pIter(p);
2395  }
2396  /* h contains the 1/lcm of all denominators in c_n_n*/
2397  //n_Normalize(h,r->cf->extRing->cf);
2398  if(!n_IsOne(h,r->cf->extRing->cf))
2399  {
2400  p=ph;
2401  while (p!=NULL)
2402  { // each monom: coeff in Q_a
2403  poly c_n=(poly)pGetCoeff(p);
2404  while (c_n!=NULL)
2405  { // each monom: coeff in Q
2406  d=n_Mult(h,pGetCoeff(c_n),r->cf->extRing->cf);
2407  n_Normalize(d,r->cf->extRing->cf);
2408  n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf);
2409  pGetCoeff(c_n)=d;
2410  pIter(c_n);
2411  }
2412  pIter(p);
2413  }
2414  }
2415  n_Delete(&h,r->cf->extRing->cf);
2416  }
2417  /*else
2418  {
2419  // special handling for rat. functions.:
2420  number hzz =NULL;
2421  p=ph;
2422  while (p!=NULL)
2423  { // each monom: coeff in Q_a (Z_a)
2424  fraction f=(fraction)pGetCoeff(p);
2425  poly c_n=NUM(f);
2426  if (hzz==NULL)
2427  {
2428  hzz=n_Copy(pGetCoeff(c_n),r->cf->extRing->cf);
2429  pIter(c_n);
2430  }
2431  while ((c_n!=NULL)&&(!n_IsOne(hzz,r->cf->extRing->cf)))
2432  { // each monom: coeff in Q (Z)
2433  d=n_Gcd(hzz,pGetCoeff(c_n),r->cf->extRing->cf);
2434  n_Delete(&hzz,r->cf->extRing->cf);
2435  hzz=d;
2436  pIter(c_n);
2437  }
2438  pIter(p);
2439  }
2440  // hzz contains the gcd of all numerators in f
2441  h=n_Invers(hzz,r->cf->extRing->cf);
2442  n_Delete(&hzz,r->cf->extRing->cf);
2443  n_Normalize(h,r->cf->extRing->cf);
2444  if(!n_IsOne(h,r->cf->extRing->cf))
2445  {
2446  p=ph;
2447  while (p!=NULL)
2448  { // each monom: coeff in Q_a (Z_a)
2449  fraction f=(fraction)pGetCoeff(p);
2450  NUM(f)=p_Mult_nn(NUM(f),h,r->cf->extRing);
2451  p_Normalize(NUM(f),r->cf->extRing);
2452  pIter(p);
2453  }
2454  }
2455  n_Delete(&h,r->cf->extRing->cf);
2456  }*/
2457  }
2458  }
2459  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2460 }
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
Definition: coeffs.h:536
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define TEST_OPT_CONTENTSB
Definition: options.h:121
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:531
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
int k
Definition: cfEzgcd.cc:93
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1...
Definition: coeffs.h:721
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:840
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
#define pIter(p)
Definition: monomials.h:44
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:945
const ring r
Definition: syzextra.cc:208
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:742
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:568
static number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2522
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:425
#define p_Test(p, r)
Definition: p_polys.h:160
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:36
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition: coeffs.h:626
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:692
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
polyrec * poly
Definition: hilb.h:10
static BOOLEAN rField_has_Units(const ring r)
Definition: ring.h:483
static Poly * h
Definition: janet.cc:978

◆ p_ContentRat()

void p_ContentRat ( poly ph,
const ring  r 
)

Definition at line 1705 of file p_polys.cc.

1708 {
1709  // init array of RatLeadCoeffs
1710  // poly p_GetCoeffRat(poly p, int ishift, ring r);
1711 
1712  int len=pLength(ph);
1713  poly *C = (poly *)omAlloc0((len+1)*sizeof(poly)); //rat coeffs
1714  poly *LM = (poly *)omAlloc0((len+1)*sizeof(poly)); // rat lead terms
1715  int *D = (int *)omAlloc0((len+1)*sizeof(int)); //degrees of coeffs
1716  int *L = (int *)omAlloc0((len+1)*sizeof(int)); //lengths of coeffs
1717  int k = 0;
1718  poly p = p_Copy(ph, r); // ph will be needed below
1719  int mintdeg = p_Totaldegree(p, r);
1720  int minlen = len;
1721  int dd = 0; int i;
1722  int HasConstantCoef = 0;
1723  int is = r->real_var_start - 1;
1724  while (p!=NULL)
1725  {
1726  LM[k] = p_GetExp_k_n(p,1,is, r); // need LmRat istead of p_HeadRat(p, is, currRing); !
1727  C[k] = p_GetCoeffRat(p, is, r);
1728  D[k] = p_Totaldegree(C[k], r);
1729  mintdeg = si_min(mintdeg,D[k]);
1730  L[k] = pLength(C[k]);
1731  minlen = si_min(minlen,L[k]);
1732  if (p_IsConstant(C[k], r))
1733  {
1734  // C[k] = const, so the content will be numerical
1735  HasConstantCoef = 1;
1736  // smth like goto cleanup and return(pContent(p));
1737  }
1738  p_LmDeleteAndNextRat(&p, is, r);
1739  k++;
1740  }
1741 
1742  // look for 1 element of minimal degree and of minimal length
1743  k--;
1744  poly d;
1745  int mindeglen = len;
1746  if (k<=0) // this poly is not a ratgring poly -> pContent
1747  {
1748  p_Delete(&C[0], r);
1749  p_Delete(&LM[0], r);
1750  p_Content(ph, r);
1751  goto cleanup;
1752  }
1753 
1754  int pmindeglen;
1755  for(i=0; i<=k; i++)
1756  {
1757  if (D[i] == mintdeg)
1758  {
1759  if (L[i] < mindeglen)
1760  {
1761  mindeglen=L[i];
1762  pmindeglen = i;
1763  }
1764  }
1765  }
1766  d = p_Copy(C[pmindeglen], r);
1767  // there are dd>=1 mindeg elements
1768  // and pmideglen is the coordinate of one of the smallest among them
1769 
1770  // poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r));
1771  // return naGcd(d,d2,currRing);
1772 
1773  // adjoin pContentRat here?
1774  for(i=0; i<=k; i++)
1775  {
1776  d=singclap_gcd(d,p_Copy(C[i], r), r);
1777  if (p_Totaldegree(d, r)==0)
1778  {
1779  // cleanup, pContent, return
1780  p_Delete(&d, r);
1781  for(;k>=0;k--)
1782  {
1783  p_Delete(&C[k], r);
1784  p_Delete(&LM[k], r);
1785  }
1786  p_Content(ph, r);
1787  goto cleanup;
1788  }
1789  }
1790  for(i=0; i<=k; i++)
1791  {
1792  poly h=singclap_pdivide(C[i],d, r);
1793  p_Delete(&C[i], r);
1794  C[i]=h;
1795  }
1796 
1797  // zusammensetzen,
1798  p=NULL; // just to be sure
1799  for(i=0; i<=k; i++)
1800  {
1801  p = p_Add_q(p, p_Mult_q(C[i],LM[i], r), r);
1802  C[i]=NULL; LM[i]=NULL;
1803  }
1804  p_Delete(&ph, r); // do not need it anymore
1805  ph = p;
1806  // aufraeumen, return
1807 cleanup:
1808  omFree(C);
1809  omFree(LM);
1810  omFree(D);
1811  omFree(L);
1812 }
#define D(A)
Definition: gentable.cc:123
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
return P p
Definition: myNF.cc:203
poly singclap_gcd(poly f, poly g, const ring r)
destroys f and g
Definition: clapsing.cc:264
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
int k
Definition: cfEzgcd.cc:93
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:534
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition: p_polys.cc:1661
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition: p_polys.cc:1683
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2255
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1295
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ p_Copy() [1/2]

static poly p_Copy ( poly  p,
const ring  r 
)
inlinestatic

returns a copy of p

Definition at line 804 of file p_polys.h.

805 {
806  p_Test(p,r);
807  const poly pp = p_Copy_noCheck(p, r);
808  p_Test(pp,r);
809  return pp;
810 }
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:797
const ring r
Definition: syzextra.cc:208
#define p_Test(p, r)
Definition: p_polys.h:160
polyrec * poly
Definition: hilb.h:10

◆ p_Copy() [2/2]

static poly p_Copy ( poly  p,
const ring  lmRing,
const ring  tailRing 
)
inlinestatic

Definition at line 826 of file p_polys.h.

827 {
828  if (p != NULL)
829  {
830 #ifndef PDEBUG
831  if (tailRing == lmRing)
832  return p_Copy_noCheck(p, tailRing);
833 #endif
834  poly pres = p_Head(p, lmRing);
835  pNext(pres) = p_Copy_noCheck(pNext(p), tailRing);
836  return pres;
837  }
838  else
839  return NULL;
840 }
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
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:797
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ p_Copy_noCheck()

static poly p_Copy_noCheck ( poly  p,
const ring  r 
)
inlinestatic

returns a copy of p (without any additional testing)

Definition at line 797 of file p_polys.h.

798 {
799  assume(r != NULL); assume(r->p_Procs != NULL); assume(r->p_Procs->p_Copy != NULL);
800  return r->p_Procs->p_Copy(p, r);
801 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10

◆ p_DecrExp()

static long p_DecrExp ( poly  p,
int  v,
ring  r 
)
inlinestatic

Definition at line 593 of file p_polys.h.

594 {
596  int e = p_GetExp(p,v,r);
597  pAssume2(e > 0);
598  e--;
599  return p_SetExp(p,v,e,r);
600 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
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:464
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
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:483

◆ p_Deg()

long p_Deg ( poly  a,
const ring  r 
)

Definition at line 588 of file p_polys.cc.

589 {
591 // assume(p_GetOrder(a, r) == p_WTotaldegree(a, r)); // WRONG assume!
592  return p_GetOrder(a, r);
593 }
const poly a
Definition: syzextra.cc:212
const ring r
Definition: syzextra.cc:208
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:416
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119

◆ p_DegW()

long p_DegW ( poly  p,
const short *  w,
const ring  R 
)

Definition at line 691 of file p_polys.cc.

692 {
693  p_Test(p, R);
694  assume( w != NULL );
695  long r=-LONG_MAX;
696 
697  while (p!=NULL)
698  {
699  long t=totaldegreeWecart_IV(p,R,w);
700  if (t>r) r=t;
701  pIter(p);
702  }
703  return r;
704 }
return P p
Definition: myNF.cc:203
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:239
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
const ring R
Definition: DebugPrint.cc:36
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ p_Delete() [1/2]

static void p_Delete ( poly p,
const ring  r 
)
inlinestatic

Definition at line 843 of file p_polys.h.

844 {
845  assume( p!= NULL );
846  r->p_Procs->p_Delete(p, r);
847 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10

◆ p_Delete() [2/2]

static void p_Delete ( poly p,
const ring  lmRing,
const ring  tailRing 
)
inlinestatic

Definition at line 849 of file p_polys.h.

850 {
851  assume( p!= NULL );
852  if (*p != NULL)
853  {
854 #ifndef PDEBUG
855  if (tailRing == lmRing)
856  {
857  p_Delete(p, tailRing);
858  return;
859  }
860 #endif
861  if (pNext(*p) != NULL)
862  p_Delete(&pNext(*p), tailRing);
863  p_LmDelete(p, lmRing);
864  }
865 }
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 assume(x)
Definition: mod2.h:394
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706

◆ p_DeleteComp()

void p_DeleteComp ( poly p,
int  k,
const ring  r 
)

Definition at line 3488 of file p_polys.cc.

3489 {
3490  poly q;
3491 
3492  while ((*p!=NULL) && (p_GetComp(*p,r)==k)) p_LmDelete(p,r);
3493  if (*p==NULL) return;
3494  q = *p;
3495  if (p_GetComp(q,r)>k)
3496  {
3497  p_SubComp(q,1,r);
3498  p_SetmComp(q,r);
3499  }
3500  while (pNext(q)!=NULL)
3501  {
3502  if (p_GetComp(pNext(q),r)==k)
3503  p_LmDelete(&(pNext(q)),r);
3504  else
3505  {
3506  pIter(q);
3507  if (p_GetComp(q,r)>k)
3508  {
3509  p_SubComp(q,1,r);
3510  p_SetmComp(q,r);
3511  }
3512  }
3513  }
3514 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:448
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10

◆ p_Diff()

poly p_Diff ( poly  a,
int  k,
const ring  r 
)

Definition at line 1859 of file p_polys.cc.

1860 {
1861  poly res, f, last;
1862  number t;
1863 
1864  last = res = NULL;
1865  while (a!=NULL)
1866  {
1867  if (p_GetExp(a,k,r)!=0)
1868  {
1869  f = p_LmInit(a,r);
1870  t = n_Init(p_GetExp(a,k,r),r->cf);
1871  pSetCoeff0(f,n_Mult(t,pGetCoeff(a),r->cf));
1872  n_Delete(&t,r->cf);
1873  if (n_IsZero(pGetCoeff(f),r->cf))
1874  p_LmDelete(&f,r);
1875  else
1876  {
1877  p_DecrExp(f,k,r);
1878  p_Setm(f,r);
1879  if (res==NULL)
1880  {
1881  res=last=f;
1882  }
1883  else
1884  {
1885  pNext(last)=f;
1886  last=f;
1887  }
1888  }
1889  }
1890  pIter(a);
1891  }
1892  return res;
1893 }
const poly a
Definition: syzextra.cc:212
static poly last
Definition: hdegree.cc:1077
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
int k
Definition: cfEzgcd.cc:93
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
#define pIter(p)
Definition: monomials.h:44
poly res
Definition: myNF.cc:322
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
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:464
FILE * f
Definition: checklibs.c:9
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static long p_DecrExp(poly p, int v, ring r)
Definition: p_polys.h:593
polyrec * poly
Definition: hilb.h:10

◆ p_DiffOp()

poly p_DiffOp ( poly  a,
poly  b,
BOOLEAN  multiply,
const ring  r 
)

Definition at line 1934 of file p_polys.cc.

1935 {
1936  poly result=NULL;
1937  poly h;
1938  for(;a!=NULL;pIter(a))
1939  {
1940  for(h=b;h!=NULL;pIter(h))
1941  {
1942  result=p_Add_q(result,p_DiffOpM(a,h,multiply,r),r);
1943  }
1944  }
1945  return result;
1946 }
const poly a
Definition: syzextra.cc:212
static poly p_DiffOpM(poly a, poly b, BOOLEAN multiply, const ring r)
Definition: p_polys.cc:1895
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

◆ p_Div_mm()

poly p_Div_mm ( poly  p,
const poly  m,
const ring  r 
)

divide polynomial by monomial

Definition at line 1509 of file p_polys.cc.

1510 {
1511  p_Test(p, r);
1512  p_Test(m, r);
1513  poly result = p;
1514  poly prev = NULL;
1515  number n=pGetCoeff(m);
1516  while (p!=NULL)
1517  {
1518  number nc = n_Div(pGetCoeff(p),n,r->cf);
1519  n_Normalize(nc,r->cf);
1520  if (!n_IsZero(nc,r->cf))
1521  {
1522  p_SetCoeff(p,nc,r);
1523  prev=p;
1524  p_ExpVectorSub(p,m,r);
1525  pIter(p);
1526  }
1527  else
1528  {
1529  if (prev==NULL)
1530  {
1531  p_LmDelete(&result,r);
1532  p=result;
1533  }
1534  else
1535  {
1536  p_LmDelete(&pNext(prev),r);
1537  p=pNext(prev);
1538  }
1539  }
1540  }
1541  p_Test(result,r);
1542  return(result);
1543 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1363
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

◆ p_Div_nn()

poly p_Div_nn ( poly  p,
const number  n,
const ring  r 
)

Definition at line 1476 of file p_polys.cc.

1477 {
1478  pAssume(!n_IsZero(n,r->cf));
1479  p_Test(p, r);
1480  poly result = p;
1481  poly prev = NULL;
1482  while (p!=NULL)
1483  {
1484  number nc = n_Div(pGetCoeff(p),n,r->cf);
1485  if (!n_IsZero(nc,r->cf))
1486  {
1487  p_SetCoeff(p,nc,r);
1488  prev=p;
1489  pIter(p);
1490  }
1491  else
1492  {
1493  if (prev==NULL)
1494  {
1495  p_LmDelete(&result,r);
1496  p=result;
1497  }
1498  else
1499  {
1500  p_LmDelete(&pNext(prev),r);
1501  p=pNext(prev);
1502  }
1503  }
1504  }
1505  p_Test(result,r);
1506  return(result);
1507 }
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

◆ p_Divide()

poly p_Divide ( poly  a,
poly  b,
const ring  r 
)

Definition at line 1463 of file p_polys.cc.

1464 {
1465  assume((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(b,r)==0));
1466  int i;
1467  poly result = p_Init(r);
1468 
1469  for(i=(int)r->N; i; i--)
1472  p_Setm(result,r);
1473  return result;
1474 }
const poly a
Definition: syzextra.cc:212
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
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:464
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
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:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

◆ p_DivideM()

poly p_DivideM ( poly  a,
poly  b,
const ring  r 
)

Definition at line 1549 of file p_polys.cc.

1550 {
1551  if (a==NULL) { p_Delete(&b,r); return NULL; }
1552  poly result=a;
1553  poly prev=NULL;
1554 #ifdef HAVE_RINGS
1555  number inv=pGetCoeff(b);
1556 #else
1557  number inv=n_Invers(pGetCoeff(b),r->cf);
1558 #endif
1559 
1560  while (a!=NULL)
1561  {
1562  if (p_DivisibleBy(b,a,r))
1563  {
1564  p_ExpVectorSub(a,b,r);
1565  prev=a;
1566  pIter(a);
1567  }
1568  else
1569  {
1570  if (prev==NULL)
1571  {
1572  p_LmDelete(&result,r);
1573  a=result;
1574  }
1575  else
1576  {
1577  p_LmDelete(&pNext(prev),r);
1578  a=pNext(prev);
1579  }
1580  }
1581  }
1582 #ifdef HAVE_RINGS
1583  if (n_IsUnit(inv,r->cf))
1584  {
1585  inv = n_Invers(inv,r->cf);
1586  p_Mult_nn(result,inv,r);
1587  n_Delete(&inv, r->cf);
1588  }
1589  else
1590  {
1591  result = p_Div_nn(result,inv,r);
1592  }
1593 #else
1594  result = p_Mult_nn(result,inv,r);
1595  n_Delete(&inv, r->cf);
1596 #endif
1597  p_Delete(&b, r);
1598  return result;
1599 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
const poly a
Definition: syzextra.cc:212
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1476
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
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:568
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1363
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:895
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

◆ p_DivisibleBy() [1/2]

static BOOLEAN p_DivisibleBy ( poly  a,
poly  b,
const ring  r 
)
inlinestatic

Definition at line 1777 of file p_polys.h.

1778 {
1781 
1782  if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)))
1783  return _p_LmDivisibleByNoComp(a,b,r);
1784  return FALSE;
1785 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define pIfThen1(cond, check)
Definition: monomials.h:187
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213

◆ p_DivisibleBy() [2/2]

static BOOLEAN p_DivisibleBy ( poly  a,
const ring  r_a,
poly  b,
const ring  r_b 
)
inlinestatic

Definition at line 1786 of file p_polys.h.

1787 {
1788  pIfThen1(b!=NULL, p_LmCheckPolyRing1(b, r_b));
1789  pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r_a));
1790  if (a != NULL) {
1791  return _p_LmDivisibleBy(a, r_a, b, r_b);
1792  }
1793  return FALSE;
1794 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1742
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define pIfThen1(cond, check)
Definition: monomials.h:187
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213

◆ p_DivisibleByRingCase()

BOOLEAN p_DivisibleByRingCase ( poly  f,
poly  g,
const ring  r 
)

divisibility check over ground ring (which may contain zero divisors); TRUE iff LT(f) divides LT(g), i.e., LT(f)*c*m = LT(g), for some coefficient c and some monomial m; does not take components into account

Definition at line 1603 of file p_polys.cc.

1604 {
1605  int exponent;
1606  for(int i = (int)rVar(r); i>0; i--)
1607  {
1608  exponent = p_GetExp(g, i, r) - p_GetExp(f, i, r);
1609  if (exponent < 0) return FALSE;
1610  }
1611  return n_DivBy(pGetCoeff(g), pGetCoeff(f), r->cf);
1612 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
g
Definition: cfModGcd.cc:4031
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:464
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:787
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )

◆ p_EqualPolys() [1/2]

BOOLEAN p_EqualPolys ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 4367 of file p_polys.cc.

4368 {
4369  while ((p1 != NULL) && (p2 != NULL))
4370  {
4371  if (! p_LmEqual(p1, p2,r))
4372  return FALSE;
4373  if (! n_Equal(p_GetCoeff(p1,r), p_GetCoeff(p2,r),r->cf ))
4374  return FALSE;
4375  pIter(p1);
4376  pIter(p2);
4377  }
4378  return (p1==p2);
4379 }
#define FALSE
Definition: auxiliary.h:94
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1611
#define NULL
Definition: omList.c:10
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:464
#define p_GetCoeff(p, r)
Definition: monomials.h:57
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_EqualPolys() [2/2]

BOOLEAN p_EqualPolys ( poly  p1,
poly  p2,
const ring  r1,
const ring  r2 
)

same as the usual p_EqualPolys for polys belonging to equal rings

Definition at line 4405 of file p_polys.cc.

4406 {
4407  assume( r1 == r2 || rSamePolyRep(r1, r2) ); // will be used in rEqual!
4408  assume( r1->cf == r2->cf );
4409 
4410  while ((p1 != NULL) && (p2 != NULL))
4411  {
4412  // returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !!
4413  // #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r)
4414 
4415  if (! p_ExpVectorEqual(p1, p2, r1, r2))
4416  return FALSE;
4417 
4418  if (! n_Equal(p_GetCoeff(p1,r1), p_GetCoeff(p2,r2), r1->cf ))
4419  return FALSE;
4420 
4421  pIter(p1);
4422  pIter(p2);
4423  }
4424  return (p1==p2);
4425 }
#define FALSE
Definition: auxiliary.h:94
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:394
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:1677
#define NULL
Definition: omList.c:10
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:464
#define p_GetCoeff(p, r)
Definition: monomials.h:57
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4381

◆ p_ExpVectorAdd()

static void p_ExpVectorAdd ( poly  p1,
poly  p2,
const ring  r 
)
inlinestatic

Definition at line 1334 of file p_polys.h.

1335 {
1336  p_LmCheckPolyRing1(p1, r);
1338 #if PDEBUG >= 1
1339  for (int i=1; i<=r->N; i++)
1340  pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
1341  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
1342 #endif
1343 
1344  p_MemAdd_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
1346 }
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208
#define p_MemAdd_LengthGeneral(r, s, length)
Definition: p_MemAdd.h:173
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:464
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1215
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_ExpVectorAddSub()

static void p_ExpVectorAddSub ( poly  p1,
poly  p2,
poly  p3,
const ring  r 
)
inlinestatic

Definition at line 1379 of file p_polys.h.

1380 {
1381  p_LmCheckPolyRing1(p1, r);
1383  p_LmCheckPolyRing1(p3, r);
1384 #if PDEBUG >= 1
1385  for (int i=1; i<=r->N; i++)
1386  pAssume1(p_GetExp(p1, i, r) + p_GetExp(p2, i, r) >= p_GetExp(p3, i, r));
1387  pAssume1(p_GetComp(p1, r) == 0 ||
1388  (p_GetComp(p2, r) - p_GetComp(p3, r) == 0) ||
1389  (p_GetComp(p1, r) == p_GetComp(p2, r) - p_GetComp(p3, r)));
1390 #endif
1391 
1392  p_MemAddSub_LengthGeneral(p1->exp, p2->exp, p3->exp, r->ExpL_Size);
1393  // no need to adjust in case of NegWeights
1394 }
#define p_GetComp(p, r)
Definition: monomials.h:72
#define p_MemAddSub_LengthGeneral(r, s, t, length)
Definition: p_MemAdd.h:312
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:464
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_ExpVectorCopy()

static void p_ExpVectorCopy ( poly  d_p,
poly  s_p,
const ring  r 
)
inlinestatic

Definition at line 1236 of file p_polys.h.

1237 {
1238  p_LmCheckPolyRing1(d_p, r);
1239  p_LmCheckPolyRing1(s_p, r);
1240  memcpy(d_p->exp, s_p->exp, r->ExpL_Size*sizeof(long));
1241 }
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185

◆ p_ExpVectorDiff()

static void p_ExpVectorDiff ( poly  pr,
poly  p1,
poly  p2,
const ring  r 
)
inlinestatic

Definition at line 1397 of file p_polys.h.

1398 {
1399  p_LmCheckPolyRing1(p1, r);
1401  p_LmCheckPolyRing1(pr, r);
1402 #if PDEBUG >= 2
1403  for (int i=1; i<=r->N; i++)
1404  pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
1405  pAssume1(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
1406 #endif
1407 
1408  p_MemDiff_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
1410 }
#define p_GetComp(p, r)
Definition: monomials.h:72
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1225
const ring r
Definition: syzextra.cc:208
#define p_MemDiff_LengthGeneral(r, s1, s2, length)
Definition: p_MemAdd.h:262
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:464
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define rRing_has_Comp(r)
Definition: monomials.h:274
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_ExpVectorEqual()

static BOOLEAN p_ExpVectorEqual ( poly  p1,
poly  p2,
const ring  r 
)
inlinestatic

Definition at line 1412 of file p_polys.h.

1413 {
1414  p_LmCheckPolyRing1(p1, r);
1416 
1417  unsigned i = r->ExpL_Size;
1418  unsigned long *ep = p1->exp;
1419  unsigned long *eq = p2->exp;
1420 
1421  do
1422  {
1423  i--;
1424  if (ep[i] != eq[i]) return FALSE;
1425  }
1426  while (i!=0);
1427  return TRUE;
1428 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_ExpVectorSub()

static void p_ExpVectorSub ( poly  p1,
poly  p2,
const ring  r 
)
inlinestatic

Definition at line 1363 of file p_polys.h.

1364 {
1365  p_LmCheckPolyRing1(p1, r);
1367 #if PDEBUG >= 1
1368  for (int i=1; i<=r->N; i++)
1369  pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
1370  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0 ||
1371  p_GetComp(p1, r) == p_GetComp(p2, r));
1372 #endif
1373 
1374  p_MemSub_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
1376 }
#define p_GetComp(p, r)
Definition: monomials.h:72
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1225
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:464
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define p_MemSub_LengthGeneral(r, s, length)
Definition: p_MemAdd.h:291
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_ExpVectorSum()

static void p_ExpVectorSum ( poly  pr,
poly  p1,
poly  p2,
const ring  r 
)
inlinestatic

Definition at line 1348 of file p_polys.h.

1349 {
1350  p_LmCheckPolyRing1(p1, r);
1352  p_LmCheckPolyRing1(pr, r);
1353 #if PDEBUG >= 1
1354  for (int i=1; i<=r->N; i++)
1355  pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
1356  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
1357 #endif
1358 
1359  p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
1361 }
#define p_MemSum_LengthGeneral(r, s1, s2, length)
Definition: p_MemAdd.h:86
#define p_GetComp(p, r)
Definition: monomials.h:72
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:464
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1215
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_Farey()

poly p_Farey ( poly  p,
number  N,
const ring  r 
)

Definition at line 61 of file p_polys.cc.

62 {
63  poly h=p_Copy(p,r);
64  poly hh=h;
65  while(h!=NULL)
66  {
67  number c=pGetCoeff(h);
68  pSetCoeff0(h,n_Farey(c,N,r->cf));
69  n_Delete(&c,r->cf);
70  pIter(h);
71  }
72  while((hh!=NULL)&&(n_IsZero(pGetCoeff(hh),r->cf)))
73  {
74  p_LmDelete(&hh,r);
75  }
76  h=hh;
77  while((h!=NULL) && (pNext(h)!=NULL))
78  {
79  if(n_IsZero(pGetCoeff(pNext(h)),r->cf))
80  {
81  p_LmDelete(&pNext(h),r);
82  }
83  else pIter(h);
84  }
85  return hh;
86 }
return P p
Definition: myNF.cc:203
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
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:801
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ p_FDeg()

static long p_FDeg ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 375 of file p_polys.h.

375 { return r->pFDeg(p,r); }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208

◆ p_GcdMon()

poly p_GcdMon ( poly  f,
poly  g,
const ring  r 
)

polynomial gcd for f=mon

Definition at line 4794 of file p_polys.cc.

4795 {
4796  assume(f!=NULL);
4797  assume(g!=NULL);
4798  assume(pNext(f)==NULL);
4799  poly G=p_Head(f,r);
4800  poly h=g;
4801  int *mf=(int*)omAlloc((r->N+1)*sizeof(int));
4802  p_GetExpV(f,mf,r);
4803  int *mh=(int*)omAlloc((r->N+1)*sizeof(int));
4804  BOOLEAN const_mon;
4805  BOOLEAN one_coeff=n_IsOne(pGetCoeff(G),r->cf);
4806  loop
4807  {
4808  if (h==NULL) break;
4809  if(!one_coeff)
4810  {
4811  number n=n_SubringGcd(pGetCoeff(G),pGetCoeff(h),r->cf);
4812  one_coeff=n_IsOne(n,r->cf);
4813  p_SetCoeff(G,n,r);
4814  }
4815  p_GetExpV(h,mh,r);
4816  const_mon=TRUE;
4817  for(unsigned j=r->N;j!=0;j--)
4818  {
4819  if (mh[j]<mf[j]) mf[j]=mh[j];
4820  if (mf[j]>0) const_mon=FALSE;
4821  }
4822  if (one_coeff && const_mon) break;
4823  pIter(h);
4824  }
4825  mf[0]=0;
4826  p_SetExpV(G,mf,r); // included is p_SetComp, p_Setm
4827  omFreeSize(mf,(r->N+1)*sizeof(int));
4828  omFreeSize(mh,(r->N+1)*sizeof(int));
4829  return G;
4830 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1443
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
g
Definition: cfModGcd.cc:4031
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
static TreeM * G
Definition: janet.cc:38
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1451
#define pIter(p)
Definition: monomials.h:44
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
FILE * f
Definition: checklibs.c:9
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:692
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85

◆ p_GetCoeffRat()

poly p_GetCoeffRat ( poly  p,
int  ishift,
ring  r 
)

Definition at line 1683 of file p_polys.cc.

1684 {
1685  poly q = pNext(p);
1686  poly res; // = p_Head(p,r);
1687  res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally
1689  poly s;
1690  long cmp = p_GetComp(p, r);
1691  while ( (q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r)) && (p_GetComp(q, r) == cmp) )
1692  {
1693  s = p_GetExp_k_n(q, ishift+1, r->N, r);
1694  p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r);
1695  res = p_Add_q(res,s,r);
1696  q = pNext(q);
1697  }
1698  cmp = 0;
1699  p_SetCompP(res,cmp,r);
1700  return res;
1701 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:635
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1295
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877

◆ p_GetExp() [1/3]

static long p_GetExp ( const poly  p,
const unsigned long  iBitmask,
const int  VarOffset 
)
inlinestatic

get a single variable exponent : the integer VarOffset encodes:

  1. the position of a variable in the exponent vector p->exp (lower 24 bits)
  2. number of bits to shift to the right in the upper 8 bits (which takes at most 6 bits for 64 bit) Thus VarOffset always has 2 zero higher bits!

Definition at line 464 of file p_polys.h.

465 {
466  pAssume2((VarOffset >> (24 + 6)) == 0);
467 #if 0
468  int pos=(VarOffset & 0xffffff);
469  int bitpos=(VarOffset >> 24);
470  unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask;
471  return exp;
472 #else
473  return (long)
474  ((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24))
475  & iBitmask);
476 #endif
477 }
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
p exp[i]
Definition: DebugPrint.cc:39

◆ p_GetExp() [2/3]

static long p_GetExp ( const poly  p,
const ring  r,
const int  VarOffset 
)
inlinestatic

Definition at line 550 of file p_polys.h.

551 {
553  pAssume2(VarOffset != -1);
554  return p_GetExp(p, r->bitmask, VarOffset);
555 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
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:464

◆ p_GetExp() [3/3]

static long p_GetExp ( const poly  p,
const int  v,
const ring  r 
)
inlinestatic

get v^th exponent for a monomial

Definition at line 567 of file p_polys.h.

568 {
570  pAssume2(v>0 && v <= r->N);
571  pAssume2(r->VarOffset[v] != -1);
572  return p_GetExp(p, r->bitmask, r->VarOffset[v]);
573 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
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:464
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37

◆ p_GetExp_k_n()

static poly p_GetExp_k_n ( poly  p,
int  l,
int  k,
const ring  r 
)
inlinestatic

Definition at line 1295 of file p_polys.h.

1296 {
1297  if (p == NULL) return NULL;
1299  poly np;
1300  omTypeAllocBin(poly, np, r->PolyBin);
1301  p_SetRingOfLm(np, r);
1302  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
1303  pNext(np) = NULL;
1304  pSetCoeff0(np, n_Init(1, r->cf));
1305  int i;
1306  for(i=l;i<=k;i++)
1307  {
1308  //np->exp[(r->VarOffset[i] & 0xffffff)] =0;
1309  p_SetExp(np,i,0,r);
1310  }
1311  p_Setm(np,r);
1312  return np;
1313 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
int k
Definition: cfEzgcd.cc:93
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
const ring r
Definition: syzextra.cc:208
#define p_SetRingOfLm(p, r)
Definition: monomials.h:152
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
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:483
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
int l
Definition: cfEzgcd.cc:94

◆ p_GetExpDiff()

static long p_GetExpDiff ( poly  p1,
poly  p2,
int  i,
ring  r 
)
inlinestatic

Definition at line 630 of file p_polys.h.

631 {
632  return p_GetExp(p1,i,r) - p_GetExp(p2,i,r);
633 }
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:464
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_GetExpSum()

static long p_GetExpSum ( poly  p1,
poly  p2,
int  i,
ring  r 
)
inlinestatic

Definition at line 624 of file p_polys.h.

625 {
626  p_LmCheckPolyRing2(p1, r);
628  return p_GetExp(p1,i,r) + p_GetExp(p2,i,r);
629 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
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:464
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_GetExpV()

static void p_GetExpV ( poly  p,
int *  ev,
const ring  r 
)
inlinestatic

Definition at line 1443 of file p_polys.h.

1444 {
1446  for (unsigned j = r->N; j!=0; j--)
1447  ev[j] = p_GetExp(p, j, r);
1448 
1449  ev[0] = p_GetComp(p, r);
1450 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
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:464
int j
Definition: myNF.cc:70
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185

◆ p_GetMaxExp() [1/2]

static unsigned long p_GetMaxExp ( const unsigned long  l,
const ring  r 
)
inlinestatic

Definition at line 742 of file p_polys.h.

743 {
744  unsigned long bitmask = r->bitmask;
745  unsigned long max = (l & bitmask);
746  unsigned long j = r->ExpPerLong - 1;
747 
748  if (j > 0)
749  {
750  unsigned long i = r->BitsPerExp;
751  long e;
752  loop
753  {
754  e = ((l >> i) & bitmask);
755  if ((unsigned long) e > max)
756  max = e;
757  j--;
758  if (j==0) break;
759  i += r->BitsPerExp;
760  }
761  }
762  return max;
763 }
loop
Definition: myNF.cc:98
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static int max(int a, int b)
Definition: fast_mult.cc:264
int i
Definition: cfEzgcd.cc:123
int l
Definition: cfEzgcd.cc:94

◆ p_GetMaxExp() [2/2]

static unsigned long p_GetMaxExp ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 765 of file p_polys.h.

766 {
767  return p_GetMaxExp(p_GetMaxExpL(p, r), r);
768 }
return P p
Definition: myNF.cc:203
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
const ring r
Definition: syzextra.cc:208
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max=0)
return the maximal exponent of p in form of the maximal long var
Definition: p_polys.cc:1176

◆ p_GetMaxExpL()

unsigned long p_GetMaxExpL ( poly  p,
const ring  r,
unsigned long  l_max = 0 
)

return the maximal exponent of p in form of the maximal long var

Definition at line 1176 of file p_polys.cc.

1177 {
1178  unsigned long l_p, divmask = r->divmask;
1179  int i;
1180 
1181  while (p != NULL)
1182  {
1183  l_p = p->exp[r->VarL_Offset[0]];
1184  if (l_p > l_max ||
1185  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1186  l_max = p_GetMaxExpL2(l_max, l_p, r);
1187  for (i=1; i<r->VarL_Size; i++)
1188  {
1189  l_p = p->exp[r->VarL_Offset[i]];
1190  // do the divisibility trick to find out whether l has an exponent
1191  if (l_p > l_max ||
1192  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1193  l_max = p_GetMaxExpL2(l_max, l_p, r);
1194  }
1195  pIter(p);
1196  }
1197  return l_max;
1198 }
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1108

◆ p_GetMaxExpP()

poly p_GetMaxExpP ( poly  p,
ring  r 
)

return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0, next == NULL, ord is not set

Definition at line 1139 of file p_polys.cc.

1140 {
1141  p_CheckPolyRing(p, r);
1142  if (p == NULL) return p_Init(r);
1143  poly max = p_LmInit(p, r);
1144  pIter(p);
1145  if (p == NULL) return max;
1146  int i, offset;
1147  unsigned long l_p, l_max;
1148  unsigned long divmask = r->divmask;
1149 
1150  do
1151  {
1152  offset = r->VarL_Offset[0];
1153  l_p = p->exp[offset];
1154  l_max = max->exp[offset];
1155  // do the divisibility trick to find out whether l has an exponent
1156  if (l_p > l_max ||
1157  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1158  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1159 
1160  for (i=1; i<r->VarL_Size; i++)
1161  {
1162  offset = r->VarL_Offset[i];
1163  l_p = p->exp[offset];
1164  l_max = max->exp[offset];
1165  // do the divisibility trick to find out whether l has an exponent
1166  if (l_p > l_max ||
1167  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1168  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1169  }
1170  pIter(p);
1171  }
1172  while (p != NULL);
1173  return max;
1174 }
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1108
polyrec * poly
Definition: hilb.h:10
int offset
Definition: libparse.cc:1091
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_GetOrder()

static long p_GetOrder ( poly  p,
ring  r 
)
inlinestatic

Definition at line 416 of file p_polys.h.

417 {
419  if (r->typ==NULL) return ((p)->exp[r->pOrdIndex]);
420  int i=0;
421  loop
422  {
423  switch(r->typ[i].ord_typ)
424  {
425  case ro_am:
426  case ro_wp_neg:
427  return ((p->exp[r->pOrdIndex])-POLY_NEGWEIGHT_OFFSET);
428  case ro_syzcomp:
429  case ro_syz:
430  case ro_cp:
431  i++;
432  break;
433  //case ro_dp:
434  //case ro_wp:
435  default:
436  return ((p)->exp[r->pOrdIndex]);
437  }
438  }
439 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
Definition: ring.h:68
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:244
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
Definition: ring.h:66
Definition: ring.h:64
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
Definition: ring.h:62
p exp[i]
Definition: DebugPrint.cc:39

◆ p_GetSetmProc()

p_SetmProc p_GetSetmProc ( const ring  r)

Definition at line 561 of file p_polys.cc.

562 {
563  // covers lp, rp, ls,
564  if (r->typ == NULL) return p_Setm_Dummy;
565 
566  if (r->OrdSize == 1)
567  {
568  if (r->typ[0].ord_typ == ro_dp &&
569  r->typ[0].data.dp.start == 1 &&
570  r->typ[0].data.dp.end == r->N &&
571  r->typ[0].data.dp.place == r->pOrdIndex)
572  return p_Setm_TotalDegree;
573  if (r->typ[0].ord_typ == ro_wp &&
574  r->typ[0].data.wp.start == 1 &&
575  r->typ[0].data.wp.end == r->N &&
576  r->typ[0].data.wp.place == r->pOrdIndex &&
577  r->typ[0].data.wp.weights == r->firstwv)
579  }
580  return p_Setm_General;
581 }
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:163
Definition: ring.h:61
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:555
void p_Setm_TotalDegree(poly p, const ring r)
Definition: p_polys.cc:548
const ring r
Definition: syzextra.cc:208
void p_Setm_Dummy(poly p, const ring r)
Definition: p_polys.cc:542
#define NULL
Definition: omList.c:10
Definition: ring.h:60

◆ p_GetShortExpVector() [1/2]

unsigned long p_GetShortExpVector ( const poly  a,
const ring  r 
)

Definition at line 4635 of file p_polys.cc.

4636 {
4637  assume(p != NULL);
4638  unsigned long ev = 0; // short exponent vector
4639  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4640  unsigned int m1; // highest bit which is filled with (n+1)
4641  int i=0,j=1;
4642 
4643  if (n == 0)
4644  {
4645  if (r->N <2*BIT_SIZEOF_LONG)
4646  {
4647  n=1;
4648  m1=0;
4649  }
4650  else
4651  {
4652  for (; j<=r->N; j++)
4653  {
4654  if (p_GetExp(p,j,r) > 0) i++;
4655  if (i == BIT_SIZEOF_LONG) break;
4656  }
4657  if (i>0)
4658  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4659  return ev;
4660  }
4661  }
4662  else
4663  {
4664  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4665  }
4666 
4667  n++;
4668  while (i<m1)
4669  {
4670  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4671  i += n;
4672  j++;
4673  }
4674 
4675  n--;
4676  while (i<BIT_SIZEOF_LONG)
4677  {
4678  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4679  i += n;
4680  j++;
4681  }
4682  return ev;
4683 }
return P p
Definition: myNF.cc:203
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4602
#define NULL
Definition: omList.c:10
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78

◆ p_GetShortExpVector() [2/2]

unsigned long p_GetShortExpVector ( const poly  p,
const poly  pp,
const ring  r 
)

p_GetShortExpVector of p * pp

Definition at line 4687 of file p_polys.cc.

4688 {
4689  assume(p != NULL);
4690  assume(pp != NULL);
4691 
4692  unsigned long ev = 0; // short exponent vector
4693  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4694  unsigned int m1; // highest bit which is filled with (n+1)
4695  int j=1;
4696  unsigned long i = 0L;
4697 
4698  if (n == 0)
4699  {
4700  if (r->N <2*BIT_SIZEOF_LONG)
4701  {
4702  n=1;
4703  m1=0;
4704  }
4705  else
4706  {
4707  for (; j<=r->N; j++)
4708  {
4709  if (p_GetExp(p,j,r) > 0 || p_GetExp(pp,j,r) > 0) i++;
4710  if (i == BIT_SIZEOF_LONG) break;
4711  }
4712  if (i>0)
4713  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4714  return ev;
4715  }
4716  }
4717  else
4718  {
4719  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4720  }
4721 
4722  n++;
4723  while (i<m1)
4724  {
4725  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4726  i += n;
4727  j++;
4728  }
4729 
4730  n--;
4731  while (i<BIT_SIZEOF_LONG)
4732  {
4733  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4734  i += n;
4735  j++;
4736  }
4737  return ev;
4738 }
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4602
#define NULL
Definition: omList.c:10
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78

◆ p_GetTotalDegree()

static unsigned long p_GetTotalDegree ( const unsigned long  l,
const ring  r,
const int  number_of_exps 
)
inlinestatic

Definition at line 771 of file p_polys.h.

772 {
773  const unsigned long bitmask = r->bitmask;
774  unsigned long sum = (l & bitmask);
775  unsigned long j = number_of_exps - 1;
776 
777  if (j > 0)
778  {
779  unsigned long i = r->BitsPerExp;
780  loop
781  {
782  sum += ((l >> i) & bitmask);
783  j--;
784  if (j==0) break;
785  i += r->BitsPerExp;
786  }
787  }
788  return sum;
789 }
loop
Definition: myNF.cc:98
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int l
Definition: cfEzgcd.cc:94

◆ p_GetVariables()

int p_GetVariables ( poly  p,
int *  e,
const ring  r 
)

set entry e[i] to 1 if var(i) occurs in p, ignore var(j) if e[j]>0 return #(e[i]>0)

Definition at line 1268 of file p_polys.cc.

1269 {
1270  int i;
1271  int n=0;
1272  while(p!=NULL)
1273  {
1274  n=0;
1275  for(i=r->N; i>0; i--)
1276  {
1277  if(e[i]==0)
1278  {
1279  if (p_GetExp(p,i,r)>0)
1280  {
1281  e[i]=1;
1282  n++;
1283  }
1284  }
1285  else
1286  n++;
1287  }
1288  if (n==r->N) break;
1289  pIter(p);
1290  }
1291  return n;
1292 }
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
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:464
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ p_HasNotCF()

BOOLEAN p_HasNotCF ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1330 of file p_polys.cc.

1331 {
1332 
1333  if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
1334  return FALSE;
1335  int i = rVar(r);
1336  loop
1337  {
1338  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1339  return FALSE;
1340  i--;
1341  if (i == 0)
1342  return TRUE;
1343  }
1344 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
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:464
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_Head()

static poly p_Head ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 812 of file p_polys.h.

813 {
814  if (p == NULL) return NULL;
816  poly np;
817  omTypeAllocBin(poly, np, r->PolyBin);
818  p_SetRingOfLm(np, r);
819  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
820  pNext(np) = NULL;
821  pSetCoeff0(np, n_Copy(pGetCoeff(p), r->cf));
822  return np;
823 }
return P p
Definition: myNF.cc:203
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
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
#define p_SetRingOfLm(p, r)
Definition: monomials.h:152
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10

◆ p_Homogen()

poly p_Homogen ( poly  p,
int  varnum,
const ring  r 
)

Definition at line 3200 of file p_polys.cc.

3201 {
3202  pFDegProc deg;
3203  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3204  deg=p_Totaldegree;
3205  else
3206  deg=r->pFDeg;
3207 
3208  poly q=NULL, qn;
3209  int o,ii;
3210  sBucket_pt bp;
3211 
3212  if (p!=NULL)
3213  {
3214  if ((varnum < 1) || (varnum > rVar(r)))
3215  {
3216  return NULL;
3217  }
3218  o=deg(p,r);
3219  q=pNext(p);
3220  while (q != NULL)
3221  {
3222  ii=deg(q,r);
3223  if (ii>o) o=ii;
3224  pIter(q);
3225  }
3226  q = p_Copy(p,r);
3227  bp = sBucketCreate(r);
3228  while (q != NULL)
3229  {
3230  ii = o-deg(q,r);
3231  if (ii!=0)
3232  {
3233  p_AddExp(q,varnum, (long)ii,r);
3234  p_Setm(q,r);
3235  }
3236  qn = pNext(q);
3237  pNext(q) = NULL;
3238  sBucket_Add_p(bp, q, 1);
3239  q = qn;
3240  }
3241  sBucketDestroyAdd(bp, &q, &ii);
3242  }
3243  return q;
3244 }
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:72
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void sBucket_Add_p(sBucket_pt bucket, poly p, int length)
adds poly p to bucket destroys p!
Definition: sbuckets.cc:201
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:120
#define NULL
Definition: omList.c:10
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:46
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:601
polyrec * poly
Definition: hilb.h:10

◆ p_IncrExp()

static long p_IncrExp ( poly  p,
int  v,
ring  r 
)
inlinestatic

Definition at line 586 of file p_polys.h.

587 {
589  int e = p_GetExp(p,v,r);
590  e++;
591  return p_SetExp(p,v,e,r);
592 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
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:464
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
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:483

◆ p_Init() [1/2]

static poly p_Init ( const ring  r,
omBin  bin 
)
inlinestatic

Definition at line 1243 of file p_polys.h.

1244 {
1245  p_CheckRing1(r);
1246  pAssume1(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
1247  poly p;
1248  omTypeAlloc0Bin(poly, p, bin);
1250  p_SetRingOfLm(p, r);
1251  return p;
1252 }
return P p
Definition: myNF.cc:203
#define p_CheckRing1(r)
Definition: monomials.h:186
const ring r
Definition: syzextra.cc:208
#define p_SetRingOfLm(p, r)
Definition: monomials.h:152
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1215
#define omTypeAlloc0Bin(type, addr, bin)
Definition: omAllocDecl.h:204
#define NULL
Definition: omList.c:10
#define omSizeWOfBin(bin_ptr)
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_Init() [2/2]

static poly p_Init ( const ring  r)
inlinestatic

Definition at line 1253 of file p_polys.h.

1254 {
1255  return p_Init(r, r->PolyBin);
1256 }
const ring r
Definition: syzextra.cc:208
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_Invers()

poly p_Invers ( int  n,
poly  u,
intvec w,
const ring  R 
)

Definition at line 4324 of file p_polys.cc.

4325 {
4326  if(n<0)
4327  return NULL;
4328  number u0=n_Invers(pGetCoeff(u),R->cf);
4329  poly v=p_NSet(u0,R);
4330  if(n==0)
4331  return v;
4332  short *ww=iv2array(w,R);
4333  poly u1=p_JetW(p_Sub(p_One(R),p_Mult_nn(u,u0,R),R),n,ww,R);
4334  if(u1==NULL)
4335  {
4336  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4337  return v;
4338  }
4339  poly v1=p_Mult_nn(p_Copy(u1,R),u0,R);
4340  v=p_Add_q(v,p_Copy(v1,R),R);
4341  for(int i=n/p_MinDeg(u1,w,R);i>1;i--)
4342  {
4343  v1=p_JetW(p_Mult_q(v1,p_Copy(u1,R),R),n,ww,R);
4344  v=p_Add_q(v,p_Copy(v1,R),R);
4345  }
4346  p_Delete(&u1,R);
4347  p_Delete(&v1,R);
4348  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4349  return v;
4350 }
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:208
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1444
int p_MinDeg(poly p, intvec *w, const ring R)
Definition: p_polys.cc:4303
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void * ADDRESS
Definition: auxiliary.h:115
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
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1951
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly p_One(const ring r)
Definition: p_polys.cc:1314
const ring R
Definition: DebugPrint.cc:36
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:568
int i
Definition: cfEzgcd.cc:123
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:895
poly p_JetW(poly p, int m, short *w, const ring R)
Definition: p_polys.cc:4285
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

◆ p_IsConstant()

static BOOLEAN p_IsConstant ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 1876 of file p_polys.h.

1877 {
1878  if (p == NULL) return TRUE;
1879  p_Test(p, r);
1880  return (pNext(p)==NULL) && p_LmIsConstant(p, r);
1881 }
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:949
const ring r
Definition: syzextra.cc:208
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43

◆ p_IsConstantComp()

static BOOLEAN p_IsConstantComp ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 1870 of file p_polys.h.

1871 {
1872  if (p == NULL) return TRUE;
1873  return (pNext(p)==NULL) && p_LmIsConstantComp(p, r);
1874 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:932
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43

◆ p_IsConstantPoly()

static BOOLEAN p_IsConstantPoly ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 1890 of file p_polys.h.

1891 {
1892  p_Test(p, r);
1893  poly pp=p;
1894  while(pp!=NULL)
1895  {
1896  if (! p_LmIsConstantComp(pp, r))
1897  return FALSE;
1898  pIter(pp);
1899  }
1900  return TRUE;
1901 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:932
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ p_ISet()

poly p_ISet ( long  i,
const ring  r 
)

returns the poly representing the integer i

Definition at line 1298 of file p_polys.cc.

1299 {
1300  poly rc = NULL;
1301  if (i!=0)
1302  {
1303  rc = p_Init(r);
1304  pSetCoeff0(rc,n_Init(i,r->cf));
1305  if (n_IsZero(pGetCoeff(rc),r->cf))
1306  p_LmDelete(&rc,r);
1307  }
1308  return rc;
1309 }
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
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
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:468
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_IsHomogeneous()

BOOLEAN p_IsHomogeneous ( poly  p,
const ring  r 
)

Definition at line 3249 of file p_polys.cc.

3250 {
3251  poly qp=p;
3252  int o;
3253 
3254  if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
3255  pFDegProc d;
3256  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3257  d=p_Totaldegree;
3258  else
3259  d=r->pFDeg;
3260  o = d(p,r);
3261  do
3262  {
3263  if (d(qp,r) != o) return FALSE;
3264  pIter(qp);
3265  }
3266  while (qp != NULL);
3267  return TRUE;
3268 }
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:46
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ p_IsOne()

static BOOLEAN p_IsOne ( const poly  p,
const ring  R 
)
inlinestatic

either poly(1) or gen(k)?!

Definition at line 1884 of file p_polys.h.

1885 {
1886  p_Test(p, R);
1887  return (p_IsConstant(p, R) && n_IsOne(p_GetCoeff(p, R), R->cf));
1888 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
const ring R
Definition: DebugPrint.cc:36
#define p_Test(p, r)
Definition: p_polys.h:160
#define p_GetCoeff(p, r)
Definition: monomials.h:57

◆ p_IsPurePower()

int p_IsPurePower ( const poly  p,
const ring  r 
)

return i, if head depends only on var(i)

Definition at line 1227 of file p_polys.cc.

1228 {
1229  int i,k=0;
1230 
1231  for (i=r->N;i;i--)
1232  {
1233  if (p_GetExp(p,i, r)!=0)
1234  {
1235  if(k!=0) return 0;
1236  k=i;
1237  }
1238  }
1239  return k;
1240 }
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
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:464
int i
Definition: cfEzgcd.cc:123

◆ p_IsUnit()

static BOOLEAN p_IsUnit ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 1903 of file p_polys.h.

1904 {
1905  if (p == NULL) return FALSE;
1906  if (rField_is_Ring(r))
1907  return (p_LmIsConstant(p, r) && n_IsUnit(pGetCoeff(p),r->cf));
1908  return p_LmIsConstant(p, r);
1909 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
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
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:949
const ring r
Definition: syzextra.cc:208
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10

◆ p_IsUnivariate()

int p_IsUnivariate ( poly  p,
const ring  r 
)

return i, if poly depends only on var(i)

Definition at line 1248 of file p_polys.cc.

1249 {
1250  int i,k=-1;
1251 
1252  while (p!=NULL)
1253  {
1254  for (i=r->N;i;i--)
1255  {
1256  if (p_GetExp(p,i, r)!=0)
1257  {
1258  if((k!=-1)&&(k!=i)) return 0;
1259  k=i;
1260  }
1261  }
1262  pIter(p);
1263  }
1264  return k;
1265 }
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
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:464
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ p_Jet()

poly p_Jet ( poly  p,
int  m,
const ring  R 
)

Definition at line 4241 of file p_polys.cc.

4242 {
4243  while((p!=NULL) && (p_Totaldegree(p,R)>m)) p_LmDelete(&p,R);
4244  if (p==NULL) return NULL;
4245  poly r=p;
4246  while (pNext(p)!=NULL)
4247  {
4248  if (p_Totaldegree(pNext(p),R)>m)
4249  {
4250  p_LmDelete(&pNext(p),R);
4251  }
4252  else
4253  pIter(p);
4254  }
4255  return r;
4256 }
return P p
Definition: myNF.cc:203
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10

◆ p_JetW()

poly p_JetW ( poly  p,
int  m,
short *  w,
const ring  R 
)

Definition at line 4285 of file p_polys.cc.

4286 {
4287  while((p!=NULL) && (totaldegreeWecart_IV(p,R,w)>m)) p_LmDelete(&p,R);
4288  if (p==NULL) return NULL;
4289  poly r=p;
4290  while (pNext(p)!=NULL)
4291  {
4292  if (totaldegreeWecart_IV(pNext(p),R,w)>m)
4293  {
4294  p_LmDelete(&pNext(p),R);
4295  }
4296  else
4297  pIter(p);
4298  }
4299  return r;
4300 }
return P p
Definition: myNF.cc:203
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:239
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10

◆ p_Last()

poly p_Last ( const poly  a,
int &  l,
const ring  r 
)

Definition at line 4476 of file p_polys.cc.

4477 {
4478  if (p == NULL)
4479  {
4480  l = 0;
4481  return NULL;
4482  }
4483  l = 1;
4484  poly a = p;
4485  if (! rIsSyzIndexRing(r))
4486  {
4487  poly next = pNext(a);
4488  while (next!=NULL)
4489  {
4490  a = next;
4491  next = pNext(a);
4492  l++;
4493  }
4494  }
4495  else
4496  {
4497  int curr_limit = rGetCurrSyzLimit(r);
4498  poly pp = a;
4499  while ((a=pNext(a))!=NULL)
4500  {
4501  if (p_GetComp(a,r)<=curr_limit/*syzComp*/)
4502  l++;
4503  else break;
4504  pp = a;
4505  }
4506  a=pp;
4507  }
4508  return a;
4509 }
const poly a
Definition: syzextra.cc:212
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
#define p_GetComp(p, r)
Definition: monomials.h:72
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
poly pp
Definition: myNF.cc:296
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
int l
Definition: cfEzgcd.cc:94
ListNode * next
Definition: janet.h:31

◆ p_Lcm() [1/2]

void p_Lcm ( const poly  a,
const poly  b,
poly  m,
const ring  r 
)

Definition at line 1616 of file p_polys.cc.

1617 {
1618  for (int i=r->N; i; --i)
1619  p_SetExp(m,i, si_max( p_GetExp(a,i,r), p_GetExp(b,i,r)),r);
1620 
1622  /* Don't do a pSetm here, otherwise hres/lres chockes */
1623 }
const poly a
Definition: syzextra.cc:212
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
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:464
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
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:483
const poly b
Definition: syzextra.cc:213

◆ p_Lcm() [2/2]

poly p_Lcm ( const poly  a,
const poly  b,
const ring  r 
)

Definition at line 1625 of file p_polys.cc.

1626 {
1627  poly m=p_Init(r);
1628  p_Lcm(a, b, m, r);
1629  p_Setm(m,r);
1630  return(m);
1631 }
const poly a
Definition: syzextra.cc:212
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1616
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243
const poly b
Definition: syzextra.cc:213

◆ p_LcmRat()

poly p_LcmRat ( const poly  a,
const poly  b,
const long  lCompM,
const ring  r 
)

Definition at line 1638 of file p_polys.cc.

1639 {
1640  poly m = // p_One( r);
1641  p_Init(r);
1642 
1643 // const int (currRing->N) = r->N;
1644 
1645  // for (int i = (currRing->N); i>=r->real_var_start; i--)
1646  for (int i = r->real_var_end; i>=r->real_var_start; i--)
1647  {
1648  const int lExpA = p_GetExp (a, i, r);
1649  const int lExpB = p_GetExp (b, i, r);
1650 
1651  p_SetExp (m, i, si_max(lExpA, lExpB), r);
1652  }
1653 
1654  p_SetComp (m, lCompM, r);
1655  p_Setm(m,r);
1656  n_New(&(p_GetCoeff(m, r)), r);
1657 
1658  return(m);
1659 };
#define n_New(n, r)
Definition: coeffs.h:444
const poly a
Definition: syzextra.cc:212
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
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:464
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
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:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243
const poly b
Definition: syzextra.cc:213

◆ p_LDeg()

static long p_LDeg ( const poly  p,
int *  l,
const ring  r 
)
inlinestatic

Definition at line 376 of file p_polys.h.

376 { return r->pLDeg(p,l,r); }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int l
Definition: cfEzgcd.cc:94

◆ 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  {
93  return TRUE;
94  }
95  return FALSE;
96  #endif
97  }
98  return TRUE;
99 }
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
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:1677
#define NULL
Definition: omList.c:10
#define omIsBinPageAddr(addr)
Definition: omBinPage.h:68
#define omSizeWOfBin(bin_ptr)
#define pPolyAssumeReturnMsg(cond, msg)
Definition: monomials.h:145

◆ p_LmCheckPolyRing()

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

◆ p_LmCmp()

static int p_LmCmp ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1467 of file p_polys.h.

1468 {
1470  p_LmCheckPolyRing1(q, r);
1471 
1472  const unsigned long* _s1 = ((unsigned long*) p->exp);
1473  const unsigned long* _s2 = ((unsigned long*) q->exp);
1474  register unsigned long _v1;
1475  register unsigned long _v2;
1476  const unsigned long _l = r->CmpL_Size;
1477 
1478  register unsigned long _i=0;
1479 
1480  LengthGeneral_OrdGeneral_LoopTop:
1481  _v1 = _s1[_i];
1482  _v2 = _s2[_i];
1483  if (_v1 == _v2)
1484  {
1485  _i++;
1486  if (_i == _l) return 0;
1487  goto LengthGeneral_OrdGeneral_LoopTop;
1488  }
1489  const long* _ordsgn = (long*) r->ordsgn;
1490  if (_v1 > _v2)
1491  {
1492  if (_ordsgn[_i] == 1) return 1;
1493  return -1;
1494  }
1495  if (_ordsgn[_i] == 1) return -1;
1496  return 1;
1497 
1498 }
if(0 > strat->sl)
Definition: myNF.cc:73
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185

◆ p_LmDelete() [1/2]

static void p_LmDelete ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 706 of file p_polys.h.

707 {
709  n_Delete(&pGetCoeff(p), r->cf);
710  omFreeBinAddr(p);
711 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
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
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459

◆ p_LmDelete() [2/2]

static void p_LmDelete ( poly p,
const ring  r 
)
inlinestatic

Definition at line 712 of file p_polys.h.

713 {
715  poly h = *p;
716  *p = pNext(h);
717  n_Delete(&pGetCoeff(h), r->cf);
718  omFreeBinAddr(h);
719 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
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
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ p_LmDeleteAndNext()

static poly p_LmDeleteAndNext ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 720 of file p_polys.h.

721 {
723  poly pnext = pNext(p);
724  n_Delete(&pGetCoeff(p), r->cf);
725  omFreeBinAddr(p);
726  return pnext;
727 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
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
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10

◆ p_LmDeleteAndNextRat()

void p_LmDeleteAndNextRat ( poly p,
int  ishift,
ring  r 
)

Definition at line 1661 of file p_polys.cc.

1662 {
1663  /* modifies p*/
1664  // Print("start: "); Print(" "); p_wrp(*p,r);
1665  p_LmCheckPolyRing2(*p, r);
1666  poly q = p_Head(*p,r);
1667  const long cmp = p_GetComp(*p, r);
1668  while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) ) && (p_GetComp(*p, r) == cmp) )
1669  {
1670  p_LmDelete(p,r);
1671  // Print("while: ");p_wrp(*p,r);Print(" ");
1672  }
1673  // p_wrp(*p,r);Print(" ");
1674  // PrintS("end\n");
1675  p_LmDelete(&q,r);
1676 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:635
#define NULL
Definition: omList.c:10
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10

◆ p_LmDivisibleBy() [1/2]

static BOOLEAN p_LmDivisibleBy ( poly  a,
poly  b,
const ring  r 
)
inlinestatic

Definition at line 1768 of file p_polys.h.

1769 {
1772  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1773  return _p_LmDivisibleByNoComp(a, b, r);
1774  return FALSE;
1775 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define pIfThen1(cond, check)
Definition: monomials.h:187
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213

◆ p_LmDivisibleBy() [2/2]

static BOOLEAN p_LmDivisibleBy ( poly  a,
const ring  r_a,
poly  b,
const ring  r_b 
)
inlinestatic

Definition at line 1795 of file p_polys.h.

1796 {
1797  p_LmCheckPolyRing(a, r_a);
1798  p_LmCheckPolyRing(b, r_b);
1799  return _p_LmDivisibleBy(a, r_a, b, r_b);
1800 }
const poly a
Definition: syzextra.cc:212
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1742
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
const poly b
Definition: syzextra.cc:213

◆ p_LmDivisibleByNoComp() [1/2]

static BOOLEAN p_LmDivisibleByNoComp ( poly  a,
poly  b,
const ring  r 
)
inlinestatic

Definition at line 1754 of file p_polys.h.

1755 {
1758  return _p_LmDivisibleByNoComp(a, b, r);
1759 }
const poly a
Definition: syzextra.cc:212
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
const poly b
Definition: syzextra.cc:213

◆ p_LmDivisibleByNoComp() [2/2]

static BOOLEAN p_LmDivisibleByNoComp ( poly  a,
const ring  ra,
poly  b,
const ring  rb 
)
inlinestatic

Definition at line 1761 of file p_polys.h.

1762 {
1763  p_LmCheckPolyRing1(a, ra);
1764  p_LmCheckPolyRing1(b, rb);
1765  return _p_LmDivisibleByNoComp(a, ra, b, rb);
1766 }
const poly a
Definition: syzextra.cc:212
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
const poly b
Definition: syzextra.cc:213

◆ p_LmDivisibleByPart()

static BOOLEAN p_LmDivisibleByPart ( poly  a,
poly  b,
const ring  r,
const int  start,
const int  end 
)
inlinestatic

Definition at line 1733 of file p_polys.h.

1734 {
1737  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1738  return _p_LmDivisibleByNoCompPart(a, r, b, r,start, end);
1739  return FALSE;
1740 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define pIfThen1(cond, check)
Definition: monomials.h:187
#define NULL
Definition: omList.c:10
static BOOLEAN _p_LmDivisibleByNoCompPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition: p_polys.h:1708
const poly b
Definition: syzextra.cc:213

◆ p_LmExpVectorAddIsOk()

static BOOLEAN p_LmExpVectorAddIsOk ( const poly  p1,
const poly  p2,
const ring  r 
)
inlinestatic

Definition at line 1911 of file p_polys.h.

1913 {
1914  p_LmCheckPolyRing(p1, r);
1916  unsigned long l1, l2, divmask = r->divmask;
1917  int i;
1918 
1919  for (i=0; i<r->VarL_Size; i++)
1920  {
1921  l1 = p1->exp[r->VarL_Offset[i]];
1922  l2 = p2->exp[r->VarL_Offset[i]];
1923  // do the divisiblity trick
1924  if ( (l1 > ULONG_MAX - l2) ||
1925  (((l1 & divmask) ^ (l2 & divmask)) != ((l1 + l2) & divmask)))
1926  return FALSE;
1927  }
1928  return TRUE;
1929 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ p_LmFree() [1/2]

static void p_LmFree ( poly  p,
ring   
)
inlinestatic

Definition at line 678 of file p_polys.h.

680 {
682  omFreeBinAddr(p);
683 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258

◆ p_LmFree() [2/2]

static void p_LmFree ( poly p,
ring   
)
inlinestatic

Definition at line 687 of file p_polys.h.

689 {
691  poly h = *p;
692  *p = pNext(h);
693  omFreeBinAddr(h);
694 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ p_LmFreeAndNext()

static poly p_LmFreeAndNext ( poly  p,
ring   
)
inlinestatic

Definition at line 698 of file p_polys.h.

700 {
702  poly pnext = pNext(p);
703  omFreeBinAddr(p);
704  return pnext;
705 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ p_LmInit() [1/3]

static poly p_LmInit ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 1258 of file p_polys.h.

1259 {
1261  poly np;
1262  omTypeAllocBin(poly, np, r->PolyBin);
1263  p_SetRingOfLm(np, r);
1264  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
1265  pNext(np) = NULL;
1266  pSetCoeff0(np, NULL);
1267  return np;
1268 }
return P p
Definition: myNF.cc:203
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
const ring r
Definition: syzextra.cc:208
#define p_SetRingOfLm(p, r)
Definition: monomials.h:152
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10

◆ p_LmInit() [2/3]

static poly p_LmInit ( poly  s_p,
const ring  s_r,
const ring  d_r,
omBin  d_bin 
)
inlinestatic

Definition at line 1269 of file p_polys.h.

1270 {
1271  p_LmCheckPolyRing1(s_p, s_r);
1272  p_CheckRing(d_r);
1273  pAssume1(d_r->N <= s_r->N);
1274  poly d_p = p_Init(d_r, d_bin);
1275  for (unsigned i=d_r->N; i!=0; i--)
1276  {
1277  p_SetExp(d_p, i, p_GetExp(s_p, i,s_r), d_r);
1278  }
1279  if (rRing_has_Comp(d_r))
1280  {
1281  p_SetComp(d_p, p_GetComp(s_p,s_r), d_r);
1282  }
1283  p_Setm(d_p, d_r);
1284  return d_p;
1285 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#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:464
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#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:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:127
#define pAssume1(cond)
Definition: monomials.h:179
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_LmInit() [3/3]

static poly p_LmInit ( poly  s_p,
const ring  s_r,
const ring  d_r 
)
inlinestatic

Definition at line 1286 of file p_polys.h.

1287 {
1288  pAssume1(d_r != NULL);
1289  return p_LmInit(s_p, s_r, d_r, d_r->PolyBin);
1290 }
#define NULL
Definition: omList.c:10
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_LmIsConstant()

static BOOLEAN p_LmIsConstant ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 949 of file p_polys.h.

950 {
951  if (p_LmIsConstantComp(p, r))
952  return (p_GetComp(p, r) == 0);
953  return FALSE;
954 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:932
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208

◆ p_LmIsConstantComp()

static BOOLEAN p_LmIsConstantComp ( const poly  p,
const ring  r 
)
inlinestatic

Definition at line 932 of file p_polys.h.

933 {
934  //p_LmCheckPolyRing(p, r);
935  int i = r->VarL_Size - 1;
936 
937  do
938  {
939  if (p->exp[r->VarL_Offset[i]] != 0)
940  return FALSE;
941  i--;
942  }
943  while (i >= 0);
944  return TRUE;
945 }
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123

◆ p_LmShallowCopyDelete()

static poly p_LmShallowCopyDelete ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 1316 of file p_polys.h.

1317 {
1319  pAssume1(omSizeWOfBin(bin) == omSizeWOfBin(r->PolyBin));
1320  poly new_p = p_New(r);
1321  memcpy(new_p->exp, p->exp, r->ExpL_Size*sizeof(long));
1322  pSetCoeff0(new_p, pGetCoeff(p));
1323  pNext(new_p) = pNext(p);
1324  omFreeBinAddr(p);
1325  return new_p;
1326 }
return P p
Definition: myNF.cc:203
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
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define omSizeWOfBin(bin_ptr)
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:659
#define pAssume1(cond)
Definition: monomials.h:179

◆ p_LmShortDivisibleBy() [1/2]

static BOOLEAN p_LmShortDivisibleBy ( poly  a,
unsigned long  sev_a,
poly  b,
unsigned long  not_sev_b,
const ring  r 
)
inlinestatic

Definition at line 1802 of file p_polys.h.

1804 {
1807 #ifndef PDIV_DEBUG
1808  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
1809  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
1810 
1811  if (sev_a & not_sev_b)
1812  {
1814  return FALSE;
1815  }
1816  return p_LmDivisibleBy(a, b, r);
1817 #else
1818  return pDebugLmShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);
1819 #endif
1820 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4635
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1754
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:203
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
#define pAssume1(cond)
Definition: monomials.h:179
const poly b
Definition: syzextra.cc:213
BOOLEAN pDebugLmShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:365

◆ p_LmShortDivisibleBy() [2/2]

static BOOLEAN p_LmShortDivisibleBy ( poly  a,
unsigned long  sev_a,
const ring  r_a,
poly  b,
unsigned long  not_sev_b,
const ring  r_b 
)
inlinestatic

Definition at line 1842 of file p_polys.h.

1844 {
1845  p_LmCheckPolyRing1(a, r_a);
1846  p_LmCheckPolyRing1(b, r_b);
1847 #ifndef PDIV_DEBUG
1848  _pPolyAssume2(p_GetShortExpVector(a, r_a) == sev_a, a, r_a);
1849  _pPolyAssume2(p_GetShortExpVector(b, r_b) == ~ not_sev_b, b, r_b);
1850 
1851  if (sev_a & not_sev_b)
1852  {
1853  pAssume1(_p_LmDivisibleByNoComp(a, r_a, b, r_b) == FALSE);
1854  return FALSE;
1855  }
1856  return _p_LmDivisibleBy(a, r_a, b, r_b);
1857 #else
1858  return pDebugLmShortDivisibleBy(a, sev_a, r_a, b, not_sev_b, r_b);
1859 #endif
1860 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4635
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:203
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1742
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition: p_polys.h:1638
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define pAssume1(cond)
Definition: monomials.h:179
const poly b
Definition: syzextra.cc:213
BOOLEAN pDebugLmShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:365

◆ p_LmShortDivisibleByNoComp()

static BOOLEAN p_LmShortDivisibleByNoComp ( poly  a,
unsigned long  sev_a,
poly  b,
unsigned long  not_sev_b,
const ring  r 
)
inlinestatic

Definition at line 1822 of file p_polys.h.

1824 {
1827 #ifndef PDIV_DEBUG
1828  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
1829  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
1830 
1831  if (sev_a & not_sev_b)
1832  {
1834  return FALSE;
1835  }
1836  return p_LmDivisibleByNoComp(a, b, r);
1837 #else
1838  return pDebugLmShortDivisibleByNoComp(a, sev_a, r, b, not_sev_b, r);
1839 #endif
1840 }
const poly a
Definition: syzextra.cc:212
BOOLEAN pDebugLmShortDivisibleByNoComp(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:388
#define FALSE
Definition: auxiliary.h:94
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4635
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1754
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:203
const ring r
Definition: syzextra.cc:208
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
#define pAssume1(cond)
Definition: monomials.h:179
const poly b
Definition: syzextra.cc:213

◆ p_LowVar()

int p_LowVar ( poly  p,
const ring  r 
)

the minimal index of used variables - 1

Definition at line 4535 of file p_polys.cc.

4536 {
4537  int k,l,lex;
4538 
4539  if (p == NULL) return -1;
4540 
4541  k = 32000;/*a very large dummy value*/
4542  while (p != NULL)
4543  {
4544  l = 1;
4545  lex = p_GetExp(p,l,r);
4546  while ((l < (rVar(r))) && (lex == 0))
4547  {
4548  l++;
4549  lex = p_GetExp(p,l,r);
4550  }
4551  l--;
4552  if (l < k) k = l;
4553  pIter(p);
4554  }
4555  return k;
4556 }
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
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:464
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94

◆ p_LtCmp()

static int p_LtCmp ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1501 of file p_polys.h.

1502 {
1503  int res = p_LmCmp(p,q,r);
1504  if(res == 0)
1505  {
1506  if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
1507  return res;
1508  number pc = n_Copy(p_GetCoeff(p,r),r->cf);
1509  number qc = n_Copy(p_GetCoeff(q,r),r->cf);
1510  if(!n_GreaterZero(pc,r->cf))
1511  pc = n_InpNeg(pc,r->cf);
1512  if(!n_GreaterZero(qc,r->cf))
1513  qc = n_InpNeg(qc,r->cf);
1514  if(n_Greater(pc,qc,r->cf))
1515  res = 1;
1516  else if(n_Greater(qc,pc,r->cf))
1517  res = -1;
1518  else if(n_Equal(pc,qc,r->cf))
1519  res = 0;
1520  n_Delete(&pc,r->cf);
1521  n_Delete(&qc,r->cf);
1522  }
1523  return res;
1524 }
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff &#39;a&#39; is larger than &#39;b&#39;; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:515
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:464
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498

◆ p_LtCmpNoAbs()

static int p_LtCmpNoAbs ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1527 of file p_polys.h.

1528 {
1529  int res = p_LmCmp(p,q,r);
1530  if(res == 0)
1531  {
1532  if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
1533  return res;
1534  number pc = p_GetCoeff(p,r);
1535  number qc = p_GetCoeff(q,r);
1536  if(n_Greater(pc,qc,r->cf))
1537  res = 1;
1538  if(n_Greater(qc,pc,r->cf))
1539  res = -1;
1540  if(n_Equal(pc,qc,r->cf))
1541  res = 0;
1542  }
1543  return res;
1544 }
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff &#39;a&#39; is larger than &#39;b&#39;; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:515
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
#define NULL
Definition: omList.c:10
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:464
#define p_GetCoeff(p, r)
Definition: monomials.h:57

◆ p_LtCmpOrdSgnDiffM()

static int p_LtCmpOrdSgnDiffM ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1549 of file p_polys.h.

1550 {
1551  if(r->OrdSgn == 1)
1552  {
1553  return(p_LtCmp(p,q,r) == 1);
1554  }
1555  else
1556  {
1557  return(p_LmCmp(p,q,r) == -1);
1558  }
1559 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1501

◆ p_LtCmpOrdSgnDiffP()

static int p_LtCmpOrdSgnDiffP ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1565 of file p_polys.h.

1566 {
1567  if(r->OrdSgn == 1)
1568  {
1569  return(p_LmCmp(p,q,r) == -1);
1570  }
1571  else
1572  {
1573  return(p_LtCmp(p,q,r) != -1);
1574  }
1575 
1576 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1501

◆ p_LtCmpOrdSgnEqM()

static int p_LtCmpOrdSgnEqM ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1582 of file p_polys.h.

1583 {
1584  return(p_LtCmp(p,q,r) == -r->OrdSgn);
1585 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1501

◆ p_LtCmpOrdSgnEqP()

static int p_LtCmpOrdSgnEqP ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1591 of file p_polys.h.

1592 {
1593  return(p_LtCmp(p,q,r) == r->OrdSgn);
1594 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1501

◆ p_MaxComp() [1/2]

static long p_MaxComp ( poly  p,
ring  lmRing,
ring  tailRing 
)
inlinestatic

Definition at line 287 of file p_polys.h.

288 {
289  long result,i;
290 
291  if(p==NULL) return 0;
292  result = p_GetComp(p, lmRing);
293  if (result != 0)
294  {
295  loop
296  {
297  pIter(p);
298  if(p==NULL) break;
299  i = p_GetComp(p, tailRing);
300  if (i>result) result = i;
301  }
302  }
303  return result;
304 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define pIter(p)
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
return result
Definition: facAbsBiFact.cc:76

◆ p_MaxComp() [2/2]

static long p_MaxComp ( poly  p,
ring  lmRing 
)
inlinestatic

Definition at line 306 of file p_polys.h.

306 {return p_MaxComp(p,lmRing,lmRing);}
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287

◆ p_MemAdd_NegWeightAdjust()

static void p_MemAdd_NegWeightAdjust ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 1215 of file p_polys.h.

1216 {
1217  if (r->NegWeightL_Offset != NULL)
1218  {
1219  for (int i=r->NegWeightL_Size-1; i>=0; i--)
1220  {
1221  p->exp[r->NegWeightL_Offset[i]] -= POLY_NEGWEIGHT_OFFSET;
1222  }
1223  }
1224 }
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:244
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ p_MemSub_NegWeightAdjust()

static void p_MemSub_NegWeightAdjust ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 1225 of file p_polys.h.

1226 {
1227  if (r->NegWeightL_Offset != NULL)
1228  {
1229  for (int i=r->NegWeightL_Size-1; i>=0; i--)
1230  {
1231  p->exp[r->NegWeightL_Offset[i]] += POLY_NEGWEIGHT_OFFSET;
1232  }
1233  }
1234 }
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:244
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ p_Merge_q()

static poly p_Merge_q ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1135 of file p_polys.h.

1136 {
1137  assume( (p != q) || (p == NULL && q == NULL) );
1138  return r->p_Procs->p_Merge_q(p, q, r);
1139 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10

◆ p_MinComp() [1/2]

static long p_MinComp ( poly  p,
ring  lmRing,
ring  tailRing 
)
inlinestatic

Definition at line 308 of file p_polys.h.

309 {
310  long result,i;
311 
312  if(p==NULL) return 0;
314  if (result != 0)
315  {
316  loop
317  {
318  pIter(p);
319  if(p==NULL) break;
320  i = p_GetComp(p,tailRing);
321  if (i<result) result = i;
322  }
323  }
324  return result;
325 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define pIter(p)
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
return result
Definition: facAbsBiFact.cc:76

◆ p_MinComp() [2/2]

static long p_MinComp ( poly  p,
ring  lmRing 
)
inlinestatic

Definition at line 327 of file p_polys.h.

327 {return p_MinComp(p,lmRing,lmRing);}
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:308

◆ p_MinDeg()

int p_MinDeg ( poly  p,
intvec w,
const ring  R 
)

Definition at line 4303 of file p_polys.cc.

4304 {
4305  if(p==NULL)
4306  return -1;
4307  int d=-1;
4308  while(p!=NULL)
4309  {
4310  int d0=0;
4311  for(int j=0;j<rVar(R);j++)
4312  if(w==NULL||j>=w->length())
4313  d0+=p_GetExp(p,j+1,R);
4314  else
4315  d0+=(*w)[j]*p_GetExp(p,j+1,R);
4316  if(d0<d||d==-1)
4317  d=d0;
4318  pIter(p);
4319  }
4320  return d;
4321 }
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define pIter(p)
Definition: monomials.h:44
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:464
int j
Definition: myNF.cc:70
const ring R
Definition: DebugPrint.cc:36
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ p_mInit()

poly p_mInit ( const char *  s,
BOOLEAN ok,
const ring  r 
)

Definition at line 1421 of file p_polys.cc.

1422 {
1423  poly p;
1424  const char *s=p_Read(st,p,r);
1425  if (*s!='\0')
1426  {
1427  if ((s!=st)&&isdigit(st[0]))
1428  {
1430  }
1431  ok=FALSE;
1432  p_Delete(&p,r);
1433  return NULL;
1434  }
1435  p_Test(p,r);
1436  ok=!errorreported;
1437  return p;
1438 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1349
const ring r
Definition: syzextra.cc:208
#define p_Test(p, r)
Definition: p_polys.h:160
short errorreported
Definition: feFopen.cc:23
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ p_Minus_mm_Mult_qq() [1/2]

static poly p_Minus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int &  lp,
int  lq,
const poly  spNoether,
const ring  r 
)
inlinestatic

Definition at line 976 of file p_polys.h.

978 {
979  int shorter;
980  const poly res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, spNoether, r);
981  lp += lq - shorter;
982 // assume( lp == pLength(res) );
983  return res;
984 }
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
polyrec * poly
Definition: hilb.h:10

◆ p_Minus_mm_Mult_qq() [2/2]

static poly p_Minus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
const ring  r 
)
inlinestatic

Definition at line 987 of file p_polys.h.

988 {
989  int shorter;
990 
991  return r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
992 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10

◆ p_Mult_mm()

static poly p_Mult_mm ( poly  p,
poly  m,
const ring  r 
)
inlinestatic

Definition at line 968 of file p_polys.h.

969 {
970  if (p_LmIsConstant(m, r))
971  return p_Mult_nn(p, pGetCoeff(m), r);
972  else
973  return r->p_Procs->p_Mult_mm(p, m, r);
974 }
return P p
Definition: myNF.cc:203
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
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:949
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:895

◆ p_Mult_nn() [1/2]

static poly p_Mult_nn ( poly  p,
number  n,
const ring  r 
)
inlinestatic

Definition at line 895 of file p_polys.h.

896 {
897  if (n_IsOne(n, r->cf))
898  return p;
899  else if (n_IsZero(n, r->cf))
900  {
901  r->p_Procs->p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
902  return NULL;
903  } else
904  return r->p_Procs->p_Mult_nn(p, n, r);
905 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define NULL
Definition: omList.c:10

◆ p_Mult_nn() [2/2]

static poly p_Mult_nn ( poly  p,
number  n,
const ring  lmRing,
const ring  tailRing 
)
inlinestatic

Definition at line 907 of file p_polys.h.

909 {
910 #ifndef PDEBUG
911  if (lmRing == tailRing)
912  return p_Mult_nn(p, n, tailRing);
913 #endif
914  poly pnext = pNext(p);
915  pNext(p) = NULL;
916  p = lmRing->p_Procs->p_Mult_nn(p, n, lmRing);
917  pNext(p) = tailRing->p_Procs->p_Mult_nn(pnext, n, tailRing);
918  return p;
919 }
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
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:895
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ p_Mult_q()

static poly p_Mult_q ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1020 of file p_polys.h.

1021 {
1022  assume( (p != q) || (p == NULL && q == NULL) );
1023 
1024  if (p == NULL)
1025  {
1026  r->p_Procs->p_Delete(&q, r);
1027  return NULL;
1028  }
1029  if (q == NULL)
1030  {
1031  r->p_Procs->p_Delete(&p, r);
1032  return NULL;
1033  }
1034 
1035  if (pNext(p) == NULL)
1036  {
1037 #ifdef HAVE_PLURAL
1038  if (rIsPluralRing(r))
1039  q = nc_mm_Mult_p(p, q, r);
1040  else
1041 #endif /* HAVE_PLURAL */
1042  q = r->p_Procs->p_Mult_mm(q, p, r);
1043 
1044  r->p_Procs->p_Delete(&p, r);
1045  return q;
1046  }
1047 
1048  if (pNext(q) == NULL)
1049  {
1050  // NEEDED
1051 #ifdef HAVE_PLURAL
1052 /* if (rIsPluralRing(r))
1053  p = gnc_p_Mult_mm(p, q, r); // ???
1054  else*/
1055 #endif /* HAVE_PLURAL */
1056  p = r->p_Procs->p_Mult_mm(p, q, r);
1057 
1058  r->p_Procs->p_Delete(&q, r);
1059  return p;
1060  }
1061 #ifdef HAVE_PLURAL
1062  if (rIsPluralRing(r))
1063  return _nc_p_Mult_q(p, q, r);
1064  else
1065 #endif
1066  return _p_Mult_q(p, q, 0, r);
1067 }
poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2.
Definition: p_Mult_q.cc:271
return P p
Definition: myNF.cc:203
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:250
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
poly _nc_p_Mult_q(poly p, poly q, const ring r)
general NC-multiplication with destruction
Definition: old.gring.cc:220
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43

◆ p_MultExp()

static long p_MultExp ( poly  p,
int  v,
long  ee,
ring  r 
)
inlinestatic

Definition at line 616 of file p_polys.h.

617 {
619  long e = p_GetExp(p,v,r);
620  e *= ee;
621  return p_SetExp(p,v,e,r);
622 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
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:464
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
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:483

◆ p_Neg()

static poly p_Neg ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 1013 of file p_polys.h.

1014 {
1015  return r->p_Procs->p_Neg(p, r);
1016 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208

◆ p_New() [1/2]

static poly p_New ( const ring  ,
omBin  bin 
)
inlinestatic

Definition at line 659 of file p_polys.h.

661 {
662  p_CheckRing2(r);
663  pAssume2(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
664  poly p;
665  omTypeAllocBin(poly, p, bin);
666  p_SetRingOfLm(p, r);
667  return p;
668 }
return P p
Definition: myNF.cc:203
#define p_CheckRing2(r)
Definition: monomials.h:208
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
#define p_SetRingOfLm(p, r)
Definition: monomials.h:152
#define NULL
Definition: omList.c:10
#define omSizeWOfBin(bin_ptr)
polyrec * poly
Definition: hilb.h:10

◆ p_New() [2/2]

static poly p_New ( ring  r)
inlinestatic

Definition at line 670 of file p_polys.h.

671 {
672  return p_New(r, r->PolyBin);
673 }
const ring r
Definition: syzextra.cc:208
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:659

◆ p_Norm()

void p_Norm ( poly  p1,
const ring  r 
)

Definition at line 3627 of file p_polys.cc.

3628 {
3629  if (rField_is_Ring(r))
3630  {
3631  if (!n_IsUnit(pGetCoeff(p1), r->cf)) return;
3632  // Werror("p_Norm not possible in the case of coefficient rings.");
3633  }
3634  else if (p1!=NULL)
3635  {
3636  if (pNext(p1)==NULL)
3637  {
3638  p_SetCoeff(p1,n_Init(1,r->cf),r);
3639  return;
3640  }
3641  poly h;
3642  if (!n_IsOne(pGetCoeff(p1),r->cf))
3643  {
3644  number k, c;
3645  n_Normalize(pGetCoeff(p1),r->cf);
3646  k = pGetCoeff(p1);
3647  c = n_Init(1,r->cf);
3648  pSetCoeff0(p1,c);
3649  h = pNext(p1);
3650  while (h!=NULL)
3651  {
3652  c=n_Div(pGetCoeff(h),k,r->cf);
3653  // no need to normalize: Z/p, R
3654  // normalize already in nDiv: Q_a, Z/p_a
3655  // remains: Q
3656  if (rField_is_Q(r) && (!n_IsOne(c,r->cf))) n_Normalize(c,r->cf);
3657  p_SetCoeff(h,c,r);
3658  pIter(h);
3659  }
3660  n_Delete(&k,r->cf);
3661  }
3662  else
3663  {
3664  //if (r->cf->cfNormalize != nDummy2) //TODO: OPTIMIZE
3665  {
3666  h = pNext(p1);
3667  while (h!=NULL)
3668  {
3669  n_Normalize(pGetCoeff(h),r->cf);
3670  pIter(h);
3671  }
3672  }
3673  }
3674  }
3675 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
int k
Definition: cfEzgcd.cc:93
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ p_Normalize()

void p_Normalize ( poly  p,
const ring  r 
)

Definition at line 3680 of file p_polys.cc.

3681 {
3682  if (rField_has_simple_inverse(r)) return; /* Z/p, GF(p,n), R, long R/C */
3683  while (p!=NULL)
3684  {
3685  // no test befor n_Normalize: n_Normalize should fix problems
3686  n_Normalize(pGetCoeff(p),r->cf);
3687  pIter(p);
3688  }
3689 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
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
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10

◆ p_NSet()

poly p_NSet ( number  n,
const ring  r 
)

returns the poly representing the number n, destroys n

Definition at line 1444 of file p_polys.cc.

1445 {
1446  if (n_IsZero(n,r->cf))
1447  {
1448  n_Delete(&n, r->cf);
1449  return NULL;
1450  }
1451  else
1452  {
1453  poly rc = p_Init(r);
1454  pSetCoeff0(rc,n);
1455  return rc;
1456  }
1457 }
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_One()

poly p_One ( const ring  r)

Definition at line 1314 of file p_polys.cc.

1315 {
1316  poly rc = p_Init(r);
1317  pSetCoeff0(rc,n_Init(1,r->cf));
1318  return rc;
1319 }
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
const ring r
Definition: syzextra.cc:208
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_OneComp()

BOOLEAN p_OneComp ( poly  p,
const ring  r 
)

return TRUE if all monoms have the same component

Definition at line 1209 of file p_polys.cc.

1210 {
1211  if(p!=NULL)
1212  {
1213  long i = p_GetComp(p, r);
1214  while (pNext(p)!=NULL)
1215  {
1216  pIter(p);
1217  if(i != p_GetComp(p, r)) return FALSE;
1218  }
1219  }
1220  return TRUE;
1221 }
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43

◆ p_PermPoly()

poly p_PermPoly ( poly  p,
const int *  perm,
const ring  OldRing,
const ring  dst,
nMapFunc  nMap,
const int *  par_perm = NULL,
int  OldPar = 0,
BOOLEAN  use_mult = FALSE 
)

Definition at line 3985 of file p_polys.cc.

3987 {
3988 #if 0
3989  p_Test(p, oldRing);
3990  PrintS("p_PermPoly::p: "); p_Write(p, oldRing, oldRing);
3991 #endif
3992  const int OldpVariables = rVar(oldRing);
3993  poly result = NULL;
3994  poly result_last = NULL;
3995  poly aq = NULL; /* the map coefficient */
3996  poly qq; /* the mapped monomial */
3997  assume(dst != NULL);
3998  assume(dst->cf != NULL);
3999  #ifdef HAVE_PLURAL
4000  poly tmp_mm=p_One(dst);
4001  #endif
4002  while (p != NULL)
4003  {
4004  // map the coefficient
4005  if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing) || (nMap==ndCopyMap))
4006  && (nMap != NULL) )
4007  {
4008  qq = p_Init(dst);
4009  assume( nMap != NULL );
4010  number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
4011  n_Test (n,dst->cf);
4012  if ( nCoeff_is_algExt(dst->cf) )
4013  n_Normalize(n, dst->cf);
4014  p_GetCoeff(qq, dst) = n;// Note: n can be a ZERO!!!
4015  }
4016  else
4017  {
4018  qq = p_One(dst);
4019 // aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst???
4020 // poly n_PermNumber(const number z, const int *par_perm, const int P, const ring src, const ring dst)
4021  aq = n_PermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing, dst);
4022  p_Test(aq, dst);
4023  if ( nCoeff_is_algExt(dst->cf) )
4024  p_Normalize(aq,dst);
4025  if (aq == NULL)
4026  p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!!
4027  p_Test(aq, dst);
4028  }
4029  if (rRing_has_Comp(dst))
4030  p_SetComp(qq, p_GetComp(p, oldRing), dst);
4031  if ( n_IsZero(pGetCoeff(qq), dst->cf) )
4032  {
4033  p_LmDelete(&qq,dst);
4034  qq = NULL;
4035  }
4036  else
4037  {
4038  // map pars:
4039  int mapped_to_par = 0;
4040  for(int i = 1; i <= OldpVariables; i++)
4041  {
4042  int e = p_GetExp(p, i, oldRing);
4043  if (e != 0)
4044  {
4045  if (perm==NULL)
4046  p_SetExp(qq, i, e, dst);
4047  else if (perm[i]>0)
4048  {
4049  #ifdef HAVE_PLURAL
4050  if(use_mult)
4051  {
4052  p_SetExp(tmp_mm,perm[i],e,dst);
4053  p_Setm(tmp_mm,dst);
4054  qq=p_Mult_mm(qq,tmp_mm,dst);
4055  p_SetExp(tmp_mm,perm[i],0,dst);
4056 
4057  }
4058  else
4059  #endif
4060  p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst);
4061  }
4062  else if (perm[i]<0)
4063  {
4064  number c = p_GetCoeff(qq, dst);
4065  if (rField_is_GF(dst))
4066  {
4067  assume( dst->cf->extRing == NULL );
4068  number ee = n_Param(1, dst);
4069  number eee;
4070  n_Power(ee, e, &eee, dst->cf); //nfDelete(ee,dst);
4071  ee = n_Mult(c, eee, dst->cf);
4072  //nfDelete(c,dst);nfDelete(eee,dst);
4073  pSetCoeff0(qq,ee);
4074  }
4075  else if (nCoeff_is_Extension(dst->cf))
4076  {
4077  const int par = -perm[i];
4078  assume( par > 0 );
4079 // WarnS("longalg missing 3");
4080 #if 1
4081  const coeffs C = dst->cf;
4082  assume( C != NULL );
4083  const ring R = C->extRing;
4084  assume( R != NULL );
4085  assume( par <= rVar(R) );
4086  poly pcn; // = (number)c
4087  assume( !n_IsZero(c, C) );
4088  if( nCoeff_is_algExt(C) )
4089  pcn = (poly) c;
4090  else // nCoeff_is_transExt(C)
4091  pcn = NUM((fraction)c);
4092  if (pNext(pcn) == NULL) // c->z
4093  p_AddExp(pcn, -perm[i], e, R);
4094  else /* more difficult: we have really to multiply: */
4095  {
4096  poly mmc = p_ISet(1, R);
4097  p_SetExp(mmc, -perm[i], e, R);
4098  p_Setm(mmc, R);
4099  number nnc;
4100  // convert back to a number: number nnc = mmc;
4101  if( nCoeff_is_algExt(C) )
4102  nnc = (number) mmc;
4103  else // nCoeff_is_transExt(C)
4104  nnc = ntInit(mmc, C);
4105  p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C);
4106  n_Delete((number *)&c, C);
4107  n_Delete((number *)&nnc, C);
4108  }
4109  mapped_to_par=1;
4110 #endif
4111  }
4112  }
4113  else
4114  {
4115  /* this variable maps to 0 !*/
4116  p_LmDelete(&qq, dst);
4117  break;
4118  }
4119  }
4120  }
4121  if ( mapped_to_par && (qq!= NULL) && nCoeff_is_algExt(dst->cf) )
4122  {
4123  number n = p_GetCoeff(qq, dst);
4124  n_Normalize(n, dst->cf);
4125  p_GetCoeff(qq, dst) = n;
4126  }
4127  }
4128  pIter(p);
4129 
4130 #if 0
4131  p_Test(aq,dst);
4132  PrintS("aq: "); p_Write(aq, dst, dst);
4133 #endif
4134 
4135 
4136 #if 1
4137  if (qq!=NULL)
4138  {
4139  p_Setm(qq,dst);
4140 
4141  p_Test(aq,dst);
4142  p_Test(qq,dst);
4143 
4144 #if 0
4145  PrintS("qq: "); p_Write(qq, dst, dst);
4146 #endif
4147 
4148  if (aq!=NULL)
4149  qq=p_Mult_q(aq,qq,dst);
4150  aq = qq;
4151  while (pNext(aq) != NULL) pIter(aq);
4152  if (result_last==NULL)
4153  {
4154  result=qq;
4155  }
4156  else
4157  {
4158  pNext(result_last)=qq;
4159  }
4160  result_last=aq;
4161  aq = NULL;
4162  }
4163  else if (aq!=NULL)
4164  {
4165  p_Delete(&aq,dst);
4166  }
4167  }
4168  result=p_SortAdd(result,dst);
4169 #else
4170  // if (qq!=NULL)
4171  // {
4172  // pSetm(qq);
4173  // pTest(qq);
4174  // pTest(aq);
4175  // if (aq!=NULL) qq=pMult(aq,qq);
4176  // aq = qq;
4177  // while (pNext(aq) != NULL) pIter(aq);
4178  // pNext(aq) = result;
4179  // aq = NULL;
4180  // result = qq;
4181  // }
4182  // else if (aq!=NULL)
4183  // {
4184  // pDelete(&aq);
4185  // }
4186  //}
4187  //p = result;
4188  //result = NULL;
4189  //while (p != NULL)
4190  //{
4191  // qq = p;
4192  // pIter(p);
4193  // qq->next = NULL;
4194  // result = pAdd(result, qq);
4195  //}
4196 #endif
4197  p_Test(result,dst);
4198 #if 0
4199  p_Test(result,dst);
4200  PrintS("result: "); p_Write(result,dst,dst);
4201 #endif
4202  #ifdef HAVE_PLURAL
4203  p_LmDelete(&tmp_mm,dst);
4204  #endif
4205  return result;
4206 }
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:244
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:513
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1..n_NumberOfParameters(...)
Definition: coeffs.h:817
#define pIter(p)
Definition: monomials.h:44
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition: p_polys.h:1142
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:927
poly p_One(const ring r)
Definition: p_polys.cc:1314
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:464
number ntInit(long i, const coeffs cf)
Definition: transext.cc:692
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
const ring R
Definition: DebugPrint.cc:36
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:742
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
#define p_Test(p, r)
Definition: p_polys.h:160
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3680
#define rRing_has_Comp(r)
Definition: monomials.h:274
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:483
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:636
#define NULL
Definition: omList.c:10
Definition: readcf.cc:156
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
Definition: p_polys.cc:3881
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:601
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:863
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
polyrec * poly
Definition: hilb.h:10
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1298
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020
return result
Definition: facAbsBiFact.cc:76

◆ p_Plus_mm_Mult_qq() [1/2]

static poly p_Plus_mm_Mult_qq ( poly  p,
poly  m,
poly  q,
int &  lp,
int  lq,
const ring  r 
)
inlinestatic

Definition at line 1106 of file p_polys.h.

1108 {
1109 #ifdef HAVE_PLURAL
1110  if (rIsPluralRing(r))
1111  return nc_p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
1112 #endif
1113 
1114 // this should be implemented more efficiently
1115  poly res;
1116  int shorter;
1117  number n_old = pGetCoeff(m);
1118  number n_neg = n_Copy(n_old, r->cf);
1119  n_neg = n_InpNeg(n_neg, r->cf);
1120  pSetCoeff0(m, n_neg);
1121  res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
1122  lp = (lp + lq) - shorter;
1123  pSetCoeff0(m, n_old);
1124  n_Delete(&n_neg, r->cf);
1125  return res;
1126 }
return P p
Definition: myNF.cc:203
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
poly nc_p_Plus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, const int, const ring r)
Definition: old.gring.cc:173
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10

◆ p_Plus_mm_Mult_qq() [2/2]

static poly p_Plus_mm_Mult_qq ( poly  p,
poly  m,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1128 of file p_polys.h.

1129 {
1130  int lp = 0, lq = 0;
1131  return p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
1132 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
Definition: p_polys.h:1106

◆ p_PolyDiv()

poly p_PolyDiv ( poly p,
const poly  divisor,
const BOOLEAN  needResult,
const ring  r 
)

assumes that p and divisor are univariate polynomials in r, mentioning the same variable; assumes divisor != NULL; p may be NULL; assumes a global monomial ordering in r; performs polynomial division of p by divisor:

  • afterwards p contains the remainder of the division, i.e., p_before = result * divisor + p_afterwards;
  • if needResult == TRUE, then the method computes and returns 'result', otherwise NULL is returned (This parametrization can be used when one is only interested in the remainder of the division. In this case, the method will be slightly faster.) leaves divisor unmodified

Definition at line 1831 of file p_polys.cc.

1832 {
1833  assume(divisor != NULL);
1834  if (p == NULL) return NULL;
1835 
1836  poly result = NULL;
1837  number divisorLC = p_GetCoeff(divisor, r);
1838  int divisorLE = p_GetExp(divisor, 1, r);
1839  while ((p != NULL) && (p_Deg(p, r) >= p_Deg(divisor, r)))
1840  {
1841  /* determine t = LT(p) / LT(divisor) */
1842  poly t = p_ISet(1, r);
1843  number c = n_Div(p_GetCoeff(p, r), divisorLC, r->cf);
1844  n_Normalize(c,r->cf);
1845  p_SetCoeff(t, c, r);
1846  int e = p_GetExp(p, 1, r) - divisorLE;
1847  p_SetExp(t, 1, e, r);
1848  p_Setm(t, r);
1849  if (needResult) result = p_Add_q(result, p_Copy(t, r), r);
1850  p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
1851  }
1852  return result;
1853 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:582
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
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:464
#define assume(x)
Definition: mod2.h:394
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:483
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1298
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020
return result
Definition: facAbsBiFact.cc:76

◆ p_Power()

poly p_Power ( poly  p,
int  i,
const ring  r 
)

Definition at line 2158 of file p_polys.cc.

2159 {
2160  poly rc=NULL;
2161 
2162  if (i==0)
2163  {
2164  p_Delete(&p,r);
2165  return p_One(r);
2166  }
2167 
2168  if(p!=NULL)
2169  {
2170  if ( (i > 0) && ((unsigned long ) i > (r->bitmask)))
2171  {
2172  Werror("exponent %d is too large, max. is %ld",i,r->bitmask);
2173  return NULL;
2174  }
2175  switch (i)
2176  {
2177 // cannot happen, see above
2178 // case 0:
2179 // {
2180 // rc=pOne();
2181 // pDelete(&p);
2182 // break;
2183 // }
2184  case 1:
2185  rc=p;
2186  break;
2187  case 2:
2188  rc=p_Mult_q(p_Copy(p,r),p,r);
2189  break;
2190  default:
2191  if (i < 0)
2192  {
2193  p_Delete(&p,r);
2194  return NULL;
2195  }
2196  else
2197  {
2198 #ifdef HAVE_PLURAL
2199  if (rIsPluralRing(r)) /* in the NC case nothing helps :-( */
2200  {
2201  int j=i;
2202  rc = p_Copy(p,r);
2203  while (j>1)
2204  {
2205  rc = p_Mult_q(p_Copy(p,r),rc,r);
2206  j--;
2207  }
2208  p_Delete(&p,r);
2209  return rc;
2210  }
2211 #endif
2212  rc = pNext(p);
2213  if (rc == NULL)
2214  return p_MonPower(p,i,r);
2215  /* else: binom ?*/
2216  int char_p=rChar(r);
2217  if ((char_p>0) && (i>char_p)
2218  && ((rField_is_Zp(r,char_p)
2219  || (rField_is_Zp_a(r,char_p)))))
2220  {
2221  poly h=p_Pow_charp(p_Copy(p,r),char_p,r);
2222  int rest=i-char_p;
2223  while (rest>=char_p)
2224  {
2225  rest-=char_p;
2226  h=p_Mult_q(h,p_Pow_charp(p_Copy(p,r),char_p,r),r);
2227  }
2228  poly res=h;
2229  if (rest>0)
2230  res=p_Mult_q(p_Power(p_Copy(p,r),rest,r),h,r);
2231  p_Delete(&p,r);
2232  return res;
2233  }
2234  if ((pNext(rc) != NULL)
2235  || rField_is_Ring(r)
2236  )
2237  return p_Pow(p,i,r);
2238  if ((char_p==0) || (i<=char_p))
2239  return p_TwoMonPower(p,i,r);
2240  return p_Pow(p,i,r);
2241  }
2242  /*end default:*/
2243  }
2244  }
2245  return rc;
2246 }
static poly p_MonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:1961
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:521
return P p
Definition: myNF.cc:203
int rChar(ring r)
Definition: ring.cc:688
static poly p_TwoMonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:2067
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1314
int j
Definition: myNF.cc:70
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
int i
Definition: cfEzgcd.cc:123
static poly p_Pow(poly p, int i, const ring r)
Definition: p_polys.cc:2132
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static poly p_Pow_charp(poly p, int i, const ring r)
Definition: p_polys.cc:2146
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2158
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ p_ProjectiveUnique()

void p_ProjectiveUnique ( poly  p,
const ring  r 
)

Definition at line 3072 of file p_polys.cc.

3073 {
3074  if( ph == NULL )
3075  return;
3076 
3077  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
3078 
3079  number h;
3080  poly p;
3081 
3082  if (rField_is_Ring(r))
3083  {
3084  p_Content(ph,r);
3085  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3086  assume( n_GreaterZero(pGetCoeff(ph),C) );
3087  return;
3088  }
3089 
3091  {
3092  assume( n_GreaterZero(pGetCoeff(ph),C) );
3093  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3094  return;
3095  }
3096  p = ph;
3097 
3098  assume(p != NULL);
3099 
3100  if(pNext(p)==NULL) // a monomial
3101  {
3102  p_SetCoeff(p, n_Init(1, C), r);
3103  return;
3104  }
3105 
3106  assume(pNext(p)!=NULL);
3107 
3108  if(!rField_is_Q(r) && !nCoeff_is_transExt(C))
3109  {
3110  h = p_GetCoeff(p, C);
3111  number hInv = n_Invers(h, C);
3112  pIter(p);
3113  while (p!=NULL)
3114  {
3115  p_SetCoeff(p, n_Mult(p_GetCoeff(p, C), hInv, C), r);
3116  pIter(p);
3117  }
3118  n_Delete(&hInv, C);
3119  p = ph;
3120  p_SetCoeff(p, n_Init(1, C), r);
3121  }
3122 
3123  p_Cleardenom(ph, r); //performs also a p_Content
3124 
3125 
3126  /* normalize ph over a transcendental extension s.t.
3127  lead (ph) is > 0 if extRing->cf == Q
3128  or lead (ph) is monic if extRing->cf == Zp*/
3129  if (nCoeff_is_transExt(C))
3130  {
3131  p= ph;
3132  h= p_GetCoeff (p, C);
3133  fraction f = (fraction) h;
3134  number n=p_GetCoeff (NUM (f),C->extRing->cf);
3135  if (rField_is_Q (C->extRing))
3136  {
3137  if (!n_GreaterZero(n,C->extRing->cf))
3138  {
3139  p=p_Neg (p,r);
3140  }
3141  }
3142  else if (rField_is_Zp(C->extRing))
3143  {
3144  if (!n_IsOne (n, C->extRing->cf))
3145  {
3146  n=n_Invers (n,C->extRing->cf);
3147  nMapFunc nMap;
3148  nMap= n_SetMap (C->extRing->cf, C);
3149  number ninv= nMap (n,C->extRing->cf, C);
3150  p=p_Mult_nn (p, ninv, r);
3151  n_Delete (&ninv, C);
3152  n_Delete (&n, C->extRing->cf);
3153  }
3154  }
3155  p= ph;
3156  }
3157 
3158  return;
3159 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
#define pIter(p)
Definition: monomials.h:44
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
const ring r
Definition: syzextra.cc:208
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:568
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:935
FILE * f
Definition: checklibs.c:9
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:895
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2255
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:725
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
Definition: readcf.cc:156
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2755

◆ p_Read()

const char* p_Read ( const char *  s,
poly p,
const ring  r 
)

Definition at line 1349 of file p_polys.cc.

1350 {
1351  if (r==NULL) { rc=NULL;return st;}
1352  int i,j;
1353  rc = p_Init(r);
1354  const char *s = n_Read(st,&(p_GetCoeff(rc, r)),r->cf);
1355  if (s==st)
1356  /* i.e. it does not start with a coeff: test if it is a ringvar*/
1357  {
1358  j = r_IsRingVar(s,r->names,r->N);
1359  if (j >= 0)
1360  {
1361  p_IncrExp(rc,1+j,r);
1362  while (*s!='\0') s++;
1363  goto done;
1364  }
1365  }
1366  while (*s!='\0')
1367  {
1368  char ss[2];
1369  ss[0] = *s++;
1370  ss[1] = '\0';
1371  j = r_IsRingVar(ss,r->names,r->N);
1372  if (j >= 0)
1373  {
1374  const char *s_save=s;
1375  s = eati(s,&i);
1376  if (((unsigned long)i) > r->bitmask/2)
1377  {
1378  // exponent to large: it is not a monomial
1379  p_LmDelete(&rc,r);
1380  return s_save;
1381  }
1382  p_AddExp(rc,1+j, (long)i, r);
1383  }
1384  else
1385  {
1386  // 1st char of is not a varname
1387  // We return the parsed polynomial nevertheless. This is needed when
1388  // we are parsing coefficients in a rational function field.
1389  s--;
1390  break;
1391  }
1392  }
1393 done:
1394  if (n_IsZero(pGetCoeff(rc),r->cf)) p_LmDelete(&rc,r);
1395  else
1396  {
1397 #ifdef HAVE_PLURAL
1398  // in super-commutative ring
1399  // squares of anti-commutative variables are zeroes!
1400  if(rIsSCA(r))
1401  {
1402  const unsigned int iFirstAltVar = scaFirstAltVar(r);
1403  const unsigned int iLastAltVar = scaLastAltVar(r);
1404 
1405  assume(rc != NULL);
1406 
1407  for(unsigned int k = iFirstAltVar; k <= iLastAltVar; k++)
1408  if( p_GetExp(rc, k, r) > 1 )
1409  {
1410  p_LmDelete(&rc, r);
1411  goto finish;
1412  }
1413  }
1414 #endif
1415 
1416  p_Setm(rc,r);
1417  }
1418 finish:
1419  return s;
1420 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const char * eati(const char *s, int *i)
Definition: reporter.cc:373
static FORCE_INLINE const char * n_Read(const char *s, number *a, const coeffs r)
!!! Recommendation: This method is too cryptic to be part of the user- !!! interface. As defined here, it is merely a helper !!! method for parsing number input strings.
Definition: coeffs.h:602
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:586
int k
Definition: cfEzgcd.cc:93
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
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:222
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
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:468
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:601
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1243

◆ p_Series()

poly p_Series ( int  n,
poly  p,
poly  u,
intvec w,
const ring  R 
)

Definition at line 4353 of file p_polys.cc.

4354 {
4355  short *ww=iv2array(w,R);
4356  if(p!=NULL)
4357  {
4358  if(u==NULL)
4359  p=p_JetW(p,n,ww,R);
4360  else
4361  p=p_JetW(p_Mult_q(p,p_Invers(n-p_MinDeg(p,w,R),u,w,R),R),n,ww,R);
4362  }
4363  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4364  return p;
4365 }
return P p
Definition: myNF.cc:203
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:208
int p_MinDeg(poly p, intvec *w, const ring R)
Definition: p_polys.cc:4303
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void * ADDRESS
Definition: auxiliary.h:115
poly p_Invers(int n, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4324
const ring R
Definition: DebugPrint.cc:36
poly p_JetW(poly p, int m, short *w, const ring R)
Definition: p_polys.cc:4285
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

◆ p_SetCoeff()

static number p_SetCoeff ( poly  p,
number  n,
ring  r 
)
inlinestatic

Definition at line 407 of file p_polys.h.

408 {
410  n_Delete(&(p->coef), r->cf);
411  (p)->coef=n;
412  return n;
413 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459

◆ p_SetComp()

static unsigned long p_SetComp ( poly  p,
unsigned long  c,
ring  r 
)
inlinestatic

Definition at line 242 of file p_polys.h.

243 {
245  if (r->pCompIndex>=0) __p_GetComp(p,r) = c;
246  return c;
247 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
#define __p_GetComp(p, r)
Definition: monomials.h:71
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208

◆ p_SetCompP() [1/2]

static void p_SetCompP ( poly  p,
int  i,
ring  r 
)
inlinestatic

Definition at line 249 of file p_polys.h.

250 {
251  if (p != NULL)
252  {
253  p_Test(p, r);
255  {
256  do
257  {
258  p_SetComp(p, i, r);
259  p_SetmComp(p, r);
260  pIter(p);
261  }
262  while (p != NULL);
263  }
264  else
265  {
266  do
267  {
268  p_SetComp(p, i, r);
269  pIter(p);
270  }
271  while(p != NULL);
272  }
273  }
274 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition: ring.cc:1871
#define p_Test(p, r)
Definition: p_polys.h:160
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10

◆ p_SetCompP() [2/2]

static void p_SetCompP ( poly  p,
int  i,
ring  lmRing,
ring  tailRing 
)
inlinestatic

Definition at line 276 of file p_polys.h.

277 {
278  if (p != NULL)
279  {
280  p_SetComp(p, i, lmRing);
281  p_SetmComp(p, lmRing);
283  }
284 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
int i
Definition: cfEzgcd.cc:123
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43

◆ p_SetExp() [1/3]

static unsigned long p_SetExp ( poly  p,
const unsigned long  e,
const unsigned long  iBitmask,
const int  VarOffset 
)
inlinestatic

set a single variable exponent : VarOffset encodes the position in p->exp

See also
p_GetExp

Definition at line 483 of file p_polys.h.

484 {
485  pAssume2(e>=0);
486  pAssume2(e<=iBitmask);
487  pAssume2((VarOffset >> (24 + 6)) == 0);
488 
489  // shift e to the left:
490  register int shift = VarOffset >> 24;
491  unsigned long ee = e << shift /*(VarOffset >> 24)*/;
492  // find the bits in the exponent vector
493  register int offset = (VarOffset & 0xffffff);
494  // clear the bits in the exponent vector:
495  p->exp[offset] &= ~( iBitmask << shift );
496  // insert e with |
497  p->exp[ offset ] |= ee;
498  return e;
499 }
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
int offset
Definition: libparse.cc:1091

◆ p_SetExp() [2/3]

static long p_SetExp ( poly  p,
const long  e,
const ring  r,
const int  VarOffset 
)
inlinestatic

Definition at line 557 of file p_polys.h.

558 {
560  pAssume2(VarOffset != -1);
561  return p_SetExp(p, e, r->bitmask, VarOffset);
562 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
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:483

◆ p_SetExp() [3/3]

static long p_SetExp ( poly  p,
const int  v,
const long  e,
const ring  r 
)
inlinestatic

set v^th exponent for a monomial

Definition at line 577 of file p_polys.h.

578 {
580  pAssume2(v>0 && v <= r->N);
581  pAssume2(r->VarOffset[v] != -1);
582  return p_SetExp(p, e, r->bitmask, r->VarOffset[v]);
583 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
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:483

◆ p_SetExpV()

static void p_SetExpV ( poly  p,
int *  ev,
const ring  r 
)
inlinestatic

Definition at line 1451 of file p_polys.h.

1452 {
1454  for (unsigned j = r->N; j!=0; j--)
1455  p_SetExp(p, j, ev[j], r);
1456 
1457  p_SetComp(p, ev[0],r);
1458  p_Setm(p, r);
1459 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185
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:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228

◆ p_Setm()

static void p_Setm ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 228 of file p_polys.h.

229 {
230  p_CheckRing2(r);
231  r->p_Setm(p, r);
232 }
return P p
Definition: myNF.cc:203
#define p_CheckRing2(r)
Definition: monomials.h:208
const ring r
Definition: syzextra.cc:208

◆ p_SetModDeg()

void p_SetModDeg ( intvec w,
ring  r 
)

Definition at line 3579 of file p_polys.cc.

3580 {
3581  if (w!=NULL)
3582  {
3583  r->pModW = w;
3584  pOldFDeg = r->pFDeg;
3585  pOldLDeg = r->pLDeg;
3586  pOldLexOrder = r->pLexOrder;
3588  r->pLexOrder = TRUE;
3589  }
3590  else
3591  {
3592  r->pModW = NULL;
3594  r->pLexOrder = pOldLexOrder;
3595  }
3596 }
static BOOLEAN pOldLexOrder
Definition: p_polys.cc:3568
static long pModDeg(poly p, ring r)
Definition: p_polys.cc:3570
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3555
static pLDegProc pOldLDeg
Definition: p_polys.cc:3567
#define NULL
Definition: omList.c:10
static pFDegProc pOldFDeg
Definition: p_polys.cc:3566
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ p_ShallowCopyDelete()

static poly p_ShallowCopyDelete ( poly  p,
const ring  r,
omBin  bin 
)
inlinestatic

Definition at line 869 of file p_polys.h.

870 {
872  pAssume2(omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
873  return r->p_Procs->p_ShallowCopyDelete(p, r, bin);
874 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
#define omSizeWOfBin(bin_ptr)

◆ p_ShallowDelete()

void p_ShallowDelete ( poly p,
const ring  r 
)

◆ p_Shift()

void p_Shift ( poly p,
int  i,
const ring  r 
)

shifts components of the vector p by i

Definition at line 4561 of file p_polys.cc.

4562 {
4563  poly qp1 = *p,qp2 = *p;/*working pointers*/
4564  int j = p_MaxComp(*p,r),k = p_MinComp(*p,r);
4565 
4566  if (j+i < 0) return ;
4567  while (qp1 != NULL)
4568  {
4569  if ((p_GetComp(qp1,r)+i > 0) || ((j == -i) && (j == k)))
4570  {
4571  p_AddComp(qp1,i,r);
4572  p_SetmComp(qp1,r);
4573  qp2 = qp1;
4574  pIter(qp1);
4575  }
4576  else
4577  {
4578  if (qp2 == *p)
4579  {
4580  pIter(*p);
4581  p_LmDelete(&qp2,r);
4582  qp2 = *p;
4583  qp1 = *p;
4584  }
4585  else
4586  {
4587  qp2->next = qp1->next;
4588  if (qp1!=NULL) p_LmDelete(&qp1,r);
4589  qp1 = qp2->next;
4590  }
4591  }
4592  }
4593 }
static unsigned long p_AddComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:442
return
Definition: syzextra.cc:280
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:308
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287

◆ p_SimpleContent()

void p_SimpleContent ( poly  p,
int  s,
const ring  r 
)

Definition at line 2464 of file p_polys.cc.

2465 {
2466  if(TEST_OPT_CONTENTSB) return;
2467  if (ph==NULL) return;
2468  if (pNext(ph)==NULL)
2469  {
2470  p_SetCoeff(ph,n_Init(1,r->cf),r);
2471  return;
2472  }
2473  if ((pNext(pNext(ph))==NULL)||(!rField_is_Q(r)))
2474  {
2475  return;
2476  }
2477  number d=p_InitContent(ph,r);
2478  if (n_Size(d,r->cf)<=smax)
2479  {
2480  //if (TEST_OPT_PROT) PrintS("G");
2481  return;
2482  }
2483 
2484 
2485  poly p=ph;
2486  number h=d;
2487  if (smax==1) smax=2;
2488  while (p!=NULL)
2489  {
2490 #if 0
2491  d=n_Gcd(h,pGetCoeff(p),r->cf);
2492  n_Delete(&h,r->cf);
2493  h = d;
2494 #else
2495  STATISTIC(n_Gcd); nlInpGcd(h,pGetCoeff(p),r->cf); // FIXME? TODO? // extern void nlInpGcd(number &a, number b, const coeffs r);
2496 #endif
2497  if(n_Size(h,r->cf)<smax)
2498  {
2499  //if (TEST_OPT_PROT) PrintS("g");
2500  return;
2501  }
2502  pIter(p);
2503  }
2504  p = ph;
2505  if (!n_GreaterZero(pGetCoeff(p),r->cf)) h=n_InpNeg(h,r->cf);
2506  if(n_IsOne(h,r->cf)) return;
2507  //if (TEST_OPT_PROT) PrintS("c");
2508  while (p!=NULL)
2509  {
2510 #if 1
2511  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2512  p_SetCoeff(p,d,r);
2513 #else
2514  STATISTIC(n_ExactDiv); nlInpExactDiv(pGetCoeff(p),h,r->cf); // no such function... ?
2515 #endif
2516  pIter(p);
2517  }
2518  n_Delete(&h,r->cf);
2519 }
#define STATISTIC(f)
Definition: numstats.h:16
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:690
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define TEST_OPT_CONTENTSB
Definition: options.h:121
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
void nlInpGcd(number &a, number b, const coeffs r)
Definition: longrat.cc:2778
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
static number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2522
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition: coeffs.h:626
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:574

◆ p_Size()

int p_Size ( poly  p,
const ring  r 
)

Definition at line 3183 of file p_polys.cc.

3184 {
3185  int count = 0;
3186  if (r->cf->has_simple_Alloc)
3187  return pLength(p);
3188  while ( p != NULL )
3189  {
3190  count+= n_Size( pGetCoeff( p ), r->cf );
3191  pIter( p );
3192  }
3193  return count;
3194 }
int status int void size_t count
Definition: si_signals.h:59
return P p
Definition: myNF.cc:203
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
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define NULL
Definition: omList.c:10
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:574

◆ p_SortAdd()

static poly p_SortAdd ( poly  p,
const ring  r,
BOOLEAN  revert = FALSE 
)
inlinestatic

Definition at line 1142 of file p_polys.h.

1143 {
1144  if (revert) p = pReverse(p);
1145  return sBucketSortAdd(p, r);
1146 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
poly sBucketSortAdd(poly p, const ring r)
Sorts p with bucketSort: p may have equal monomials
Definition: sbuckets.cc:364
static poly pReverse(poly p)
Definition: p_polys.h:330

◆ p_SortMerge()

static poly p_SortMerge ( poly  p,
const ring  r,
BOOLEAN  revert = FALSE 
)
inlinestatic

Definition at line 1152 of file p_polys.h.

1153 {
1154  if (revert) p = pReverse(p);
1155  return sBucketSortMerge(p, r);
1156 }
return P p
Definition: myNF.cc:203
poly sBucketSortMerge(poly p, const ring r)
Sorts p with bucketSort: assumes all monomials of p are different
Definition: sbuckets.cc:327
const ring r
Definition: syzextra.cc:208
static poly pReverse(poly p)
Definition: p_polys.h:330

◆ p_Split()

void p_Split ( poly  p,
poly r 
)

Definition at line 1321 of file p_polys.cc.

1322 {
1323  *h=pNext(p);
1324  pNext(p)=NULL;
1325 }
return P p
Definition: myNF.cc:203
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static Poly * h
Definition: janet.cc:978

◆ p_String() [1/2]

char* p_String ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 186 of file polys0.cc.

187 {
188  StringSetS("");
190  return StringEndS();
191 }
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
char * StringEndS()
Definition: reporter.cc:151
void StringSetS(const char *st)
Definition: reporter.cc:128
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136

◆ p_String() [2/2]

static char* p_String ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1163 of file p_polys.h.

1164 {
1165  return p_String(p, p_ring, p_ring);
1166 }
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:186
return P p
Definition: myNF.cc:203

◆ p_String0() [1/2]

void p_String0 ( poly  p,
ring  lmRing,
ring  tailRing 
)

print p according to ShortOut in lmRing & tailRing

Definition at line 136 of file polys0.cc.

137 {
138  if (p == NULL)
139  {
140  StringAppendS("0");
141  return;
142  }
144  if ((n_GetChar(lmRing->cf) == 0)
145  && (nCoeff_is_transExt(lmRing->cf)))
146  p_Normalize(p,lmRing); /* Manual/absfact.tst */
147  if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
148  {
149  writemon(p,0, lmRing);
150  p = pNext(p);
151  while (p!=NULL)
152  {
153  assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
154  if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
155  StringAppendS("+");
156  writemon(p,0, tailRing);
157  p = pNext(p);
158  }
159  return;
160  }
161 
162  long k = 1;
163  StringAppendS("[");
164  loop
165  {
166  while (k < p_GetComp(p,lmRing))
167  {
168  StringAppendS("0,");
169  k++;
170  }
171  writemon(p,k,lmRing);
172  pIter(p);
173  while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
174  {
175  if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
176  writemon(p,k,tailRing);
177  pIter(p);
178  }
179  if (p == NULL) break;
180  StringAppendS(",");
181  k++;
182  }
183  StringAppendS("]");
184 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:448
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:394
void StringAppendS(const char *st)
Definition: reporter.cc:107
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:935
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:468
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3680
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:498
static void writemon(poly p, int ko, const ring r)
Definition: polys0.cc:23

◆ p_String0() [2/2]

static void p_String0 ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1167 of file p_polys.h.

1168 {
1169  p_String0(p, p_ring, p_ring);
1170 }
return P p
Definition: myNF.cc:203
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136

◆ p_String0Long()

void p_String0Long ( const poly  p,
ring  lmRing,
ring  tailRing 
)

print p in a long way

print p in a long way

Definition at line 116 of file polys0.cc.

117 {
118  // NOTE: the following (non-thread-safe!) UGLYNESS
119  // (changing naRing->ShortOut for a while) is due to Hans!
120  // Just think of other ring using the VERY SAME naRing and possible
121  // side-effects...
122  // but this is not a problem: i/o is not thread-safe anyway.
123  const BOOLEAN bLMShortOut = rShortOut(lmRing);
124  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
125 
126  lmRing->ShortOut = FALSE;
127  tailRing->ShortOut = FALSE;
128 
130 
131  lmRing->ShortOut = bLMShortOut;
132  tailRing->ShortOut = bTAILShortOut;
133 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:572
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136
int BOOLEAN
Definition: auxiliary.h:85

◆ p_String0Short()

void p_String0Short ( const poly  p,
ring  lmRing,
ring  tailRing 
)

print p in a short way, if possible

print p in a short way, if possible

Definition at line 97 of file polys0.cc.

98 {
99  // NOTE: the following (non-thread-safe!) UGLYNESS
100  // (changing naRing->ShortOut for a while) is due to Hans!
101  // Just think of other ring using the VERY SAME naRing and possible
102  // side-effects...
103  const BOOLEAN bLMShortOut = rShortOut(lmRing);
104  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
105 
106  lmRing->ShortOut = rCanShortOut(lmRing);
107  tailRing->ShortOut = rCanShortOut(tailRing);
108 
110 
111  lmRing->ShortOut = bLMShortOut;
112  tailRing->ShortOut = bTAILShortOut;
113 }
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
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:572
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:577
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136
int BOOLEAN
Definition: auxiliary.h:85

◆ p_Sub()

poly p_Sub ( poly  a,
poly  b,
const ring  r 
)

Definition at line 1951 of file p_polys.cc.

1952 {
1953  return p_Add_q(p1, p_Neg(p2,r),r);
1954 }
const ring r
Definition: syzextra.cc:208
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877

◆ p_SubComp()

static unsigned long p_SubComp ( poly  p,
unsigned long  v,
ring  r 
)
inlinestatic

Definition at line 448 of file p_polys.h.

449 {
453  return __p_GetComp(p,r) -= v;
454 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
#define __p_GetComp(p, r)
Definition: monomials.h:71
return P p
Definition: myNF.cc:203
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:203
#define pAssume2(cond)
Definition: monomials.h:201
const ring r
Definition: syzextra.cc:208
#define rRing_has_Comp(r)
Definition: monomials.h:274
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37

◆ p_SubExp()

static long p_SubExp ( poly  p,
int  v,
long  ee,
ring  r 
)
inlinestatic

Definition at line 608 of file p_polys.h.

609 {
611  long e = p_GetExp(p,v,r);
612  pAssume2(e >= ee);
613  e -= ee;
614  return p_SetExp(p,v,e,r);
615 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:207
return P p
Definition: myNF.cc:203
#define pAssume2(cond)
Definition: monomials.h:201
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:464
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
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:483

◆ p_Subst()

poly p_Subst ( poly  p,
int  n,
poly  e,
const ring  r 
)

Definition at line 3822 of file p_polys.cc.

3823 {
3824  if (e == NULL) return p_Subst0(p, n,r);
3825 
3826  if (p_IsConstant(e,r))
3827  {
3828  if (n_IsOne(pGetCoeff(e),r->cf)) return p_Subst1(p,n,r);
3829  else return p_Subst2(p, n, pGetCoeff(e),r);
3830  }
3831 
3832 #ifdef HAVE_PLURAL
3833  if (rIsPluralRing(r))
3834  {
3835  return nc_pSubst(p,n,e,r);
3836  }
3837 #endif
3838 
3839  int exponent,i;
3840  poly h, res, m;
3841  int *me,*ee;
3842  number nu,nu1;
3843 
3844  me=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3845  ee=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3846  if (e!=NULL) p_GetExpV(e,ee,r);
3847  res=NULL;
3848  h=p;
3849  while (h!=NULL)
3850  {
3851  if ((e!=NULL) || (p_GetExp(h,n,r)==0))
3852  {
3853  m=p_Head(h,r);
3854  p_GetExpV(m,me,r);
3855  exponent=me[n];
3856  me[n]=0;
3857  for(i=rVar(r);i>0;i--)
3858  me[i]+=exponent*ee[i];
3859  p_SetExpV(m,me,r);
3860  if (e!=NULL)
3861  {
3862  n_Power(pGetCoeff(e),exponent,&nu,r->cf);
3863  nu1=n_Mult(pGetCoeff(m),nu,r->cf);
3864  n_Delete(&nu,r->cf);
3865  p_SetCoeff(m,nu1,r);
3866  }
3867  res=p_Add_q(res,m,r);
3868  }
3869  p_LmDelete(&h,r);
3870  }
3871  omFreeSize((ADDRESS)me,(rVar(r)+1)*sizeof(int));
3872  omFreeSize((ADDRESS)ee,(rVar(r)+1)*sizeof(int));
3873  return res;
3874 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1443
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static poly p_Subst1(poly p, int n, const ring r)
Definition: p_polys.cc:3729
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void * ADDRESS
Definition: auxiliary.h:115
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
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1451
poly res
Definition: myNF.cc:322
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
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:464
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
static poly p_Subst0(poly p, int n, const ring r)
Definition: p_polys.cc:3797
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:636
#define NULL
Definition: omList.c:10
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
static poly p_Subst2(poly p, int n, number e, const ring r)
Definition: p_polys.cc:3756
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
poly nc_pSubst(poly p, int n, poly e, const ring r)
substitute the n-th variable by e in p destroy p e is not a constant
Definition: old.gring.cc:3234
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

◆ p_TakeOutComp() [1/2]

void p_TakeOutComp ( poly p,
long  comp,
poly q,
int *  lq,
const ring  r 
)

Definition at line 3440 of file p_polys.cc.

3441 {
3442  spolyrec pp, qq;
3443  poly p, q, p_prev;
3444  int l = 0;
3445 
3446 #ifdef HAVE_ASSUME
3447  int lp = pLength(*r_p);
3448 #endif
3449 
3450  pNext(&pp) = *r_p;
3451  p = *r_p;
3452  p_prev = &pp;
3453  q = &qq;
3454 
3455  while(p != NULL)
3456  {
3457  while (p_GetComp(p,r) == comp)
3458  {
3459  pNext(q) = p;
3460  pIter(q);
3461  p_SetComp(p, 0,r);
3462  p_SetmComp(p,r);
3463  pIter(p);
3464  l++;
3465  if (p == NULL)
3466  {
3467  pNext(p_prev) = NULL;
3468  goto Finish;
3469  }
3470  }
3471  pNext(p_prev) = p;
3472  p_prev = p;
3473  pIter(p);
3474  }
3475 
3476  Finish:
3477  pNext(q) = NULL;
3478  *r_p = pNext(&pp);
3479  *r_q = pNext(&qq);
3480  *lq = l;
3481 #ifdef HAVE_ASSUME
3482  assume(pLength(*r_p) + pLength(*r_q) == lp);
3483 #endif
3484  p_Test(*r_p,r);
3485  p_Test(*r_q,r);
3486 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
poly pp
Definition: myNF.cc:296
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define p_Test(p, r)
Definition: p_polys.h:160
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
int l
Definition: cfEzgcd.cc:94

◆ p_TakeOutComp() [2/2]

poly p_TakeOutComp ( poly p,
int  k,
const ring  r 
)

Definition at line 3379 of file p_polys.cc.

3380 {
3381  poly q = *p,qq=NULL,result = NULL;
3382 
3383  if (q==NULL) return NULL;
3384  BOOLEAN use_setmcomp=rOrd_SetCompRequiresSetm(r);
3385  if (p_GetComp(q,r)==k)
3386  {
3387  result = q;
3388  do
3389  {
3390  p_SetComp(q,0,r);
3391  if (use_setmcomp) p_SetmComp(q,r);
3392  qq = q;
3393  pIter(q);
3394  }
3395  while ((q!=NULL) && (p_GetComp(q,r)==k));
3396  *p = q;
3397  pNext(qq) = NULL;
3398  }
3399  if (q==NULL) return result;
3400  if (p_GetComp(q,r) > k)
3401  {
3402  p_SubComp(q,1,r);
3403  if (use_setmcomp) p_SetmComp(q,r);
3404  }
3405  poly pNext_q;
3406  while ((pNext_q=pNext(q))!=NULL)
3407  {
3408  if (p_GetComp(pNext_q,r)==k)
3409  {
3410  if (result==NULL)
3411  {
3412  result = pNext_q;
3413  qq = result;
3414  }
3415  else
3416  {
3417  pNext(qq) = pNext_q;
3418  pIter(qq);
3419  }
3420  pNext(q) = pNext(pNext_q);
3421  pNext(qq) =NULL;
3422  p_SetComp(qq,0,r);
3423  if (use_setmcomp) p_SetmComp(qq,r);
3424  }
3425  else
3426  {
3427  /*pIter(q);*/ q=pNext_q;
3428  if (p_GetComp(q,r) > k)
3429  {
3430  p_SubComp(q,1,r);
3431  if (use_setmcomp) p_SetmComp(q,r);
3432  }
3433  }
3434  }
3435  return result;
3436 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition: ring.cc:1871
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:448
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
return result
Definition: facAbsBiFact.cc:76

◆ p_TakeOutComp1()

poly p_TakeOutComp1 ( poly p,
int  k,
const ring  r 
)

Definition at line 3328 of file p_polys.cc.

3329 {
3330  poly q = *p;
3331 
3332  if (q==NULL) return NULL;
3333 
3334  poly qq=NULL,result = NULL;
3335 
3336  if (p_GetComp(q,r)==k)
3337  {
3338  result = q; /* *p */
3339  while ((q!=NULL) && (p_GetComp(q,r)==k))
3340  {
3341  p_SetComp(q,0,r);
3342  p_SetmComp(q,r);
3343  qq = q;
3344  pIter(q);
3345  }
3346  *p = q;
3347  pNext(qq) = NULL;
3348  }
3349  if (q==NULL) return result;
3350 // if (pGetComp(q) > k) pGetComp(q)--;
3351  while (pNext(q)!=NULL)
3352  {
3353  if (p_GetComp(pNext(q),r)==k)
3354  {
3355  if (result==NULL)
3356  {
3357  result = pNext(q);
3358  qq = result;
3359  }
3360  else
3361  {
3362  pNext(qq) = pNext(q);
3363  pIter(qq);
3364  }
3365  pNext(q) = pNext(pNext(q));
3366  pNext(qq) =NULL;
3367  p_SetComp(qq,0,r);
3368  p_SetmComp(qq,r);
3369  }
3370  else
3371  {
3372  pIter(q);
3373 // if (pGetComp(q) > k) pGetComp(q)--;
3374  }
3375  }
3376  return result;
3377 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define p_SetmComp
Definition: p_polys.h:239
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

◆ p_Totaldegree()

static long p_Totaldegree ( poly  p,
const ring  r 
)
inlinestatic

Definition at line 1430 of file p_polys.h.

1431 {
1433  unsigned long s = p_GetTotalDegree(p->exp[r->VarL_Offset[0]],
1434  r,
1435  r->ExpPerLong);
1436  for (unsigned i=r->VarL_Size-1; i!=0; i--)
1437  {
1438  s += p_GetTotalDegree(p->exp[r->VarL_Offset[i]], r,r->ExpPerLong);
1439  }
1440  return (long)s;
1441 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
static unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps)
Definition: p_polys.h:771
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:185

◆ p_Var()

int p_Var ( poly  mi,
const ring  r 
)

Definition at line 4511 of file p_polys.cc.

4512 {
4513  if (m==NULL) return 0;
4514  if (pNext(m)!=NULL) return 0;
4515  int i,e=0;
4516  for (i=rVar(r); i>0; i--)
4517  {
4518  int exp=p_GetExp(m,i,r);
4519  if (exp==1)
4520  {
4521  if (e==0) e=i;
4522  else return 0;
4523  }
4524  else if (exp!=0)
4525  {
4526  return 0;
4527  }
4528  }
4529  return e;
4530 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
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:464
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
p exp[i]
Definition: DebugPrint.cc:39

◆ p_Vec2Polys()

void p_Vec2Polys ( poly  v,
poly **  p,
int *  len,
const ring  r 
)

Definition at line 3521 of file p_polys.cc.

3522 {
3523  poly h;
3524  int k;
3525 
3526  *len=p_MaxComp(v,r);
3527  if (*len==0) *len=1;
3528  *p=(poly*)omAlloc0((*len)*sizeof(poly));
3529  while (v!=NULL)
3530  {
3531  h=p_Head(v,r);
3532  k=p_GetComp(h,r);
3533  p_SetComp(h,0,r);
3534  (*p)[k-1]=p_Add_q((*p)[k-1],h,r);
3535  pIter(v);
3536  }
3537 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:287

◆ p_VectorHasUnit()

void p_VectorHasUnit ( poly  p,
int *  k,
int *  len,
const ring  r 
)

Definition at line 3296 of file p_polys.cc.

3297 {
3298  poly q=p,qq;
3299  int i,j=0;
3300 
3301  *len = 0;
3302  while (q!=NULL)
3303  {
3304  if (p_LmIsConstantComp(q,r))
3305  {
3306  i = p_GetComp(q,r);
3307  qq = p;
3308  while ((qq != q) && (p_GetComp(qq,r) != i)) pIter(qq);
3309  if (qq == q)
3310  {
3311  j = 0;
3312  while (qq!=NULL)
3313  {
3314  if (p_GetComp(qq,r)==i) j++;
3315  pIter(qq);
3316  }
3317  if ((*len == 0) || (j<*len))
3318  {
3319  *len = j;
3320  *k = i;
3321  }
3322  }
3323  }
3324  pIter(q);
3325  }
3326 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:932
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ p_VectorHasUnitB()

BOOLEAN p_VectorHasUnitB ( poly  p,
int *  k,
const ring  r 
)

Definition at line 3271 of file p_polys.cc.

3272 {
3273  poly q=p,qq;
3274  int i;
3275 
3276  while (q!=NULL)
3277  {
3278  if (p_LmIsConstantComp(q,r))
3279  {
3280  i = p_GetComp(q,r);
3281  qq = p;
3282  while ((qq != q) && (p_GetComp(qq,r) != i)) pIter(qq);
3283  if (qq == q)
3284  {
3285  *k = i;
3286  return TRUE;
3287  }
3288  else
3289  pIter(q);
3290  }
3291  else pIter(q);
3292  }
3293  return FALSE;
3294 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:932
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ p_WDegree()

long p_WDegree ( poly  p,
const ring  r 
)

Definition at line 715 of file p_polys.cc.

716 {
717  if (r->firstwv==NULL) return p_Totaldegree(p, r);
719  int i;
720  long j =0;
721 
722  for(i=1;i<=r->firstBlockEnds;i++)
723  j+=p_GetExp(p, i, r)*r->firstwv[i-1];
724 
725  for (;i<=rVar(r);i++)
726  j+=p_GetExp(p,i, r)*p_Weight(i, r);
727 
728  return j;
729 }
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
int p_Weight(int i, const ring r)
Definition: p_polys.cc:706
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:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119

◆ p_Weight()

int p_Weight ( int  c,
const ring  r 
)

Definition at line 706 of file p_polys.cc.

707 {
708  if ((r->firstwv==NULL) || (i>r->firstBlockEnds))
709  {
710  return 1;
711  }
712  return r->firstwv[i-1];
713 }
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ p_WFirstTotalDegree()

long p_WFirstTotalDegree ( poly  p,
ring  r 
)

Definition at line 597 of file p_polys.cc.

598 {
599  int i;
600  long sum = 0;
601 
602  for (i=1; i<= r->firstBlockEnds; i++)
603  {
604  sum += p_GetExp(p, i, r)*r->firstwv[i-1];
605  }
606  return sum;
607 }
return P p
Definition: myNF.cc:203
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:464
int i
Definition: cfEzgcd.cc:123

◆ p_Write() [1/2]

void p_Write ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 206 of file polys0.cc.

207 {
209  PrintLn();
210 }
void PrintLn()
Definition: reporter.cc:310
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
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:196

◆ p_Write() [2/2]

static void p_Write ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1171 of file p_polys.h.

1172 {
1173  p_Write(p, p_ring, p_ring);
1174 }
return P p
Definition: myNF.cc:203
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206

◆ p_Write0() [1/2]

void p_Write0 ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 196 of file polys0.cc.

197 {
198  char *s=p_String(p, lmRing, tailRing);
199  PrintS(s);
200  omFree(s);
201 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:186
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 omFree(addr)
Definition: omAllocDecl.h:261
void PrintS(const char *s)
Definition: reporter.cc:284

◆ p_Write0() [2/2]

static void p_Write0 ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1175 of file p_polys.h.

1176 {
1177  p_Write0(p, p_ring, p_ring);
1178 }
return P p
Definition: myNF.cc:203
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:196

◆ p_wrp() [1/2]

void p_wrp ( poly  p,
ring  lmRing,
ring  tailRing 
)

Definition at line 237 of file polys0.cc.

238 {
239  poly r;
240 
241  if (p==NULL) PrintS("NULL");
242  else if (pNext(p)==NULL) p_Write0(p, lmRing);
243  else
244  {
245  r = pNext(pNext(p));
246  pNext(pNext(p)) = NULL;
247  p_Write0(p, tailRing);
248  if (r!=NULL)
249  {
250  PrintS("+...");
251  pNext(pNext(p)) = r;
252  }
253  }
254 }
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
const ring r
Definition: syzextra.cc:208
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:196
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ p_wrp() [2/2]

static void p_wrp ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1179 of file p_polys.h.

1180 {
1181  p_wrp(p, p_ring, p_ring);
1182 }
return P p
Definition: myNF.cc:203
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237

◆ p_WTotaldegree()

long p_WTotaldegree ( poly  p,
const ring  r 
)

Definition at line 614 of file p_polys.cc.

615 {
617  int i, k;
618  long j =0;
619 
620  // iterate through each block:
621  for (i=0;r->order[i]!=0;i++)
622  {
623  int b0=r->block0[i];
624  int b1=r->block1[i];
625  switch(r->order[i])
626  {
627  case ringorder_M:
628  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
629  { // in jedem block:
630  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/]*r->OrdSgn;
631  }
632  break;
633  case ringorder_am:
634  b1=si_min(b1,r->N);
635  /* no break, continue as ringorder_a*/
636  case ringorder_a:
637  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
638  { // only one line
639  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
640  }
641  return j*r->OrdSgn;
642  case ringorder_wp:
643  case ringorder_ws:
644  case ringorder_Wp:
645  case ringorder_Ws:
646  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
647  { // in jedem block:
648  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
649  }
650  break;
651  case ringorder_lp:
652  case ringorder_ls:
653  case ringorder_rs:
654  case ringorder_dp:
655  case ringorder_ds:
656  case ringorder_Dp:
657  case ringorder_Ds:
658  case ringorder_rp:
659  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
660  {
661  j+= p_GetExp(p,k,r);
662  }
663  break;
664  case ringorder_a64:
665  {
666  int64* w=(int64*)r->wvhdl[i];
667  for (k=0;k<=(b1 /*r->block1[i]*/ - b0 /*r->block0[i]*/);k++)
668  {
669  //there should be added a line which checks if w[k]>2^31
670  j+= p_GetExp(p,k+1, r)*(long)w[k];
671  }
672  //break;
673  return j;
674  }
675  case ringorder_c: /* nothing to do*/
676  case ringorder_C: /* nothing to do*/
677  case ringorder_S: /* nothing to do*/
678  case ringorder_s: /* nothing to do*/
679  case ringorder_IS: /* nothing to do */
680  case ringorder_unspec: /* to make clang happy, does not occur*/
681  case ringorder_no: /* to make clang happy, does not occur*/
682  case ringorder_L: /* to make clang happy, does not occur*/
683  case ringorder_aa: /* ignored by p_WTotaldegree*/
684  break;
685  /* no default: all orderings covered */
686  }
687  }
688  return j;
689 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:99
for int64 weights
Definition: ring.h:79
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
return P p
Definition: myNF.cc:203
opposite of ls
Definition: ring.h:100
long int64
Definition: auxiliary.h:66
int k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
Definition: cfEzgcd.cc:66
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:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:101
S?
Definition: ring.h:83
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:119
const CanonicalForm & w
Definition: facAbsFact.cc:55
s?
Definition: ring.h:84

◆ pEnlargeSet()

void pEnlargeSet ( poly **  p,
int  length,
int  increment 
)

Definition at line 3602 of file p_polys.cc.

3603 {
3604  poly* h;
3605 
3606  if (*p==NULL)
3607  {
3608  if (increment==0) return;
3609  h=(poly*)omAlloc0(increment*sizeof(poly));
3610  }
3611  else
3612  {
3613  h=(poly*)omReallocSize((poly*)*p,l*sizeof(poly),(l+increment)*sizeof(poly));
3614  if (increment>0)
3615  {
3616  //for (i=l; i<l+increment; i++)
3617  // h[i]=NULL;
3618  memset(&(h[l]),0,increment*sizeof(poly));
3619  }
3620  }
3621  *p=h;
3622 }
return P p
Definition: myNF.cc:203
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94

◆ pHaveCommonMonoms()

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:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:44
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:164
#define NULL
Definition: omList.c:10

◆ pIsMonomOf()

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:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:44
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10

◆ pLDeg0()

long pLDeg0 ( poly  p,
int *  l,
ring  r 
)

Definition at line 740 of file p_polys.cc.

741 {
742  p_CheckPolyRing(p, r);
743  long k= p_GetComp(p, r);
744  int ll=1;
745 
746  if (k > 0)
747  {
748  while ((pNext(p)!=NULL) && (p_GetComp(pNext(p), r)==k))
749  {
750  pIter(p);
751  ll++;
752  }
753  }
754  else
755  {
756  while (pNext(p)!=NULL)
757  {
758  pIter(p);
759  ll++;
760  }
761  }
762  *l=ll;
763  return r->pFDeg(p, r);
764 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg0c()

long pLDeg0c ( poly  p,
int *  l,
ring  r 
)

Definition at line 771 of file p_polys.cc.

772 {
773  assume(p!=NULL);
774  p_Test(p,r);
775  p_CheckPolyRing(p, r);
776  long o;
777  int ll=1;
778 
779  if (! rIsSyzIndexRing(r))
780  {
781  while (pNext(p) != NULL)
782  {
783  pIter(p);
784  ll++;
785  }
786  o = r->pFDeg(p, r);
787  }
788  else
789  {
790  int curr_limit = rGetCurrSyzLimit(r);
791  poly pp = p;
792  while ((p=pNext(p))!=NULL)
793  {
794  if (p_GetComp(p, r)<=curr_limit/*syzComp*/)
795  ll++;
796  else break;
797  pp = p;
798  }
799  p_Test(pp,r);
800  o = r->pFDeg(pp, r);
801  }
802  *l=ll;
803  return o;
804 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
#define p_GetComp(p, r)
Definition: monomials.h:72
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
poly pp
Definition: myNF.cc:296
#define pIter(p)
Definition: monomials.h:44
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1()

long pLDeg1 ( poly  p,
int *  l,
ring  r 
)

Definition at line 842 of file p_polys.cc.

843 {
844  p_CheckPolyRing(p, r);
845  long k= p_GetComp(p, r);
846  int ll=1;
847  long t,max;
848 
849  max=r->pFDeg(p, r);
850  if (k > 0)
851  {
852  while (((p=pNext(p))!=NULL) && (p_GetComp(p, r)==k))
853  {
854  t=r->pFDeg(p, r);
855  if (t>max) max=t;
856  ll++;
857  }
858  }
859  else
860  {
861  while ((p=pNext(p))!=NULL)
862  {
863  t=r->pFDeg(p, r);
864  if (t>max) max=t;
865  ll++;
866  }
867  }
868  *l=ll;
869  return max;
870 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1_Deg()

long pLDeg1_Deg ( poly  p,
int *  l,
ring  r 
)

Definition at line 911 of file p_polys.cc.

912 {
913  assume(r->pFDeg == p_Deg);
914  p_CheckPolyRing(p, r);
915  long k= p_GetComp(p, r);
916  int ll=1;
917  long t,max;
918 
919  max=p_GetOrder(p, r);
920  if (k > 0)
921  {
922  while (((p=pNext(p))!=NULL) && (p_GetComp(p, r)==k))
923  {
924  t=p_GetOrder(p, r);
925  if (t>max) max=t;
926  ll++;
927  }
928  }
929  else
930  {
931  while ((p=pNext(p))!=NULL)
932  {
933  t=p_GetOrder(p, r);
934  if (t>max) max=t;
935  ll++;
936  }
937  }
938  *l=ll;
939  return max;
940 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:394
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:416
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1_Totaldegree()

long pLDeg1_Totaldegree ( poly  p,
int *  l,
ring  r 
)

Definition at line 976 of file p_polys.cc.

977 {
978  p_CheckPolyRing(p, r);
979  long k= p_GetComp(p, r);
980  int ll=1;
981  long t,max;
982 
983  max=p_Totaldegree(p, r);
984  if (k > 0)
985  {
986  while (((p=pNext(p))!=NULL) && (p_GetComp(p, r)==k))
987  {
988  t=p_Totaldegree(p, r);
989  if (t>max) max=t;
990  ll++;
991  }
992  }
993  else
994  {
995  while ((p=pNext(p))!=NULL)
996  {
997  t=p_Totaldegree(p, r);
998  if (t>max) max=t;
999  ll++;
1000  }
1001  }
1002  *l=ll;
1003  return max;
1004 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
int k
Definition: cfEzgcd.cc:93
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1_WFirstTotalDegree()

long pLDeg1_WFirstTotalDegree ( poly  p,
int *  l,
ring  r 
)

Definition at line 1039 of file p_polys.cc.

1040 {
1041  p_CheckPolyRing(p, r);
1042  long k= p_GetComp(p, r);
1043  int ll=1;
1044  long t,max;
1045 
1047  if (k > 0)
1048  {
1049  while (((p=pNext(p))!=NULL) && (p_GetComp(p, r)==k))
1050  {
1051  t=p_WFirstTotalDegree(p, r);
1052  if (t>max) max=t;
1053  ll++;
1054  }
1055  }
1056  else
1057  {
1058  while ((p=pNext(p))!=NULL)
1059  {
1060  t=p_WFirstTotalDegree(p, r);
1061  if (t>max) max=t;
1062  ll++;
1063  }
1064  }
1065  *l=ll;
1066  return max;
1067 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:597
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1c()

long pLDeg1c ( poly  p,
int *  l,
ring  r 
)

Definition at line 878 of file p_polys.cc.

879 {
880  p_CheckPolyRing(p, r);
881  int ll=1;
882  long t,max;
883 
884  max=r->pFDeg(p, r);
885  if (rIsSyzIndexRing(r))
886  {
887  long limit = rGetCurrSyzLimit(r);
888  while ((p=pNext(p))!=NULL)
889  {
890  if (p_GetComp(p, r)<=limit)
891  {
892  if ((t=r->pFDeg(p, r))>max) max=t;
893  ll++;
894  }
895  else break;
896  }
897  }
898  else
899  {
900  while ((p=pNext(p))!=NULL)
901  {
902  if ((t=r->pFDeg(p, r))>max) max=t;
903  ll++;
904  }
905  }
906  *l=ll;
907  return max;
908 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
#define p_GetComp(p, r)
Definition: monomials.h:72
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1c_Deg()

long pLDeg1c_Deg ( poly  p,
int *  l,
ring  r 
)

Definition at line 942 of file p_polys.cc.

943 {
944  assume(r->pFDeg == p_Deg);
945  p_CheckPolyRing(p, r);
946  int ll=1;
947  long t,max;
948 
949  max=p_GetOrder(p, r);
950  if (rIsSyzIndexRing(r))
951  {
952  long limit = rGetCurrSyzLimit(r);
953  while ((p=pNext(p))!=NULL)
954  {
955  if (p_GetComp(p, r)<=limit)
956  {
957  if ((t=p_GetOrder(p, r))>max) max=t;
958  ll++;
959  }
960  else break;
961  }
962  }
963  else
964  {
965  while ((p=pNext(p))!=NULL)
966  {
967  if ((t=p_GetOrder(p, r))>max) max=t;
968  ll++;
969  }
970  }
971  *l=ll;
972  return max;
973 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
#define p_GetComp(p, r)
Definition: monomials.h:72
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:394
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:416
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1c_Totaldegree()

long pLDeg1c_Totaldegree ( poly  p,
int *  l,
ring  r 
)

Definition at line 1006 of file p_polys.cc.

1007 {
1008  p_CheckPolyRing(p, r);
1009  int ll=1;
1010  long t,max;
1011 
1012  max=p_Totaldegree(p, r);
1013  if (rIsSyzIndexRing(r))
1014  {
1015  long limit = rGetCurrSyzLimit(r);
1016  while ((p=pNext(p))!=NULL)
1017  {
1018  if (p_GetComp(p, r)<=limit)
1019  {
1020  if ((t=p_Totaldegree(p, r))>max) max=t;
1021  ll++;
1022  }
1023  else break;
1024  }
1025  }
1026  else
1027  {
1028  while ((p=pNext(p))!=NULL)
1029  {
1030  if ((t=p_Totaldegree(p, r))>max) max=t;
1031  ll++;
1032  }
1033  }
1034  *l=ll;
1035  return max;
1036 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
#define p_GetComp(p, r)
Definition: monomials.h:72
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDeg1c_WFirstTotalDegree()

long pLDeg1c_WFirstTotalDegree ( poly  p,
int *  l,
ring  r 
)

Definition at line 1069 of file p_polys.cc.

1070 {
1071  p_CheckPolyRing(p, r);
1072  int ll=1;
1073  long t,max;
1074 
1076  if (rIsSyzIndexRing(r))
1077  {
1078  long limit = rGetCurrSyzLimit(r);
1079  while ((p=pNext(p))!=NULL)
1080  {
1081  if (p_GetComp(p, r)<=limit)
1082  {
1083  if ((t=p_Totaldegree(p, r))>max) max=t;
1084  ll++;
1085  }
1086  else break;
1087  }
1088  }
1089  else
1090  {
1091  while ((p=pNext(p))!=NULL)
1092  {
1093  if ((t=p_Totaldegree(p, r))>max) max=t;
1094  ll++;
1095  }
1096  }
1097  *l=ll;
1098  return max;
1099 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
#define p_GetComp(p, r)
Definition: monomials.h:72
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
static int max(int a, int b)
Definition: fast_mult.cc:264
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:597
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLDegb()

long pLDegb ( poly  p,
int *  l,
ring  r 
)

Definition at line 812 of file p_polys.cc.

813 {
814  p_CheckPolyRing(p, r);
815  long k= p_GetComp(p, r);
816  long o = r->pFDeg(p, r);
817  int ll=1;
818 
819  if (k != 0)
820  {
821  while (((p=pNext(p))!=NULL) && (p_GetComp(p, r)==k))
822  {
823  ll++;
824  }
825  }
826  else
827  {
828  while ((p=pNext(p)) !=NULL)
829  {
830  ll++;
831  }
832  }
833  *l=ll;
834  return o;
835 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:111
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int l
Definition: cfEzgcd.cc:94

◆ pLength()

static unsigned pLength ( poly  a)
inlinestatic

Definition at line 189 of file p_polys.h.

190 {
191  unsigned l = 0;
192  while (a!=NULL)
193  {
194  pIter(a);
195  l++;
196  }
197  return l;
198 }
const poly a
Definition: syzextra.cc:212
#define pIter(p)
Definition: monomials.h:44
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94

◆ pp_Jet()

poly pp_Jet ( poly  p,
int  m,
const ring  R 
)

Definition at line 4213 of file p_polys.cc.

4214 {
4215  poly r=NULL;
4216  poly t=NULL;
4217 
4218  while (p!=NULL)
4219  {
4220  if (p_Totaldegree(p,R)<=m)
4221  {
4222  if (r==NULL)
4223  r=p_Head(p,R);
4224  else
4225  if (t==NULL)
4226  {
4227  pNext(r)=p_Head(p,R);
4228  t=pNext(r);
4229  }
4230  else
4231  {
4232  pNext(t)=p_Head(p,R);
4233  pIter(t);
4234  }
4235  }
4236  pIter(p);
4237  }
4238  return r;
4239 }
return P p
Definition: myNF.cc:203
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
#define pIter(p)
Definition: monomials.h:44
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ pp_JetW()

poly pp_JetW ( poly  p,
int  m,
short *  w,
const ring  R 
)

Definition at line 4258 of file p_polys.cc.

4259 {
4260  poly r=NULL;
4261  poly t=NULL;
4262  while (p!=NULL)
4263  {
4264  if (totaldegreeWecart_IV(p,R,w)<=m)
4265  {
4266  if (r==NULL)
4267  r=p_Head(p,R);
4268  else
4269  if (t==NULL)
4270  {
4271  pNext(r)=p_Head(p,R);
4272  t=pNext(r);
4273  }
4274  else
4275  {
4276  pNext(t)=p_Head(p,R);
4277  pIter(t);
4278  }
4279  }
4280  pIter(p);
4281  }
4282  return r;
4283 }
return P p
Definition: myNF.cc:203
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:239
#define pIter(p)
Definition: monomials.h:44
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ pp_Mult_Coeff_mm_DivSelect() [1/2]

static poly pp_Mult_Coeff_mm_DivSelect ( poly  p,
const poly  m,
const ring  r 
)
inlinestatic

Definition at line 996 of file p_polys.h.

997 {
998  int shorter;
999  return r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1000 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119

◆ pp_Mult_Coeff_mm_DivSelect() [2/2]

static poly pp_Mult_Coeff_mm_DivSelect ( poly  p,
int &  lp,
const poly  m,
const ring  r 
)
inlinestatic

Definition at line 1004 of file p_polys.h.

1005 {
1006  int shorter;
1007  poly pp = r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1008  lp -= shorter;
1009  return pp;
1010 }
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
polyrec * poly
Definition: hilb.h:10

◆ pp_Mult_mm()

static poly pp_Mult_mm ( poly  p,
poly  m,
const ring  r 
)
inlinestatic

Definition at line 957 of file p_polys.h.

958 {
959  if (p_LmIsConstant(m, r))
960  return pp_Mult_nn(p, pGetCoeff(m), r);
961  else
962  {
963  return r->p_Procs->pp_Mult_mm(p, m, r);
964  }
965 }
return P p
Definition: myNF.cc:203
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
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
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:949
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119

◆ pp_Mult_nn()

static poly pp_Mult_nn ( poly  p,
number  n,
const ring  r 
)
inlinestatic

Definition at line 922 of file p_polys.h.

923 {
924  if (n_IsOne(n, r->cf))
925  return p_Copy(p, r);
926  else
927  return r->p_Procs->pp_Mult_nn(p, n, r);
928 }
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
const ring r
Definition: syzextra.cc:208

◆ pp_Mult_qq()

static poly pp_Mult_qq ( poly  p,
poly  q,
const ring  r 
)
inlinestatic

Definition at line 1070 of file p_polys.h.

1071 {
1072  if (p == NULL || q == NULL) return NULL;
1073 
1074  if (pNext(p) == NULL)
1075  {
1076 #ifdef HAVE_PLURAL
1077  if (rIsPluralRing(r))
1078  return nc_mm_Mult_pp(p, q, r);
1079 #endif
1080  return r->p_Procs->pp_Mult_mm(q, p, r);
1081  }
1082 
1083  if (pNext(q) == NULL)
1084  {
1085  return r->p_Procs->pp_Mult_mm(p, q, r);
1086  }
1087 
1088  poly qq = q;
1089  if (p == q)
1090  qq = p_Copy(q, r);
1091 
1092  poly res;
1093 #ifdef HAVE_PLURAL
1094  if (rIsPluralRing(r))
1095  res = _nc_pp_Mult_qq(p, qq, r);
1096  else
1097 #endif
1098  res = _p_Mult_q(p, qq, 1, r);
1099 
1100  if (qq != q)
1101  p_Delete(&qq, r);
1102  return res;
1103 }
poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r)
general NC-multiplication without destruction
Definition: old.gring.cc:259
poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2.
Definition: p_Mult_q.cc:271
return P p
Definition: myNF.cc:203
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
polyrec * poly
Definition: hilb.h:10

◆ pRestoreDegProcs()

void pRestoreDegProcs ( ring  r,
pFDegProc  old_FDeg,
pLDegProc  old_lDeg 
)

Definition at line 3555 of file p_polys.cc.

3556 {
3557  assume(old_FDeg != NULL && old_lDeg != NULL);
3558  r->pFDeg = old_FDeg;
3559  r->pLDeg = old_lDeg;
3560 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10

◆ pReverse()

static poly pReverse ( poly  p)
inlinestatic

Definition at line 330 of file p_polys.h.

331 {
332  if (p == NULL || pNext(p) == NULL) return p;
333 
334  poly q = pNext(p), // == pNext(p)
335  qn;
336  pNext(p) = NULL;
337  do
338  {
339  qn = pNext(q);
340  pNext(q) = p;
341  p = q;
342  q = qn;
343  }
344  while (qn != NULL);
345  return p;
346 }
return P p
Definition: myNF.cc:203
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ pSetDegProcs()

void pSetDegProcs ( ring  r,
pFDegProc  new_FDeg,
pLDegProc  new_lDeg = NULL 
)

Definition at line 3543 of file p_polys.cc.

3544 {
3545  assume(new_FDeg != NULL);
3546  r->pFDeg = new_FDeg;
3547 
3548  if (new_lDeg == NULL)
3549  new_lDeg = r->pLDegOrig;
3550 
3551  r->pLDeg = new_lDeg;
3552 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10