My Project  UNKNOWN_GIT_VERSION
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_Mult_nn(p, n, r)   r->p_Procs->p_Mult_nn(p, n, r)
 
#define __pp_Mult_nn(p, n, r)   r->p_Procs->pp_Mult_nn(p, n, r)
 
#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)
 
poly p_Vec2Poly (poly v, int k, const ring r)
 
void p_Vec2Array (poly v, poly *p, int len, const ring r)
 julia: vector to already allocated array (len=p_MaxComp(v,r)) More...
 
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_ContentForGB (poly p, const ring r)
 
void p_Content (poly p, const ring r)
 
void p_SimpleContent (poly p, int s, const ring r)
 
number p_InitContent (poly ph, 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 @Note: 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 @Note: 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_GetExpVL (poly p, int64 *ev, const ring r)
 
static void p_SetExpV (poly p, int *ev, const ring r)
 
static void p_SetExpVL (poly p, int64 *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 int p_CmpPolys (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_MDivide (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)
 
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_Mult_nn

#define __p_Mult_nn (   p,
  n,
 
)    r->p_Procs->p_Mult_nn(p, n, r)

Definition at line 928 of file p_polys.h.

◆ __pp_Mult_nn

#define __pp_Mult_nn (   p,
  n,
 
)    r->p_Procs->pp_Mult_nn(p, n, r)

Definition at line 959 of file p_polys.h.

◆ _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)

Definition at line 1213 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 1645 of file p_polys.h.

◆ p_LmEqual

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

Definition at line 1649 of file p_polys.h.

◆ p_LmTest

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

Definition at line 165 of file p_polys.h.

◆ p_SetmComp

#define p_SetmComp   p_Setm

Definition at line 245 of file p_polys.h.

◆ p_Test

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

Definition at line 164 of file p_polys.h.

◆ pDivAssume

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

Definition at line 1219 of file p_polys.h.

◆ pIfThen

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

Definition at line 158 of file p_polys.h.

◆ pp_Test

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

Definition at line 166 of file p_polys.h.

Function Documentation

◆ _p_LmDivisibleBy() [1/2]

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

Definition at line 1801 of file p_polys.h.

1802 {
1803  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
1804  return _p_LmDivisibleByNoComp(a, r_a, b, r_b);
1805  return FALSE;
1806 }

◆ _p_LmDivisibleBy() [2/2]

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

Definition at line 1795 of file p_polys.h.

1796 {
1797  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1798  return _p_LmDivisibleByNoComp(a, b, r);
1799  return FALSE;
1800 }

◆ _p_LmDivisibleByNoComp() [1/2]

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

Definition at line 1740 of file p_polys.h.

1741 {
1742  int i=r_a->N;
1743  pAssume1(r_a->N == r_b->N);
1744 
1745  do
1746  {
1747  if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
1748  return FALSE;
1749  i--;
1750  }
1751  while (i);
1752 /*#ifdef HAVE_RINGS
1753  return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
1754 #else
1755 */
1756  return TRUE;
1757 //#endif
1758 }

◆ _p_LmDivisibleByNoComp() [2/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 1691 of file p_polys.h.

1692 {
1693  int i=r->VarL_Size - 1;
1694  unsigned long divmask = r->divmask;
1695  unsigned long la, lb;
1696 
1697  if (r->VarL_LowIndex >= 0)
1698  {
1699  i += r->VarL_LowIndex;
1700  do
1701  {
1702  la = a->exp[i];
1703  lb = b->exp[i];
1704  if ((la > lb) ||
1705  (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1706  {
1708  return FALSE;
1709  }
1710  i--;
1711  }
1712  while (i>=r->VarL_LowIndex);
1713  }
1714  else
1715  {
1716  do
1717  {
1718  la = a->exp[r->VarL_Offset[i]];
1719  lb = b->exp[r->VarL_Offset[i]];
1720  if ((la > lb) ||
1721  (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1722  {
1724  return FALSE;
1725  }
1726  i--;
1727  }
1728  while (i>=0);
1729  }
1730 /*#ifdef HAVE_RINGS
1731  pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf));
1732  return (!rField_is_Ring(r)) || n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf);
1733 #else
1734 */
1736  return TRUE;
1737 //#endif
1738 }

◆ _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 1761 of file p_polys.h.

1762 {
1763  int i=end;
1764  pAssume1(r_a->N == r_b->N);
1765 
1766  do
1767  {
1768  if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
1769  return FALSE;
1770  i--;
1771  }
1772  while (i>=start);
1773 /*#ifdef HAVE_RINGS
1774  return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
1775 #else
1776 */
1777  return TRUE;
1778 //#endif
1779 }

◆ _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 1780 of file p_polys.h.

1781 {
1782  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
1783  return _p_LmDivisibleByNoCompPart(a, r_a, b, r_b,start,end);
1784  return FALSE;
1785 }

◆ _p_LmTest()

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

Definition at line 323 of file pDebug.cc.

324 {
325  if (level < 0 || p == NULL) return TRUE;
326  poly pnext = pNext(p);
327  pNext(p) = NULL;
328  BOOLEAN test_res = _p_Test(p, r, level);
329  pNext(p) = pnext;
330  return test_res;
331 }

◆ _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 273 of file p_Mult_q.cc.

274 {
275  assume(r != NULL);
276 #ifdef HAVE_RINGS
277  if (!nCoeff_is_Domain(r->cf))
278  return _p_Mult_q_Normal_ZeroDiv(p, q, copy, r);
279 #endif
280  int lp, lq, l;
281  poly pt;
282 
283  pqLength(p, q, lp, lq, MIN_LENGTH_BUCKET);
284 
285  if (lp < lq)
286  {
287  pt = p;
288  p = q;
289  q = pt;
290  l = lp;
291  lp = lq;
292  lq = l;
293  }
295  return _p_Mult_q_Normal(p, q, copy, r);
296  else if ((lq >= MIN_LENGTH_FACTORY)
297  && (r->cf->convSingNFactoryN!=ndConvSingNFactoryN))
298  {
299  poly h=singclap_pmult(p,q,r);
300  if (!copy)
301  {
302  p_Delete(&p,r);
303  p_Delete(&q,r);
304  }
305  return h;
306  }
307  else
308  {
309  assume(lp == pLength(p));
310  assume(lq == pLength(q));
311  return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
312  }
313 }

◆ _p_Test()

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

Definition at line 212 of file pDebug.cc.

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

◆ _pp_Test()

BOOLEAN _pp_Test ( poly  p,
ring  lmRing,
ring  tailRing,
int  level 
)

Definition at line 333 of file pDebug.cc.

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

◆ n_PermNumber()

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

Definition at line 3924 of file p_polys.cc.

3925 {
3926 #if 0
3927  PrintS("\nSource Ring: \n");
3928  rWrite(src);
3929 
3930  if(0)
3931  {
3932  number zz = n_Copy(z, src->cf);
3933  PrintS("z: "); n_Write(zz, src);
3934  n_Delete(&zz, src->cf);
3935  }
3936 
3937  PrintS("\nDestination Ring: \n");
3938  rWrite(dst);
3939 
3940  /*Print("\nOldPar: %d\n", OldPar);
3941  for( int i = 1; i <= OldPar; i++ )
3942  {
3943  Print("par(%d) -> par/var (%d)\n", i, par_perm[i-1]);
3944  }*/
3945 #endif
3946  if( z == NULL )
3947  return NULL;
3948 
3949  const coeffs srcCf = src->cf;
3950  assume( srcCf != NULL );
3951 
3952  assume( !nCoeff_is_GF(srcCf) );
3953  assume( src->cf->extRing!=NULL );
3954 
3955  poly zz = NULL;
3956 
3957  const ring srcExtRing = srcCf->extRing;
3958  assume( srcExtRing != NULL );
3959 
3960  const coeffs dstCf = dst->cf;
3961  assume( dstCf != NULL );
3962 
3963  if( nCoeff_is_algExt(srcCf) ) // nCoeff_is_GF(srcCf)?
3964  {
3965  zz = (poly) z;
3966  if( zz == NULL ) return NULL;
3967  }
3968  else if (nCoeff_is_transExt(srcCf))
3969  {
3970  assume( !IS0(z) );
3971 
3972  zz = NUM((fraction)z);
3973  p_Test (zz, srcExtRing);
3974 
3975  if( zz == NULL ) return NULL;
3976  if( !DENIS1((fraction)z) )
3977  {
3978  if (!p_IsConstant(DEN((fraction)z),srcExtRing))
3979  WarnS("Not defined: Cannot map a rational fraction and make a polynomial out of it! Ignoring the denominator.");
3980  }
3981  }
3982  else
3983  {
3984  assume (FALSE);
3985  WerrorS("Number permutation is not implemented for this data yet!");
3986  return NULL;
3987  }
3988 
3989  assume( zz != NULL );
3990  p_Test (zz, srcExtRing);
3991 
3992  nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf);
3993 
3994  assume( nMap != NULL );
3995 
3996  poly qq;
3997  if ((par_perm == NULL) && (rPar(dst) != 0 && rVar (srcExtRing) > 0))
3998  {
3999  int* perm;
4000  perm=(int *)omAlloc0((rVar(srcExtRing)+1)*sizeof(int));
4001  perm[0]= 0;
4002  for(int i=si_min(rVar(srcExtRing),rPar(dst));i>0;i--)
4003  perm[i]=-i;
4004  qq = p_PermPoly(zz, perm, srcExtRing, dst, nMap, NULL, rVar(srcExtRing)-1);
4005  omFreeSize ((ADDRESS)perm, (rVar(srcExtRing)+1)*sizeof(int));
4006  }
4007  else
4008  qq = p_PermPoly(zz, par_perm-1, srcExtRing, dst, nMap, NULL, rVar (srcExtRing)-1);
4009 
4010  if(nCoeff_is_transExt(srcCf)
4011  && (!DENIS1((fraction)z))
4012  && p_IsConstant(DEN((fraction)z),srcExtRing))
4013  {
4014  number n=nMap(pGetCoeff(DEN((fraction)z)),srcExtRing->cf, dstCf);
4015  qq=p_Div_nn(qq,n,dst);
4016  n_Delete(&n,dstCf);
4017  p_Normalize(qq,dst);
4018  }
4019  p_Test (qq, dst);
4020 
4021  return qq;
4022 }

◆ p_Add_q() [1/2]

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

Definition at line 893 of file p_polys.h.

894 {
895  assume( (p != q) || (p == NULL && q == NULL) );
896  if (q==NULL) return p;
897  if (p==NULL) return q;
898  int shorter;
899  return r->p_Procs->p_Add_q(p, q, shorter, r);
900 }

◆ 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 903 of file p_polys.h.

904 {
905  assume( (p != q) || (p == NULL && q == NULL) );
906  if (q==NULL) return p;
907  if (p==NULL) { lp=lq; return q; }
908  int shorter;
909  poly res = r->p_Procs->p_Add_q(p, q, shorter, r);
910  lp += lq - shorter;
911  return res;
912 }

◆ p_AddComp()

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

Definition at line 448 of file p_polys.h.

449 {
450  p_LmCheckPolyRing2(p, r);
452  return __p_GetComp(p,r) += v;
453 }

◆ p_AddExp()

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

Definition at line 607 of file p_polys.h.

608 {
609  p_LmCheckPolyRing2(p, r);
610  int e = p_GetExp(p,v,r);
611  e += ee;
612  return p_SetExp(p,v,e,r);
613 }

◆ p_CheckIsFromRing()

BOOLEAN p_CheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 102 of file pDebug.cc.

103 {
104  while (p!=NULL)
105  {
107  pIter(p);
108  }
109  return TRUE;
110 }

◆ p_CheckPolyRing()

BOOLEAN p_CheckPolyRing ( poly  p,
ring  r 
)

Definition at line 112 of file pDebug.cc.

113 {
114  #ifndef X_OMALLOC
115  pAssumeReturn(r != NULL && r->PolyBin != NULL);
116  #endif
117  return p_CheckIsFromRing(p, r);
118 }

◆ p_CheckRing()

BOOLEAN p_CheckRing ( ring  r)

Definition at line 128 of file pDebug.cc.

129 {
130  #ifndef X_OMALLOC
131  pAssumeReturn(r != NULL && r->PolyBin != NULL);
132  #endif
133  return TRUE;
134 }

◆ p_ChineseRemainder()

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

Definition at line 85 of file p_polys.cc.

86 {
87  poly r,h,hh;
88  int j;
89  poly res_p=NULL;
90  loop
91  {
92  /* search the lead term */
93  r=NULL;
94  for(j=rl-1;j>=0;j--)
95  {
96  h=xx[j];
97  if ((h!=NULL)
98  &&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
99  r=h;
100  }
101  /* nothing found -> return */
102  if (r==NULL) break;
103  /* create the monomial in h */
104  h=p_Head(r,R);
105  /* collect the coeffs in x[..]*/
106  for(j=rl-1;j>=0;j--)
107  {
108  hh=xx[j];
109  if ((hh!=NULL) && (p_LmCmp(h,hh,R)==0))
110  {
111  x[j]=pGetCoeff(hh);
112  hh=p_LmFreeAndNext(hh,R);
113  xx[j]=hh;
114  }
115  else
116  x[j]=n_Init(0, R->cf);
117  }
118  number n=n_ChineseRemainderSym(x,q,rl,TRUE,inv_cache,R->cf);
119  for(j=rl-1;j>=0;j--)
120  {
121  x[j]=NULL; // n_Init(0...) takes no memory
122  }
123  if (n_IsZero(n,R->cf)) p_Delete(&h,R);
124  else
125  {
126  //Print("new mon:");pWrite(h);
127  p_SetCoeff(h,n,R);
128  pNext(h)=res_p;
129  res_p=h; // building res_p in reverse order!
130  }
131  }
132  res_p=pReverse(res_p);
133  p_Test(res_p, R);
134  return res_p;
135 }

◆ p_Cleardenom()

poly p_Cleardenom ( poly  p,
const ring  r 
)

Definition at line 2782 of file p_polys.cc.

2783 {
2784  if( p == NULL )
2785  return NULL;
2786 
2787  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
2788 
2789 #if CLEARENUMERATORS
2790  if( 0 )
2791  {
2792  CPolyCoeffsEnumerator itr(p);
2793  n_ClearDenominators(itr, C);
2794  n_ClearContent(itr, C); // divide out the content
2795  p_Test(p, r); n_Test(pGetCoeff(p), C);
2796  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2797 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2798  return p;
2799  }
2800 #endif
2801 
2802  number d, h;
2803 
2804  if (rField_is_Ring(r))
2805  {
2806  p_ContentForGB(p,r);
2807  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2808  return p;
2809  }
2810 
2812  {
2813  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2814  return p;
2815  }
2816 
2817  assume(p != NULL);
2818 
2819  if(pNext(p)==NULL)
2820  {
2821  if (!TEST_OPT_CONTENTSB
2822  && !rField_is_Ring(r))
2823  p_SetCoeff(p,n_Init(1,r->cf),r);
2824  else if(!n_GreaterZero(pGetCoeff(p),C))
2825  p = p_Neg(p,r);
2826  return p;
2827  }
2828 
2829  assume(pNext(p)!=NULL);
2830  poly start=p;
2831 
2832 #if 0 && CLEARENUMERATORS
2833 //CF: does not seem to work that well..
2834 
2835  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2836  {
2837  CPolyCoeffsEnumerator itr(p);
2838  n_ClearDenominators(itr, C);
2839  n_ClearContent(itr, C); // divide out the content
2840  p_Test(p, r); n_Test(pGetCoeff(p), C);
2841  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2842 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2843  return start;
2844  }
2845 #endif
2846 
2847  if(1)
2848  {
2849  // get lcm of all denominators ----------------------------------
2850  h = n_Init(1,r->cf);
2851  while (p!=NULL)
2852  {
2853  n_Normalize(pGetCoeff(p),r->cf);
2854  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2855  n_Delete(&h,r->cf);
2856  h=d;
2857  pIter(p);
2858  }
2859  /* h now contains the 1/lcm of all denominators */
2860  if(!n_IsOne(h,r->cf))
2861  {
2862  // multiply by the lcm of all denominators
2863  p = start;
2864  while (p!=NULL)
2865  {
2866  d=n_Mult(h,pGetCoeff(p),r->cf);
2867  n_Normalize(d,r->cf);
2868  p_SetCoeff(p,d,r);
2869  pIter(p);
2870  }
2871  }
2872  n_Delete(&h,r->cf);
2873  p=start;
2874 
2875  p_ContentForGB(p,r);
2876 #ifdef HAVE_RATGRING
2877  if (rIsRatGRing(r))
2878  {
2879  /* quick unit detection in the rational case is done in gr_nc_bba */
2880  p_ContentRat(p, r);
2881  start=p;
2882  }
2883 #endif
2884  }
2885 
2886  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2887 
2888  return start;
2889 }

◆ p_Cleardenom_n()

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

Definition at line 2891 of file p_polys.cc.

2892 {
2893  const coeffs C = r->cf;
2894  number d, h;
2895 
2896  assume( ph != NULL );
2897 
2898  poly p = ph;
2899 
2900 #if CLEARENUMERATORS
2901  if( 0 )
2902  {
2903  CPolyCoeffsEnumerator itr(ph);
2904 
2905  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2906  n_ClearContent(itr, h, C); // divide by the content h
2907 
2908  c = n_Div(d, h, C); // d/h
2909 
2910  n_Delete(&d, C);
2911  n_Delete(&h, C);
2912 
2913  n_Test(c, C);
2914 
2915  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2916  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2917 /*
2918  if(!n_GreaterZero(pGetCoeff(ph),C))
2919  {
2920  ph = p_Neg(ph,r);
2921  c = n_InpNeg(c, C);
2922  }
2923 */
2924  return;
2925  }
2926 #endif
2927 
2928 
2929  if( pNext(p) == NULL )
2930  {
2931  if(!TEST_OPT_CONTENTSB)
2932  {
2933  c=n_Invers(pGetCoeff(p), C);
2934  p_SetCoeff(p, n_Init(1, C), r);
2935  }
2936  else
2937  {
2938  c=n_Init(1,C);
2939  }
2940 
2941  if(!n_GreaterZero(pGetCoeff(ph),C))
2942  {
2943  ph = p_Neg(ph,r);
2944  c = n_InpNeg(c, C);
2945  }
2946 
2947  return;
2948  }
2949  if (TEST_OPT_CONTENTSB) { c=n_Init(1,C); return; }
2950 
2951  assume( pNext(p) != NULL );
2952 
2953 #if CLEARENUMERATORS
2954  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2955  {
2956  CPolyCoeffsEnumerator itr(ph);
2957 
2958  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2959  n_ClearContent(itr, h, C); // divide by the content h
2960 
2961  c = n_Div(d, h, C); // d/h
2962 
2963  n_Delete(&d, C);
2964  n_Delete(&h, C);
2965 
2966  n_Test(c, C);
2967 
2968  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2969  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2970 /*
2971  if(!n_GreaterZero(pGetCoeff(ph),C))
2972  {
2973  ph = p_Neg(ph,r);
2974  c = n_InpNeg(c, C);
2975  }
2976 */
2977  return;
2978  }
2979 #endif
2980 
2981 
2982 
2983 
2984  if(1)
2985  {
2986  h = n_Init(1,r->cf);
2987  while (p!=NULL)
2988  {
2989  n_Normalize(pGetCoeff(p),r->cf);
2990  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2991  n_Delete(&h,r->cf);
2992  h=d;
2993  pIter(p);
2994  }
2995  c=h;
2996  /* contains the 1/lcm of all denominators */
2997  if(!n_IsOne(h,r->cf))
2998  {
2999  p = ph;
3000  while (p!=NULL)
3001  {
3002  /* should be: // NOTE: don't use ->coef!!!!
3003  * number hh;
3004  * nGetDenom(p->coef,&hh);
3005  * nMult(&h,&hh,&d);
3006  * nNormalize(d);
3007  * nDelete(&hh);
3008  * nMult(d,p->coef,&hh);
3009  * nDelete(&d);
3010  * nDelete(&(p->coef));
3011  * p->coef =hh;
3012  */
3013  d=n_Mult(h,pGetCoeff(p),r->cf);
3014  n_Normalize(d,r->cf);
3015  p_SetCoeff(p,d,r);
3016  pIter(p);
3017  }
3018  if (rField_is_Q_a(r))
3019  {
3020  loop
3021  {
3022  h = n_Init(1,r->cf);
3023  p=ph;
3024  while (p!=NULL)
3025  {
3026  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
3027  n_Delete(&h,r->cf);
3028  h=d;
3029  pIter(p);
3030  }
3031  /* contains the 1/lcm of all denominators */
3032  if(!n_IsOne(h,r->cf))
3033  {
3034  p = ph;
3035  while (p!=NULL)
3036  {
3037  /* should be: // NOTE: don't use ->coef!!!!
3038  * number hh;
3039  * nGetDenom(p->coef,&hh);
3040  * nMult(&h,&hh,&d);
3041  * nNormalize(d);
3042  * nDelete(&hh);
3043  * nMult(d,p->coef,&hh);
3044  * nDelete(&d);
3045  * nDelete(&(p->coef));
3046  * p->coef =hh;
3047  */
3048  d=n_Mult(h,pGetCoeff(p),r->cf);
3049  n_Normalize(d,r->cf);
3050  p_SetCoeff(p,d,r);
3051  pIter(p);
3052  }
3053  number t=n_Mult(c,h,r->cf);
3054  n_Delete(&c,r->cf);
3055  c=t;
3056  }
3057  else
3058  {
3059  break;
3060  }
3061  n_Delete(&h,r->cf);
3062  }
3063  }
3064  }
3065  }
3066 
3067  if(!n_GreaterZero(pGetCoeff(ph),C))
3068  {
3069  ph = p_Neg(ph,r);
3070  c = n_InpNeg(c, C);
3071  }
3072 
3073 }

◆ p_Cmp()

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

Definition at line 1653 of file p_polys.h.

1654 {
1655  if (p2==NULL)
1656  {
1657  if (p1==NULL) return 0;
1658  return 1;
1659  }
1660  if (p1==NULL)
1661  return -1;
1662  return p_LmCmp(p1,p2,r);
1663 }

◆ p_CmpPolys()

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

Definition at line 1665 of file p_polys.h.

1666 {
1667  if (p2==NULL)
1668  {
1669  if (p1==NULL) return 0;
1670  return 1;
1671  }
1672  if (p1==NULL)
1673  return -1;
1674  return p_ComparePolys(p1,p2,r);
1675 }

◆ p_Comp_k_n()

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

Definition at line 641 of file p_polys.h.

642 {
643  if ((a==NULL) || (b==NULL) ) return FALSE;
644  p_LmCheckPolyRing2(a, r);
645  p_LmCheckPolyRing2(b, r);
646  pAssume2(k > 0 && k <= r->N);
647  int i=k;
648  for(;i<=r->N;i++)
649  {
650  if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE;
651  // if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;
652  }
653  return TRUE;
654 }

◆ p_Compare()

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

Definition at line 4804 of file p_polys.cc.

4805 {
4806  int r=p_Cmp(a,b,R);
4807  if ((r==0)&&(a!=NULL))
4808  {
4809  number h=n_Sub(pGetCoeff(a),pGetCoeff(b),R->cf);
4810  /* compare lead coeffs */
4811  r = -1+n_IsZero(h,R->cf)+2*n_GreaterZero(h,R->cf); /* -1: <, 0:==, 1: > */
4812  n_Delete(&h,R->cf);
4813  }
4814  else if (a==NULL)
4815  {
4816  if (b==NULL)
4817  {
4818  /* compare 0, 0 */
4819  r=0;
4820  }
4821  else if(p_IsConstant(b,R))
4822  {
4823  /* compare 0, const */
4824  r = 1-2*n_GreaterZero(pGetCoeff(b),R->cf); /* -1: <, 1: > */
4825  }
4826  }
4827  else if (b==NULL)
4828  {
4829  if (p_IsConstant(a,R))
4830  {
4831  /* compare const, 0 */
4832  r = -1+2*n_GreaterZero(pGetCoeff(a),R->cf); /* -1: <, 1: > */
4833  }
4834  }
4835  return(r);
4836 }

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

4475 {
4476  number n,nn;
4477  pAssume(p1 != NULL && p2 != NULL);
4478 
4479  if (!p_LmEqual(p1,p2,r)) //compare leading mons
4480  return FALSE;
4481  if ((pNext(p1)==NULL) && (pNext(p2)!=NULL))
4482  return FALSE;
4483  if ((pNext(p2)==NULL) && (pNext(p1)!=NULL))
4484  return FALSE;
4485  if (pLength(p1) != pLength(p2))
4486  return FALSE;
4487  #ifdef HAVE_RINGS
4488  if (rField_is_Ring(r))
4489  {
4490  if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf)) return FALSE;
4491  }
4492  #endif
4493  n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf);
4494  while ((p1 != NULL) /*&& (p2 != NULL)*/)
4495  {
4496  if ( ! p_LmEqual(p1, p2,r))
4497  {
4498  n_Delete(&n, r->cf);
4499  return FALSE;
4500  }
4501  if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf))
4502  {
4503  n_Delete(&n, r->cf);
4504  n_Delete(&nn, r->cf);
4505  return FALSE;
4506  }
4507  n_Delete(&nn, r->cf);
4508  pIter(p1);
4509  pIter(p2);
4510  }
4511  n_Delete(&n, r->cf);
4512  return TRUE;
4513 }

◆ p_Content()

void p_Content ( poly  p,
const ring  r 
)

Definition at line 2238 of file p_polys.cc.

2239 {
2240  if (ph==NULL) return;
2241  const coeffs cf=r->cf;
2242  if (pNext(ph)==NULL)
2243  {
2244  p_SetCoeff(ph,n_Init(1,cf),r);
2245  }
2246  if (cf->cfSubringGcd==ndGcd) /* trivial gcd*/ return;
2247  number h=p_InitContent(ph,r); /* first guess of a gcd of all coeffs */
2248  poly p;
2249  if(n_IsOne(h,cf))
2250  {
2251  goto content_finish;
2252  }
2253  p=ph;
2254  // take the SubringGcd of all coeffs
2255  while (p!=NULL)
2256  {
2258  number d=n_SubringGcd(h,pGetCoeff(p),cf);
2259  n_Delete(&h,cf);
2260  h = d;
2261  if(n_IsOne(h,cf))
2262  {
2263  goto content_finish;
2264  }
2265  pIter(p);
2266  }
2267  // if found<>1, divide by it
2268  p = ph;
2269  while (p!=NULL)
2270  {
2271  number d = n_ExactDiv(pGetCoeff(p),h,cf);
2272  p_SetCoeff(p,d,r);
2273  pIter(p);
2274  }
2275 content_finish:
2276  n_Delete(&h,r->cf);
2277  // and last: check leading sign:
2278  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2279 }

◆ p_ContentForGB()

void p_ContentForGB ( poly  p,
const ring  r 
)

Definition at line 2283 of file p_polys.cc.

2284 {
2285  if(TEST_OPT_CONTENTSB) return;
2286  assume( ph != NULL );
2287 
2288  assume( r != NULL ); assume( r->cf != NULL );
2289 
2290 
2291 #if CLEARENUMERATORS
2292  if( 0 )
2293  {
2294  const coeffs C = r->cf;
2295  // experimentall (recursive enumerator treatment) of alg. Ext!
2296  CPolyCoeffsEnumerator itr(ph);
2297  n_ClearContent(itr, r->cf);
2298 
2299  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2300  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2301 
2302  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2303  return;
2304  }
2305 #endif
2306 
2307 
2308 #ifdef HAVE_RINGS
2309  if (rField_is_Ring(r))
2310  {
2311  if (rField_has_Units(r))
2312  {
2313  number k = n_GetUnit(pGetCoeff(ph),r->cf);
2314  if (!n_IsOne(k,r->cf))
2315  {
2316  number tmpGMP = k;
2317  k = n_Invers(k,r->cf);
2318  n_Delete(&tmpGMP,r->cf);
2319  poly h = pNext(ph);
2320  p_SetCoeff(ph, n_Mult(pGetCoeff(ph), k,r->cf),r);
2321  while (h != NULL)
2322  {
2323  p_SetCoeff(h, n_Mult(pGetCoeff(h), k,r->cf),r);
2324  pIter(h);
2325  }
2326 // assume( n_GreaterZero(pGetCoeff(ph),r->cf) );
2327 // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2328  }
2329  n_Delete(&k,r->cf);
2330  }
2331  return;
2332  }
2333 #endif
2334  number h,d;
2335  poly p;
2336 
2337  if(pNext(ph)==NULL)
2338  {
2339  p_SetCoeff(ph,n_Init(1,r->cf),r);
2340  }
2341  else
2342  {
2343  assume( pNext(ph) != NULL );
2344 #if CLEARENUMERATORS
2345  if( nCoeff_is_Q(r->cf) )
2346  {
2347  // experimentall (recursive enumerator treatment) of alg. Ext!
2348  CPolyCoeffsEnumerator itr(ph);
2349  n_ClearContent(itr, r->cf);
2350 
2351  p_Test(ph, r); n_Test(pGetCoeff(ph), r->cf);
2352  assume(n_GreaterZero(pGetCoeff(ph), r->cf)); // ??
2353 
2354  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2355  return;
2356  }
2357 #endif
2358 
2359  n_Normalize(pGetCoeff(ph),r->cf);
2360  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2361  if (rField_is_Q(r)||(getCoeffType(r->cf)==n_transExt)) // should not be used anymore if CLEARENUMERATORS is 1
2362  {
2363  h=p_InitContent(ph,r);
2364  p=ph;
2365  }
2366  else
2367  {
2368  h=n_Copy(pGetCoeff(ph),r->cf);
2369  p = pNext(ph);
2370  }
2371  while (p!=NULL)
2372  {
2373  n_Normalize(pGetCoeff(p),r->cf);
2374  d=n_SubringGcd(h,pGetCoeff(p),r->cf);
2375  n_Delete(&h,r->cf);
2376  h = d;
2377  if(n_IsOne(h,r->cf))
2378  {
2379  break;
2380  }
2381  pIter(p);
2382  }
2383  //number tmp;
2384  if(!n_IsOne(h,r->cf))
2385  {
2386  p = ph;
2387  while (p!=NULL)
2388  {
2389  //d = nDiv(pGetCoeff(p),h);
2390  //tmp = nExactDiv(pGetCoeff(p),h);
2391  //if (!nEqual(d,tmp))
2392  //{
2393  // StringSetS("** div0:");nWrite(pGetCoeff(p));StringAppendS("/");
2394  // nWrite(h);StringAppendS("=");nWrite(d);StringAppendS(" int:");
2395  // nWrite(tmp);Print(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
2396  //}
2397  //nDelete(&tmp);
2398  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2399  p_SetCoeff(p,d,r);
2400  pIter(p);
2401  }
2402  }
2403  n_Delete(&h,r->cf);
2404  if (rField_is_Q_a(r))
2405  {
2406  // special handling for alg. ext.:
2407  if (getCoeffType(r->cf)==n_algExt)
2408  {
2409  h = n_Init(1, r->cf->extRing->cf);
2410  p=ph;
2411  while (p!=NULL)
2412  { // each monom: coeff in Q_a
2413  poly c_n_n=(poly)pGetCoeff(p);
2414  poly c_n=c_n_n;
2415  while (c_n!=NULL)
2416  { // each monom: coeff in Q
2417  d=n_NormalizeHelper(h,pGetCoeff(c_n),r->cf->extRing->cf);
2418  n_Delete(&h,r->cf->extRing->cf);
2419  h=d;
2420  pIter(c_n);
2421  }
2422  pIter(p);
2423  }
2424  /* h contains the 1/lcm of all denominators in c_n_n*/
2425  //n_Normalize(h,r->cf->extRing->cf);
2426  if(!n_IsOne(h,r->cf->extRing->cf))
2427  {
2428  p=ph;
2429  while (p!=NULL)
2430  { // each monom: coeff in Q_a
2431  poly c_n=(poly)pGetCoeff(p);
2432  while (c_n!=NULL)
2433  { // each monom: coeff in Q
2434  d=n_Mult(h,pGetCoeff(c_n),r->cf->extRing->cf);
2435  n_Normalize(d,r->cf->extRing->cf);
2436  n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf);
2437  pGetCoeff(c_n)=d;
2438  pIter(c_n);
2439  }
2440  pIter(p);
2441  }
2442  }
2443  n_Delete(&h,r->cf->extRing->cf);
2444  }
2445  /*else
2446  {
2447  // special handling for rat. functions.:
2448  number hzz =NULL;
2449  p=ph;
2450  while (p!=NULL)
2451  { // each monom: coeff in Q_a (Z_a)
2452  fraction f=(fraction)pGetCoeff(p);
2453  poly c_n=NUM(f);
2454  if (hzz==NULL)
2455  {
2456  hzz=n_Copy(pGetCoeff(c_n),r->cf->extRing->cf);
2457  pIter(c_n);
2458  }
2459  while ((c_n!=NULL)&&(!n_IsOne(hzz,r->cf->extRing->cf)))
2460  { // each monom: coeff in Q (Z)
2461  d=n_Gcd(hzz,pGetCoeff(c_n),r->cf->extRing->cf);
2462  n_Delete(&hzz,r->cf->extRing->cf);
2463  hzz=d;
2464  pIter(c_n);
2465  }
2466  pIter(p);
2467  }
2468  // hzz contains the gcd of all numerators in f
2469  h=n_Invers(hzz,r->cf->extRing->cf);
2470  n_Delete(&hzz,r->cf->extRing->cf);
2471  n_Normalize(h,r->cf->extRing->cf);
2472  if(!n_IsOne(h,r->cf->extRing->cf))
2473  {
2474  p=ph;
2475  while (p!=NULL)
2476  { // each monom: coeff in Q_a (Z_a)
2477  fraction f=(fraction)pGetCoeff(p);
2478  NUM(f)=__p_Mult_nn(NUM(f),h,r->cf->extRing);
2479  p_Normalize(NUM(f),r->cf->extRing);
2480  pIter(p);
2481  }
2482  }
2483  n_Delete(&h,r->cf->extRing->cf);
2484  }*/
2485  }
2486  }
2487  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2488 }

◆ p_ContentRat()

void p_ContentRat ( poly &  ph,
const ring  r 
)

Definition at line 1691 of file p_polys.cc.

1694 {
1695  // init array of RatLeadCoeffs
1696  // poly p_GetCoeffRat(poly p, int ishift, ring r);
1697 
1698  int len=pLength(ph);
1699  poly *C = (poly *)omAlloc0((len+1)*sizeof(poly)); //rat coeffs
1700  poly *LM = (poly *)omAlloc0((len+1)*sizeof(poly)); // rat lead terms
1701  int *D = (int *)omAlloc0((len+1)*sizeof(int)); //degrees of coeffs
1702  int *L = (int *)omAlloc0((len+1)*sizeof(int)); //lengths of coeffs
1703  int k = 0;
1704  poly p = p_Copy(ph, r); // ph will be needed below
1705  int mintdeg = p_Totaldegree(p, r);
1706  int minlen = len;
1707  int dd = 0; int i;
1708  int HasConstantCoef = 0;
1709  int is = r->real_var_start - 1;
1710  while (p!=NULL)
1711  {
1712  LM[k] = p_GetExp_k_n(p,1,is, r); // need LmRat istead of p_HeadRat(p, is, currRing); !
1713  C[k] = p_GetCoeffRat(p, is, r);
1714  D[k] = p_Totaldegree(C[k], r);
1715  mintdeg = si_min(mintdeg,D[k]);
1716  L[k] = pLength(C[k]);
1717  minlen = si_min(minlen,L[k]);
1718  if (p_IsConstant(C[k], r))
1719  {
1720  // C[k] = const, so the content will be numerical
1721  HasConstantCoef = 1;
1722  // smth like goto cleanup and return(pContent(p));
1723  }
1724  p_LmDeleteAndNextRat(&p, is, r);
1725  k++;
1726  }
1727 
1728  // look for 1 element of minimal degree and of minimal length
1729  k--;
1730  poly d;
1731  int mindeglen = len;
1732  if (k<=0) // this poly is not a ratgring poly -> pContent
1733  {
1734  p_Delete(&C[0], r);
1735  p_Delete(&LM[0], r);
1736  p_ContentForGB(ph, r);
1737  goto cleanup;
1738  }
1739 
1740  int pmindeglen;
1741  for(i=0; i<=k; i++)
1742  {
1743  if (D[i] == mintdeg)
1744  {
1745  if (L[i] < mindeglen)
1746  {
1747  mindeglen=L[i];
1748  pmindeglen = i;
1749  }
1750  }
1751  }
1752  d = p_Copy(C[pmindeglen], r);
1753  // there are dd>=1 mindeg elements
1754  // and pmideglen is the coordinate of one of the smallest among them
1755 
1756  // poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r));
1757  // return naGcd(d,d2,currRing);
1758 
1759  // adjoin pContentRat here?
1760  for(i=0; i<=k; i++)
1761  {
1762  d=singclap_gcd(d,p_Copy(C[i], r), r);
1763  if (p_Totaldegree(d, r)==0)
1764  {
1765  // cleanup, pContent, return
1766  p_Delete(&d, r);
1767  for(;k>=0;k--)
1768  {
1769  p_Delete(&C[k], r);
1770  p_Delete(&LM[k], r);
1771  }
1772  p_ContentForGB(ph, r);
1773  goto cleanup;
1774  }
1775  }
1776  for(i=0; i<=k; i++)
1777  {
1778  poly h=singclap_pdivide(C[i],d, r);
1779  p_Delete(&C[i], r);
1780  C[i]=h;
1781  }
1782 
1783  // zusammensetzen,
1784  p=NULL; // just to be sure
1785  for(i=0; i<=k; i++)
1786  {
1787  p = p_Add_q(p, p_Mult_q(C[i],LM[i], r), r);
1788  C[i]=NULL; LM[i]=NULL;
1789  }
1790  p_Delete(&ph, r); // do not need it anymore
1791  ph = p;
1792  // aufraeumen, return
1793 cleanup:
1794  omFree(C);
1795  omFree(LM);
1796  omFree(D);
1797  omFree(L);
1798 }

◆ p_Copy() [1/2]

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

Definition at line 840 of file p_polys.h.

841 {
842  if (p != NULL)
843  {
844 #ifndef PDEBUG
845  if (tailRing == lmRing)
846  return p_Copy_noCheck(p, tailRing);
847 #endif
848  poly pres = p_Head(p, lmRing);
849  if (pNext(p)!=NULL)
850  pNext(pres) = p_Copy_noCheck(pNext(p), tailRing);
851  return pres;
852  }
853  else
854  return NULL;
855 }

◆ p_Copy() [2/2]

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

returns a copy of p

Definition at line 813 of file p_polys.h.

814 {
815  if (p!=NULL)
816  {
817  p_Test(p,r);
818  const poly pp = p_Copy_noCheck(p, r);
819  p_Test(pp,r);
820  return pp;
821  }
822  else
823  return NULL;
824 }

◆ 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 803 of file p_polys.h.

804 {
805  /*assume(p!=NULL);*/
806  assume(r != NULL);
807  assume(r->p_Procs != NULL);
808  assume(r->p_Procs->p_Copy != NULL);
809  return r->p_Procs->p_Copy(p, r);
810 }

◆ p_DecrExp()

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

Definition at line 599 of file p_polys.h.

600 {
601  p_LmCheckPolyRing2(p, r);
602  int e = p_GetExp(p,v,r);
603  pAssume2(e > 0);
604  e--;
605  return p_SetExp(p,v,e,r);
606 }

◆ p_Deg()

long p_Deg ( poly  a,
const ring  r 
)

Definition at line 579 of file p_polys.cc.

580 {
581  p_LmCheckPolyRing(a, r);
582 // assume(p_GetOrder(a, r) == p_WTotaldegree(a, r)); // WRONG assume!
583  return p_GetOrder(a, r);
584 }

◆ p_DegW()

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

Definition at line 682 of file p_polys.cc.

683 {
684  p_Test(p, R);
685  assume( w != NULL );
686  long r=-LONG_MAX;
687 
688  while (p!=NULL)
689  {
690  long t=totaldegreeWecart_IV(p,R,w);
691  if (t>r) r=t;
692  pIter(p);
693  }
694  return r;
695 }

◆ p_Delete() [1/2]

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

Definition at line 865 of file p_polys.h.

866 {
867  assume( p!= NULL );
868  if (*p != NULL)
869  {
870 #ifndef PDEBUG
871  if (tailRing == lmRing)
872  {
873  p_Delete(p, tailRing);
874  return;
875  }
876 #endif
877  if (pNext(*p) != NULL)
878  p_Delete(&pNext(*p), tailRing);
879  p_LmDelete(p, lmRing);
880  }
881 }

◆ p_Delete() [2/2]

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

Definition at line 858 of file p_polys.h.

859 {
860  assume( p!= NULL );
861  assume( r!= NULL );
862  if ((*p)!=NULL) r->p_Procs->p_Delete(p, r);
863 }

◆ p_DeleteComp()

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

Definition at line 3494 of file p_polys.cc.

3495 {
3496  poly q;
3497 
3498  while ((*p!=NULL) && (__p_GetComp(*p,r)==k)) p_LmDelete(p,r);
3499  if (*p==NULL) return;
3500  q = *p;
3501  if (__p_GetComp(q,r)>k)
3502  {
3503  p_SubComp(q,1,r);
3504  p_SetmComp(q,r);
3505  }
3506  while (pNext(q)!=NULL)
3507  {
3508  if (__p_GetComp(pNext(q),r)==k)
3509  p_LmDelete(&(pNext(q)),r);
3510  else
3511  {
3512  pIter(q);
3513  if (__p_GetComp(q,r)>k)
3514  {
3515  p_SubComp(q,1,r);
3516  p_SetmComp(q,r);
3517  }
3518  }
3519  }
3520 }

◆ p_Diff()

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

Definition at line 1845 of file p_polys.cc.

1846 {
1847  poly res, f, last;
1848  number t;
1849 
1850  last = res = NULL;
1851  while (a!=NULL)
1852  {
1853  if (p_GetExp(a,k,r)!=0)
1854  {
1855  f = p_LmInit(a,r);
1856  t = n_Init(p_GetExp(a,k,r),r->cf);
1857  pSetCoeff0(f,n_Mult(t,pGetCoeff(a),r->cf));
1858  n_Delete(&t,r->cf);
1859  if (n_IsZero(pGetCoeff(f),r->cf))
1860  p_LmDelete(&f,r);
1861  else
1862  {
1863  p_DecrExp(f,k,r);
1864  p_Setm(f,r);
1865  if (res==NULL)
1866  {
1867  res=last=f;
1868  }
1869  else
1870  {
1871  pNext(last)=f;
1872  last=f;
1873  }
1874  }
1875  }
1876  pIter(a);
1877  }
1878  return res;
1879 }

◆ p_DiffOp()

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

Definition at line 1920 of file p_polys.cc.

1921 {
1922  poly result=NULL;
1923  poly h;
1924  for(;a!=NULL;pIter(a))
1925  {
1926  for(h=b;h!=NULL;pIter(h))
1927  {
1928  result=p_Add_q(result,p_DiffOpM(a,h,multiply,r),r);
1929  }
1930  }
1931  return result;
1932 }

◆ p_Div_mm()

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

divide polynomial by monomial

Definition at line 1500 of file p_polys.cc.

1501 {
1502  p_Test(p, r);
1503  p_Test(m, r);
1504  poly result = p;
1505  poly prev = NULL;
1506  number n=pGetCoeff(m);
1507  while (p!=NULL)
1508  {
1509  number nc = n_Div(pGetCoeff(p),n,r->cf);
1510  n_Normalize(nc,r->cf);
1511  if (!n_IsZero(nc,r->cf))
1512  {
1513  p_SetCoeff(p,nc,r);
1514  prev=p;
1515  p_ExpVectorSub(p,m,r);
1516  pIter(p);
1517  }
1518  else
1519  {
1520  if (prev==NULL)
1521  {
1522  p_LmDelete(&result,r);
1523  p=result;
1524  }
1525  else
1526  {
1527  p_LmDelete(&pNext(prev),r);
1528  p=pNext(prev);
1529  }
1530  }
1531  }
1532  p_Test(result,r);
1533  return(result);
1534 }

◆ p_Div_nn()

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

Definition at line 1467 of file p_polys.cc.

1468 {
1469  pAssume(!n_IsZero(n,r->cf));
1470  p_Test(p, r);
1471  poly result = p;
1472  poly prev = NULL;
1473  while (p!=NULL)
1474  {
1475  number nc = n_Div(pGetCoeff(p),n,r->cf);
1476  if (!n_IsZero(nc,r->cf))
1477  {
1478  p_SetCoeff(p,nc,r);
1479  prev=p;
1480  pIter(p);
1481  }
1482  else
1483  {
1484  if (prev==NULL)
1485  {
1486  p_LmDelete(&result,r);
1487  p=result;
1488  }
1489  else
1490  {
1491  p_LmDelete(&pNext(prev),r);
1492  p=pNext(prev);
1493  }
1494  }
1495  }
1496  p_Test(result,r);
1497  return(result);
1498 }

◆ p_DivideM()

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

Definition at line 1540 of file p_polys.cc.

1541 {
1542  if (a==NULL) { p_Delete(&b,r); return NULL; }
1543  poly result=a;
1544  poly prev=NULL;
1545  number inv=pGetCoeff(b);
1546 
1547  while (a!=NULL)
1548  {
1549  if (p_DivisibleBy(b,a,r))
1550  {
1551  p_ExpVectorSub(a,b,r);
1552  prev=a;
1553  pIter(a);
1554  }
1555  else
1556  {
1557  if (prev==NULL)
1558  {
1559  p_LmDelete(&result,r);
1560  a=result;
1561  }
1562  else
1563  {
1564  p_LmDelete(&pNext(prev),r);
1565  a=pNext(prev);
1566  }
1567  }
1568  }
1569  if (result!=NULL)
1570  {
1571  //if ((!rField_is_Ring(r)) || n_IsUnit(inv,r->cf))
1572  if (rField_is_Zp(r))
1573  {
1574  inv = n_Invers(inv,r->cf);
1575  __p_Mult_nn(result,inv,r);
1576  n_Delete(&inv, r->cf);
1577  }
1578  else
1579  {
1580  result = p_Div_nn(result,inv,r);
1581  }
1582  }
1583  p_Delete(&b, r);
1584  return result;
1585 }

◆ p_DivisibleBy() [1/2]

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

Definition at line 1839 of file p_polys.h.

1840 {
1841  pIfThen1(b!=NULL, p_LmCheckPolyRing1(b, r_b));
1842  pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r_a));
1843  if (a != NULL) {
1844  return _p_LmDivisibleBy(a, r_a, b, r_b);
1845  }
1846  return FALSE;
1847 }

◆ p_DivisibleBy() [2/2]

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

Definition at line 1830 of file p_polys.h.

1831 {
1833  pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r));
1834 
1835  if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)))
1836  return _p_LmDivisibleByNoComp(a,b,r);
1837  return FALSE;
1838 }

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

1590 {
1591  int exponent;
1592  for(int i = (int)rVar(r); i>0; i--)
1593  {
1594  exponent = p_GetExp(g, i, r) - p_GetExp(f, i, r);
1595  if (exponent < 0) return FALSE;
1596  }
1597  return n_DivBy(pGetCoeff(g), pGetCoeff(f), r->cf);
1598 }

◆ p_EqualPolys() [1/2]

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

Definition at line 4410 of file p_polys.cc.

4411 {
4412  while ((p1 != NULL) && (p2 != NULL))
4413  {
4414  if (! p_LmEqual(p1, p2,r))
4415  return FALSE;
4416  if (! n_Equal(p_GetCoeff(p1,r), p_GetCoeff(p2,r),r->cf ))
4417  return FALSE;
4418  pIter(p1);
4419  pIter(p2);
4420  }
4421  return (p1==p2);
4422 }

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

4449 {
4450  assume( r1 == r2 || rSamePolyRep(r1, r2) ); // will be used in rEqual!
4451  assume( r1->cf == r2->cf );
4452 
4453  while ((p1 != NULL) && (p2 != NULL))
4454  {
4455  // returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !!
4456  // #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r)
4457 
4458  if (! p_ExpVectorEqual(p1, p2, r1, r2))
4459  return FALSE;
4460 
4461  if (! n_Equal(p_GetCoeff(p1,r1), p_GetCoeff(p2,r2), r1->cf ))
4462  return FALSE;
4463 
4464  pIter(p1);
4465  pIter(p2);
4466  }
4467  return (p1==p2);
4468 }

◆ p_ExpVectorAdd()

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

Definition at line 1348 of file p_polys.h.

1349 {
1350  p_LmCheckPolyRing1(p1, r);
1351  p_LmCheckPolyRing1(p2, r);
1352 #if PDEBUG >= 1
1353  for (int i=1; i<=r->N; i++)
1354  pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
1355  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
1356 #endif
1357 
1358  p_MemAdd_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
1359  p_MemAdd_NegWeightAdjust(p1, r);
1360 }

◆ p_ExpVectorAddSub()

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

Definition at line 1393 of file p_polys.h.

1394 {
1395  p_LmCheckPolyRing1(p1, r);
1396  p_LmCheckPolyRing1(p2, r);
1397  p_LmCheckPolyRing1(p3, r);
1398 #if PDEBUG >= 1
1399  for (int i=1; i<=r->N; i++)
1400  pAssume1(p_GetExp(p1, i, r) + p_GetExp(p2, i, r) >= p_GetExp(p3, i, r));
1401  pAssume1(p_GetComp(p1, r) == 0 ||
1402  (p_GetComp(p2, r) - p_GetComp(p3, r) == 0) ||
1403  (p_GetComp(p1, r) == p_GetComp(p2, r) - p_GetComp(p3, r)));
1404 #endif
1405 
1406  p_MemAddSub_LengthGeneral(p1->exp, p2->exp, p3->exp, r->ExpL_Size);
1407  // no need to adjust in case of NegWeights
1408 }

◆ p_ExpVectorCopy()

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

Definition at line 1250 of file p_polys.h.

1251 {
1252  p_LmCheckPolyRing1(d_p, r);
1253  p_LmCheckPolyRing1(s_p, r);
1254  memcpy(d_p->exp, s_p->exp, r->ExpL_Size*sizeof(long));
1255 }

◆ p_ExpVectorDiff()

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

Definition at line 1411 of file p_polys.h.

1412 {
1413  p_LmCheckPolyRing1(p1, r);
1414  p_LmCheckPolyRing1(p2, r);
1415  p_LmCheckPolyRing1(pr, r);
1416 #if PDEBUG >= 2
1417  for (int i=1; i<=r->N; i++)
1418  pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
1419  pAssume1(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
1420 #endif
1421 
1422  p_MemDiff_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
1423  p_MemSub_NegWeightAdjust(pr, r);
1424 }

◆ p_ExpVectorEqual()

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

Definition at line 1426 of file p_polys.h.

1427 {
1428  p_LmCheckPolyRing1(p1, r);
1429  p_LmCheckPolyRing1(p2, r);
1430 
1431  unsigned i = r->ExpL_Size;
1432  unsigned long *ep = p1->exp;
1433  unsigned long *eq = p2->exp;
1434 
1435  do
1436  {
1437  i--;
1438  if (ep[i] != eq[i]) return FALSE;
1439  }
1440  while (i!=0);
1441  return TRUE;
1442 }

◆ p_ExpVectorSub()

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

Definition at line 1377 of file p_polys.h.

1378 {
1379  p_LmCheckPolyRing1(p1, r);
1380  p_LmCheckPolyRing1(p2, r);
1381 #if PDEBUG >= 1
1382  for (int i=1; i<=r->N; i++)
1383  pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
1384  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0 ||
1385  p_GetComp(p1, r) == p_GetComp(p2, r));
1386 #endif
1387 
1388  p_MemSub_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
1389  p_MemSub_NegWeightAdjust(p1, r);
1390 }

◆ p_ExpVectorSum()

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

Definition at line 1362 of file p_polys.h.

1363 {
1364  p_LmCheckPolyRing1(p1, r);
1365  p_LmCheckPolyRing1(p2, r);
1366  p_LmCheckPolyRing1(pr, r);
1367 #if PDEBUG >= 1
1368  for (int i=1; i<=r->N; i++)
1369  pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
1370  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
1371 #endif
1372 
1373  p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
1374  p_MemAdd_NegWeightAdjust(pr, r);
1375 }

◆ p_Farey()

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

Definition at line 52 of file p_polys.cc.

53 {
54  poly h=p_Copy(p,r);
55  poly hh=h;
56  while(h!=NULL)
57  {
58  number c=pGetCoeff(h);
59  pSetCoeff0(h,n_Farey(c,N,r->cf));
60  n_Delete(&c,r->cf);
61  pIter(h);
62  }
63  while((hh!=NULL)&&(n_IsZero(pGetCoeff(hh),r->cf)))
64  {
65  p_LmDelete(&hh,r);
66  }
67  h=hh;
68  while((h!=NULL) && (pNext(h)!=NULL))
69  {
70  if(n_IsZero(pGetCoeff(pNext(h)),r->cf))
71  {
72  p_LmDelete(&pNext(h),r);
73  }
74  else pIter(h);
75  }
76  return hh;
77 }

◆ p_FDeg()

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

Definition at line 381 of file p_polys.h.

381 { return r->pFDeg(p,r); }

◆ p_GcdMon()

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

polynomial gcd for f=mon

Definition at line 4838 of file p_polys.cc.

4839 {
4840  assume(f!=NULL);
4841  assume(g!=NULL);
4842  assume(pNext(f)==NULL);
4843  poly G=p_Head(f,r);
4844  poly h=g;
4845  int *mf=(int*)omAlloc((r->N+1)*sizeof(int));
4846  p_GetExpV(f,mf,r);
4847  int *mh=(int*)omAlloc((r->N+1)*sizeof(int));
4848  BOOLEAN const_mon;
4849  BOOLEAN one_coeff=n_IsOne(pGetCoeff(G),r->cf);
4850  loop
4851  {
4852  if (h==NULL) break;
4853  if(!one_coeff)
4854  {
4855  number n=n_SubringGcd(pGetCoeff(G),pGetCoeff(h),r->cf);
4856  one_coeff=n_IsOne(n,r->cf);
4857  p_SetCoeff(G,n,r);
4858  }
4859  p_GetExpV(h,mh,r);
4860  const_mon=TRUE;
4861  for(unsigned j=r->N;j!=0;j--)
4862  {
4863  if (mh[j]<mf[j]) mf[j]=mh[j];
4864  if (mf[j]>0) const_mon=FALSE;
4865  }
4866  if (one_coeff && const_mon) break;
4867  pIter(h);
4868  }
4869  mf[0]=0;
4870  p_SetExpV(G,mf,r); // included is p_SetComp, p_Setm
4871  omFreeSize(mf,(r->N+1)*sizeof(int));
4872  omFreeSize(mh,(r->N+1)*sizeof(int));
4873  return G;
4874 }

◆ p_GetCoeffRat()

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

Definition at line 1669 of file p_polys.cc.

1670 {
1671  poly q = pNext(p);
1672  poly res; // = p_Head(p,r);
1673  res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally
1674  p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r);
1675  poly s;
1676  long cmp = p_GetComp(p, r);
1677  while ( (q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r)) && (p_GetComp(q, r) == cmp) )
1678  {
1679  s = p_GetExp_k_n(q, ishift+1, r->N, r);
1680  p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r);
1681  res = p_Add_q(res,s,r);
1682  q = pNext(q);
1683  }
1684  cmp = 0;
1685  p_SetCompP(res,cmp,r);
1686  return res;
1687 }

◆ p_GetExp() [1/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 573 of file p_polys.h.

574 {
575  p_LmCheckPolyRing2(p, r);
576  pAssume2(v>0 && v <= r->N);
577  pAssume2(r->VarOffset[v] != -1);
578  return p_GetExp(p, r->bitmask, r->VarOffset[v]);
579 }

◆ p_GetExp() [2/3]

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

Definition at line 556 of file p_polys.h.

557 {
558  p_LmCheckPolyRing2(p, r);
559  pAssume2(VarOffset != -1);
560  return p_GetExp(p, r->bitmask, VarOffset);
561 }

◆ p_GetExp() [3/3]

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

get a single variable exponent @Note: 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 470 of file p_polys.h.

471 {
472  pAssume2((VarOffset >> (24 + 6)) == 0);
473 #if 0
474  int pos=(VarOffset & 0xffffff);
475  int bitpos=(VarOffset >> 24);
476  unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask;
477  return exp;
478 #else
479  return (long)
480  ((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24))
481  & iBitmask);
482 #endif
483 }

◆ p_GetExp_k_n()

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

Definition at line 1309 of file p_polys.h.

1310 {
1311  if (p == NULL) return NULL;
1312  p_LmCheckPolyRing1(p, r);
1313  poly np;
1314  omTypeAllocBin(poly, np, r->PolyBin);
1315  p_SetRingOfLm(np, r);
1316  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
1317  pNext(np) = NULL;
1318  pSetCoeff0(np, n_Init(1, r->cf));
1319  int i;
1320  for(i=l;i<=k;i++)
1321  {
1322  //np->exp[(r->VarOffset[i] & 0xffffff)] =0;
1323  p_SetExp(np,i,0,r);
1324  }
1325  p_Setm(np,r);
1326  return np;
1327 }

◆ p_GetExpDiff()

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

Definition at line 636 of file p_polys.h.

637 {
638  return p_GetExp(p1,i,r) - p_GetExp(p2,i,r);
639 }

◆ p_GetExpSum()

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

Definition at line 630 of file p_polys.h.

631 {
632  p_LmCheckPolyRing2(p1, r);
633  p_LmCheckPolyRing2(p2, r);
634  return p_GetExp(p1,i,r) + p_GetExp(p2,i,r);
635 }

◆ p_GetExpV()

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

Definition at line 1457 of file p_polys.h.

1458 {
1459  p_LmCheckPolyRing1(p, r);
1460  for (unsigned j = r->N; j!=0; j--)
1461  ev[j] = p_GetExp(p, j, r);
1462 
1463  ev[0] = p_GetComp(p, r);
1464 }

◆ p_GetExpVL()

static void p_GetExpVL ( poly  p,
int64 ev,
const ring  r 
)
inlinestatic

Definition at line 1466 of file p_polys.h.

1467 {
1468  p_LmCheckPolyRing1(p, r);
1469  for (unsigned j = r->N; j!=0; j--)
1470  ev[j-1] = p_GetExp(p, j, r);
1471 }

◆ p_GetMaxExp() [1/2]

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

Definition at line 771 of file p_polys.h.

772 {
773  return p_GetMaxExp(p_GetMaxExpL(p, r), r);
774 }

◆ p_GetMaxExp() [2/2]

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

Definition at line 748 of file p_polys.h.

749 {
750  unsigned long bitmask = r->bitmask;
751  unsigned long max = (l & bitmask);
752  unsigned long j = r->ExpPerLong - 1;
753 
754  if (j > 0)
755  {
756  unsigned long i = r->BitsPerExp;
757  long e;
758  loop
759  {
760  e = ((l >> i) & bitmask);
761  if ((unsigned long) e > max)
762  max = e;
763  j--;
764  if (j==0) break;
765  i += r->BitsPerExp;
766  }
767  }
768  return max;
769 }

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

1168 {
1169  unsigned long l_p, divmask = r->divmask;
1170  int i;
1171 
1172  while (p != NULL)
1173  {
1174  l_p = p->exp[r->VarL_Offset[0]];
1175  if (l_p > l_max ||
1176  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1177  l_max = p_GetMaxExpL2(l_max, l_p, r);
1178  for (i=1; i<r->VarL_Size; i++)
1179  {
1180  l_p = p->exp[r->VarL_Offset[i]];
1181  // do the divisibility trick to find out whether l has an exponent
1182  if (l_p > l_max ||
1183  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1184  l_max = p_GetMaxExpL2(l_max, l_p, r);
1185  }
1186  pIter(p);
1187  }
1188  return l_max;
1189 }

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

1131 {
1132  p_CheckPolyRing(p, r);
1133  if (p == NULL) return p_Init(r);
1134  poly max = p_LmInit(p, r);
1135  pIter(p);
1136  if (p == NULL) return max;
1137  int i, offset;
1138  unsigned long l_p, l_max;
1139  unsigned long divmask = r->divmask;
1140 
1141  do
1142  {
1143  offset = r->VarL_Offset[0];
1144  l_p = p->exp[offset];
1145  l_max = max->exp[offset];
1146  // do the divisibility trick to find out whether l has an exponent
1147  if (l_p > l_max ||
1148  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1149  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1150 
1151  for (i=1; i<r->VarL_Size; i++)
1152  {
1153  offset = r->VarL_Offset[i];
1154  l_p = p->exp[offset];
1155  l_max = max->exp[offset];
1156  // do the divisibility trick to find out whether l has an exponent
1157  if (l_p > l_max ||
1158  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1159  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1160  }
1161  pIter(p);
1162  }
1163  while (p != NULL);
1164  return max;
1165 }

◆ p_GetOrder()

static long p_GetOrder ( poly  p,
ring  r 
)
inlinestatic

Definition at line 422 of file p_polys.h.

423 {
424  p_LmCheckPolyRing2(p, r);
425  if (r->typ==NULL) return ((p)->exp[r->pOrdIndex]);
426  int i=0;
427  loop
428  {
429  switch(r->typ[i].ord_typ)
430  {
431  case ro_am:
432  case ro_wp_neg:
433  return ((p->exp[r->pOrdIndex])-POLY_NEGWEIGHT_OFFSET);
434  case ro_syzcomp:
435  case ro_syz:
436  case ro_cp:
437  i++;
438  break;
439  //case ro_dp:
440  //case ro_wp:
441  default:
442  return ((p)->exp[r->pOrdIndex]);
443  }
444  }
445 }

◆ p_GetSetmProc()

p_SetmProc p_GetSetmProc ( const ring  r)

Definition at line 552 of file p_polys.cc.

553 {
554  // covers lp, rp, ls,
555  if (r->typ == NULL) return p_Setm_Dummy;
556 
557  if (r->OrdSize == 1)
558  {
559  if (r->typ[0].ord_typ == ro_dp &&
560  r->typ[0].data.dp.start == 1 &&
561  r->typ[0].data.dp.end == r->N &&
562  r->typ[0].data.dp.place == r->pOrdIndex)
563  return p_Setm_TotalDegree;
564  if (r->typ[0].ord_typ == ro_wp &&
565  r->typ[0].data.wp.start == 1 &&
566  r->typ[0].data.wp.end == r->N &&
567  r->typ[0].data.wp.place == r->pOrdIndex &&
568  r->typ[0].data.wp.weights == r->firstwv)
570  }
571  return p_Setm_General;
572 }

◆ p_GetShortExpVector() [1/2]

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

Definition at line 4679 of file p_polys.cc.

4680 {
4681  assume(p != NULL);
4682  unsigned long ev = 0; // short exponent vector
4683  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4684  unsigned int m1; // highest bit which is filled with (n+1)
4685  int i=0,j=1;
4686 
4687  if (n == 0)
4688  {
4689  if (r->N <2*BIT_SIZEOF_LONG)
4690  {
4691  n=1;
4692  m1=0;
4693  }
4694  else
4695  {
4696  for (; j<=r->N; j++)
4697  {
4698  if (p_GetExp(p,j,r) > 0) i++;
4699  if (i == BIT_SIZEOF_LONG) break;
4700  }
4701  if (i>0)
4702  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4703  return ev;
4704  }
4705  }
4706  else
4707  {
4708  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4709  }
4710 
4711  n++;
4712  while (i<m1)
4713  {
4714  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4715  i += n;
4716  j++;
4717  }
4718 
4719  n--;
4720  while (i<BIT_SIZEOF_LONG)
4721  {
4722  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4723  i += n;
4724  j++;
4725  }
4726  return ev;
4727 }

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

4732 {
4733  assume(p != NULL);
4734  assume(pp != NULL);
4735 
4736  unsigned long ev = 0; // short exponent vector
4737  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4738  unsigned int m1; // highest bit which is filled with (n+1)
4739  int j=1;
4740  unsigned long i = 0L;
4741 
4742  if (n == 0)
4743  {
4744  if (r->N <2*BIT_SIZEOF_LONG)
4745  {
4746  n=1;
4747  m1=0;
4748  }
4749  else
4750  {
4751  for (; j<=r->N; j++)
4752  {
4753  if (p_GetExp(p,j,r) > 0 || p_GetExp(pp,j,r) > 0) i++;
4754  if (i == BIT_SIZEOF_LONG) break;
4755  }
4756  if (i>0)
4757  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4758  return ev;
4759  }
4760  }
4761  else
4762  {
4763  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4764  }
4765 
4766  n++;
4767  while (i<m1)
4768  {
4769  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4770  i += n;
4771  j++;
4772  }
4773 
4774  n--;
4775  while (i<BIT_SIZEOF_LONG)
4776  {
4777  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4778  i += n;
4779  j++;
4780  }
4781  return ev;
4782 }

◆ p_GetTotalDegree()

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

Definition at line 777 of file p_polys.h.

778 {
779  const unsigned long bitmask = r->bitmask;
780  unsigned long sum = (l & bitmask);
781  unsigned long j = number_of_exps - 1;
782 
783  if (j > 0)
784  {
785  unsigned long i = r->BitsPerExp;
786  loop
787  {
788  sum += ((l >> i) & bitmask);
789  j--;
790  if (j==0) break;
791  i += r->BitsPerExp;
792  }
793  }
794  return sum;
795 }

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

1260 {
1261  int i;
1262  int n=0;
1263  while(p!=NULL)
1264  {
1265  n=0;
1266  for(i=r->N; i>0; i--)
1267  {
1268  if(e[i]==0)
1269  {
1270  if (p_GetExp(p,i,r)>0)
1271  {
1272  e[i]=1;
1273  n++;
1274  }
1275  }
1276  else
1277  n++;
1278  }
1279  if (n==r->N) break;
1280  pIter(p);
1281  }
1282  return n;
1283 }

◆ p_HasNotCF()

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

Definition at line 1321 of file p_polys.cc.

1322 {
1323 
1324  if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
1325  return FALSE;
1326  int i = rVar(r);
1327  loop
1328  {
1329  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1330  return FALSE;
1331  i--;
1332  if (i == 0)
1333  return TRUE;
1334  }
1335 }

◆ p_Head()

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

Definition at line 826 of file p_polys.h.

827 {
828  if (p == NULL) return NULL;
829  p_LmCheckPolyRing1(p, r);
830  poly np;
831  omTypeAllocBin(poly, np, r->PolyBin);
832  p_SetRingOfLm(np, r);
833  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
834  pNext(np) = NULL;
835  pSetCoeff0(np, n_Copy(pGetCoeff(p), r->cf));
836  return np;
837 }

◆ p_Homogen()

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

Definition at line 3208 of file p_polys.cc.

3209 {
3210  pFDegProc deg;
3211  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3212  deg=p_Totaldegree;
3213  else
3214  deg=r->pFDeg;
3215 
3216  poly q=NULL, qn;
3217  int o,ii;
3218  sBucket_pt bp;
3219 
3220  if (p!=NULL)
3221  {
3222  if ((varnum < 1) || (varnum > rVar(r)))
3223  {
3224  return NULL;
3225  }
3226  o=deg(p,r);
3227  q=pNext(p);
3228  while (q != NULL)
3229  {
3230  ii=deg(q,r);
3231  if (ii>o) o=ii;
3232  pIter(q);
3233  }
3234  q = p_Copy(p,r);
3235  bp = sBucketCreate(r);
3236  while (q != NULL)
3237  {
3238  ii = o-deg(q,r);
3239  if (ii!=0)
3240  {
3241  p_AddExp(q,varnum, (long)ii,r);
3242  p_Setm(q,r);
3243  }
3244  qn = pNext(q);
3245  pNext(q) = NULL;
3246  sBucket_Add_m(bp, q);
3247  q = qn;
3248  }
3249  sBucketDestroyAdd(bp, &q, &ii);
3250  }
3251  return q;
3252 }

◆ p_IncrExp()

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

Definition at line 592 of file p_polys.h.

593 {
594  p_LmCheckPolyRing2(p, r);
595  int e = p_GetExp(p,v,r);
596  e++;
597  return p_SetExp(p,v,e,r);
598 }

◆ p_Init() [1/2]

static poly p_Init ( const ring  r)
inlinestatic

Definition at line 1267 of file p_polys.h.

1268 {
1269  return p_Init(r, r->PolyBin);
1270 }

◆ p_Init() [2/2]

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

Definition at line 1257 of file p_polys.h.

1258 {
1259  p_CheckRing1(r);
1260  pAssume1(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
1261  poly p;
1262  omTypeAlloc0Bin(poly, p, bin);
1264  p_SetRingOfLm(p, r);
1265  return p;
1266 }

◆ p_InitContent()

number p_InitContent ( poly  ph,
const ring  r 
)

Definition at line 2549 of file p_polys.cc.

2552 {
2554  assume(ph!=NULL);
2555  assume(pNext(ph)!=NULL);
2556  assume(rField_is_Q(r));
2557  if (pNext(pNext(ph))==NULL)
2558  {
2559  return n_GetNumerator(pGetCoeff(pNext(ph)),r->cf);
2560  }
2561  poly p=ph;
2562  number n1=n_GetNumerator(pGetCoeff(p),r->cf);
2563  pIter(p);
2564  number n2=n_GetNumerator(pGetCoeff(p),r->cf);
2565  pIter(p);
2566  number d;
2567  number t;
2568  loop
2569  {
2570  nlNormalize(pGetCoeff(p),r->cf);
2571  t=n_GetNumerator(pGetCoeff(p),r->cf);
2572  if (nlGreaterZero(t,r->cf))
2573  d=nlAdd(n1,t,r->cf);
2574  else
2575  d=nlSub(n1,t,r->cf);
2576  nlDelete(&t,r->cf);
2577  nlDelete(&n1,r->cf);
2578  n1=d;
2579  pIter(p);
2580  if (p==NULL) break;
2581  nlNormalize(pGetCoeff(p),r->cf);
2582  t=n_GetNumerator(pGetCoeff(p),r->cf);
2583  if (nlGreaterZero(t,r->cf))
2584  d=nlAdd(n2,t,r->cf);
2585  else
2586  d=nlSub(n2,t,r->cf);
2587  nlDelete(&t,r->cf);
2588  nlDelete(&n2,r->cf);
2589  n2=d;
2590  pIter(p);
2591  if (p==NULL) break;
2592  }
2593  d=nlGcd(n1,n2,r->cf);
2594  nlDelete(&n1,r->cf);
2595  nlDelete(&n2,r->cf);
2596  return d;
2597 }
2598 #else
2599 {
2600  number d=pGetCoeff(ph);
2601  int s;
2602  int s2=-1;
2603  if(rField_is_Q(r))
2604  {
2605  if (SR_HDL(d)&SR_INT) return d;
2606  s=mpz_size1(d->z);
2607  }
2608  else
2609  s=n_Size(d,r->cf);
2610  number d2=d;
2611  loop
2612  {
2613  pIter(ph);
2614  if(ph==NULL)
2615  {
2616  if (s2==-1) return n_Copy(d,r->cf);
2617  break;
2618  }
2619  if (rField_is_Q(r))
2620  {
2621  if (SR_HDL(pGetCoeff(ph))&SR_INT)
2622  {
2623  s2=s;
2624  d2=d;
2625  s=0;
2626  d=pGetCoeff(ph);
2627  if (s2==0) break;
2628  }
2629  else if (mpz_size1((pGetCoeff(ph)->z))<=s)
2630  {
2631  s2=s;
2632  d2=d;
2633  d=pGetCoeff(ph);
2634  s=mpz_size1(d->z);
2635  }
2636  }
2637  else
2638  {
2639  int ns=n_Size(pGetCoeff(ph),r->cf);
2640  if (ns<=3)
2641  {
2642  s2=s;
2643  d2=d;
2644  d=pGetCoeff(ph);
2645  s=ns;
2646  if (s2<=3) break;
2647  }
2648  else if (ns<s)
2649  {
2650  s2=s;
2651  d2=d;
2652  d=pGetCoeff(ph);
2653  s=ns;
2654  }
2655  }
2656  }
2657  return n_SubringGcd(d,d2,r->cf);
2658 }

◆ p_IsConstant()

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

Definition at line 1929 of file p_polys.h.

1930 {
1931  if (p == NULL) return TRUE;
1932  p_Test(p, r);
1933  return (pNext(p)==NULL) && p_LmIsConstant(p, r);
1934 }

◆ p_IsConstantComp()

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

Definition at line 1923 of file p_polys.h.

1924 {
1925  if (p == NULL) return TRUE;
1926  return (pNext(p)==NULL) && p_LmIsConstantComp(p, r);
1927 }

◆ p_IsConstantPoly()

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

Definition at line 1943 of file p_polys.h.

1944 {
1945  p_Test(p, r);
1946  poly pp=p;
1947  while(pp!=NULL)
1948  {
1949  if (! p_LmIsConstantComp(pp, r))
1950  return FALSE;
1951  pIter(pp);
1952  }
1953  return TRUE;
1954 }

◆ p_ISet()

poly p_ISet ( long  i,
const ring  r 
)

returns the poly representing the integer i

Definition at line 1289 of file p_polys.cc.

1290 {
1291  poly rc = NULL;
1292  if (i!=0)
1293  {
1294  rc = p_Init(r);
1295  pSetCoeff0(rc,n_Init(i,r->cf));
1296  if (n_IsZero(pGetCoeff(rc),r->cf))
1297  p_LmDelete(&rc,r);
1298  }
1299  return rc;
1300 }

◆ p_IsHomogeneous()

BOOLEAN p_IsHomogeneous ( poly  p,
const ring  r 
)

Definition at line 3257 of file p_polys.cc.

3258 {
3259  poly qp=p;
3260  int o;
3261 
3262  if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
3263  pFDegProc d;
3264  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3265  d=p_Totaldegree;
3266  else
3267  d=r->pFDeg;
3268  o = d(p,r);
3269  do
3270  {
3271  if (d(qp,r) != o) return FALSE;
3272  pIter(qp);
3273  }
3274  while (qp != NULL);
3275  return TRUE;
3276 }

◆ p_IsOne()

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

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

Definition at line 1937 of file p_polys.h.

1938 {
1939  p_Test(p, R);
1940  return (p_IsConstant(p, R) && n_IsOne(p_GetCoeff(p, R), R->cf));
1941 }

◆ p_IsPurePower()

int p_IsPurePower ( const poly  p,
const ring  r 
)

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

Definition at line 1218 of file p_polys.cc.

1219 {
1220  int i,k=0;
1221 
1222  for (i=r->N;i;i--)
1223  {
1224  if (p_GetExp(p,i, r)!=0)
1225  {
1226  if(k!=0) return 0;
1227  k=i;
1228  }
1229  }
1230  return k;
1231 }

◆ p_IsUnit()

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

Definition at line 1956 of file p_polys.h.

1957 {
1958  if (p == NULL) return FALSE;
1959  if (rField_is_Ring(r))
1960  return (p_LmIsConstant(p, r) && n_IsUnit(pGetCoeff(p),r->cf));
1961  return p_LmIsConstant(p, r);
1962 }

◆ p_IsUnivariate()

int p_IsUnivariate ( poly  p,
const ring  r 
)

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

Definition at line 1239 of file p_polys.cc.

1240 {
1241  int i,k=-1;
1242 
1243  while (p!=NULL)
1244  {
1245  for (i=r->N;i;i--)
1246  {
1247  if (p_GetExp(p,i, r)!=0)
1248  {
1249  if((k!=-1)&&(k!=i)) return 0;
1250  k=i;
1251  }
1252  }
1253  pIter(p);
1254  }
1255  return k;
1256 }

◆ p_Jet()

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

Definition at line 4284 of file p_polys.cc.

4285 {
4286  while((p!=NULL) && (p_Totaldegree(p,R)>m)) p_LmDelete(&p,R);
4287  if (p==NULL) return NULL;
4288  poly r=p;
4289  while (pNext(p)!=NULL)
4290  {
4291  if (p_Totaldegree(pNext(p),R)>m)
4292  {
4293  p_LmDelete(&pNext(p),R);
4294  }
4295  else
4296  pIter(p);
4297  }
4298  return r;
4299 }

◆ p_JetW()

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

Definition at line 4328 of file p_polys.cc.

4329 {
4330  while((p!=NULL) && (totaldegreeWecart_IV(p,R,w)>m)) p_LmDelete(&p,R);
4331  if (p==NULL) return NULL;
4332  poly r=p;
4333  while (pNext(p)!=NULL)
4334  {
4335  if (totaldegreeWecart_IV(pNext(p),R,w)>m)
4336  {
4337  p_LmDelete(&pNext(p),R);
4338  }
4339  else
4340  pIter(p);
4341  }
4342  return r;
4343 }

◆ p_Last()

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

Definition at line 4519 of file p_polys.cc.

4520 {
4521  if (p == NULL)
4522  {
4523  l = 0;
4524  return NULL;
4525  }
4526  l = 1;
4527  poly a = p;
4528  if (! rIsSyzIndexRing(r))
4529  {
4530  poly next = pNext(a);
4531  while (next!=NULL)
4532  {
4533  a = next;
4534  next = pNext(a);
4535  l++;
4536  }
4537  }
4538  else
4539  {
4540  int curr_limit = rGetCurrSyzLimit(r);
4541  poly pp = a;
4542  while ((a=pNext(a))!=NULL)
4543  {
4544  if (__p_GetComp(a,r)<=curr_limit/*syzComp*/)
4545  l++;
4546  else break;
4547  pp = a;
4548  }
4549  a=pp;
4550  }
4551  return a;
4552 }

◆ p_Lcm() [1/2]

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

Definition at line 1611 of file p_polys.cc.

1612 {
1613  poly m=p_Init(r);
1614  p_Lcm(a, b, m, r);
1615  p_Setm(m,r);
1616  return(m);
1617 }

◆ p_Lcm() [2/2]

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

Definition at line 1602 of file p_polys.cc.

1603 {
1604  for (int i=r->N; i; --i)
1605  p_SetExp(m,i, si_max( p_GetExp(a,i,r), p_GetExp(b,i,r)),r);
1606 
1607  p_SetComp(m, si_max(p_GetComp(a,r), p_GetComp(b,r)),r);
1608  /* Don't do a pSetm here, otherwise hres/lres chockes */
1609 }

◆ p_LcmRat()

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

Definition at line 1624 of file p_polys.cc.

1625 {
1626  poly m = // p_One( r);
1627  p_Init(r);
1628 
1629 // const int (currRing->N) = r->N;
1630 
1631  // for (int i = (currRing->N); i>=r->real_var_start; i--)
1632  for (int i = r->real_var_end; i>=r->real_var_start; i--)
1633  {
1634  const int lExpA = p_GetExp (a, i, r);
1635  const int lExpB = p_GetExp (b, i, r);
1636 
1637  p_SetExp (m, i, si_max(lExpA, lExpB), r);
1638  }
1639 
1640  p_SetComp (m, lCompM, r);
1641  p_Setm(m,r);
1642  n_New(&(p_GetCoeff(m, r)), r);
1643 
1644  return(m);
1645 };

◆ p_LDeg()

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

Definition at line 382 of file p_polys.h.

382 { return r->pLDeg(p,l,r); }

◆ p_LmCheckIsFromRing()

BOOLEAN p_LmCheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 71 of file pDebug.cc.

72 {
73  if (p != NULL)
74  {
75  #if (OM_TRACK > 0) && defined(OM_TRACK_CUSTOM)
76  void* custom = omGetCustomOfAddr(p);
77  if (custom != NULL)
78  {
79  pPolyAssumeReturnMsg(custom == r ||
80  // be more sloppy for qrings
81  (r->qideal != NULL &&
82  omIsBinPageAddr(p) &&
83  omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin)) ||
84  rSamePolyRep((ring) custom, r),
85  "monomial not from specified ring",p,r);
86  return TRUE;
87  }
88  else
89  #endif
90  #ifndef X_OMALLOC
91  {
94  return TRUE;
95  }
96  return FALSE;
97  #endif
98  }
99  return TRUE;
100 }

◆ p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing ( poly  p,
ring  r 
)

Definition at line 120 of file pDebug.cc.

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

◆ p_LmCmp()

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

Definition at line 1498 of file p_polys.h.

1499 {
1500  p_LmCheckPolyRing1(p, r);
1501  p_LmCheckPolyRing1(q, r);
1502 
1503  const unsigned long* _s1 = ((unsigned long*) p->exp);
1504  const unsigned long* _s2 = ((unsigned long*) q->exp);
1505  REGISTER unsigned long _v1;
1506  REGISTER unsigned long _v2;
1507  const unsigned long _l = r->CmpL_Size;
1508 
1509  REGISTER unsigned long _i=0;
1510 
1511  LengthGeneral_OrdGeneral_LoopTop:
1512  _v1 = _s1[_i];
1513  _v2 = _s2[_i];
1514  if (_v1 == _v2)
1515  {
1516  _i++;
1517  if (_i == _l) return 0;
1518  goto LengthGeneral_OrdGeneral_LoopTop;
1519  }
1520  const long* _ordsgn = (long*) r->ordsgn;
1521 #if 1 /* two variants*/
1522  if (_v1 > _v2)
1523  {
1524  return _ordsgn[_i];
1525  }
1526  return -(_ordsgn[_i]);
1527 #else
1528  if (_v1 > _v2)
1529  {
1530  if (_ordsgn[_i] == 1) return 1;
1531  return -1;
1532  }
1533  if (_ordsgn[_i] == 1) return -1;
1534  return 1;
1535 #endif
1536 }

◆ p_LmDelete() [1/2]

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

Definition at line 718 of file p_polys.h.

719 {
720  p_LmCheckPolyRing2(*p, r);
721  poly h = *p;
722  *p = pNext(h);
723  n_Delete(&pGetCoeff(h), r->cf);
724  omFreeBinAddr(h);
725 }

◆ p_LmDelete() [2/2]

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

Definition at line 712 of file p_polys.h.

713 {
714  p_LmCheckPolyRing2(p, r);
715  n_Delete(&pGetCoeff(p), r->cf);
716  omFreeBinAddr(p);
717 }

◆ p_LmDeleteAndNext()

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

Definition at line 726 of file p_polys.h.

727 {
728  p_LmCheckPolyRing2(p, r);
729  poly pnext = pNext(p);
730  n_Delete(&pGetCoeff(p), r->cf);
731  omFreeBinAddr(p);
732  return pnext;
733 }

◆ p_LmDeleteAndNextRat()

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

Definition at line 1647 of file p_polys.cc.

1648 {
1649  /* modifies p*/
1650  // Print("start: "); Print(" "); p_wrp(*p,r);
1651  p_LmCheckPolyRing2(*p, r);
1652  poly q = p_Head(*p,r);
1653  const long cmp = p_GetComp(*p, r);
1654  while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) ) && (p_GetComp(*p, r) == cmp) )
1655  {
1656  p_LmDelete(p,r);
1657  // Print("while: ");p_wrp(*p,r);Print(" ");
1658  }
1659  // p_wrp(*p,r);Print(" ");
1660  // PrintS("end\n");
1661  p_LmDelete(&q,r);
1662 }

◆ p_LmDivisibleBy() [1/2]

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

Definition at line 1848 of file p_polys.h.

1849 {
1850  p_LmCheckPolyRing(a, r_a);
1851  p_LmCheckPolyRing(b, r_b);
1852  return _p_LmDivisibleBy(a, r_a, b, r_b);
1853 }

◆ p_LmDivisibleBy() [2/2]

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

Definition at line 1821 of file p_polys.h.

1822 {
1823  p_LmCheckPolyRing1(b, r);
1824  pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
1825  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1826  return _p_LmDivisibleByNoComp(a, b, r);
1827  return FALSE;
1828 }

◆ p_LmDivisibleByNoComp() [1/2]

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

Definition at line 1814 of file p_polys.h.

1815 {
1816  p_LmCheckPolyRing1(a, ra);
1817  p_LmCheckPolyRing1(b, rb);
1818  return _p_LmDivisibleByNoComp(a, ra, b, rb);
1819 }

◆ p_LmDivisibleByNoComp() [2/2]

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

Definition at line 1807 of file p_polys.h.

1808 {
1809  p_LmCheckPolyRing1(a, r);
1810  p_LmCheckPolyRing1(b, r);
1811  return _p_LmDivisibleByNoComp(a, b, r);
1812 }

◆ p_LmDivisibleByPart()

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

Definition at line 1786 of file p_polys.h.

1787 {
1788  p_LmCheckPolyRing1(b, r);
1789  pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
1790  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1791  return _p_LmDivisibleByNoCompPart(a, r, b, r,start, end);
1792  return FALSE;
1793 }

◆ p_LmExpVectorAddIsOk()

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

Definition at line 1964 of file p_polys.h.

1966 {
1967  p_LmCheckPolyRing(p1, r);
1968  p_LmCheckPolyRing(p2, r);
1969  unsigned long l1, l2, divmask = r->divmask;
1970  int i;
1971 
1972  for (i=0; i<r->VarL_Size; i++)
1973  {
1974  l1 = p1->exp[r->VarL_Offset[i]];
1975  l2 = p2->exp[r->VarL_Offset[i]];
1976  // do the divisiblity trick
1977  if ( (l1 > ULONG_MAX - l2) ||
1978  (((l1 & divmask) ^ (l2 & divmask)) != ((l1 + l2) & divmask)))
1979  return FALSE;
1980  }
1981  return TRUE;
1982 }

◆ p_LmFree() [1/2]

static void p_LmFree ( poly *  p,
ring   
)
inlinestatic

Definition at line 693 of file p_polys.h.

695 {
696  p_LmCheckPolyRing2(*p, r);
697  poly h = *p;
698  *p = pNext(h);
699  omFreeBinAddr(h);
700 }

◆ p_LmFree() [2/2]

static void p_LmFree ( poly  p,
ring   
)
inlinestatic

Definition at line 684 of file p_polys.h.

686 {
687  p_LmCheckPolyRing2(p, r);
688  omFreeBinAddr(p);
689 }

◆ p_LmFreeAndNext()

static poly p_LmFreeAndNext ( poly  p,
ring   
)
inlinestatic

Definition at line 704 of file p_polys.h.

706 {
707  p_LmCheckPolyRing2(p, r);
708  poly pnext = pNext(p);
709  omFreeBinAddr(p);
710  return pnext;
711 }

◆ p_LmInit() [1/3]

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

Definition at line 1272 of file p_polys.h.

1273 {
1274  p_LmCheckPolyRing1(p, r);
1275  poly np;
1276  omTypeAllocBin(poly, np, r->PolyBin);
1277  p_SetRingOfLm(np, r);
1278  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
1279  pNext(np) = NULL;
1280  pSetCoeff0(np, NULL);
1281  return np;
1282 }

◆ p_LmInit() [2/3]

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

Definition at line 1300 of file p_polys.h.

1301 {
1302  pAssume1(d_r != NULL);
1303  return p_LmInit(s_p, s_r, d_r, d_r->PolyBin);
1304 }

◆ p_LmInit() [3/3]

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

Definition at line 1283 of file p_polys.h.

1284 {
1285  p_LmCheckPolyRing1(s_p, s_r);
1286  p_CheckRing(d_r);
1287  pAssume1(d_r->N <= s_r->N);
1288  poly d_p = p_Init(d_r, d_bin);
1289  for (unsigned i=d_r->N; i!=0; i--)
1290  {
1291  p_SetExp(d_p, i, p_GetExp(s_p, i,s_r), d_r);
1292  }
1293  if (rRing_has_Comp(d_r))
1294  {
1295  p_SetComp(d_p, p_GetComp(s_p,s_r), d_r);
1296  }
1297  p_Setm(d_p, d_r);
1298  return d_p;
1299 }

◆ p_LmIsConstant()

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

Definition at line 980 of file p_polys.h.

981 {
982  if (p_LmIsConstantComp(p, r))
983  return (p_GetComp(p, r) == 0);
984  return FALSE;
985 }

◆ p_LmIsConstantComp()

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

Definition at line 963 of file p_polys.h.

964 {
965  //p_LmCheckPolyRing(p, r);
966  int i = r->VarL_Size - 1;
967 
968  do
969  {
970  if (p->exp[r->VarL_Offset[i]] != 0)
971  return FALSE;
972  i--;
973  }
974  while (i >= 0);
975  return TRUE;
976 }

◆ p_LmShallowCopyDelete()

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

Definition at line 1330 of file p_polys.h.

1331 {
1332  p_LmCheckPolyRing1(p, r);
1333  pAssume1(omSizeWOfBin(bin) == omSizeWOfBin(r->PolyBin));
1334  poly new_p = p_New(r);
1335  memcpy(new_p->exp, p->exp, r->ExpL_Size*sizeof(long));
1336  pSetCoeff0(new_p, pGetCoeff(p));
1337  pNext(new_p) = pNext(p);
1338  omFreeBinAddr(p);
1339  return new_p;
1340 }

◆ p_LmShortDivisibleBy() [1/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 1895 of file p_polys.h.

1897 {
1898  p_LmCheckPolyRing1(a, r_a);
1899  p_LmCheckPolyRing1(b, r_b);
1900 #ifndef PDIV_DEBUG
1901  _pPolyAssume2(p_GetShortExpVector(a, r_a) == sev_a, a, r_a);
1902  _pPolyAssume2(p_GetShortExpVector(b, r_b) == ~ not_sev_b, b, r_b);
1903 
1904  if (sev_a & not_sev_b)
1905  {
1906  pAssume1(_p_LmDivisibleByNoComp(a, r_a, b, r_b) == FALSE);
1907  return FALSE;
1908  }
1909  return _p_LmDivisibleBy(a, r_a, b, r_b);
1910 #else
1911  return pDebugLmShortDivisibleBy(a, sev_a, r_a, b, not_sev_b, r_b);
1912 #endif
1913 }

◆ p_LmShortDivisibleBy() [2/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 1855 of file p_polys.h.

1857 {
1858  p_LmCheckPolyRing1(a, r);
1859  p_LmCheckPolyRing1(b, r);
1860 #ifndef PDIV_DEBUG
1861  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
1862  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
1863 
1864  if (sev_a & not_sev_b)
1865  {
1867  return FALSE;
1868  }
1869  return p_LmDivisibleBy(a, b, r);
1870 #else
1871  return pDebugLmShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);
1872 #endif
1873 }

◆ 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 1875 of file p_polys.h.

1877 {
1878  p_LmCheckPolyRing1(a, r);
1879  p_LmCheckPolyRing1(b, r);
1880 #ifndef PDIV_DEBUG
1881  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
1882  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
1883 
1884  if (sev_a & not_sev_b)
1885  {
1887  return FALSE;
1888  }
1889  return p_LmDivisibleByNoComp(a, b, r);
1890 #else
1891  return pDebugLmShortDivisibleByNoComp(a, sev_a, r, b, not_sev_b, r);
1892 #endif
1893 }

◆ p_LowVar()

int p_LowVar ( poly  p,
const ring  r 
)

the minimal index of used variables - 1

Definition at line 4578 of file p_polys.cc.

4579 {
4580  int k,l,lex;
4581 
4582  if (p == NULL) return -1;
4583 
4584  k = 32000;/*a very large dummy value*/
4585  while (p != NULL)
4586  {
4587  l = 1;
4588  lex = p_GetExp(p,l,r);
4589  while ((l < (rVar(r))) && (lex == 0))
4590  {
4591  l++;
4592  lex = p_GetExp(p,l,r);
4593  }
4594  l--;
4595  if (l < k) k = l;
4596  pIter(p);
4597  }
4598  return k;
4599 }

◆ p_LtCmp()

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

Definition at line 1539 of file p_polys.h.

1540 {
1541  int res = p_LmCmp(p,q,r);
1542  if(res == 0)
1543  {
1544  if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
1545  return res;
1546  number pc = n_Copy(p_GetCoeff(p,r),r->cf);
1547  number qc = n_Copy(p_GetCoeff(q,r),r->cf);
1548  if(!n_GreaterZero(pc,r->cf))
1549  pc = n_InpNeg(pc,r->cf);
1550  if(!n_GreaterZero(qc,r->cf))
1551  qc = n_InpNeg(qc,r->cf);
1552  if(n_Greater(pc,qc,r->cf))
1553  res = 1;
1554  else if(n_Greater(qc,pc,r->cf))
1555  res = -1;
1556  else if(n_Equal(pc,qc,r->cf))
1557  res = 0;
1558  n_Delete(&pc,r->cf);
1559  n_Delete(&qc,r->cf);
1560  }
1561  return res;
1562 }

◆ p_LtCmpNoAbs()

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

Definition at line 1565 of file p_polys.h.

1566 {
1567  int res = p_LmCmp(p,q,r);
1568  if(res == 0)
1569  {
1570  if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
1571  return res;
1572  number pc = p_GetCoeff(p,r);
1573  number qc = p_GetCoeff(q,r);
1574  if(n_Greater(pc,qc,r->cf))
1575  res = 1;
1576  if(n_Greater(qc,pc,r->cf))
1577  res = -1;
1578  if(n_Equal(pc,qc,r->cf))
1579  res = 0;
1580  }
1581  return res;
1582 }

◆ p_LtCmpOrdSgnDiffM()

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

Definition at line 1587 of file p_polys.h.

1588 {
1589  if(r->OrdSgn == 1)
1590  {
1591  return(p_LtCmp(p,q,r) == 1);
1592  }
1593  else
1594  {
1595  return(p_LmCmp(p,q,r) == -1);
1596  }
1597 }

◆ p_LtCmpOrdSgnDiffP()

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

Definition at line 1603 of file p_polys.h.

1604 {
1605  if(r->OrdSgn == 1)
1606  {
1607  return(p_LmCmp(p,q,r) == -1);
1608  }
1609  else
1610  {
1611  return(p_LtCmp(p,q,r) != -1);
1612  }
1613 
1614 }

◆ p_LtCmpOrdSgnEqM()

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

Definition at line 1620 of file p_polys.h.

1621 {
1622  return(p_LtCmp(p,q,r) == -r->OrdSgn);
1623 }

◆ p_LtCmpOrdSgnEqP()

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

Definition at line 1629 of file p_polys.h.

1630 {
1631  return(p_LtCmp(p,q,r) == r->OrdSgn);
1632 }

◆ p_MaxComp() [1/2]

static long p_MaxComp ( poly  p,
ring  lmRing 
)
inlinestatic

Definition at line 312 of file p_polys.h.

312 {return p_MaxComp(p,lmRing,lmRing);}

◆ p_MaxComp() [2/2]

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

Definition at line 293 of file p_polys.h.

294 {
295  long result,i;
296 
297  if(p==NULL) return 0;
298  result = p_GetComp(p, lmRing);
299  if (result != 0)
300  {
301  loop
302  {
303  pIter(p);
304  if(p==NULL) break;
305  i = p_GetComp(p, tailRing);
306  if (i>result) result = i;
307  }
308  }
309  return result;
310 }

◆ p_MDivide()

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

Definition at line 1454 of file p_polys.cc.

1455 {
1456  assume((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(b,r)==0));
1457  int i;
1458  poly result = p_Init(r);
1459 
1460  for(i=(int)r->N; i; i--)
1461  p_SetExp(result,i, p_GetExp(a,i,r)- p_GetExp(b,i,r),r);
1462  p_SetComp(result, p_GetComp(a,r) - p_GetComp(b,r),r);
1463  p_Setm(result,r);
1464  return result;
1465 }

◆ p_MemAdd_NegWeightAdjust()

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

Definition at line 1229 of file p_polys.h.

1230 {
1231  if (r->NegWeightL_Offset != NULL)
1232  {
1233  for (int i=r->NegWeightL_Size-1; i>=0; i--)
1234  {
1235  p->exp[r->NegWeightL_Offset[i]] -= POLY_NEGWEIGHT_OFFSET;
1236  }
1237  }
1238 }

◆ p_MemSub_NegWeightAdjust()

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

Definition at line 1239 of file p_polys.h.

1240 {
1241  if (r->NegWeightL_Offset != NULL)
1242  {
1243  for (int i=r->NegWeightL_Size-1; i>=0; i--)
1244  {
1245  p->exp[r->NegWeightL_Offset[i]] += POLY_NEGWEIGHT_OFFSET;
1246  }
1247  }
1248 }

◆ p_Merge_q()

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

Definition at line 1149 of file p_polys.h.

1150 {
1151  assume( (p != q) || (p == NULL && q == NULL) );
1152  return r->p_Procs->p_Merge_q(p, q, r);
1153 }

◆ p_MinComp() [1/2]

static long p_MinComp ( poly  p,
ring  lmRing 
)
inlinestatic

Definition at line 333 of file p_polys.h.

333 {return p_MinComp(p,lmRing,lmRing);}

◆ p_MinComp() [2/2]

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

Definition at line 314 of file p_polys.h.

315 {
316  long result,i;
317 
318  if(p==NULL) return 0;
319  result = p_GetComp(p,lmRing);
320  if (result != 0)
321  {
322  loop
323  {
324  pIter(p);
325  if(p==NULL) break;
326  i = p_GetComp(p,tailRing);
327  if (i<result) result = i;
328  }
329  }
330  return result;
331 }

◆ p_MinDeg()

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

Definition at line 4346 of file p_polys.cc.

4347 {
4348  if(p==NULL)
4349  return -1;
4350  int d=-1;
4351  while(p!=NULL)
4352  {
4353  int d0=0;
4354  for(int j=0;j<rVar(R);j++)
4355  if(w==NULL||j>=w->length())
4356  d0+=p_GetExp(p,j+1,R);
4357  else
4358  d0+=(*w)[j]*p_GetExp(p,j+1,R);
4359  if(d0<d||d==-1)
4360  d=d0;
4361  pIter(p);
4362  }
4363  return d;
4364 }

◆ p_mInit()

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

Definition at line 1412 of file p_polys.cc.

1413 {
1414  poly p;
1415  const char *s=p_Read(st,p,r);
1416  if (*s!='\0')
1417  {
1418  if ((s!=st)&&isdigit(st[0]))
1419  {
1421  }
1422  ok=FALSE;
1423  p_Delete(&p,r);
1424  return NULL;
1425  }
1426  p_Test(p,r);
1427  ok=!errorreported;
1428  return p;
1429 }

◆ p_Minus_mm_Mult_qq() [1/2]

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

Definition at line 1018 of file p_polys.h.

1019 {
1020  int shorter;
1021 
1022  return r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
1023 }

◆ p_Minus_mm_Mult_qq() [2/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 1007 of file p_polys.h.

1009 {
1010  int shorter;
1011  const poly res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, spNoether, r);
1012  lp += lq - shorter;
1013 // assume( lp == pLength(res) );
1014  return res;
1015 }

◆ p_Mult_mm()

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

Definition at line 998 of file p_polys.h.

999 {
1000  if (p==NULL) return NULL;
1001  if (p_LmIsConstant(m, r))
1002  return __p_Mult_nn(p, pGetCoeff(m), r);
1003  else
1004  return r->p_Procs->p_Mult_mm(p, m, r);
1005 }

◆ p_Mult_nn() [1/2]

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

Definition at line 930 of file p_polys.h.

932 {
933  assume(p!=NULL);
934 #ifndef PDEBUG
935  if (lmRing == tailRing)
936  return p_Mult_nn(p, n, tailRing);
937 #endif
938  poly pnext = pNext(p);
939  pNext(p) = NULL;
940  p = lmRing->p_Procs->p_Mult_nn(p, n, lmRing);
941  if (pnext!=NULL)
942  {
943  pNext(p) = tailRing->p_Procs->p_Mult_nn(pnext, n, tailRing);
944  }
945  return p;
946 }

◆ p_Mult_nn() [2/2]

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

Definition at line 915 of file p_polys.h.

916 {
917  if (p==NULL) return NULL;
918  if (n_IsOne(n, r->cf))
919  return p;
920  else if (n_IsZero(n, r->cf))
921  {
922  p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
923  return NULL;
924  }
925  else
926  return r->p_Procs->p_Mult_nn(p, n, r);
927 }

◆ p_Mult_q()

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

Definition at line 1051 of file p_polys.h.

1052 {
1053  assume( (p != q) || (p == NULL && q == NULL) );
1054 
1055  if (p == NULL)
1056  {
1057  p_Delete(&q, r);
1058  return NULL;
1059  }
1060  if (q == NULL)
1061  {
1062  p_Delete(&p, r);
1063  return NULL;
1064  }
1065 
1066  if (pNext(p) == NULL)
1067  {
1068  q = r->p_Procs->p_mm_Mult(q, p, r);
1069  p_LmDelete(&p, r);
1070  return q;
1071  }
1072 
1073  if (pNext(q) == NULL)
1074  {
1075  p = r->p_Procs->p_Mult_mm(p, q, r);
1076  p_LmDelete(&q, r);
1077  return p;
1078  }
1079 #ifdef HAVE_PLURAL
1080  if (rIsNCRing(r))
1081  return _nc_p_Mult_q(p, q, r);
1082  else
1083 #endif
1084  return _p_Mult_q(p, q, 0, r);
1085 }

◆ p_MultExp()

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

Definition at line 622 of file p_polys.h.

623 {
624  p_LmCheckPolyRing2(p, r);
625  long e = p_GetExp(p,v,r);
626  e *= ee;
627  return p_SetExp(p,v,e,r);
628 }

◆ p_Neg()

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

Definition at line 1044 of file p_polys.h.

1045 {
1046  return r->p_Procs->p_Neg(p, r);
1047 }

◆ p_New() [1/2]

static poly p_New ( const  ring,
omBin  bin 
)
inlinestatic

Definition at line 665 of file p_polys.h.

667 {
668  p_CheckRing2(r);
669  pAssume2(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
670  poly p;
671  omTypeAllocBin(poly, p, bin);
672  p_SetRingOfLm(p, r);
673  return p;
674 }

◆ p_New() [2/2]

static poly p_New ( ring  r)
inlinestatic

Definition at line 676 of file p_polys.h.

677 {
678  return p_New(r, r->PolyBin);
679 }

◆ p_Norm()

void p_Norm ( poly  p1,
const ring  r 
)

Definition at line 3670 of file p_polys.cc.

3671 {
3672  if (rField_is_Ring(r))
3673  {
3674  if (!n_IsUnit(pGetCoeff(p1), r->cf)) return;
3675  // Werror("p_Norm not possible in the case of coefficient rings.");
3676  }
3677  else if (p1!=NULL)
3678  {
3679  if (pNext(p1)==NULL)
3680  {
3681  p_SetCoeff(p1,n_Init(1,r->cf),r);
3682  return;
3683  }
3684  poly h;
3685  if (!n_IsOne(pGetCoeff(p1),r->cf))
3686  {
3687  number k, c;
3688  n_Normalize(pGetCoeff(p1),r->cf);
3689  k = pGetCoeff(p1);
3690  c = n_Init(1,r->cf);
3691  pSetCoeff0(p1,c);
3692  h = pNext(p1);
3693  while (h!=NULL)
3694  {
3695  c=n_Div(pGetCoeff(h),k,r->cf);
3696  // no need to normalize: Z/p, R
3697  // normalize already in nDiv: Q_a, Z/p_a
3698  // remains: Q
3699  if (rField_is_Q(r) && (!n_IsOne(c,r->cf))) n_Normalize(c,r->cf);
3700  p_SetCoeff(h,c,r);
3701  pIter(h);
3702  }
3703  n_Delete(&k,r->cf);
3704  }
3705  else
3706  {
3707  //if (r->cf->cfNormalize != nDummy2) //TODO: OPTIMIZE
3708  {
3709  h = pNext(p1);
3710  while (h!=NULL)
3711  {
3712  n_Normalize(pGetCoeff(h),r->cf);
3713  pIter(h);
3714  }
3715  }
3716  }
3717  }
3718 }

◆ p_Normalize()

void p_Normalize ( poly  p,
const ring  r 
)

Definition at line 3723 of file p_polys.cc.

3724 {
3725  if (rField_has_simple_inverse(r)) return; /* Z/p, GF(p,n), R, long R/C */
3726  while (p!=NULL)
3727  {
3728  // no test befor n_Normalize: n_Normalize should fix problems
3729  n_Normalize(pGetCoeff(p),r->cf);
3730  pIter(p);
3731  }
3732 }

◆ p_NSet()

poly p_NSet ( number  n,
const ring  r 
)

returns the poly representing the number n, destroys n

Definition at line 1435 of file p_polys.cc.

1436 {
1437  if (n_IsZero(n,r->cf))
1438  {
1439  n_Delete(&n, r->cf);
1440  return NULL;
1441  }
1442  else
1443  {
1444  poly rc = p_Init(r);
1445  pSetCoeff0(rc,n);
1446  return rc;
1447  }
1448 }

◆ p_One()

poly p_One ( const ring  r)

Definition at line 1305 of file p_polys.cc.

1306 {
1307  poly rc = p_Init(r);
1308  pSetCoeff0(rc,n_Init(1,r->cf));
1309  return rc;
1310 }

◆ p_OneComp()

BOOLEAN p_OneComp ( poly  p,
const ring  r 
)

return TRUE if all monoms have the same component

Definition at line 1200 of file p_polys.cc.

1201 {
1202  if(p!=NULL)
1203  {
1204  long i = p_GetComp(p, r);
1205  while (pNext(p)!=NULL)
1206  {
1207  pIter(p);
1208  if(i != p_GetComp(p, r)) return FALSE;
1209  }
1210  }
1211  return TRUE;
1212 }

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

4030 {
4031 #if 0
4032  p_Test(p, oldRing);
4033  PrintS("p_PermPoly::p: "); p_Write(p, oldRing, oldRing);
4034 #endif
4035  const int OldpVariables = rVar(oldRing);
4036  poly result = NULL;
4037  poly result_last = NULL;
4038  poly aq = NULL; /* the map coefficient */
4039  poly qq; /* the mapped monomial */
4040  assume(dst != NULL);
4041  assume(dst->cf != NULL);
4042  #ifdef HAVE_PLURAL
4043  poly tmp_mm=p_One(dst);
4044  #endif
4045  while (p != NULL)
4046  {
4047  // map the coefficient
4048  if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing) || (nMap==ndCopyMap))
4049  && (nMap != NULL) )
4050  {
4051  qq = p_Init(dst);
4052  assume( nMap != NULL );
4053  number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
4054  n_Test (n,dst->cf);
4055  if ( nCoeff_is_algExt(dst->cf) )
4056  n_Normalize(n, dst->cf);
4057  p_GetCoeff(qq, dst) = n;// Note: n can be a ZERO!!!
4058  }
4059  else
4060  {
4061  qq = p_One(dst);
4062 // aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst???
4063 // poly n_PermNumber(const number z, const int *par_perm, const int P, const ring src, const ring dst)
4064  aq = n_PermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing, dst);
4065  p_Test(aq, dst);
4066  if ( nCoeff_is_algExt(dst->cf) )
4067  p_Normalize(aq,dst);
4068  if (aq == NULL)
4069  p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!!
4070  p_Test(aq, dst);
4071  }
4072  if (rRing_has_Comp(dst))
4073  p_SetComp(qq, p_GetComp(p, oldRing), dst);
4074  if ( n_IsZero(pGetCoeff(qq), dst->cf) )
4075  {
4076  p_LmDelete(&qq,dst);
4077  qq = NULL;
4078  }
4079  else
4080  {
4081  // map pars:
4082  int mapped_to_par = 0;
4083  for(int i = 1; i <= OldpVariables; i++)
4084  {
4085  int e = p_GetExp(p, i, oldRing);
4086  if (e != 0)
4087  {
4088  if (perm==NULL)
4089  p_SetExp(qq, i, e, dst);
4090  else if (perm[i]>0)
4091  {
4092  #ifdef HAVE_PLURAL
4093  if(use_mult)
4094  {
4095  p_SetExp(tmp_mm,perm[i],e,dst);
4096  p_Setm(tmp_mm,dst);
4097  qq=p_Mult_mm(qq,tmp_mm,dst);
4098  p_SetExp(tmp_mm,perm[i],0,dst);
4099 
4100  }
4101  else
4102  #endif
4103  p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst);
4104  }
4105  else if (perm[i]<0)
4106  {
4107  number c = p_GetCoeff(qq, dst);
4108  if (rField_is_GF(dst))
4109  {
4110  assume( dst->cf->extRing == NULL );
4111  number ee = n_Param(1, dst);
4112  number eee;
4113  n_Power(ee, e, &eee, dst->cf); //nfDelete(ee,dst);
4114  ee = n_Mult(c, eee, dst->cf);
4115  //nfDelete(c,dst);nfDelete(eee,dst);
4116  pSetCoeff0(qq,ee);
4117  }
4118  else if (nCoeff_is_Extension(dst->cf))
4119  {
4120  const int par = -perm[i];
4121  assume( par > 0 );
4122 // WarnS("longalg missing 3");
4123 #if 1
4124  const coeffs C = dst->cf;
4125  assume( C != NULL );
4126  const ring R = C->extRing;
4127  assume( R != NULL );
4128  assume( par <= rVar(R) );
4129  poly pcn; // = (number)c
4130  assume( !n_IsZero(c, C) );
4131  if( nCoeff_is_algExt(C) )
4132  pcn = (poly) c;
4133  else // nCoeff_is_transExt(C)
4134  pcn = NUM((fraction)c);
4135  if (pNext(pcn) == NULL) // c->z
4136  p_AddExp(pcn, -perm[i], e, R);
4137  else /* more difficult: we have really to multiply: */
4138  {
4139  poly mmc = p_ISet(1, R);
4140  p_SetExp(mmc, -perm[i], e, R);
4141  p_Setm(mmc, R);
4142  number nnc;
4143  // convert back to a number: number nnc = mmc;
4144  if( nCoeff_is_algExt(C) )
4145  nnc = (number) mmc;
4146  else // nCoeff_is_transExt(C)
4147  nnc = ntInit(mmc, C);
4148  p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C);
4149  n_Delete((number *)&c, C);
4150  n_Delete((number *)&nnc, C);
4151  }
4152  mapped_to_par=1;
4153 #endif
4154  }
4155  }
4156  else
4157  {
4158  /* this variable maps to 0 !*/
4159  p_LmDelete(&qq, dst);
4160  break;
4161  }
4162  }
4163  }
4164  if ( mapped_to_par && (qq!= NULL) && nCoeff_is_algExt(dst->cf) )
4165  {
4166  number n = p_GetCoeff(qq, dst);
4167  n_Normalize(n, dst->cf);
4168  p_GetCoeff(qq, dst) = n;
4169  }
4170  }
4171  pIter(p);
4172 
4173 #if 0
4174  p_Test(aq,dst);
4175  PrintS("aq: "); p_Write(aq, dst, dst);
4176 #endif
4177 
4178 
4179 #if 1
4180  if (qq!=NULL)
4181  {
4182  p_Setm(qq,dst);
4183 
4184  p_Test(aq,dst);
4185  p_Test(qq,dst);
4186 
4187 #if 0
4188  PrintS("qq: "); p_Write(qq, dst, dst);
4189 #endif
4190 
4191  if (aq!=NULL)
4192  qq=p_Mult_q(aq,qq,dst);
4193  aq = qq;
4194  while (pNext(aq) != NULL) pIter(aq);
4195  if (result_last==NULL)
4196  {
4197  result=qq;
4198  }
4199  else
4200  {
4201  pNext(result_last)=qq;
4202  }
4203  result_last=aq;
4204  aq = NULL;
4205  }
4206  else if (aq!=NULL)
4207  {
4208  p_Delete(&aq,dst);
4209  }
4210  }
4211  result=p_SortAdd(result,dst);
4212 #else
4213  // if (qq!=NULL)
4214  // {
4215  // pSetm(qq);
4216  // pTest(qq);
4217  // pTest(aq);
4218  // if (aq!=NULL) qq=pMult(aq,qq);
4219  // aq = qq;
4220  // while (pNext(aq) != NULL) pIter(aq);
4221  // pNext(aq) = result;
4222  // aq = NULL;
4223  // result = qq;
4224  // }
4225  // else if (aq!=NULL)
4226  // {
4227  // pDelete(&aq);
4228  // }
4229  //}
4230  //p = result;
4231  //result = NULL;
4232  //while (p != NULL)
4233  //{
4234  // qq = p;
4235  // pIter(p);
4236  // qq->next = NULL;
4237  // result = pAdd(result, qq);
4238  //}
4239 #endif
4240  p_Test(result,dst);
4241 #if 0
4242  p_Test(result,dst);
4243  PrintS("result: "); p_Write(result,dst,dst);
4244 #endif
4245  #ifdef HAVE_PLURAL
4246  p_LmDelete(&tmp_mm,dst);
4247  #endif
4248  return result;
4249 }

◆ p_Plus_mm_Mult_qq() [1/2]

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

Definition at line 1142 of file p_polys.h.

1143 {
1144  int lp = 0, lq = 0;
1145  return p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
1146 }

◆ p_Plus_mm_Mult_qq() [2/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 1120 of file p_polys.h.

1122 {
1123 #ifdef HAVE_PLURAL
1124  if (rIsPluralRing(r))
1125  return nc_p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
1126 #endif
1127 
1128 // this should be implemented more efficiently
1129  poly res;
1130  int shorter;
1131  number n_old = pGetCoeff(m);
1132  number n_neg = n_Copy(n_old, r->cf);
1133  n_neg = n_InpNeg(n_neg, r->cf);
1134  pSetCoeff0(m, n_neg);
1135  res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
1136  lp = (lp + lq) - shorter;
1137  pSetCoeff0(m, n_old);
1138  n_Delete(&n_neg, r->cf);
1139  return res;
1140 }

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

1818 {
1819  assume(divisor != NULL);
1820  if (p == NULL) return NULL;
1821 
1822  poly result = NULL;
1823  number divisorLC = p_GetCoeff(divisor, r);
1824  int divisorLE = p_GetExp(divisor, 1, r);
1825  while ((p != NULL) && (p_Deg(p, r) >= p_Deg(divisor, r)))
1826  {
1827  /* determine t = LT(p) / LT(divisor) */
1828  poly t = p_ISet(1, r);
1829  number c = n_Div(p_GetCoeff(p, r), divisorLC, r->cf);
1830  n_Normalize(c,r->cf);
1831  p_SetCoeff(t, c, r);
1832  int e = p_GetExp(p, 1, r) - divisorLE;
1833  p_SetExp(t, 1, e, r);
1834  p_Setm(t, r);
1835  if (needResult) result = p_Add_q(result, p_Copy(t, r), r);
1836  p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
1837  }
1838  return result;
1839 }

◆ p_Power()

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

Definition at line 2144 of file p_polys.cc.

2145 {
2146  poly rc=NULL;
2147 
2148  if (i==0)
2149  {
2150  p_Delete(&p,r);
2151  return p_One(r);
2152  }
2153 
2154  if(p!=NULL)
2155  {
2156  if ( (i > 0) && ((unsigned long ) i > (r->bitmask)))
2157  {
2158  Werror("exponent %d is too large, max. is %ld",i,r->bitmask);
2159  return NULL;
2160  }
2161  switch (i)
2162  {
2163 // cannot happen, see above
2164 // case 0:
2165 // {
2166 // rc=pOne();
2167 // pDelete(&p);
2168 // break;
2169 // }
2170  case 1:
2171  rc=p;
2172  break;
2173  case 2:
2174  rc=p_Mult_q(p_Copy(p,r),p,r);
2175  break;
2176  default:
2177  if (i < 0)
2178  {
2179  p_Delete(&p,r);
2180  return NULL;
2181  }
2182  else
2183  {
2184 #ifdef HAVE_PLURAL
2185  if (rIsNCRing(r)) /* in the NC case nothing helps :-( */
2186  {
2187  int j=i;
2188  rc = p_Copy(p,r);
2189  while (j>1)
2190  {
2191  rc = p_Mult_q(p_Copy(p,r),rc,r);
2192  j--;
2193  }
2194  p_Delete(&p,r);
2195  return rc;
2196  }
2197 #endif
2198  rc = pNext(p);
2199  if (rc == NULL)
2200  return p_MonPower(p,i,r);
2201  /* else: binom ?*/
2202  int char_p=rChar(r);
2203  if ((char_p>0) && (i>char_p)
2204  && ((rField_is_Zp(r,char_p)
2205  || (rField_is_Zp_a(r,char_p)))))
2206  {
2207  poly h=p_Pow_charp(p_Copy(p,r),char_p,r);
2208  int rest=i-char_p;
2209  while (rest>=char_p)
2210  {
2211  rest-=char_p;
2212  h=p_Mult_q(h,p_Pow_charp(p_Copy(p,r),char_p,r),r);
2213  }
2214  poly res=h;
2215  if (rest>0)
2216  res=p_Mult_q(p_Power(p_Copy(p,r),rest,r),h,r);
2217  p_Delete(&p,r);
2218  return res;
2219  }
2220  if ((pNext(rc) != NULL)
2221  || rField_is_Ring(r)
2222  )
2223  return p_Pow(p,i,r);
2224  if ((char_p==0) || (i<=char_p))
2225  return p_TwoMonPower(p,i,r);
2226  return p_Pow(p,i,r);
2227  }
2228  /*end default:*/
2229  }
2230  }
2231  return rc;
2232 }

◆ p_ProjectiveUnique()

void p_ProjectiveUnique ( poly  p,
const ring  r 
)

Definition at line 3080 of file p_polys.cc.

3081 {
3082  if( ph == NULL )
3083  return;
3084 
3085  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
3086 
3087  number h;
3088  poly p;
3089 
3090  if (rField_is_Ring(r))
3091  {
3092  p_ContentForGB(ph,r);
3093  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3094  assume( n_GreaterZero(pGetCoeff(ph),C) );
3095  return;
3096  }
3097 
3099  {
3100  assume( n_GreaterZero(pGetCoeff(ph),C) );
3101  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3102  return;
3103  }
3104  p = ph;
3105 
3106  assume(p != NULL);
3107 
3108  if(pNext(p)==NULL) // a monomial
3109  {
3110  p_SetCoeff(p, n_Init(1, C), r);
3111  return;
3112  }
3113 
3114  assume(pNext(p)!=NULL);
3115 
3116  if(!rField_is_Q(r) && !nCoeff_is_transExt(C))
3117  {
3118  h = p_GetCoeff(p, C);
3119  number hInv = n_Invers(h, C);
3120  pIter(p);
3121  while (p!=NULL)
3122  {
3123  p_SetCoeff(p, n_Mult(p_GetCoeff(p, C), hInv, C), r);
3124  pIter(p);
3125  }
3126  n_Delete(&hInv, C);
3127  p = ph;
3128  p_SetCoeff(p, n_Init(1, C), r);
3129  }
3130 
3131  p_Cleardenom(ph, r); //removes also Content
3132 
3133 
3134  /* normalize ph over a transcendental extension s.t.
3135  lead (ph) is > 0 if extRing->cf == Q
3136  or lead (ph) is monic if extRing->cf == Zp*/
3137  if (nCoeff_is_transExt(C))
3138  {
3139  p= ph;
3140  h= p_GetCoeff (p, C);
3141  fraction f = (fraction) h;
3142  number n=p_GetCoeff (NUM (f),C->extRing->cf);
3143  if (rField_is_Q (C->extRing))
3144  {
3145  if (!n_GreaterZero(n,C->extRing->cf))
3146  {
3147  p=p_Neg (p,r);
3148  }
3149  }
3150  else if (rField_is_Zp(C->extRing))
3151  {
3152  if (!n_IsOne (n, C->extRing->cf))
3153  {
3154  n=n_Invers (n,C->extRing->cf);
3155  nMapFunc nMap;
3156  nMap= n_SetMap (C->extRing->cf, C);
3157  number ninv= nMap (n,C->extRing->cf, C);
3158  p=__p_Mult_nn (p, ninv, r);
3159  n_Delete (&ninv, C);
3160  n_Delete (&n, C->extRing->cf);
3161  }
3162  }
3163  p= ph;
3164  }
3165 
3166  return;
3167 }

◆ p_Read()

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

Definition at line 1340 of file p_polys.cc.

1341 {
1342  if (r==NULL) { rc=NULL;return st;}
1343  int i,j;
1344  rc = p_Init(r);
1345  const char *s = n_Read(st,&(p_GetCoeff(rc, r)),r->cf);
1346  if (s==st)
1347  /* i.e. it does not start with a coeff: test if it is a ringvar*/
1348  {
1349  j = r_IsRingVar(s,r->names,r->N);
1350  if (j >= 0)
1351  {
1352  p_IncrExp(rc,1+j,r);
1353  while (*s!='\0') s++;
1354  goto done;
1355  }
1356  }
1357  while (*s!='\0')
1358  {
1359  char ss[2];
1360  ss[0] = *s++;
1361  ss[1] = '\0';
1362  j = r_IsRingVar(ss,r->names,r->N);
1363  if (j >= 0)
1364  {
1365  const char *s_save=s;
1366  s = eati(s,&i);
1367  if (((unsigned long)i) > r->bitmask/2)
1368  {
1369  // exponent to large: it is not a monomial
1370  p_LmDelete(&rc,r);
1371  return s_save;
1372  }
1373  p_AddExp(rc,1+j, (long)i, r);
1374  }
1375  else
1376  {
1377  // 1st char of is not a varname
1378  // We return the parsed polynomial nevertheless. This is needed when
1379  // we are parsing coefficients in a rational function field.
1380  s--;
1381  break;
1382  }
1383  }
1384 done:
1385  if (n_IsZero(pGetCoeff(rc),r->cf)) p_LmDelete(&rc,r);
1386  else
1387  {
1388 #ifdef HAVE_PLURAL
1389  // in super-commutative ring
1390  // squares of anti-commutative variables are zeroes!
1391  if(rIsSCA(r))
1392  {
1393  const unsigned int iFirstAltVar = scaFirstAltVar(r);
1394  const unsigned int iLastAltVar = scaLastAltVar(r);
1395 
1396  assume(rc != NULL);
1397 
1398  for(unsigned int k = iFirstAltVar; k <= iLastAltVar; k++)
1399  if( p_GetExp(rc, k, r) > 1 )
1400  {
1401  p_LmDelete(&rc, r);
1402  goto finish;
1403  }
1404  }
1405 #endif
1406 
1407  p_Setm(rc,r);
1408  }
1409 finish:
1410  return s;
1411 }

◆ p_Series()

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

Definition at line 4396 of file p_polys.cc.

4397 {
4398  short *ww=iv2array(w,R);
4399  if(p!=NULL)
4400  {
4401  if(u==NULL)
4402  p=p_JetW(p,n,ww,R);
4403  else
4404  p=p_JetW(p_Mult_q(p,p_Invers(n-p_MinDeg(p,w,R),u,w,R),R),n,ww,R);
4405  }
4406  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4407  return p;
4408 }

◆ p_SetCoeff()

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

Definition at line 413 of file p_polys.h.

414 {
415  p_LmCheckPolyRing2(p, r);
416  n_Delete(&(p->coef), r->cf);
417  (p)->coef=n;
418  return n;
419 }

◆ p_SetComp()

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

Definition at line 248 of file p_polys.h.

249 {
250  p_LmCheckPolyRing2(p, r);
251  if (r->pCompIndex>=0) __p_GetComp(p,r) = c;
252  return c;
253 }

◆ p_SetCompP() [1/2]

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

Definition at line 282 of file p_polys.h.

283 {
284  if (p != NULL)
285  {
286  p_SetComp(p, i, lmRing);
287  p_SetmComp(p, lmRing);
288  p_SetCompP(pNext(p), i, tailRing);
289  }
290 }

◆ p_SetCompP() [2/2]

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

Definition at line 255 of file p_polys.h.

256 {
257  if (p != NULL)
258  {
259  p_Test(p, r);
261  {
262  do
263  {
264  p_SetComp(p, i, r);
265  p_SetmComp(p, r);
266  pIter(p);
267  }
268  while (p != NULL);
269  }
270  else
271  {
272  do
273  {
274  p_SetComp(p, i, r);
275  pIter(p);
276  }
277  while(p != NULL);
278  }
279  }
280 }

◆ p_SetExp() [1/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 583 of file p_polys.h.

584 {
585  p_LmCheckPolyRing2(p, r);
586  pAssume2(v>0 && v <= r->N);
587  pAssume2(r->VarOffset[v] != -1);
588  return p_SetExp(p, e, r->bitmask, r->VarOffset[v]);
589 }

◆ p_SetExp() [2/3]

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

Definition at line 563 of file p_polys.h.

564 {
565  p_LmCheckPolyRing2(p, r);
566  pAssume2(VarOffset != -1);
567  return p_SetExp(p, e, r->bitmask, VarOffset);
568 }

◆ p_SetExp() [3/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 @Note: VarOffset encodes the position in p->exp

See also
p_GetExp

Definition at line 489 of file p_polys.h.

490 {
491  pAssume2(e>=0);
492  pAssume2(e<=iBitmask);
493  pAssume2((VarOffset >> (24 + 6)) == 0);
494 
495  // shift e to the left:
496  REGISTER int shift = VarOffset >> 24;
497  unsigned long ee = e << shift /*(VarOffset >> 24)*/;
498  // find the bits in the exponent vector
499  REGISTER int offset = (VarOffset & 0xffffff);
500  // clear the bits in the exponent vector:
501  p->exp[offset] &= ~( iBitmask << shift );
502  // insert e with |
503  p->exp[ offset ] |= ee;
504  return e;
505 }

◆ p_SetExpV()

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

Definition at line 1472 of file p_polys.h.

1473 {
1474  p_LmCheckPolyRing1(p, r);
1475  for (unsigned j = r->N; j!=0; j--)
1476  p_SetExp(p, j, ev[j], r);
1477 
1478  if(ev[0]!=0) p_SetComp(p, ev[0],r);
1479  p_Setm(p, r);
1480 }

◆ p_SetExpVL()

static void p_SetExpVL ( poly  p,
int64 ev,
const ring  r 
)
inlinestatic

Definition at line 1482 of file p_polys.h.

1483 {
1484  p_LmCheckPolyRing1(p, r);
1485  for (unsigned j = r->N; j!=0; j--)
1486  p_SetExp(p, j, ev[j], r);
1487 
1488  if(ev[0]!=0) p_SetComp(p, ev[0],r);
1489  p_Setm(p, r);
1490 }

◆ p_Setm()

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

Definition at line 234 of file p_polys.h.

235 {
236  p_CheckRing2(r);
237  r->p_Setm(p, r);
238 }

◆ p_SetModDeg()

void p_SetModDeg ( intvec w,
ring  r 
)

Definition at line 3624 of file p_polys.cc.

3625 {
3626  if (w!=NULL)
3627  {
3628  r->pModW = w;
3629  pOldFDeg = r->pFDeg;
3630  pOldLDeg = r->pLDeg;
3631  pOldLexOrder = r->pLexOrder;
3632  pSetDegProcs(r,pModDeg);
3633  r->pLexOrder = TRUE;
3634  }
3635  else
3636  {
3637  r->pModW = NULL;
3639  r->pLexOrder = pOldLexOrder;
3640  }
3641 }

◆ p_ShallowCopyDelete()

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

Definition at line 885 of file p_polys.h.

886 {
887  p_LmCheckPolyRing2(p, r);
888  pAssume2(omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
889  return r->p_Procs->p_ShallowCopyDelete(p, r, bin);
890 }

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

4605 {
4606  poly qp1 = *p,qp2 = *p;/*working pointers*/
4607  int j = p_MaxComp(*p,r),k = p_MinComp(*p,r);
4608 
4609  if (j+i < 0) return ;
4610  BOOLEAN toPoly= ((j == -i) && (j == k));
4611  while (qp1 != NULL)
4612  {
4613  if (toPoly || (__p_GetComp(qp1,r)+i > 0))
4614  {
4615  p_AddComp(qp1,i,r);
4616  p_SetmComp(qp1,r);
4617  qp2 = qp1;
4618  pIter(qp1);
4619  }
4620  else
4621  {
4622  if (qp2 == *p)
4623  {
4624  pIter(*p);
4625  p_LmDelete(&qp2,r);
4626  qp2 = *p;
4627  qp1 = *p;
4628  }
4629  else
4630  {
4631  qp2->next = qp1->next;
4632  if (qp1!=NULL) p_LmDelete(&qp1,r);
4633  qp1 = qp2->next;
4634  }
4635  }
4636  }
4637 }

◆ p_SimpleContent()

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

Definition at line 2492 of file p_polys.cc.

2493 {
2494  if(TEST_OPT_CONTENTSB) return;
2495  if (ph==NULL) return;
2496  if (pNext(ph)==NULL)
2497  {
2498  p_SetCoeff(ph,n_Init(1,r->cf),r);
2499  return;
2500  }
2501  if ((pNext(pNext(ph))==NULL)||(!rField_is_Q(r)))
2502  {
2503  return;
2504  }
2505  number d=p_InitContent(ph,r);
2506  if (n_Size(d,r->cf)<=smax)
2507  {
2508  //if (TEST_OPT_PROT) PrintS("G");
2509  return;
2510  }
2511 
2512  poly p=ph;
2513  number h=d;
2514  if (smax==1) smax=2;
2515  while (p!=NULL)
2516  {
2517 #if 0
2518  d=n_Gcd(h,pGetCoeff(p),r->cf);
2519  n_Delete(&h,r->cf);
2520  h = d;
2521 #else
2522  STATISTIC(n_Gcd); nlInpGcd(h,pGetCoeff(p),r->cf);
2523 #endif
2524  if(n_Size(h,r->cf)<smax)
2525  {
2526  //if (TEST_OPT_PROT) PrintS("g");
2527  return;
2528  }
2529  pIter(p);
2530  }
2531  p = ph;
2532  if (!n_GreaterZero(pGetCoeff(p),r->cf)) h=n_InpNeg(h,r->cf);
2533  if(n_IsOne(h,r->cf)) return;
2534  //if (TEST_OPT_PROT) PrintS("c");
2535  while (p!=NULL)
2536  {
2537 #if 1
2538  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2539  p_SetCoeff(p,d,r);
2540 #else
2541  STATISTIC(n_ExactDiv); nlInpExactDiv(pGetCoeff(p),h,r->cf); // no such function... ?
2542 #endif
2543  pIter(p);
2544  }
2545  n_Delete(&h,r->cf);
2546 }

◆ p_Size()

int p_Size ( poly  p,
const ring  r 
)

Definition at line 3191 of file p_polys.cc.

3192 {
3193  int count = 0;
3194  if (r->cf->has_simple_Alloc)
3195  return pLength(p);
3196  while ( p != NULL )
3197  {
3198  count+= n_Size( pGetCoeff( p ), r->cf );
3199  pIter( p );
3200  }
3201  return count;
3202 }

◆ p_SortAdd()

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

Definition at line 1156 of file p_polys.h.

1157 {
1158  if (revert) p = pReverse(p);
1159  return sBucketSortAdd(p, r);
1160 }

◆ p_SortMerge()

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

Definition at line 1166 of file p_polys.h.

1167 {
1168  if (revert) p = pReverse(p);
1169  return sBucketSortMerge(p, r);
1170 }

◆ p_Split()

void p_Split ( poly  p,
poly *  r 
)

Definition at line 1312 of file p_polys.cc.

1313 {
1314  *h=pNext(p);
1315  pNext(p)=NULL;
1316 }

◆ p_String() [1/2]

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

Definition at line 184 of file polys0.cc.

185 {
186  StringSetS("");
187  p_String0(p, lmRing, tailRing);
188  return StringEndS();
189 }

◆ p_String() [2/2]

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

Definition at line 1177 of file p_polys.h.

1178 {
1179  return p_String(p, p_ring, p_ring);
1180 }

◆ p_String0() [1/2]

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

print p according to ShortOut in lmRing & tailRing

Definition at line 134 of file polys0.cc.

135 {
136  if (p == NULL)
137  {
138  StringAppendS("0");
139  return;
140  }
141  p_Normalize(p,lmRing);
142  if ((n_GetChar(lmRing->cf) == 0)
143  && (nCoeff_is_transExt(lmRing->cf)))
144  p_Normalize(p,lmRing); /* Manual/absfact.tst */
145  if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
146  {
147  writemon(p,0, lmRing);
148  p = pNext(p);
149  while (p!=NULL)
150  {
151  assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
152  if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
153  StringAppendS("+");
154  writemon(p,0, tailRing);
155  p = pNext(p);
156  }
157  return;
158  }
159 
160  long k = 1;
161  StringAppendS("[");
162  loop
163  {
164  while (k < p_GetComp(p,lmRing))
165  {
166  StringAppendS("0,");
167  k++;
168  }
169  writemon(p,k,lmRing);
170  pIter(p);
171  while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
172  {
173  if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
174  writemon(p,k,tailRing);
175  pIter(p);
176  }
177  if (p == NULL) break;
178  StringAppendS(",");
179  k++;
180  }
181  StringAppendS("]");
182 }

◆ p_String0() [2/2]

static void p_String0 ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1181 of file p_polys.h.

1182 {
1183  p_String0(p, p_ring, p_ring);
1184 }

◆ 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 114 of file polys0.cc.

115 {
116  // NOTE: the following (non-thread-safe!) UGLYNESS
117  // (changing naRing->ShortOut for a while) is due to Hans!
118  // Just think of other ring using the VERY SAME naRing and possible
119  // side-effects...
120  // but this is not a problem: i/o is not thread-safe anyway.
121  const BOOLEAN bLMShortOut = rShortOut(lmRing);
122  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
123 
124  lmRing->ShortOut = FALSE;
125  tailRing->ShortOut = FALSE;
126 
127  p_String0(p, lmRing, tailRing);
128 
129  lmRing->ShortOut = bLMShortOut;
130  tailRing->ShortOut = bTAILShortOut;
131 }

◆ 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 95 of file polys0.cc.

96 {
97  // NOTE: the following (non-thread-safe!) UGLYNESS
98  // (changing naRing->ShortOut for a while) is due to Hans!
99  // Just think of other ring using the VERY SAME naRing and possible
100  // side-effects...
101  const BOOLEAN bLMShortOut = rShortOut(lmRing);
102  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
103 
104  lmRing->ShortOut = rCanShortOut(lmRing);
105  tailRing->ShortOut = rCanShortOut(tailRing);
106 
107  p_String0(p, lmRing, tailRing);
108 
109  lmRing->ShortOut = bLMShortOut;
110  tailRing->ShortOut = bTAILShortOut;
111 }

◆ p_Sub()

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

Definition at line 1937 of file p_polys.cc.

1938 {
1939  return p_Add_q(p1, p_Neg(p2,r),r);
1940 }

◆ p_SubComp()

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

Definition at line 454 of file p_polys.h.

455 {
456  p_LmCheckPolyRing2(p, r);
458  _pPolyAssume2(__p_GetComp(p,r) >= v,p,r);
459  return __p_GetComp(p,r) -= v;
460 }

◆ p_SubExp()

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

Definition at line 614 of file p_polys.h.

615 {
616  p_LmCheckPolyRing2(p, r);
617  long e = p_GetExp(p,v,r);
618  pAssume2(e >= ee);
619  e -= ee;
620  return p_SetExp(p,v,e,r);
621 }

◆ p_Subst()

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

Definition at line 3865 of file p_polys.cc.

3866 {
3867  if (e == NULL) return p_Subst0(p, n,r);
3868 
3869  if (p_IsConstant(e,r))
3870  {
3871  if (n_IsOne(pGetCoeff(e),r->cf)) return p_Subst1(p,n,r);
3872  else return p_Subst2(p, n, pGetCoeff(e),r);
3873  }
3874 
3875 #ifdef HAVE_PLURAL
3876  if (rIsPluralRing(r))
3877  {
3878  return nc_pSubst(p,n,e,r);
3879  }
3880 #endif
3881 
3882  int exponent,i;
3883  poly h, res, m;
3884  int *me,*ee;
3885  number nu,nu1;
3886 
3887  me=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3888  ee=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3889  if (e!=NULL) p_GetExpV(e,ee,r);
3890  res=NULL;
3891  h=p;
3892  while (h!=NULL)
3893  {
3894  if ((e!=NULL) || (p_GetExp(h,n,r)==0))
3895  {
3896  m=p_Head(h,r);
3897  p_GetExpV(m,me,r);
3898  exponent=me[n];
3899  me[n]=0;
3900  for(i=rVar(r);i>0;i--)
3901  me[i]+=exponent*ee[i];
3902  p_SetExpV(m,me,r);
3903  if (e!=NULL)
3904  {
3905  n_Power(pGetCoeff(e),exponent,&nu,r->cf);
3906  nu1=n_Mult(pGetCoeff(m),nu,r->cf);
3907  n_Delete(&nu,r->cf);
3908  p_SetCoeff(m,nu1,r);
3909  }
3910  res=p_Add_q(res,m,r);
3911  }
3912  p_LmDelete(&h,r);
3913  }
3914  omFreeSize((ADDRESS)me,(rVar(r)+1)*sizeof(int));
3915  omFreeSize((ADDRESS)ee,(rVar(r)+1)*sizeof(int));
3916  return res;
3917 }

◆ p_TakeOutComp() [1/2]

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

Definition at line 3385 of file p_polys.cc.

3386 {
3387  poly q = *p,qq=NULL,result = NULL;
3388 
3389  if (q==NULL) return NULL;
3390  BOOLEAN use_setmcomp=rOrd_SetCompRequiresSetm(r);
3391  if (__p_GetComp(q,r)==k)
3392  {
3393  result = q;
3394  do
3395  {
3396  p_SetComp(q,0,r);
3397  if (use_setmcomp) p_SetmComp(q,r);
3398  qq = q;
3399  pIter(q);
3400  }
3401  while ((q!=NULL) && (__p_GetComp(q,r)==k));
3402  *p = q;
3403  pNext(qq) = NULL;
3404  }
3405  if (q==NULL) return result;
3406  if (__p_GetComp(q,r) > k)
3407  {
3408  p_SubComp(q,1,r);
3409  if (use_setmcomp) p_SetmComp(q,r);
3410  }
3411  poly pNext_q;
3412  while ((pNext_q=pNext(q))!=NULL)
3413  {
3414  if (__p_GetComp(pNext_q,r)==k)
3415  {
3416  if (result==NULL)
3417  {
3418  result = pNext_q;
3419  qq = result;
3420  }
3421  else
3422  {
3423  pNext(qq) = pNext_q;
3424  pIter(qq);
3425  }
3426  pNext(q) = pNext(pNext_q);
3427  pNext(qq) =NULL;
3428  p_SetComp(qq,0,r);
3429  if (use_setmcomp) p_SetmComp(qq,r);
3430  }
3431  else
3432  {
3433  /*pIter(q);*/ q=pNext_q;
3434  if (__p_GetComp(q,r) > k)
3435  {
3436  p_SubComp(q,1,r);
3437  if (use_setmcomp) p_SetmComp(q,r);
3438  }
3439  }
3440  }
3441  return result;
3442 }

◆ p_TakeOutComp() [2/2]

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

Definition at line 3446 of file p_polys.cc.

3447 {
3448  spolyrec pp, qq;
3449  poly p, q, p_prev;
3450  int l = 0;
3451 
3452 #ifndef SING_NDEBUG
3453  int lp = pLength(*r_p);
3454 #endif
3455 
3456  pNext(&pp) = *r_p;
3457  p = *r_p;
3458  p_prev = &pp;
3459  q = &qq;
3460 
3461  while(p != NULL)
3462  {
3463  while (__p_GetComp(p,r) == comp)
3464  {
3465  pNext(q) = p;
3466  pIter(q);
3467  p_SetComp(p, 0,r);
3468  p_SetmComp(p,r);
3469  pIter(p);
3470  l++;
3471  if (p == NULL)
3472  {
3473  pNext(p_prev) = NULL;
3474  goto Finish;
3475  }
3476  }
3477  pNext(p_prev) = p;
3478  p_prev = p;
3479  pIter(p);
3480  }
3481 
3482  Finish:
3483  pNext(q) = NULL;
3484  *r_p = pNext(&pp);
3485  *r_q = pNext(&qq);
3486  *lq = l;
3487 #ifndef SING_NDEBUG
3488  assume(pLength(*r_p) + pLength(*r_q) == lp);
3489 #endif
3490  p_Test(*r_p,r);
3491  p_Test(*r_q,r);
3492 }

◆ p_TakeOutComp1()

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

Definition at line 3334 of file p_polys.cc.

3335 {
3336  poly q = *p;
3337 
3338  if (q==NULL) return NULL;
3339 
3340  poly qq=NULL,result = NULL;
3341 
3342  if (__p_GetComp(q,r)==k)
3343  {
3344  result = q; /* *p */
3345  while ((q!=NULL) && (__p_GetComp(q,r)==k))
3346  {
3347  p_SetComp(q,0,r);
3348  p_SetmComp(q,r);
3349  qq = q;
3350  pIter(q);
3351  }
3352  *p = q;
3353  pNext(qq) = NULL;
3354  }
3355  if (q==NULL) return result;
3356 // if (pGetComp(q) > k) pGetComp(q)--;
3357  while (pNext(q)!=NULL)
3358  {
3359  if (__p_GetComp(pNext(q),r)==k)
3360  {
3361  if (result==NULL)
3362  {
3363  result = pNext(q);
3364  qq = result;
3365  }
3366  else
3367  {
3368  pNext(qq) = pNext(q);
3369  pIter(qq);
3370  }
3371  pNext(q) = pNext(pNext(q));
3372  pNext(qq) =NULL;
3373  p_SetComp(qq,0,r);
3374  p_SetmComp(qq,r);
3375  }
3376  else
3377  {
3378  pIter(q);
3379 // if (pGetComp(q) > k) pGetComp(q)--;
3380  }
3381  }
3382  return result;
3383 }

◆ p_Totaldegree()

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

Definition at line 1444 of file p_polys.h.

1445 {
1446  p_LmCheckPolyRing1(p, r);
1447  unsigned long s = p_GetTotalDegree(p->exp[r->VarL_Offset[0]],
1448  r,
1449  r->ExpPerLong);
1450  for (unsigned i=r->VarL_Size-1; i!=0; i--)
1451  {
1452  s += p_GetTotalDegree(p->exp[r->VarL_Offset[i]], r,r->ExpPerLong);
1453  }
1454  return (long)s;
1455 }

◆ p_Var()

int p_Var ( poly  mi,
const ring  r 
)

Definition at line 4554 of file p_polys.cc.

4555 {
4556  if (m==NULL) return 0;
4557  if (pNext(m)!=NULL) return 0;
4558  int i,e=0;
4559  for (i=rVar(r); i>0; i--)
4560  {
4561  int exp=p_GetExp(m,i,r);
4562  if (exp==1)
4563  {
4564  if (e==0) e=i;
4565  else return 0;
4566  }
4567  else if (exp!=0)
4568  {
4569  return 0;
4570  }
4571  }
4572  return e;
4573 }

◆ p_Vec2Array()

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

julia: vector to already allocated array (len=p_MaxComp(v,r))

julia: vector to already allocated array (len=p_MaxComp(v,r))

Definition at line 3543 of file p_polys.cc.

3544 {
3545  poly h;
3546  int k;
3547 
3548  for(int i=len-1;i>=0;i--) p[i]=NULL;
3549  while (v!=NULL)
3550  {
3551  h=p_Head(v,r);
3552  k=__p_GetComp(h,r);
3553  if (k>len) { Werror("wrong rank:%d, should be %d",len,k); }
3554  else
3555  {
3556  p_SetComp(h,0,r);
3557  p_Setm(h,r);
3558  pNext(h)=p[k-1];p[k-1]=h;
3559  }
3560  pIter(v);
3561  }
3562  for(int i=len-1;i>=0;i--)
3563  {
3564  if (p[i]!=NULL) p[i]=pReverse(p[i]);
3565  }
3566 }

◆ p_Vec2Poly()

poly p_Vec2Poly ( poly  v,
int  k,
const ring  r 
)

Definition at line 3522 of file p_polys.cc.

3523 {
3524  poly h;
3525  poly res=NULL;
3526 
3527  while (v!=NULL)
3528  {
3529  if (__p_GetComp(v,r)==k)
3530  {
3531  h=p_Head(v,r);
3532  p_SetComp(h,0,r);
3533  pNext(h)=res;res=h;
3534  }
3535  pIter(v);
3536  }
3537  if (res!=NULL) res=pReverse(res);
3538  return res;
3539 }

◆ p_Vec2Polys()

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

Definition at line 3573 of file p_polys.cc.

3574 {
3575  poly h;
3576  int k;
3577 
3578  *len=p_MaxComp(v,r);
3579  if (*len==0) *len=1;
3580  *p=(poly*)omAlloc0((*len)*sizeof(poly));
3581  p_Vec2Array(v,*p,*len,r);
3582 }

◆ p_VectorHasUnit()

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

Definition at line 3302 of file p_polys.cc.

3303 {
3304  poly q=p,qq;
3305  int i,j=0;
3306 
3307  *len = 0;
3308  while (q!=NULL)
3309  {
3310  if (p_LmIsConstantComp(q,r))
3311  {
3312  i = __p_GetComp(q,r);
3313  qq = p;
3314  while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
3315  if (qq == q)
3316  {
3317  j = 0;
3318  while (qq!=NULL)
3319  {
3320  if (__p_GetComp(qq,r)==i) j++;
3321  pIter(qq);
3322  }
3323  if ((*len == 0) || (j<*len))
3324  {
3325  *len = j;
3326  *k = i;
3327  }
3328  }
3329  }
3330  pIter(q);
3331  }
3332 }

◆ p_VectorHasUnitB()

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

Definition at line 3279 of file p_polys.cc.

3280 {
3281  poly q=p,qq;
3282  int i;
3283 
3284  while (q!=NULL)
3285  {
3286  if (p_LmIsConstantComp(q,r))
3287  {
3288  i = __p_GetComp(q,r);
3289  qq = p;
3290  while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
3291  if (qq == q)
3292  {
3293  *k = i;
3294  return TRUE;
3295  }
3296  }
3297  pIter(q);
3298  }
3299  return FALSE;
3300 }

◆ p_WDegree()

long p_WDegree ( poly  p,
const ring  r 
)

Definition at line 706 of file p_polys.cc.

707 {
708  if (r->firstwv==NULL) return p_Totaldegree(p, r);
709  p_LmCheckPolyRing(p, r);
710  int i;
711  long j =0;
712 
713  for(i=1;i<=r->firstBlockEnds;i++)
714  j+=p_GetExp(p, i, r)*r->firstwv[i-1];
715 
716  for (;i<=rVar(r);i++)
717  j+=p_GetExp(p,i, r)*p_Weight(i, r);
718 
719  return j;
720 }

◆ p_Weight()

int p_Weight ( int  c,
const ring  r 
)

Definition at line 697 of file p_polys.cc.

698 {
699  if ((r->firstwv==NULL) || (i>r->firstBlockEnds))
700  {
701  return 1;
702  }
703  return r->firstwv[i-1];
704 }

◆ p_WFirstTotalDegree()

long p_WFirstTotalDegree ( poly  p,
ring  r 
)

Definition at line 588 of file p_polys.cc.

589 {
590  int i;
591  long sum = 0;
592 
593  for (i=1; i<= r->firstBlockEnds; i++)
594  {
595  sum += p_GetExp(p, i, r)*r->firstwv[i-1];
596  }
597  return sum;
598 }

◆ p_Write() [1/2]

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

Definition at line 204 of file polys0.cc.

205 {
206  p_Write0(p, lmRing, tailRing);
207  PrintLn();
208 }

◆ p_Write() [2/2]

static void p_Write ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1185 of file p_polys.h.

1186 {
1187  p_Write(p, p_ring, p_ring);
1188 }

◆ p_Write0() [1/2]

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

Definition at line 194 of file polys0.cc.

195 {
196  char *s=p_String(p, lmRing, tailRing);
197  PrintS(s);
198  omFree(s);
199 }

◆ p_Write0() [2/2]

static void p_Write0 ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1189 of file p_polys.h.

1190 {
1191  p_Write0(p, p_ring, p_ring);
1192 }

◆ p_wrp() [1/2]

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

Definition at line 235 of file polys0.cc.

236 {
237  poly r;
238 
239  if (p==NULL) PrintS("NULL");
240  else if (pNext(p)==NULL) p_Write0(p, lmRing);
241  else
242  {
243  r = pNext(pNext(p));
244  pNext(pNext(p)) = NULL;
245  p_Write0(p, tailRing);
246  if (r!=NULL)
247  {
248  PrintS("+...");
249  pNext(pNext(p)) = r;
250  }
251  }
252 }

◆ p_wrp() [2/2]

static void p_wrp ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1193 of file p_polys.h.

1194 {
1195  p_wrp(p, p_ring, p_ring);
1196 }

◆ p_WTotaldegree()

long p_WTotaldegree ( poly  p,
const ring  r 
)

Definition at line 605 of file p_polys.cc.

606 {
607  p_LmCheckPolyRing(p, r);
608  int i, k;
609  long j =0;
610 
611  // iterate through each block:
612  for (i=0;r->order[i]!=0;i++)
613  {
614  int b0=r->block0[i];
615  int b1=r->block1[i];
616  switch(r->order[i])
617  {
618  case ringorder_M:
619  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
620  { // in jedem block:
621  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/]*r->OrdSgn;
622  }
623  break;
624  case ringorder_am:
625  b1=si_min(b1,r->N);
626  /* no break, continue as ringorder_a*/
627  case ringorder_a:
628  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
629  { // only one line
630  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
631  }
632  return j*r->OrdSgn;
633  case ringorder_wp:
634  case ringorder_ws:
635  case ringorder_Wp:
636  case ringorder_Ws:
637  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
638  { // in jedem block:
639  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
640  }
641  break;
642  case ringorder_lp:
643  case ringorder_ls:
644  case ringorder_rs:
645  case ringorder_dp:
646  case ringorder_ds:
647  case ringorder_Dp:
648  case ringorder_Ds:
649  case ringorder_rp:
650  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
651  {
652  j+= p_GetExp(p,k,r);
653  }
654  break;
655  case ringorder_a64:
656  {
657  int64* w=(int64*)r->wvhdl[i];
658  for (k=0;k<=(b1 /*r->block1[i]*/ - b0 /*r->block0[i]*/);k++)
659  {
660  //there should be added a line which checks if w[k]>2^31
661  j+= p_GetExp(p,k+1, r)*(long)w[k];
662  }
663  //break;
664  return j;
665  }
666  case ringorder_c: /* nothing to do*/
667  case ringorder_C: /* nothing to do*/
668  case ringorder_S: /* nothing to do*/
669  case ringorder_s: /* nothing to do*/
670  case ringorder_IS: /* nothing to do */
671  case ringorder_unspec: /* to make clang happy, does not occur*/
672  case ringorder_no: /* to make clang happy, does not occur*/
673  case ringorder_L: /* to make clang happy, does not occur*/
674  case ringorder_aa: /* ignored by p_WTotaldegree*/
675  break;
676  /* no default: all orderings covered */
677  }
678  }
679  return j;
680 }

◆ pEnlargeSet()

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

Definition at line 3647 of file p_polys.cc.

3648 {
3649  poly* h;
3650 
3651  if (*p==NULL)
3652  {
3653  if (increment==0) return;
3654  h=(poly*)omAlloc0(increment*sizeof(poly));
3655  }
3656  else
3657  {
3658  h=(poly*)omReallocSize((poly*)*p,l*sizeof(poly),(l+increment)*sizeof(poly));
3659  if (increment>0)
3660  {
3661  memset(&(h[l]),0,increment*sizeof(poly));
3662  }
3663  }
3664  *p=h;
3665 }

◆ pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms ( poly  p,
poly  q 
)

Definition at line 175 of file pDebug.cc.

176 {
177  while (p != NULL)
178  {
179  if (pIsMonomOf(q, p))
180  {
181  return TRUE;
182  }
183  pIter(p);
184  }
185  return FALSE;
186 }

◆ pIsMonomOf()

BOOLEAN pIsMonomOf ( poly  p,
poly  m 
)

Definition at line 165 of file pDebug.cc.

166 {
167  if (m == NULL) return TRUE;
168  while (p != NULL)
169  {
170  if (p == m) return TRUE;
171  pIter(p);
172  }
173  return FALSE;
174 }

◆ pLDeg0()

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

Definition at line 731 of file p_polys.cc.

732 {
733  p_CheckPolyRing(p, r);
734  long k= p_GetComp(p, r);
735  int ll=1;
736 
737  if (k > 0)
738  {
739  while ((pNext(p)!=NULL) && (__p_GetComp(pNext(p), r)==k))
740  {
741  pIter(p);
742  ll++;
743  }
744  }
745  else
746  {
747  while (pNext(p)!=NULL)
748  {
749  pIter(p);
750  ll++;
751  }
752  }
753  *l=ll;
754  return r->pFDeg(p, r);
755 }

◆ pLDeg0c()

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

Definition at line 762 of file p_polys.cc.

763 {
764  assume(p!=NULL);
765  p_Test(p,r);
766  p_CheckPolyRing(p, r);
767  long o;
768  int ll=1;
769 
770  if (! rIsSyzIndexRing(r))
771  {
772  while (pNext(p) != NULL)
773  {
774  pIter(p);
775  ll++;
776  }
777  o = r->pFDeg(p, r);
778  }
779  else
780  {
781  int curr_limit = rGetCurrSyzLimit(r);
782  poly pp = p;
783  while ((p=pNext(p))!=NULL)
784  {
785  if (__p_GetComp(p, r)<=curr_limit/*syzComp*/)
786  ll++;
787  else break;
788  pp = p;
789  }
790  p_Test(pp,r);
791  o = r->pFDeg(pp, r);
792  }
793  *l=ll;
794  return o;
795 }

◆ pLDeg1()

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

Definition at line 833 of file p_polys.cc.

834 {
835  p_CheckPolyRing(p, r);
836  long k= p_GetComp(p, r);
837  int ll=1;
838  long t,max;
839 
840  max=r->pFDeg(p, r);
841  if (k > 0)
842  {
843  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
844  {
845  t=r->pFDeg(p, r);
846  if (t>max) max=t;
847  ll++;
848  }
849  }
850  else
851  {
852  while ((p=pNext(p))!=NULL)
853  {
854  t=r->pFDeg(p, r);
855  if (t>max) max=t;
856  ll++;
857  }
858  }
859  *l=ll;
860  return max;
861 }

◆ pLDeg1_Deg()

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

Definition at line 902 of file p_polys.cc.

903 {
904  assume(r->pFDeg == p_Deg);
905  p_CheckPolyRing(p, r);
906  long k= p_GetComp(p, r);
907  int ll=1;
908  long t,max;
909 
910  max=p_GetOrder(p, r);
911  if (k > 0)
912  {
913  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
914  {
915  t=p_GetOrder(p, r);
916  if (t>max) max=t;
917  ll++;
918  }
919  }
920  else
921  {
922  while ((p=pNext(p))!=NULL)
923  {
924  t=p_GetOrder(p, r);
925  if (t>max) max=t;
926  ll++;
927  }
928  }
929  *l=ll;
930  return max;
931 }

◆ pLDeg1_Totaldegree()

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

Definition at line 967 of file p_polys.cc.

968 {
969  p_CheckPolyRing(p, r);
970  long k= p_GetComp(p, r);
971  int ll=1;
972  long t,max;
973 
974  max=p_Totaldegree(p, r);
975  if (k > 0)
976  {
977  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
978  {
979  t=p_Totaldegree(p, r);
980  if (t>max) max=t;
981  ll++;
982  }
983  }
984  else
985  {
986  while ((p=pNext(p))!=NULL)
987  {
988  t=p_Totaldegree(p, r);
989  if (t>max) max=t;
990  ll++;
991  }
992  }
993  *l=ll;
994  return max;
995 }

◆ pLDeg1_WFirstTotalDegree()

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

Definition at line 1030 of file p_polys.cc.

1031 {
1032  p_CheckPolyRing(p, r);
1033  long k= p_GetComp(p, r);
1034  int ll=1;
1035  long t,max;
1036 
1038  if (k > 0)
1039  {
1040  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
1041  {
1042  t=p_WFirstTotalDegree(p, r);
1043  if (t>max) max=t;
1044  ll++;
1045  }
1046  }
1047  else
1048  {
1049  while ((p=pNext(p))!=NULL)
1050  {
1051  t=p_WFirstTotalDegree(p, r);
1052  if (t>max) max=t;
1053  ll++;
1054  }
1055  }
1056  *l=ll;
1057  return max;
1058 }

◆ pLDeg1c()

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

Definition at line 869 of file p_polys.cc.

870 {
871  p_CheckPolyRing(p, r);
872  int ll=1;
873  long t,max;
874 
875  max=r->pFDeg(p, r);
876  if (rIsSyzIndexRing(r))
877  {
878  long limit = rGetCurrSyzLimit(r);
879  while ((p=pNext(p))!=NULL)
880  {
881  if (__p_GetComp(p, r)<=limit)
882  {
883  if ((t=r->pFDeg(p, r))>max) max=t;
884  ll++;
885  }
886  else break;
887  }
888  }
889  else
890  {
891  while ((p=pNext(p))!=NULL)
892  {
893  if ((t=r->pFDeg(p, r))>max) max=t;
894  ll++;
895  }
896  }
897  *l=ll;
898  return max;
899 }

◆ pLDeg1c_Deg()

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

Definition at line 933 of file p_polys.cc.

934 {
935  assume(r->pFDeg == p_Deg);
936  p_CheckPolyRing(p, r);
937  int ll=1;
938  long t,max;
939 
940  max=p_GetOrder(p, r);
941  if (rIsSyzIndexRing(r))
942  {
943  long limit = rGetCurrSyzLimit(r);
944  while ((p=pNext(p))!=NULL)
945  {
946  if (__p_GetComp(p, r)<=limit)
947  {
948  if ((t=p_GetOrder(p, r))>max) max=t;
949  ll++;
950  }
951  else break;
952  }
953  }
954  else
955  {
956  while ((p=pNext(p))!=NULL)
957  {
958  if ((t=p_GetOrder(p, r))>max) max=t;
959  ll++;
960  }
961  }
962  *l=ll;
963  return max;
964 }

◆ pLDeg1c_Totaldegree()

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

Definition at line 997 of file p_polys.cc.

998 {
999  p_CheckPolyRing(p, r);
1000  int ll=1;
1001  long t,max;
1002 
1003  max=p_Totaldegree(p, r);
1004  if (rIsSyzIndexRing(r))
1005  {
1006  long limit = rGetCurrSyzLimit(r);
1007  while ((p=pNext(p))!=NULL)
1008  {
1009  if (__p_GetComp(p, r)<=limit)
1010  {
1011  if ((t=p_Totaldegree(p, r))>max) max=t;
1012  ll++;
1013  }
1014  else break;
1015  }
1016  }
1017  else
1018  {
1019  while ((p=pNext(p))!=NULL)
1020  {
1021  if ((t=p_Totaldegree(p, r))>max) max=t;
1022  ll++;
1023  }
1024  }
1025  *l=ll;
1026  return max;
1027 }

◆ pLDeg1c_WFirstTotalDegree()

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

Definition at line 1060 of file p_polys.cc.

1061 {
1062  p_CheckPolyRing(p, r);
1063  int ll=1;
1064  long t,max;
1065 
1067  if (rIsSyzIndexRing(r))
1068  {
1069  long limit = rGetCurrSyzLimit(r);
1070  while ((p=pNext(p))!=NULL)
1071  {
1072  if (__p_GetComp(p, r)<=limit)
1073  {
1074  if ((t=p_Totaldegree(p, r))>max) max=t;
1075  ll++;
1076  }
1077  else break;
1078  }
1079  }
1080  else
1081  {
1082  while ((p=pNext(p))!=NULL)
1083  {
1084  if ((t=p_Totaldegree(p, r))>max) max=t;
1085  ll++;
1086  }
1087  }
1088  *l=ll;
1089  return max;
1090 }

◆ pLDegb()

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

Definition at line 803 of file p_polys.cc.

804 {
805  p_CheckPolyRing(p, r);
806  long k= p_GetComp(p, r);
807  long o = r->pFDeg(p, r);
808  int ll=1;
809 
810  if (k != 0)
811  {
812  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
813  {
814  ll++;
815  }
816  }
817  else
818  {
819  while ((p=pNext(p)) !=NULL)
820  {
821  ll++;
822  }
823  }
824  *l=ll;
825  return o;
826 }

◆ pLength()

static unsigned pLength ( poly  a)
inlinestatic

Definition at line 193 of file p_polys.h.

194 {
195  unsigned l = 0;
196  while (a!=NULL)
197  {
198  pIter(a);
199  l++;
200  }
201  return l;
202 }

◆ pp_Jet()

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

Definition at line 4256 of file p_polys.cc.

4257 {
4258  poly r=NULL;
4259  poly t=NULL;
4260 
4261  while (p!=NULL)
4262  {
4263  if (p_Totaldegree(p,R)<=m)
4264  {
4265  if (r==NULL)
4266  r=p_Head(p,R);
4267  else
4268  if (t==NULL)
4269  {
4270  pNext(r)=p_Head(p,R);
4271  t=pNext(r);
4272  }
4273  else
4274  {
4275  pNext(t)=p_Head(p,R);
4276  pIter(t);
4277  }
4278  }
4279  pIter(p);
4280  }
4281  return r;
4282 }

◆ pp_JetW()

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

Definition at line 4301 of file p_polys.cc.

4302 {
4303  poly r=NULL;
4304  poly t=NULL;
4305  while (p!=NULL)
4306  {
4307  if (totaldegreeWecart_IV(p,R,w)<=m)
4308  {
4309  if (r==NULL)
4310  r=p_Head(p,R);
4311  else
4312  if (t==NULL)
4313  {
4314  pNext(r)=p_Head(p,R);
4315  t=pNext(r);
4316  }
4317  else
4318  {
4319  pNext(t)=p_Head(p,R);
4320  pIter(t);
4321  }
4322  }
4323  pIter(p);
4324  }
4325  return r;
4326 }

◆ 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 1027 of file p_polys.h.

1028 {
1029  int shorter;
1030  return r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1031 }

◆ 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 1035 of file p_polys.h.

1036 {
1037  int shorter;
1038  poly pp = r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1039  lp -= shorter;
1040  return pp;
1041 }

◆ pp_Mult_mm()

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

Definition at line 988 of file p_polys.h.

989 {
990  if (p==NULL) return NULL;
991  if (p_LmIsConstant(m, r))
992  return __pp_Mult_nn(p, pGetCoeff(m), r);
993  else
994  return r->p_Procs->pp_Mult_mm(p, m, r);
995 }

◆ pp_Mult_nn()

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

Definition at line 949 of file p_polys.h.

950 {
951  if (p==NULL) return NULL;
952  if (n_IsOne(n, r->cf))
953  return p_Copy(p, r);
954  else if (n_IsZero(n, r->cf))
955  return NULL;
956  else
957  return r->p_Procs->pp_Mult_nn(p, n, r);
958 }

◆ pp_Mult_qq()

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

Definition at line 1088 of file p_polys.h.

1089 {
1090  if (p == NULL || q == NULL) return NULL;
1091 
1092  if (pNext(p) == NULL)
1093  {
1094  return r->p_Procs->pp_mm_Mult(q, p, r);
1095  }
1096 
1097  if (pNext(q) == NULL)
1098  {
1099  return r->p_Procs->pp_Mult_mm(p, q, r);
1100  }
1101 
1102  poly qq = q;
1103  if (p == q)
1104  qq = p_Copy(q, r);
1105 
1106  poly res;
1107 #ifdef HAVE_PLURAL
1108  if (rIsPluralRing(r))
1109  res = _nc_pp_Mult_qq(p, qq, r);
1110  else
1111 #endif
1112  res = _p_Mult_q(p, qq, 1, r);
1113 
1114  if (qq != q)
1115  p_Delete(&qq, r);
1116  return res;
1117 }

◆ pRestoreDegProcs()

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

Definition at line 3600 of file p_polys.cc.

3601 {
3602  assume(old_FDeg != NULL && old_lDeg != NULL);
3603  r->pFDeg = old_FDeg;
3604  r->pLDeg = old_lDeg;
3605 }

◆ pReverse()

static poly pReverse ( poly  p)
inlinestatic

Definition at line 336 of file p_polys.h.

337 {
338  if (p == NULL || pNext(p) == NULL) return p;
339 
340  poly q = pNext(p), // == pNext(p)
341  qn;
342  pNext(p) = NULL;
343  do
344  {
345  qn = pNext(q);
346  pNext(q) = p;
347  p = q;
348  q = qn;
349  }
350  while (qn != NULL);
351  return p;
352 }

◆ pSetDegProcs()

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

Definition at line 3588 of file p_polys.cc.

3589 {
3590  assume(new_FDeg != NULL);
3591  r->pFDeg = new_FDeg;
3592 
3593  if (new_lDeg == NULL)
3594  new_lDeg = r->pLDegOrig;
3595 
3596  r->pLDeg = new_lDeg;
3597 }
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
_pPolyAssume2
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:196
BIT_SIZEOF_LONG
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78
p_Pow_charp
static poly p_Pow_charp(poly p, int i, const ring r)
Definition: p_polys.cc:2132
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
ro_am
@ ro_am
Definition: ring.h:55
_p_Mult_q_Normal
static poly _p_Mult_q_Normal(poly p, poly q, const int copy, const ring r)
Definition: p_Mult_q.cc:191
singclap_gcd
poly singclap_gcd(poly f, poly g, const ring r)
polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
Definition: polys.cc:165
FALSE
#define FALSE
Definition: auxiliary.h:94
_p_LmDivisibleByNoCompPart
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:1761
p_SubComp
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:454
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:704
exponent
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
Definition: gengftables-conway.cc:92
p_MemCmp_LengthGeneral_OrdGeneral
#define p_MemCmp_LengthGeneral_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS)
Definition: p_MemCmp.h:719
pIfThen1
#define pIfThen1(cond, check)
Definition: monomials.h:180
writemon
static void writemon(poly p, int ko, const ring r)
Definition: polys0.cc:21
p_GetCoeff
#define p_GetCoeff(p, r)
Definition: monomials.h:51
REGISTER
#define REGISTER
Definition: omalloc.h:22
_p_LmDivisibleByNoComp
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:1691
p_MemDiff_LengthGeneral
#define p_MemDiff_LengthGeneral(r, s1, s2, length)
Definition: p_MemAdd.h:262
p_GetComp
#define p_GetComp(p, r)
Definition: monomials.h:65
p_GetTotalDegree
static unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps)
Definition: p_polys.h:777
ringorder_Ds
@ ringorder_Ds
Definition: ring.h:86
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:107
p_LmIsConstantComp
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:963
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
p_MemSum_LengthGeneral
#define p_MemSum_LengthGeneral(r, s1, s2, length)
Definition: p_MemAdd.h:86
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
omFree
#define omFree(addr)
Definition: omAllocDecl.h:261
pRestoreDegProcs
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3600
_p_Mult_q_Normal_ZeroDiv
static poly _p_Mult_q_Normal_ZeroDiv(poly p, poly q, const int copy, const ring r)
Definition: p_Mult_q.cc:163
p_DebugInit
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition: pDebug.cc:195
p_MonPower
static poly p_MonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:1947
p_Normalize
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3723
pDebugLmShortDivisibleByNoComp
BOOLEAN pDebugLmShortDivisibleByNoComp(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:389
p_Invers
static poly p_Invers(int n, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4367
errorreported
short errorreported
Definition: feFopen.cc:23
n_ExactDiv
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:622
k
int k
Definition: cfEzgcd.cc:92
p_Write0
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
pAssume
#define pAssume(cond)
Definition: monomials.h:91
rOrd_SetCompRequiresSetm
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition: ring.cc:1877
rCanShortOut
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:576
x
Variable x
Definition: cfModGcd.cc:4023
result
return result
Definition: facAbsBiFact.cc:76
lq
Definition: lq.h:40
p_CheckIsFromRing
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:102
n_GetChar
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
n_New
#define n_New(n, r)
Definition: coeffs.h:440
pOldLDeg
static pLDegProc pOldLDeg
Definition: p_polys.cc:3612
sBucketDestroyAdd
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:68
sBucket_Add_m
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition: sbuckets.cc:175
ringorder_ds
@ ringorder_ds
Definition: ring.h:85
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
p_GetShortExpVector
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4679
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: p_polys.cc:1167
n_GetNumerator
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:608
p_DebugLmDivisibleByNoComp
BOOLEAN p_DebugLmDivisibleByNoComp(poly a, poly b, ring r)
Definition: pDebug.cc:141
ringorder_ws
@ ringorder_ws
Definition: ring.h:87
p_SetRingOfLm
#define p_SetRingOfLm(p, r)
Definition: monomials.h:145
pFDegProc
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:39
p_Head
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:826
p_Mult_mm
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:998
MIN_LENGTH_BUCKET
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:21
p_MemSub_LengthGeneral
#define p_MemSub_LengthGeneral(r, s, length)
Definition: p_MemAdd.h:291
p_String
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:184
p_Neg
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1044
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:255
p_Plus_mm_Mult_qq
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
Definition: p_polys.h:1120
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
p_TwoMonPower
static poly p_TwoMonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:2053
iv2array
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:206
singclap_pdivide
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:557
pAssume2
#define pAssume2(cond)
Definition: monomials.h:194
totaldegreeWecart_IV
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:237
g
g
Definition: cfModGcd.cc:4031
pqLength
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
Definition: p_Mult_q.cc:29
TEST_OPT_CONTENTSB
#define TEST_OPT_CONTENTSB
Definition: options.h:125
level
int level(const CanonicalForm &f)
Definition: canonicalform.h:324
__p_GetComp
#define __p_GetComp(p, r)
Definition: monomials.h:64
p_MemAdd_NegWeightAdjust
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1229
ndCopyMap
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:252
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
p_MemAdd_LengthGeneral
#define p_MemAdd_LengthGeneral(r, s, length)
Definition: p_MemAdd.h:173
p_InitContent
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2549
p_Test
#define p_Test(p, r)
Definition: p_polys.h:164
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
ro_wp
@ ro_wp
Definition: ring.h:54
p_GetMaxExpL2
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1099
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
rField_is_Zp_a
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:520
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
nCoeff_is_GF
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:861
n_Param
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....
Definition: coeffs.h:805
StringEndS
char * StringEndS()
Definition: reporter.cc:151
n_Greater
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:511
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
POLY_NEGWEIGHT_OFFSET
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:237
loop
#define loop
Definition: structs.h:78
n_GetUnit
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:532
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
rField_has_Units
static BOOLEAN rField_has_Units(const ring r)
Definition: ring.h:481
b
CanonicalForm b
Definition: cfModGcd.cc:4044
__p_Mult_nn
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:928
p_Lcm
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1602
n_Normalize
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
nlSub
LINLINE number nlSub(number la, number li, const coeffs r)
Definition: longrat.cc:2599
p_LmDivisibleBy
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1821
p_ExpVectorSub
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1377
p_SetmComp
#define p_SetmComp
Definition: p_polys.h:245
n_NormalizeHelper
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:717
p_LmEqual
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1649
CPolyCoeffsEnumerator
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
Definition: PolyEnumerator.h:130
p_Setm_Dummy
void p_Setm_Dummy(poly p, const ring r)
Definition: p_polys.cc:533
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
ringorder_C
@ ringorder_C
Definition: ring.h:74
p_LmCheckPolyRing
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
rGetCurrSyzLimit
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:193
_p_LmTest
BOOLEAN _p_LmTest(poly p, ring r, int level)
Definition: pDebug.cc:323
n_PermNumber
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
Definition: p_polys.cc:3924
nCoeff_is_Q
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
ringorder_Wp
@ ringorder_Wp
Definition: ring.h:83
ringorder_S
@ ringorder_S
S?
Definition: ring.h:76
r_IsRingVar
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:213
next
ListNode * next
Definition: janet.h:31
p_SetExpV
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1472
p_LmDeleteAndNextRat
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition: p_polys.cc:1647
for
for(int i=0;i<=n;i++) degsf[i]
Definition: cfEzgcd.cc:65
p_WFirstTotalDegree
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:588
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
p_Power
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2144
pOldFDeg
static pFDegProc pOldFDeg
Definition: p_polys.cc:3611
p_LmCheckIsFromRing
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
p_MinComp
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:314
p_MemAddSub_LengthGeneral
#define p_MemAddSub_LengthGeneral(r, s, t, length)
Definition: p_MemAdd.h:312
TRUE
#define TRUE
Definition: auxiliary.h:98
p_GetOrder
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:422
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
i
int i
Definition: cfEzgcd.cc:125
rChar
int rChar(ring r)
Definition: ring.cc:686
p_PermPoly
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:4028
omIsBinPageAddr
#define omIsBinPageAddr(addr)
Definition: omBinPage.h:68
res
CanonicalForm res
Definition: facAbsFact.cc:64
sro_ord::data
union sro_ord::@0 data
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: p_polys.cc:4474
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
rField_is_Q_a
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:530
p_SortAdd
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition: p_polys.h:1156
ringorder_Dp
@ ringorder_Dp
Definition: ring.h:81
pPolyAssumeReturnMsg
#define pPolyAssumeReturnMsg(cond, msg)
Definition: monomials.h:138
_pPolyAssumeReturnMsg
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition: monomials.h:125
n_Write
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:591
TEST_OPT_NOT_BUCKETS
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
PrintS
void PrintS(const char *s)
Definition: reporter.cc:284
omSizeWOfAddr
size_t omSizeWOfAddr(void *addr)
Definition: omAllocSystem.c:113
sBucketSortAdd
poly sBucketSortAdd(poly p, const ring r)
Sorts p with bucketSort: p may have equal monomials.
Definition: sbuckets.cc:368
n_Read
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....
Definition: coeffs.h:598
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
nCoeff_is_algExt
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
p_Cmp
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1653
p_String
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:184
omTestBinAddrSize
omError_t omTestBinAddrSize(void *addr, size_t size, int check_level)
Definition: omDebug.c:44
omFreeBinAddr
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
p_Comp_k_n
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:641
scaFirstAltVar
static short scaFirstAltVar(ring r)
Definition: sca.h:18
dPolyReportError
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:44
_p_Mult_q_Bucket
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:68
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
p_Div_nn
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1467
p_Subst2
static poly p_Subst2(poly p, int n, number e, const ring r)
Definition: p_polys.cc:3799
pFalseReturn
#define pFalseReturn(cond)
Definition: monomials.h:140
sBucketCreate
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:98
ringorder_M
@ ringorder_M
Definition: ring.h:75
p_ContentRat
void p_ContentRat(poly &ph, const ring r)
Definition: p_polys.cc:1691
ro_cp
@ ro_cp
Definition: ring.h:59
D
#define D(A)
Definition: gentable.cc:131
p_JetW
poly p_JetW(poly p, int m, short *w, const ring R)
Definition: p_polys.cc:4328
h
static Poly * h
Definition: janet.cc:972
rIsRatGRing
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:419
nCoeff_is_Q_a
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:907
p_Write0
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
pAssumeReturn
#define pAssumeReturn(cond)
Definition: monomials.h:79
max
static int max(int a, int b)
Definition: fast_mult.cc:264
ndGcd
number ndGcd(number, number, const coeffs r)
Definition: numbers.cc:162
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
ro_wp_neg
@ ro_wp_neg
Definition: ring.h:57
p_New
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:665
p_CheckRing2
#define p_CheckRing2(r)
Definition: monomials.h:201
nlGcd
number nlGcd(number a, number b, const coeffs r)
Definition: longrat.cc:1203
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
omTypeAlloc0Bin
#define omTypeAlloc0Bin(type, addr, bin)
Definition: omAllocDecl.h:204
p_String0
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:134
nc_p_Plus_mm_Mult_qq
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:168
p_LtCmp
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1539
nlNormalize
void nlNormalize(number &x, const coeffs r)
Definition: longrat.cc:1345
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
return
return
Definition: cfGcdAlgExt.cc:218
pIter
#define pIter(p)
Definition: monomials.h:38
omError_NoError
@ omError_NoError
Definition: omError.h:18
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782
n_Mult
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:210
omTypeAllocBin
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
rPar
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:589
n_Init
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:538
sBucketSortMerge
poly sBucketSortMerge(poly p, const ring r)
Sorts p with bucketSort: assumes all monomials of p are different.
Definition: sbuckets.cc:334
p_DivisibleBy
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1830
spolyrec
Definition: monomials.h:24
p_Read
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1340
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1457
p_Init
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1498
p_MinDeg
int p_MinDeg(poly p, intvec *w, const ring R)
Definition: p_polys.cc:4346
pp
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
ringorder_am
@ ringorder_am
Definition: ring.h:89
p_Setm_WFirstTotalDegree
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:546
_p_LmDivisibleBy
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1795
__pp_Mult_nn
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:959
_nc_p_Mult_q
poly _nc_p_Mult_q(poly p, poly q, const ring r)
general NC-multiplication with destruction
Definition: old.gring.cc:215
pDivAssume
#define pDivAssume(x)
Definition: p_polys.h:1219
nCoeff_is_Extension
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:868
n_InpNeg
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:557
nlGreaterZero
BOOLEAN nlGreaterZero(number za, const coeffs r)
Definition: longrat.cc:1166
nCoeff_is_transExt
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
ringorder_c
@ ringorder_c
Definition: ring.h:73
p_Subst1
static poly p_Subst1(poly p, int n, const ring r)
Definition: p_polys.cc:3772
ringorder_lp
@ ringorder_lp
Definition: ring.h:78
last
static poly last
Definition: hdegree.cc:1077
n_transExt
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
ringorder_dp
@ ringorder_dp
Definition: ring.h:79
p_Setm_General
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:154
n_Farey
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:789
singclap_pmult
poly singclap_pmult(poly f, poly g, const ring r)
Definition: clapsing.cc:510
sBucket
Definition: sbuckets.cc:32
SR_INT
#define SR_INT
Definition: longrat.h:66
p_CheckRing
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:128
exp
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:358
n_Sub
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition: coeffs.h:669
STATISTIC
#define STATISTIC(f)
Definition: numstats.h:16
pIsMonomOf
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:165
p_LmCheckPolyRing2
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:200
p_CheckRing
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:128
p_LmFree
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
p_ContentForGB
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2283
ntInit
number ntInit(long i, const coeffs cf)
Definition: transext.cc:705
p_Deg
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:579
rIsNCRing
static BOOLEAN rIsNCRing(const ring r)
Definition: ring.h:409
nlInpGcd
void nlInpGcd(number &a, number b, const coeffs r)
Definition: longrat.cc:2777
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
_nc_pp_Mult_qq
poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r)
general NC-multiplication without destruction
Definition: old.gring.cc:254
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
sro_ord
Definition: ring.h:220
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1305
rField_is_GF
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:512
n_ClearContent
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:950
n_Invers
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
p_MemSub_NegWeightAdjust
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1239
p_Copy_noCheck
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:803
rWrite
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:227
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:128
omTestList
#define omTestList(ptr, level)
Definition: omList.h:81
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
p_AddComp
static unsigned long p_AddComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:448
n_ClearDenominators
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:957
pSetDegProcs
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3588
pAssume1
#define pAssume1(cond)
Definition: monomials.h:172
nlAdd
LINLINE number nlAdd(number la, number li, const coeffs r)
Definition: longrat.cc:2533
p_CheckPolyRing
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
rRing_has_Comp
#define rRing_has_Comp(r)
Definition: monomials.h:267
ringorder_a
@ ringorder_a
Definition: ring.h:71
_pPolyAssumeReturn
#define _pPolyAssumeReturn(cond, p, r)
Definition: monomials.h:102
mpz_size1
#define mpz_size1(A)
Definition: si_gmp.h:12
ringorder_IS
@ ringorder_IS
Induced (Schreyer) ordering.
Definition: ring.h:94
omSizeWOfBin
#define omSizeWOfBin(bin_ptr)
Definition: omAllocPrivate.h:100
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int64
long int64
Definition: auxiliary.h:66
pOldLexOrder
static BOOLEAN pOldLexOrder
Definition: p_polys.cc:3613
scaLastAltVar
static short scaLastAltVar(ring r)
Definition: sca.h:25
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
ringorder_ls
@ ringorder_ls
Definition: ring.h:84
ringorder_rp
@ ringorder_rp
Definition: ring.h:80
n_GreaterZero
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
ro_syzcomp
@ ro_syzcomp
Definition: ring.h:60
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:60
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
n_Gcd
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:686
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
ringorder_s
@ ringorder_s
s?
Definition: ring.h:77
p_Pow
static poly p_Pow(poly p, int i, const ring r)
Definition: p_polys.cc:2118
rField_has_simple_inverse
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:539
SR_HDL
#define SR_HDL(A)
Definition: tgb.cc:35
p_DiffOpM
static poly p_DiffOpM(poly a, poly b, BOOLEAN multiply, const ring r)
Definition: p_polys.cc:1881
m
int m
Definition: cfEzgcd.cc:121
MIN_LENGTH_FACTORY
#define MIN_LENGTH_FACTORY
Definition: p_Mult_q.h:27
_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: p_Mult_q.cc:273
p_AddExp
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:607
WarnS
#define WarnS
Definition: emacs.cc:78
n_DivBy
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:775
n_ChineseRemainderSym
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:786
assume
#define assume(x)
Definition: mod2.h:390
ringorder_L
@ ringorder_L
Definition: ring.h:90
NULL
#define NULL
Definition: omList.c:10
eati
const char * eati(const char *s, int *i)
Definition: reporter.cc:373
ringorder_Ws
@ ringorder_Ws
Definition: ring.h:88
ringorder_no
@ ringorder_no
Definition: ring.h:70
p_LmCheckPolyRing1
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:178
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
l
int l
Definition: cfEzgcd.cc:93
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
p_GetCoeffRat
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition: p_polys.cc:1669
R
#define R
Definition: sirandom.c:26
PDEBUG
#define PDEBUG
Definition: auxiliary.h:184
n_Power
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:632
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
GetBitFields
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4646
p_GetExp_k_n
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1309
p_CheckRing1
#define p_CheckRing1(r)
Definition: monomials.h:179
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
ringorder_wp
@ ringorder_wp
Definition: ring.h:82
p_IncrExp
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:592
rSamePolyRep
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1683
n_Equal
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
p
int p
Definition: cfModGcd.cc:4019
p_ExpVectorEqual
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4424
p_IsConstant
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1929
ringorder_unspec
@ ringorder_unspec
Definition: ring.h:95
p_Vec2Array
void p_Vec2Array(poly v, poly *p, int len, const ring r)
vector to already allocated array (len>=p_MaxComp(v,r))
Definition: p_polys.cc:3543
ringorder_aa
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:92
NUM
@ NUM
Definition: readcf.cc:170
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
offset
int offset
Definition: libparse.cc:1091
p_GetMaxExp
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:748
ndConvSingNFactoryN
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:273
count
int status int void size_t count
Definition: si_signals.h:59
rIsSyzIndexRing
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:710
n_Div
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
n_SetMap
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:721
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1289
p_Setm_TotalDegree
void p_Setm_TotalDegree(poly p, const ring r)
Definition: p_polys.cc:539
comp
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition: facSparseHensel.h:25
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1051
ringorder_rs
@ ringorder_rs
opposite of ls
Definition: ring.h:93
ringorder_a64
@ ringorder_a64
for int64 weights
Definition: ring.h:72
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
copy
CFArray copy(const CFList &list)
write elements of list into an array
Definition: facFqBivarUtil.cc:364
p_String0
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:134
PrintLn
void PrintLn()
Definition: reporter.cc:310
n_Size
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:570
rIsSCA
static bool rIsSCA(const ring r)
Definition: nc.h:190
ro_syz
@ ro_syz
Definition: ring.h:61
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
nlDelete
LINLINE void nlDelete(number *a, const coeffs r)
Definition: longrat.cc:2498
G
static TreeM * G
Definition: janet.cc:32
rField_is_Zp
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:491
rShortOut
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:571
p_LmDivisibleByNoComp
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1807
p_Subst0
static poly p_Subst0(poly p, int n, const ring r)
Definition: p_polys.cc:3840
p_MaxComp
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:293
n_IsUnit
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:515
_p_Test
BOOLEAN _p_Test(poly p, ring r, int level)
Definition: pDebug.cc:212
pNext
#define pNext(p)
Definition: monomials.h:37
pReverse
static poly pReverse(poly p)
Definition: p_polys.h:336
p_DecrExp
static long p_DecrExp(poly p, int v, ring r)
Definition: p_polys.h:599
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
nc_pSubst
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:3229
p_Mult_nn
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:915
if
if(yy_init)
Definition: libparse.cc:1418
ro_dp
@ ro_dp
Definition: ring.h:53
pDebugLmShortDivisibleBy
BOOLEAN pDebugLmShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:366
pModDeg
static long pModDeg(poly p, ring r)
Definition: p_polys.cc:3615
n_algExt
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
nCoeff_is_Domain
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:761
p_LmIsConstant
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:980
rField_is_Q
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
p_Weight
int p_Weight(int i, const ring r)
Definition: p_polys.cc:697