Macros | Functions
p_polys.h File Reference
#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 : the integer VarOffset encodes: More...
 
static unsigned long p_SetExp (poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
 set a single variable exponent : VarOffset encodes the position in p->exp More...
 
static long p_GetExp (const poly p, const ring r, const int VarOffset)
 
static long p_SetExp (poly p, const long e, const ring r, const int VarOffset)
 
static long p_GetExp (const poly p, const int v, const ring r)
 get v^th exponent for a monomial More...
 
static long p_SetExp (poly p, const int v, const long e, const ring r)
 set v^th exponent for a monomial More...
 
static long p_IncrExp (poly p, int v, ring r)
 
static long p_DecrExp (poly p, int v, ring r)
 
static long p_AddExp (poly p, int v, long ee, ring r)
 
static long p_SubExp (poly p, int v, long ee, ring r)
 
static long p_MultExp (poly p, int v, long ee, ring r)
 
static long p_GetExpSum (poly p1, poly p2, int i, ring r)
 
static long p_GetExpDiff (poly p1, poly p2, int i, ring r)
 
static int p_Comp_k_n (poly a, poly b, int k, ring r)
 
static poly p_New (const ring, omBin bin)
 
static poly p_New (ring r)
 
static void p_LmFree (poly p, ring)
 
static void p_LmFree (poly *p, ring)
 
static poly p_LmFreeAndNext (poly p, ring)
 
static void p_LmDelete (poly p, const ring r)
 
static void p_LmDelete (poly *p, const ring r)
 
static poly p_LmDeleteAndNext (poly p, const ring r)
 
unsigned long p_GetMaxExpL (poly p, const ring r, unsigned long l_max=0)
 return the maximal exponent of p in form of the maximal long var More...
 
poly p_GetMaxExpP (poly p, ring r)
 return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0, next == NULL, ord is not set More...
 
static unsigned long p_GetMaxExp (const unsigned long l, const ring r)
 
static unsigned long p_GetMaxExp (const poly p, const ring r)
 
static unsigned long p_GetTotalDegree (const unsigned long l, const ring r, const int number_of_exps)
 
static poly p_Copy_noCheck (poly p, const ring r)
 returns a copy of p (without any additional testing) More...
 
static poly p_Copy (poly p, const ring r)
 returns a copy of p More...
 
static poly p_Head (poly p, const ring r)
 
static poly p_Copy (poly p, const ring lmRing, const ring tailRing)
 
static void p_Delete (poly *p, const ring r)
 
static void p_Delete (poly *p, const ring lmRing, const ring tailRing)
 
static poly p_ShallowCopyDelete (poly p, const ring r, omBin bin)
 
static poly p_Add_q (poly p, poly q, const ring r)
 
static poly p_Add_q (poly p, poly q, int &lp, int lq, const ring r)
 like p_Add_q, except that if lp == pLength(lp) lq == pLength(lq) then lp == pLength(p+q) More...
 
static poly p_Mult_nn (poly p, number n, const ring r)
 
static poly p_Mult_nn (poly p, number n, const ring lmRing, const ring tailRing)
 
static poly pp_Mult_nn (poly p, number n, const ring r)
 
static BOOLEAN p_LmIsConstantComp (const poly p, const ring r)
 
static BOOLEAN p_LmIsConstant (const poly p, const ring r)
 
static poly pp_Mult_mm (poly p, poly m, const ring r)
 
static poly p_Mult_mm (poly p, poly m, const ring r)
 
static poly p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, int lq, const poly spNoether, const ring r)
 
static poly p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, const ring r)
 
static poly pp_Mult_Coeff_mm_DivSelect (poly p, const poly m, const ring r)
 
static poly pp_Mult_Coeff_mm_DivSelect (poly p, int &lp, const poly m, const ring r)
 
static poly p_Neg (poly p, const ring r)
 
poly _p_Mult_q (poly p, poly q, const int copy, const ring r)
 Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2. More...
 
static poly p_Mult_q (poly p, poly q, const ring r)
 
static poly pp_Mult_qq (poly p, poly q, const ring r)
 
static poly p_Plus_mm_Mult_qq (poly p, poly m, poly q, int &lp, int lq, const ring r)
 
static poly p_Plus_mm_Mult_qq (poly p, poly m, poly q, const ring r)
 
static poly p_Merge_q (poly p, poly q, const ring r)
 
static poly p_SortAdd (poly p, const ring r, BOOLEAN revert=FALSE)
 
static poly p_SortMerge (poly p, const ring r, BOOLEAN revert=FALSE)
 
static char * p_String (poly p, ring p_ring)
 
static void p_String0 (poly p, ring p_ring)
 
static void p_Write (poly p, ring p_ring)
 
static void p_Write0 (poly p, ring p_ring)
 
static void p_wrp (poly p, ring p_ring)
 
static void p_MemAdd_NegWeightAdjust (poly p, const ring r)
 
static void p_MemSub_NegWeightAdjust (poly p, const ring r)
 
static void p_ExpVectorCopy (poly d_p, poly s_p, const ring r)
 
static poly p_Init (const ring r, omBin bin)
 
static poly p_Init (const ring r)
 
static poly p_LmInit (poly p, const ring r)
 
static poly p_LmInit (poly s_p, const ring s_r, const ring d_r, omBin d_bin)
 
static poly p_LmInit (poly s_p, const ring s_r, const ring d_r)
 
static poly p_GetExp_k_n (poly p, int l, int k, const ring r)
 
static poly p_LmShallowCopyDelete (poly p, const ring r)
 
static void p_ExpVectorAdd (poly p1, poly p2, const ring r)
 
static void p_ExpVectorSum (poly pr, poly p1, poly p2, const ring r)
 
static void p_ExpVectorSub (poly p1, poly p2, const ring r)
 
static void p_ExpVectorAddSub (poly p1, poly p2, poly p3, const ring r)
 
static void p_ExpVectorDiff (poly pr, poly p1, poly p2, const ring r)
 
static BOOLEAN p_ExpVectorEqual (poly p1, poly p2, const ring r)
 
static long p_Totaldegree (poly p, const ring r)
 
static void p_GetExpV (poly p, int *ev, const ring r)
 
static void p_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)
 like the respective p_LmIs* routines, except that p might be empty More...
 
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)
 
BOOLEAN p_HasNotCFRing (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 926 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 957 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)
int p
Definition: cfModGcd.cc:4019
#define p_MemCmp_LengthGeneral_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS)
Definition: p_MemCmp.h:719

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

◆ p_LmEqual

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

Definition at line 1647 of file p_polys.h.

◆ p_LmTest

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

Definition at line 163 of file p_polys.h.

◆ p_SetmComp

#define p_SetmComp   p_Setm

Definition at line 243 of file p_polys.h.

◆ p_Test

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

Definition at line 162 of file p_polys.h.

◆ pDivAssume

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

Definition at line 1217 of file p_polys.h.

◆ pIfThen

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

Definition at line 156 of file p_polys.h.

◆ pp_Test

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

Definition at line 164 of file p_polys.h.

Function Documentation

◆ _p_LmDivisibleBy() [1/2]

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

Definition at line 1793 of file p_polys.h.

1794 {
1795  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1796  return _p_LmDivisibleByNoComp(a, b, r);
1797  return FALSE;
1798 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044

◆ _p_LmDivisibleBy() [2/2]

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

Definition at line 1799 of file p_polys.h.

1800 {
1801  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
1802  return _p_LmDivisibleByNoComp(a, r_a, b, r_b);
1803  return FALSE;
1804 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044

◆ _p_LmDivisibleByNoComp() [1/2]

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

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

Definition at line 1689 of file p_polys.h.

1690 {
1691  int i=r->VarL_Size - 1;
1692  unsigned long divmask = r->divmask;
1693  unsigned long la, lb;
1694 
1695  if (r->VarL_LowIndex >= 0)
1696  {
1697  i += r->VarL_LowIndex;
1698  do
1699  {
1700  la = a->exp[i];
1701  lb = b->exp[i];
1702  if ((la > lb) ||
1703  (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1704  {
1706  return FALSE;
1707  }
1708  i--;
1709  }
1710  while (i>=r->VarL_LowIndex);
1711  }
1712  else
1713  {
1714  do
1715  {
1716  la = a->exp[r->VarL_Offset[i]];
1717  lb = b->exp[r->VarL_Offset[i]];
1718  if ((la > lb) ||
1719  (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1720  {
1722  return FALSE;
1723  }
1724  i--;
1725  }
1726  while (i>=0);
1727  }
1728 /*#ifdef HAVE_RINGS
1729  pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf));
1730  return (!rField_is_Ring(r)) || n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf);
1731 #else
1732 */
1734  return TRUE;
1735 //#endif
1736 }
#define FALSE
Definition: auxiliary.h:94
BOOLEAN p_DebugLmDivisibleByNoComp(poly a, poly b, ring r)
Definition: pDebug.cc:139
#define TRUE
Definition: auxiliary.h:98
CanonicalForm b
Definition: cfModGcd.cc:4044
int i
Definition: cfEzgcd.cc:125
#define pDivAssume(x)
Definition: p_polys.h:1217

◆ _p_LmDivisibleByNoComp() [2/2]

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

Definition at line 1738 of file p_polys.h.

1739 {
1740  int i=r_a->N;
1741  pAssume1(r_a->N == r_b->N);
1742 
1743  do
1744  {
1745  if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
1746  return FALSE;
1747  i--;
1748  }
1749  while (i);
1750 /*#ifdef HAVE_RINGS
1751  return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
1752 #else
1753 */
1754  return TRUE;
1755 //#endif
1756 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define pAssume1(cond)
Definition: monomials.h:171

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

1760 {
1761  int i=end;
1762  pAssume1(r_a->N == r_b->N);
1763 
1764  do
1765  {
1766  if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
1767  return FALSE;
1768  i--;
1769  }
1770  while (i>=start);
1771 /*#ifdef HAVE_RINGS
1772  return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
1773 #else
1774 */
1775  return TRUE;
1776 //#endif
1777 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define pAssume1(cond)
Definition: monomials.h:171

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

1779 {
1780  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
1781  return _p_LmDivisibleByNoCompPart(a, r_a, b, r_b,start,end);
1782  return FALSE;
1783 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
CanonicalForm b
Definition: cfModGcd.cc:4044
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:1759

◆ _p_LmTest()

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

Definition at line 321 of file pDebug.cc.

322 {
323  if (level < 0 || p == NULL) return TRUE;
324  poly pnext = pNext(p);
325  pNext(p) = NULL;
326  BOOLEAN test_res = _p_Test(p, r, level);
327  pNext(p) = pnext;
328  return test_res;
329 }
int level(const CanonicalForm &f)
#define TRUE
Definition: auxiliary.h:98
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
BOOLEAN _p_Test(poly p, ring r, int level)
Definition: pDebug.cc:210
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85

◆ _p_Mult_q()

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

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

Definition at line 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 }
CFArray copy(const CFList &list)
write elements of list into an array
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:21
static poly _p_Mult_q_Normal_ZeroDiv(poly p, poly q, const int copy, const ring r)
Definition: p_Mult_q.cc:163
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:104
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:272
#define assume(x)
Definition: mod2.h:390
static poly _p_Mult_q_Normal(poly p, poly q, const int copy, const ring r)
Definition: p_Mult_q.cc:191
static unsigned pLength(poly a)
Definition: p_polys.h:191
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
Definition: p_Mult_q.cc:29
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define MIN_LENGTH_FACTORY
Definition: p_Mult_q.h:27
static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
Definition: coeffs.h:761
#define NULL
Definition: omList.c:12
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
poly singclap_pmult(poly f, poly g, const ring r)
Definition: clapsing.cc:509
Definition: lq.h:39
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
int l
Definition: cfEzgcd.cc:93

◆ _p_Test()

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

Definition at line 210 of file pDebug.cc.

211 {
212  assume(r->cf !=NULL);
213 
214  if (PDEBUG > level) level = PDEBUG;
215  if (level < 0 || p == NULL) return TRUE;
216 
217  poly p_prev = NULL;
218 
219  #ifndef OM_NDEBUG
220  #ifndef X_OMALLOC
221  // check addr with level+1 so as to check bin/page of addr
222  _pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, level+1)
223  == omError_NoError, "memory error",p,r);
224  #endif
225  #endif
226 
228 
229  // this checks that p does not contain a loop: rather expensive O(length^2)
230  #ifndef OM_NDEBUG
231  if (level > 1)
233  #endif
234 
235  int ismod = p_GetComp(p, r) != 0;
236 
237  while (p != NULL)
238  {
239  // ring check
241  #ifndef OM_NDEBUG
242  #ifndef X_OMALLOC
243  // omAddr check
244  _pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, 1)
245  == omError_NoError, "memory error",p,r);
246  #endif
247  #endif
248  // number/coef check
249  _pPolyAssumeReturnMsg(p->coef != NULL || (n_GetChar(r->cf) >= 2), "NULL coef",p,r);
250 
251  #ifdef LDEBUG
252  _pPolyAssumeReturnMsg(n_Test(p->coef,r->cf),"coeff err",p,r);
253  #endif
254  _pPolyAssumeReturnMsg(!n_IsZero(p->coef, r->cf), "Zero coef",p,r);
255 
256  // check for valid comp
257  _pPolyAssumeReturnMsg(p_GetComp(p, r) >= 0 && (p_GetComp(p, r)<65000), "component out of range ?",p,r);
258  // check for mix poly/vec representation
259  _pPolyAssumeReturnMsg(ismod == (p_GetComp(p, r) != 0), "mixed poly/vector",p,r);
260 
261  // special check for ringorder_s/S
262  if ((r->typ!=NULL) && (r->typ[0].ord_typ == ro_syzcomp))
263  {
264  long c1, cc1, ccc1, ec1;
265  sro_ord* o = &(r->typ[0]);
266 
267  c1 = p_GetComp(p, r);
268  if (o->data.syzcomp.Components!=NULL)
269  {
270  cc1 = o->data.syzcomp.Components[c1];
271  ccc1 = o->data.syzcomp.ShiftedComponents[cc1];
272  }
273  else { cc1=0; ccc1=0; }
274  _pPolyAssumeReturnMsg(c1 == 0 || cc1 != 0, "Component <-> TrueComponent zero mismatch",p,r);
275  _pPolyAssumeReturnMsg(c1 == 0 || ccc1 != 0,"Component <-> ShiftedComponent zero mismatch",p,r);
276  ec1 = p->exp[o->data.syzcomp.place];
277  //pPolyAssumeReturnMsg(ec1 == ccc1, "Shifted comp out of sync. should %d, is %d");
278  if (ec1 != ccc1)
279  {
280  dPolyReportError(p,r,"Shifted comp out of sync. should %d, is %d",ccc1,ec1);
281  return FALSE;
282  }
283  }
284 
285  // check that p_Setm works ok
286  if (level > 0)
287  {
288  poly p_should_equal = p_DebugInit(p, r, r);
289  _pPolyAssumeReturnMsg(p_ExpVectorEqual(p, p_should_equal, r), "p_Setm field(s) out of sync",p,r);
290  p_LmFree(p_should_equal, r);
291  }
292 
293  // check order
294  if (p_prev != NULL)
295  {
296  int cmp = p_LmCmp(p_prev, p, r);
297  if (cmp == 0)
298  {
299  _pPolyAssumeReturnMsg(0, "monoms p and p->next are equal", p_prev, r);
300  }
301  else
302  _pPolyAssumeReturnMsg(p_LmCmp(p_prev, p, r) == 1, "wrong order", p_prev, r);
303 
304  // check that compare worked sensibly
305  if (level > 1 && p_GetComp(p_prev, r) == p_GetComp(p, r))
306  {
307  int i;
308  for (i=r->N; i>0; i--)
309  {
310  if (p_GetExp(p_prev, i, r) != p_GetExp(p, i, r)) break;
311  }
312  _pPolyAssumeReturnMsg(i > 0, "Exponents equal but compare different", p_prev, r);
313  }
314  }
315  p_prev = p;
316  pIter(p);
317  }
318  return TRUE;
319 }
int level(const CanonicalForm &f)
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition: pDebug.cc:193
#define FALSE
Definition: auxiliary.h:94
#define omTestList(ptr, level)
Definition: omList.h:81
#define p_GetComp(p, r)
Definition: monomials.h:64
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
#define TRUE
Definition: auxiliary.h:98
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:42
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
union sro_ord::@0 data
#define omTestBinAddrSize(A, B, C)
Definition: xalloc.h:316
#define pIter(p)
Definition: monomials.h:37
#define pFalseReturn(cond)
Definition: monomials.h:139
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:69
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
#define PDEBUG
Definition: auxiliary.h:184
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
Definition: ring.h:218
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:126
#define NULL
Definition: omList.c:12
#define omSizeWOfBin(bin_ptr)
int p
Definition: cfModGcd.cc:4019
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4432
#define _pPolyAssumeReturnMsg(cond, msg, p, r)
Definition: monomials.h:124

◆ _pp_Test()

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

Definition at line 331 of file pDebug.cc.

332 {
333  if (PDEBUG > level) level = PDEBUG;
334  if (level < 0 || p == NULL) return TRUE;
335  if (pNext(p) == NULL || lmRing == tailRing) return _p_Test(p, lmRing, level);
336 
337  pFalseReturn(_p_LmTest(p, lmRing, level));
338  pFalseReturn(_p_Test(pNext(p), tailRing, level));
339 
340  // check that lm > Lm(tail)
341  if (level > 1)
342  {
343  poly lm = p;
344  poly tail = p_DebugInit(pNext(p), tailRing, lmRing);
345  poly pnext = pNext(lm);
346  pNext(lm) = tail;
347  BOOLEAN cmp = p_LmCmp(lm, tail, lmRing);
348  if (cmp != 1)
349  dPolyReportError(lm, lmRing, "wrong order: lm <= Lm(tail)");
350  p_LmFree(tail, lmRing);
351  pNext(lm) = pnext;
352  return (cmp == 1);
353  }
354  return TRUE;
355 }
int level(const CanonicalForm &f)
static poly p_DebugInit(poly p, ring src_ring, ring dest_ring)
Definition: pDebug.cc:193
#define TRUE
Definition: auxiliary.h:98
BOOLEAN dPolyReportError(poly p, ring r, const char *fmt,...)
Definition: pDebug.cc:42
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
BOOLEAN _p_LmTest(poly p, ring r, int level)
Definition: pDebug.cc:321
#define pFalseReturn(cond)
Definition: monomials.h:139
#define PDEBUG
Definition: auxiliary.h:184
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
BOOLEAN _p_Test(poly p, ring r, int level)
Definition: pDebug.cc:210
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85

◆ n_PermNumber()

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

Definition at line 3933 of file p_polys.cc.

3934 {
3935 #if 0
3936  PrintS("\nSource Ring: \n");
3937  rWrite(src);
3938 
3939  if(0)
3940  {
3941  number zz = n_Copy(z, src->cf);
3942  PrintS("z: "); n_Write(zz, src);
3943  n_Delete(&zz, src->cf);
3944  }
3945 
3946  PrintS("\nDestination Ring: \n");
3947  rWrite(dst);
3948 
3949  /*Print("\nOldPar: %d\n", OldPar);
3950  for( int i = 1; i <= OldPar; i++ )
3951  {
3952  Print("par(%d) -> par/var (%d)\n", i, par_perm[i-1]);
3953  }*/
3954 #endif
3955  if( z == NULL )
3956  return NULL;
3957 
3958  const coeffs srcCf = src->cf;
3959  assume( srcCf != NULL );
3960 
3961  assume( !nCoeff_is_GF(srcCf) );
3962  assume( src->cf->extRing!=NULL );
3963 
3964  poly zz = NULL;
3965 
3966  const ring srcExtRing = srcCf->extRing;
3967  assume( srcExtRing != NULL );
3968 
3969  const coeffs dstCf = dst->cf;
3970  assume( dstCf != NULL );
3971 
3972  if( nCoeff_is_algExt(srcCf) ) // nCoeff_is_GF(srcCf)?
3973  {
3974  zz = (poly) z;
3975  if( zz == NULL ) return NULL;
3976  }
3977  else if (nCoeff_is_transExt(srcCf))
3978  {
3979  assume( !IS0(z) );
3980 
3981  zz = NUM((fraction)z);
3982  p_Test (zz, srcExtRing);
3983 
3984  if( zz == NULL ) return NULL;
3985  if( !DENIS1((fraction)z) )
3986  {
3987  if (!p_IsConstant(DEN((fraction)z),srcExtRing))
3988  WarnS("Not defined: Cannot map a rational fraction and make a polynomial out of it! Ignoring the denominator.");
3989  }
3990  }
3991  else
3992  {
3993  assume (FALSE);
3994  WerrorS("Number permutation is not implemented for this data yet!");
3995  return NULL;
3996  }
3997 
3998  assume( zz != NULL );
3999  p_Test (zz, srcExtRing);
4000 
4001  nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf);
4002 
4003  assume( nMap != NULL );
4004 
4005  poly qq;
4006  if ((par_perm == NULL) && (rPar(dst) != 0 && rVar (srcExtRing) > 0))
4007  {
4008  int* perm;
4009  perm=(int *)omAlloc0((rVar(srcExtRing)+1)*sizeof(int));
4010  for(int i=si_min(rVar(srcExtRing),rPar(dst));i>0;i--)
4011  perm[i]=-i;
4012  qq = p_PermPoly(zz, perm, srcExtRing, dst, nMap, NULL, rVar(srcExtRing)-1);
4013  omFreeSize ((ADDRESS)perm, (rVar(srcExtRing)+1)*sizeof(int));
4014  }
4015  else
4016  qq = p_PermPoly(zz, par_perm-1, srcExtRing, dst, nMap, NULL, rVar (srcExtRing)-1);
4017 
4018  if(nCoeff_is_transExt(srcCf)
4019  && (!DENIS1((fraction)z))
4020  && p_IsConstant(DEN((fraction)z),srcExtRing))
4021  {
4022  number n=nMap(pGetCoeff(DEN((fraction)z)),srcExtRing->cf, dstCf);
4023  qq=p_Div_nn(qq,n,dst);
4024  n_Delete(&n,dstCf);
4025  p_Normalize(qq,dst);
4026  }
4027  p_Test (qq, dst);
4028 
4029  return qq;
4030 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
#define FALSE
Definition: auxiliary.h:94
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:593
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1487
void * ADDRESS
Definition: auxiliary.h:133
void WerrorS(const char *s)
Definition: feFopen.cc:24
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define WarnS
Definition: emacs.cc:78
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:4036
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1927
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:591
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:226
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:861
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
#define p_Test(p, r)
Definition: p_polys.h:162
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3732
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ p_Add_q() [1/2]

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

Definition at line 891 of file p_polys.h.

892 {
893  assume( (p != q) || (p == NULL && q == NULL) );
894  if (q==NULL) return p;
895  if (p==NULL) return q;
896  int shorter;
897  return r->p_Procs->p_Add_q(p, q, shorter, r);
898 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

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

902 {
903  assume( (p != q) || (p == NULL && q == NULL) );
904  if (q==NULL) return p;
905  if (p==NULL) { lp=lq; return q; }
906  int shorter;
907  poly res = r->p_Procs->p_Add_q(p, q, shorter, r);
908  lp += lq - shorter;
909  return res;
910 }
CanonicalForm res
Definition: facAbsFact.cc:64
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
Definition: lq.h:39
int p
Definition: cfModGcd.cc:4019

◆ p_AddComp()

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

Definition at line 446 of file p_polys.h.

447 {
448  p_LmCheckPolyRing2(p, r);
450  return __p_GetComp(p,r) += v;
451 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define pAssume2(cond)
Definition: monomials.h:193
#define rRing_has_Comp(r)
Definition: monomials.h:266
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int p
Definition: cfModGcd.cc:4019

◆ p_AddExp()

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

Definition at line 605 of file p_polys.h.

606 {
607  p_LmCheckPolyRing2(p, r);
608  int e = p_GetExp(p,v,r);
609  e += ee;
610  return p_SetExp(p,v,e,r);
611 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_CheckIsFromRing()

BOOLEAN p_CheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 100 of file pDebug.cc.

101 {
102  while (p!=NULL)
103  {
105  pIter(p);
106  }
107  return TRUE;
108 }
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:37
#define pFalseReturn(cond)
Definition: monomials.h:139
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:69
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_CheckPolyRing()

BOOLEAN p_CheckPolyRing ( poly  p,
ring  r 
)

Definition at line 110 of file pDebug.cc.

111 {
112  #ifndef X_OMALLOC
113  pAssumeReturn(r != NULL && r->PolyBin != NULL);
114  #endif
115  return p_CheckIsFromRing(p, r);
116 }
#define pAssumeReturn(cond)
Definition: monomials.h:78
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:100

◆ p_CheckRing()

BOOLEAN p_CheckRing ( ring  r)

Definition at line 126 of file pDebug.cc.

127 {
128  #ifndef X_OMALLOC
129  pAssumeReturn(r != NULL && r->PolyBin != NULL);
130  #endif
131  return TRUE;
132 }
#define TRUE
Definition: auxiliary.h:98
#define pAssumeReturn(cond)
Definition: monomials.h:78
#define NULL
Definition: omList.c:12

◆ p_ChineseRemainder()

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

Definition at line 83 of file p_polys.cc.

84 {
85  poly r,h,hh;
86  int j;
87  poly res_p=NULL;
88  loop
89  {
90  /* search the lead term */
91  r=NULL;
92  for(j=rl-1;j>=0;j--)
93  {
94  h=xx[j];
95  if ((h!=NULL)
96  &&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
97  r=h;
98  }
99  /* nothing found -> return */
100  if (r==NULL) break;
101  /* create the monomial in h */
102  h=p_Head(r,R);
103  /* collect the coeffs in x[..]*/
104  for(j=rl-1;j>=0;j--)
105  {
106  hh=xx[j];
107  if ((hh!=NULL) && (p_LmCmp(h,hh,R)==0))
108  {
109  x[j]=pGetCoeff(hh);
110  hh=p_LmFreeAndNext(hh,R);
111  xx[j]=hh;
112  }
113  else
114  x[j]=n_Init(0, R->cf);
115  }
116  number n=n_ChineseRemainderSym(x,q,rl,TRUE,inv_cache,R->cf);
117  for(j=rl-1;j>=0;j--)
118  {
119  x[j]=NULL; // n_Init(0...) takes no memory
120  }
121  if (n_IsZero(n,R->cf)) p_Delete(&h,R);
122  else
123  {
124  //Print("new mon:");pWrite(h);
125  p_SetCoeff(h,n,R);
126  pNext(h)=res_p;
127  res_p=h; // building res_p in reverse order!
128  }
129  }
130  res_p=pReverse(res_p);
131  p_Test(res_p, R);
132  return res_p;
133 }
int j
Definition: facHensel.cc:105
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
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:786
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:702
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
static poly pReverse(poly p)
Definition: p_polys.h:334
#define p_Test(p, r)
Definition: p_polys.h:162
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
Variable x
Definition: cfModGcd.cc:4023
#define pNext(p)
Definition: monomials.h:36
static Poly * h
Definition: janet.cc:971

◆ p_Cleardenom()

poly p_Cleardenom ( poly  p,
const ring  r 
)

Definition at line 2791 of file p_polys.cc.

2792 {
2793  if( p == NULL )
2794  return NULL;
2795 
2796  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
2797 
2798 #if CLEARENUMERATORS
2799  if( 0 )
2800  {
2801  CPolyCoeffsEnumerator itr(p);
2802  n_ClearDenominators(itr, C);
2803  n_ClearContent(itr, C); // divide out the content
2804  p_Test(p, r); n_Test(pGetCoeff(p), C);
2805  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2806 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2807  return p;
2808  }
2809 #endif
2810 
2811  number d, h;
2812 
2813  if (rField_is_Ring(r))
2814  {
2815  p_ContentForGB(p,r);
2816  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2817  return p;
2818  }
2819 
2821  {
2822  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2823  return p;
2824  }
2825 
2826  assume(p != NULL);
2827 
2828  if(pNext(p)==NULL)
2829  {
2830  if (!TEST_OPT_CONTENTSB
2831  && !rField_is_Ring(r))
2832  p_SetCoeff(p,n_Init(1,r->cf),r);
2833  else if(!n_GreaterZero(pGetCoeff(p),C))
2834  p = p_Neg(p,r);
2835  return p;
2836  }
2837 
2838  assume(pNext(p)!=NULL);
2839  poly start=p;
2840 
2841 #if 0 && CLEARENUMERATORS
2842 //CF: does not seem to work that well..
2843 
2844  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2845  {
2846  CPolyCoeffsEnumerator itr(p);
2847  n_ClearDenominators(itr, C);
2848  n_ClearContent(itr, C); // divide out the content
2849  p_Test(p, r); n_Test(pGetCoeff(p), C);
2850  assume(n_GreaterZero(pGetCoeff(p), C)); // ??
2851 // if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2852  return start;
2853  }
2854 #endif
2855 
2856  if(1)
2857  {
2858  // get lcm of all denominators ----------------------------------
2859  h = n_Init(1,r->cf);
2860  while (p!=NULL)
2861  {
2862  n_Normalize(pGetCoeff(p),r->cf);
2863  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
2864  n_Delete(&h,r->cf);
2865  h=d;
2866  pIter(p);
2867  }
2868  /* h now contains the 1/lcm of all denominators */
2869  if(!n_IsOne(h,r->cf))
2870  {
2871  // multiply by the lcm of all denominators
2872  p = start;
2873  while (p!=NULL)
2874  {
2875  d=n_Mult(h,pGetCoeff(p),r->cf);
2876  n_Normalize(d,r->cf);
2877  p_SetCoeff(p,d,r);
2878  pIter(p);
2879  }
2880  }
2881  n_Delete(&h,r->cf);
2882  p=start;
2883 
2884  p_ContentForGB(p,r);
2885 #ifdef HAVE_RATGRING
2886  if (rIsRatGRing(r))
2887  {
2888  /* quick unit detection in the rational case is done in gr_nc_bba */
2889  p_ContentRat(p, r);
2890  start=p;
2891  }
2892 #endif
2893  }
2894 
2895  if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
2896 
2897  return start;
2898 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:423
#define TEST_OPT_CONTENTSB
Definition: options.h:125
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
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2315
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
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
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:907
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
void p_ContentRat(poly &ph, const ring r)
Definition: p_polys.cc:1719
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
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
#define p_Test(p, r)
Definition: p_polys.h:162
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
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

◆ p_Cleardenom_n()

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

Definition at line 2900 of file p_polys.cc.

2901 {
2902  const coeffs C = r->cf;
2903  number d, h;
2904 
2905  assume( ph != NULL );
2906 
2907  poly p = ph;
2908 
2909 #if CLEARENUMERATORS
2910  if( 0 )
2911  {
2912  CPolyCoeffsEnumerator itr(ph);
2913 
2914  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2915  n_ClearContent(itr, h, C); // divide by the content h
2916 
2917  c = n_Div(d, h, C); // d/h
2918 
2919  n_Delete(&d, C);
2920  n_Delete(&h, C);
2921 
2922  n_Test(c, C);
2923 
2924  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2925  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2926 /*
2927  if(!n_GreaterZero(pGetCoeff(ph),C))
2928  {
2929  ph = p_Neg(ph,r);
2930  c = n_InpNeg(c, C);
2931  }
2932 */
2933  return;
2934  }
2935 #endif
2936 
2937 
2938  if( pNext(p) == NULL )
2939  {
2940  if(!TEST_OPT_CONTENTSB)
2941  {
2942  c=n_Invers(pGetCoeff(p), C);
2943  p_SetCoeff(p, n_Init(1, C), r);
2944  }
2945  else
2946  {
2947  c=n_Init(1,C);
2948  }
2949 
2950  if(!n_GreaterZero(pGetCoeff(ph),C))
2951  {
2952  ph = p_Neg(ph,r);
2953  c = n_InpNeg(c, C);
2954  }
2955 
2956  return;
2957  }
2958  if (TEST_OPT_CONTENTSB) { c=n_Init(1,C); return; }
2959 
2960  assume( pNext(p) != NULL );
2961 
2962 #if CLEARENUMERATORS
2963  if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
2964  {
2965  CPolyCoeffsEnumerator itr(ph);
2966 
2967  n_ClearDenominators(itr, d, C); // multiply with common denom. d
2968  n_ClearContent(itr, h, C); // divide by the content h
2969 
2970  c = n_Div(d, h, C); // d/h
2971 
2972  n_Delete(&d, C);
2973  n_Delete(&h, C);
2974 
2975  n_Test(c, C);
2976 
2977  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2978  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2979 /*
2980  if(!n_GreaterZero(pGetCoeff(ph),C))
2981  {
2982  ph = p_Neg(ph,r);
2983  c = n_InpNeg(c, C);
2984  }
2985 */
2986  return;
2987  }
2988 #endif
2989 
2990 
2991 
2992 
2993  if(1)
2994  {
2995  h = n_Init(1,r->cf);
2996  while (p!=NULL)
2997  {
2998  n_Normalize(pGetCoeff(p),r->cf);
2999  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
3000  n_Delete(&h,r->cf);
3001  h=d;
3002  pIter(p);
3003  }
3004  c=h;
3005  /* contains the 1/lcm of all denominators */
3006  if(!n_IsOne(h,r->cf))
3007  {
3008  p = ph;
3009  while (p!=NULL)
3010  {
3011  /* should be: // NOTE: don't use ->coef!!!!
3012  * number hh;
3013  * nGetDenom(p->coef,&hh);
3014  * nMult(&h,&hh,&d);
3015  * nNormalize(d);
3016  * nDelete(&hh);
3017  * nMult(d,p->coef,&hh);
3018  * nDelete(&d);
3019  * nDelete(&(p->coef));
3020  * p->coef =hh;
3021  */
3022  d=n_Mult(h,pGetCoeff(p),r->cf);
3023  n_Normalize(d,r->cf);
3024  p_SetCoeff(p,d,r);
3025  pIter(p);
3026  }
3027  if (rField_is_Q_a(r))
3028  {
3029  loop
3030  {
3031  h = n_Init(1,r->cf);
3032  p=ph;
3033  while (p!=NULL)
3034  {
3035  d=n_NormalizeHelper(h,pGetCoeff(p),r->cf);
3036  n_Delete(&h,r->cf);
3037  h=d;
3038  pIter(p);
3039  }
3040  /* contains the 1/lcm of all denominators */
3041  if(!n_IsOne(h,r->cf))
3042  {
3043  p = ph;
3044  while (p!=NULL)
3045  {
3046  /* should be: // NOTE: don't use ->coef!!!!
3047  * number hh;
3048  * nGetDenom(p->coef,&hh);
3049  * nMult(&h,&hh,&d);
3050  * nNormalize(d);
3051  * nDelete(&hh);
3052  * nMult(d,p->coef,&hh);
3053  * nDelete(&d);
3054  * nDelete(&(p->coef));
3055  * p->coef =hh;
3056  */
3057  d=n_Mult(h,pGetCoeff(p),r->cf);
3058  n_Normalize(d,r->cf);
3059  p_SetCoeff(p,d,r);
3060  pIter(p);
3061  }
3062  number t=n_Mult(c,h,r->cf);
3063  n_Delete(&c,r->cf);
3064  c=t;
3065  }
3066  else
3067  {
3068  break;
3069  }
3070  n_Delete(&h,r->cf);
3071  }
3072  }
3073  }
3074  }
3075 
3076  if(!n_GreaterZero(pGetCoeff(ph),C))
3077  {
3078  ph = p_Neg(ph,r);
3079  c = n_InpNeg(c, C);
3080  }
3081 
3082 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define TEST_OPT_CONTENTSB
Definition: options.h:125
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
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:534
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
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
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:907
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
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
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:564
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
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:36
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
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

◆ p_Cmp()

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

Definition at line 1651 of file p_polys.h.

1652 {
1653  if (p2==NULL)
1654  {
1655  if (p1==NULL) return 0;
1656  return 1;
1657  }
1658  if (p1==NULL)
1659  return -1;
1660  return p_LmCmp(p1,p2,r);
1661 }
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
#define NULL
Definition: omList.c:12

◆ p_CmpPolys()

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

Definition at line 1663 of file p_polys.h.

1664 {
1665  if (p2==NULL)
1666  {
1667  if (p1==NULL) return 0;
1668  return 1;
1669  }
1670  if (p1==NULL)
1671  return -1;
1672  return p_ComparePolys(p1,p2,r);
1673 }
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:4482
#define NULL
Definition: omList.c:12

◆ p_Comp_k_n()

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

Definition at line 639 of file p_polys.h.

640 {
641  if ((a==NULL) || (b==NULL) ) return FALSE;
642  p_LmCheckPolyRing2(a, r);
643  p_LmCheckPolyRing2(b, r);
644  pAssume2(k > 0 && k <= r->N);
645  int i=k;
646  for(;i<=r->N;i++)
647  {
648  if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE;
649  // if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;
650  }
651  return TRUE;
652 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define pAssume2(cond)
Definition: monomials.h:193
CanonicalForm b
Definition: cfModGcd.cc:4044
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12

◆ p_Compare()

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

Definition at line 4812 of file p_polys.cc.

4813 {
4814  int r=p_Cmp(a,b,R);
4815  if ((r==0)&&(a!=NULL))
4816  {
4817  number h=n_Sub(pGetCoeff(a),pGetCoeff(b),R->cf);
4818  /* compare lead coeffs */
4819  r = -1+n_IsZero(h,R->cf)+2*n_GreaterZero(h,R->cf); /* -1: <, 0:==, 1: > */
4820  n_Delete(&h,R->cf);
4821  }
4822  else if (a==NULL)
4823  {
4824  if (b==NULL)
4825  {
4826  /* compare 0, 0 */
4827  r=0;
4828  }
4829  else if(p_IsConstant(b,R))
4830  {
4831  /* compare 0, const */
4832  r = 1-2*n_GreaterZero(pGetCoeff(b),R->cf); /* -1: <, 1: > */
4833  }
4834  }
4835  else if (b==NULL)
4836  {
4837  if (p_IsConstant(a,R))
4838  {
4839  /* compare const, 0 */
4840  r = -1+2*n_GreaterZero(pGetCoeff(a),R->cf); /* -1: <, 1: > */
4841  }
4842  }
4843  return(r);
4844 }
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of &#39;a&#39; and &#39;b&#39;, i.e., a-b
Definition: coeffs.h:669
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1651
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
CanonicalForm b
Definition: cfModGcd.cc:4044
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1927
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
static Poly * h
Definition: janet.cc:971

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

4483 {
4484  number n,nn;
4485  pAssume(p1 != NULL && p2 != NULL);
4486 
4487  if (!p_LmEqual(p1,p2,r)) //compare leading mons
4488  return FALSE;
4489  if ((pNext(p1)==NULL) && (pNext(p2)!=NULL))
4490  return FALSE;
4491  if ((pNext(p2)==NULL) && (pNext(p1)!=NULL))
4492  return FALSE;
4493  if (pLength(p1) != pLength(p2))
4494  return FALSE;
4495  #ifdef HAVE_RINGS
4496  if (rField_is_Ring(r))
4497  {
4498  if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf)) return FALSE;
4499  }
4500  #endif
4501  n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf);
4502  while ((p1 != NULL) /*&& (p2 != NULL)*/)
4503  {
4504  if ( ! p_LmEqual(p1, p2,r))
4505  {
4506  n_Delete(&n, r->cf);
4507  return FALSE;
4508  }
4509  if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf))
4510  {
4511  n_Delete(&n, r->cf);
4512  n_Delete(&nn, r->cf);
4513  return FALSE;
4514  }
4515  n_Delete(&nn, r->cf);
4516  pIter(p1);
4517  pIter(p2);
4518  }
4519  n_Delete(&n, r->cf);
4520  return TRUE;
4521 }
#define FALSE
Definition: auxiliary.h:94
#define pAssume(cond)
Definition: monomials.h:90
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1647
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:36
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:460
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455

◆ p_Content()

void p_Content ( poly  p,
const ring  r 
)

Definition at line 2270 of file p_polys.cc.

2271 {
2272  if (ph==NULL) return;
2273  const coeffs cf=r->cf;
2274  if (pNext(ph)==NULL)
2275  {
2276  p_SetCoeff(ph,n_Init(1,cf),r);
2277  }
2278  if (cf->cfSubringGcd==ndGcd) /* trivial gcd*/ return;
2279  number h=p_InitContent(ph,r); /* first guess of a gcd of all coeffs */
2280  poly p;
2281  if(n_IsOne(h,cf))
2282  {
2283  goto content_finish;
2284  }
2285  p=ph;
2286  // take the SubringGcd of all coeffs
2287  while (p!=NULL)
2288  {
2289  n_Normalize(pGetCoeff(p),cf);
2290  number d=n_SubringGcd(h,pGetCoeff(p),cf);
2291  n_Delete(&h,cf);
2292  h = d;
2293  if(n_IsOne(h,cf))
2294  {
2295  goto content_finish;
2296  }
2297  pIter(p);
2298  }
2299  // if found<>1, divide by it
2300  p = ph;
2301  while (p!=NULL)
2302  {
2303  number d = n_ExactDiv(pGetCoeff(p),h,cf);
2304  p_SetCoeff(p,d,r);
2305  pIter(p);
2306  }
2307 content_finish:
2308  n_Delete(&h,r->cf);
2309  // and last: check leading sign:
2310  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2311 }
number ndGcd(number, number, const coeffs r)
Definition: numbers.cc:161
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
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
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
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
The main handler for Singular numbers which are suitable for Singular polynomials.
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2581
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
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
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ p_ContentForGB()

void p_ContentForGB ( poly  p,
const ring  r 
)

Definition at line 2315 of file p_polys.cc.

2316 {
2317  if(TEST_OPT_CONTENTSB) return;
2318  assume( ph != NULL );
2319 
2320  assume( r != NULL ); assume( r->cf != NULL );
2321 
2322 
2323 #if CLEARENUMERATORS
2324  if( 0 )
2325  {
2326  const coeffs C = r->cf;
2327  // experimentall (recursive enumerator treatment) of alg. Ext!
2328  CPolyCoeffsEnumerator itr(ph);
2329  n_ClearContent(itr, r->cf);
2330 
2331  p_Test(ph, r); n_Test(pGetCoeff(ph), C);
2332  assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
2333 
2334  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2335  return;
2336  }
2337 #endif
2338 
2339 
2340 #ifdef HAVE_RINGS
2341  if (rField_is_Ring(r))
2342  {
2343  if (rField_has_Units(r))
2344  {
2345  number k = n_GetUnit(pGetCoeff(ph),r->cf);
2346  if (!n_IsOne(k,r->cf))
2347  {
2348  number tmpGMP = k;
2349  k = n_Invers(k,r->cf);
2350  n_Delete(&tmpGMP,r->cf);
2351  poly h = pNext(ph);
2352  p_SetCoeff(ph, n_Mult(pGetCoeff(ph), k,r->cf),r);
2353  while (h != NULL)
2354  {
2355  p_SetCoeff(h, n_Mult(pGetCoeff(h), k,r->cf),r);
2356  pIter(h);
2357  }
2358 // assume( n_GreaterZero(pGetCoeff(ph),r->cf) );
2359 // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2360  }
2361  n_Delete(&k,r->cf);
2362  }
2363  return;
2364  }
2365 #endif
2366  number h,d;
2367  poly p;
2368 
2369  if(pNext(ph)==NULL)
2370  {
2371  p_SetCoeff(ph,n_Init(1,r->cf),r);
2372  }
2373  else
2374  {
2375  assume( pNext(ph) != NULL );
2376 #if CLEARENUMERATORS
2377  if( nCoeff_is_Q(r->cf) )
2378  {
2379  // experimentall (recursive enumerator treatment) of alg. Ext!
2380  CPolyCoeffsEnumerator itr(ph);
2381  n_ClearContent(itr, r->cf);
2382 
2383  p_Test(ph, r); n_Test(pGetCoeff(ph), r->cf);
2384  assume(n_GreaterZero(pGetCoeff(ph), r->cf)); // ??
2385 
2386  // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2387  return;
2388  }
2389 #endif
2390 
2391  n_Normalize(pGetCoeff(ph),r->cf);
2392  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2393  if (rField_is_Q(r)||(getCoeffType(r->cf)==n_transExt)) // should not be used anymore if CLEARENUMERATORS is 1
2394  {
2395  h=p_InitContent(ph,r);
2396  p=ph;
2397  }
2398  else
2399  {
2400  h=n_Copy(pGetCoeff(ph),r->cf);
2401  p = pNext(ph);
2402  }
2403  while (p!=NULL)
2404  {
2405  n_Normalize(pGetCoeff(p),r->cf);
2406  d=n_SubringGcd(h,pGetCoeff(p),r->cf);
2407  n_Delete(&h,r->cf);
2408  h = d;
2409  if(n_IsOne(h,r->cf))
2410  {
2411  break;
2412  }
2413  pIter(p);
2414  }
2415  //number tmp;
2416  if(!n_IsOne(h,r->cf))
2417  {
2418  p = ph;
2419  while (p!=NULL)
2420  {
2421  //d = nDiv(pGetCoeff(p),h);
2422  //tmp = nExactDiv(pGetCoeff(p),h);
2423  //if (!nEqual(d,tmp))
2424  //{
2425  // StringSetS("** div0:");nWrite(pGetCoeff(p));StringAppendS("/");
2426  // nWrite(h);StringAppendS("=");nWrite(d);StringAppendS(" int:");
2427  // nWrite(tmp);Print(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
2428  //}
2429  //nDelete(&tmp);
2430  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2431  p_SetCoeff(p,d,r);
2432  pIter(p);
2433  }
2434  }
2435  n_Delete(&h,r->cf);
2436  if (rField_is_Q_a(r))
2437  {
2438  // special handling for alg. ext.:
2439  if (getCoeffType(r->cf)==n_algExt)
2440  {
2441  h = n_Init(1, r->cf->extRing->cf);
2442  p=ph;
2443  while (p!=NULL)
2444  { // each monom: coeff in Q_a
2445  poly c_n_n=(poly)pGetCoeff(p);
2446  poly c_n=c_n_n;
2447  while (c_n!=NULL)
2448  { // each monom: coeff in Q
2449  d=n_NormalizeHelper(h,pGetCoeff(c_n),r->cf->extRing->cf);
2450  n_Delete(&h,r->cf->extRing->cf);
2451  h=d;
2452  pIter(c_n);
2453  }
2454  pIter(p);
2455  }
2456  /* h contains the 1/lcm of all denominators in c_n_n*/
2457  //n_Normalize(h,r->cf->extRing->cf);
2458  if(!n_IsOne(h,r->cf->extRing->cf))
2459  {
2460  p=ph;
2461  while (p!=NULL)
2462  { // each monom: coeff in Q_a
2463  poly c_n=(poly)pGetCoeff(p);
2464  while (c_n!=NULL)
2465  { // each monom: coeff in Q
2466  d=n_Mult(h,pGetCoeff(c_n),r->cf->extRing->cf);
2467  n_Normalize(d,r->cf->extRing->cf);
2468  n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf);
2469  pGetCoeff(c_n)=d;
2470  pIter(c_n);
2471  }
2472  pIter(p);
2473  }
2474  }
2475  n_Delete(&h,r->cf->extRing->cf);
2476  }
2477  /*else
2478  {
2479  // special handling for rat. functions.:
2480  number hzz =NULL;
2481  p=ph;
2482  while (p!=NULL)
2483  { // each monom: coeff in Q_a (Z_a)
2484  fraction f=(fraction)pGetCoeff(p);
2485  poly c_n=NUM(f);
2486  if (hzz==NULL)
2487  {
2488  hzz=n_Copy(pGetCoeff(c_n),r->cf->extRing->cf);
2489  pIter(c_n);
2490  }
2491  while ((c_n!=NULL)&&(!n_IsOne(hzz,r->cf->extRing->cf)))
2492  { // each monom: coeff in Q (Z)
2493  d=n_Gcd(hzz,pGetCoeff(c_n),r->cf->extRing->cf);
2494  n_Delete(&hzz,r->cf->extRing->cf);
2495  hzz=d;
2496  pIter(c_n);
2497  }
2498  pIter(p);
2499  }
2500  // hzz contains the gcd of all numerators in f
2501  h=n_Invers(hzz,r->cf->extRing->cf);
2502  n_Delete(&hzz,r->cf->extRing->cf);
2503  n_Normalize(h,r->cf->extRing->cf);
2504  if(!n_IsOne(h,r->cf->extRing->cf))
2505  {
2506  p=ph;
2507  while (p!=NULL)
2508  { // each monom: coeff in Q_a (Z_a)
2509  fraction f=(fraction)pGetCoeff(p);
2510  NUM(f)=__p_Mult_nn(NUM(f),h,r->cf->extRing);
2511  p_Normalize(NUM(f),r->cf->extRing);
2512  pIter(p);
2513  }
2514  }
2515  n_Delete(&h,r->cf->extRing->cf);
2516  }*/
2517  }
2518  }
2519  if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2520 }
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
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define TEST_OPT_CONTENTSB
Definition: options.h:125
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
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:534
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
int k
Definition: cfEzgcd.cc:92
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
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:828
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
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
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:564
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2581
#define p_Test(p, r)
Definition: p_polys.h:162
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:36
#define pNext(p)
Definition: monomials.h:36
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
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static BOOLEAN rField_has_Units(const ring r)
Definition: ring.h:485
static Poly * h
Definition: janet.cc:971

◆ p_ContentRat()

void p_ContentRat ( poly &  ph,
const ring  r 
)

Definition at line 1719 of file p_polys.cc.

1722 {
1723  // init array of RatLeadCoeffs
1724  // poly p_GetCoeffRat(poly p, int ishift, ring r);
1725 
1726  int len=pLength(ph);
1727  poly *C = (poly *)omAlloc0((len+1)*sizeof(poly)); //rat coeffs
1728  poly *LM = (poly *)omAlloc0((len+1)*sizeof(poly)); // rat lead terms
1729  int *D = (int *)omAlloc0((len+1)*sizeof(int)); //degrees of coeffs
1730  int *L = (int *)omAlloc0((len+1)*sizeof(int)); //lengths of coeffs
1731  int k = 0;
1732  poly p = p_Copy(ph, r); // ph will be needed below
1733  int mintdeg = p_Totaldegree(p, r);
1734  int minlen = len;
1735  int dd = 0; int i;
1736  int HasConstantCoef = 0;
1737  int is = r->real_var_start - 1;
1738  while (p!=NULL)
1739  {
1740  LM[k] = p_GetExp_k_n(p,1,is, r); // need LmRat istead of p_HeadRat(p, is, currRing); !
1741  C[k] = p_GetCoeffRat(p, is, r);
1742  D[k] = p_Totaldegree(C[k], r);
1743  mintdeg = si_min(mintdeg,D[k]);
1744  L[k] = pLength(C[k]);
1745  minlen = si_min(minlen,L[k]);
1746  if (p_IsConstant(C[k], r))
1747  {
1748  // C[k] = const, so the content will be numerical
1749  HasConstantCoef = 1;
1750  // smth like goto cleanup and return(pContent(p));
1751  }
1752  p_LmDeleteAndNextRat(&p, is, r);
1753  k++;
1754  }
1755 
1756  // look for 1 element of minimal degree and of minimal length
1757  k--;
1758  poly d;
1759  int mindeglen = len;
1760  if (k<=0) // this poly is not a ratgring poly -> pContent
1761  {
1762  p_Delete(&C[0], r);
1763  p_Delete(&LM[0], r);
1764  p_ContentForGB(ph, r);
1765  goto cleanup;
1766  }
1767 
1768  int pmindeglen;
1769  for(i=0; i<=k; i++)
1770  {
1771  if (D[i] == mintdeg)
1772  {
1773  if (L[i] < mindeglen)
1774  {
1775  mindeglen=L[i];
1776  pmindeglen = i;
1777  }
1778  }
1779  }
1780  d = p_Copy(C[pmindeglen], r);
1781  // there are dd>=1 mindeg elements
1782  // and pmideglen is the coordinate of one of the smallest among them
1783 
1784  // poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r));
1785  // return naGcd(d,d2,currRing);
1786 
1787  // adjoin pContentRat here?
1788  for(i=0; i<=k; i++)
1789  {
1790  d=singclap_gcd(d,p_Copy(C[i], r), r);
1791  if (p_Totaldegree(d, r)==0)
1792  {
1793  // cleanup, pContent, return
1794  p_Delete(&d, r);
1795  for(;k>=0;k--)
1796  {
1797  p_Delete(&C[k], r);
1798  p_Delete(&LM[k], r);
1799  }
1800  p_ContentForGB(ph, r);
1801  goto cleanup;
1802  }
1803  }
1804  for(i=0; i<=k; i++)
1805  {
1806  poly h=singclap_pdivide(C[i],d, r);
1807  p_Delete(&C[i], r);
1808  C[i]=h;
1809  }
1810 
1811  // zusammensetzen,
1812  p=NULL; // just to be sure
1813  for(i=0; i<=k; i++)
1814  {
1815  p = p_Add_q(p, p_Mult_q(C[i],LM[i], r), r);
1816  C[i]=NULL; LM[i]=NULL;
1817  }
1818  p_Delete(&ph, r); // do not need it anymore
1819  ph = p;
1820  // aufraeumen, return
1821 cleanup:
1822  omFree(C);
1823  omFree(LM);
1824  omFree(D);
1825  omFree(L);
1826 }
#define D(A)
Definition: gentable.cc:131
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2315
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
int k
Definition: cfEzgcd.cc:92
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:556
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define omFree(addr)
Definition: omAllocDecl.h:261
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1927
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition: p_polys.cc:1675
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:169
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition: p_polys.cc:1697
int i
Definition: cfEzgcd.cc:125
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1307
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ p_Copy() [1/2]

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

returns a copy of p

Definition at line 811 of file p_polys.h.

812 {
813  if (p!=NULL)
814  {
815  p_Test(p,r);
816  const poly pp = p_Copy_noCheck(p, r);
817  p_Test(pp,r);
818  return pp;
819  }
820  else
821  return NULL;
822 }
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:801
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Copy() [2/2]

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

Definition at line 838 of file p_polys.h.

839 {
840  if (p != NULL)
841  {
842 #ifndef PDEBUG
843  if (tailRing == lmRing)
844  return p_Copy_noCheck(p, tailRing);
845 #endif
846  poly pres = p_Head(p, lmRing);
847  if (pNext(p)!=NULL)
848  pNext(pres) = p_Copy_noCheck(pNext(p), tailRing);
849  return pres;
850  }
851  else
852  return NULL;
853 }
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:801
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

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

802 {
803  /*assume(p!=NULL);*/
804  assume(r != NULL);
805  assume(r->p_Procs != NULL);
806  assume(r->p_Procs->p_Copy != NULL);
807  return r->p_Procs->p_Copy(p, r);
808 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_DecrExp()

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

Definition at line 597 of file p_polys.h.

598 {
599  p_LmCheckPolyRing2(p, r);
600  int e = p_GetExp(p,v,r);
601  pAssume2(e > 0);
602  e--;
603  return p_SetExp(p,v,e,r);
604 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_Deg()

long p_Deg ( poly  a,
const ring  r 
)

Definition at line 577 of file p_polys.cc.

578 {
579  p_LmCheckPolyRing(a, r);
580 // assume(p_GetOrder(a, r) == p_WTotaldegree(a, r)); // WRONG assume!
581  return p_GetOrder(a, r);
582 }
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:420
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118

◆ p_DegW()

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

Definition at line 680 of file p_polys.cc.

681 {
682  p_Test(p, R);
683  assume( w != NULL );
684  long r=-LONG_MAX;
685 
686  while (p!=NULL)
687  {
688  long t=totaldegreeWecart_IV(p,R,w);
689  if (t>r) r=t;
690  pIter(p);
691  }
692  return r;
693 }
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:231
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019

◆ p_Delete() [1/2]

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

Definition at line 856 of file p_polys.h.

857 {
858  assume( p!= NULL );
859  assume( r!= NULL );
860  if ((*p)!=NULL) r->p_Procs->p_Delete(p, r);
861 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Delete() [2/2]

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

Definition at line 863 of file p_polys.h.

864 {
865  assume( p!= NULL );
866  if (*p != NULL)
867  {
868 #ifndef PDEBUG
869  if (tailRing == lmRing)
870  {
871  p_Delete(p, tailRing);
872  return;
873  }
874 #endif
875  if (pNext(*p) != NULL)
876  p_Delete(&pNext(*p), tailRing);
877  p_LmDelete(p, lmRing);
878  }
879 }
#define assume(x)
Definition: mod2.h:390
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019

◆ p_DeleteComp()

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

Definition at line 3503 of file p_polys.cc.

3504 {
3505  poly q;
3506 
3507  while ((*p!=NULL) && (__p_GetComp(*p,r)==k)) p_LmDelete(p,r);
3508  if (*p==NULL) return;
3509  q = *p;
3510  if (__p_GetComp(q,r)>k)
3511  {
3512  p_SubComp(q,1,r);
3513  p_SetmComp(q,r);
3514  }
3515  while (pNext(q)!=NULL)
3516  {
3517  if (__p_GetComp(pNext(q),r)==k)
3518  p_LmDelete(&(pNext(q)),r);
3519  else
3520  {
3521  pIter(q);
3522  if (__p_GetComp(q,r)>k)
3523  {
3524  p_SubComp(q,1,r);
3525  p_SetmComp(q,r);
3526  }
3527  }
3528  }
3529 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:452
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019

◆ p_Diff()

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

Definition at line 1873 of file p_polys.cc.

1874 {
1875  poly res, f, last;
1876  number t;
1877 
1878  last = res = NULL;
1879  while (a!=NULL)
1880  {
1881  if (p_GetExp(a,k,r)!=0)
1882  {
1883  f = p_LmInit(a,r);
1884  t = n_Init(p_GetExp(a,k,r),r->cf);
1885  pSetCoeff0(f,n_Mult(t,pGetCoeff(a),r->cf));
1886  n_Delete(&t,r->cf);
1887  if (n_IsZero(pGetCoeff(f),r->cf))
1888  p_LmDelete(&f,r);
1889  else
1890  {
1891  p_DecrExp(f,k,r);
1892  p_Setm(f,r);
1893  if (res==NULL)
1894  {
1895  res=last=f;
1896  }
1897  else
1898  {
1899  pNext(last)=f;
1900  last=f;
1901  }
1902  }
1903  }
1904  pIter(a);
1905  }
1906  return res;
1907 }
static poly last
Definition: hdegree.cc:1076
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
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
CanonicalForm res
Definition: facAbsFact.cc:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
FILE * f
Definition: checklibs.c:9
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1270
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static long p_DecrExp(poly p, int v, ring r)
Definition: p_polys.h:597

◆ p_DiffOp()

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

Definition at line 1948 of file p_polys.cc.

1949 {
1950  poly result=NULL;
1951  poly h;
1952  for(;a!=NULL;pIter(a))
1953  {
1954  for(h=b;h!=NULL;pIter(h))
1955  {
1956  result=p_Add_q(result,p_DiffOpM(a,h,multiply,r),r);
1957  }
1958  }
1959  return result;
1960 }
static poly p_DiffOpM(poly a, poly b, BOOLEAN multiply, const ring r)
Definition: p_polys.cc:1909
#define pIter(p)
Definition: monomials.h:37
CanonicalForm b
Definition: cfModGcd.cc:4044
#define NULL
Definition: omList.c:12
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971
return result
Definition: facAbsBiFact.cc:76

◆ p_Div_mm()

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

divide polynomial by monomial

Definition at line 1520 of file p_polys.cc.

1521 {
1522  p_Test(p, r);
1523  p_Test(m, r);
1524  poly result = p;
1525  poly prev = NULL;
1526  number n=pGetCoeff(m);
1527  while (p!=NULL)
1528  {
1529  number nc = n_Div(pGetCoeff(p),n,r->cf);
1530  n_Normalize(nc,r->cf);
1531  if (!n_IsZero(nc,r->cf))
1532  {
1533  p_SetCoeff(p,nc,r);
1534  prev=p;
1535  p_ExpVectorSub(p,m,r);
1536  pIter(p);
1537  }
1538  else
1539  {
1540  if (prev==NULL)
1541  {
1542  p_LmDelete(&result,r);
1543  p=result;
1544  }
1545  else
1546  {
1547  p_LmDelete(&pNext(prev),r);
1548  p=pNext(prev);
1549  }
1550  }
1551  }
1552  p_Test(result,r);
1553  return(result);
1554 }
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
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
int m
Definition: cfEzgcd.cc:121
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_Div_nn()

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

Definition at line 1487 of file p_polys.cc.

1488 {
1489  pAssume(!n_IsZero(n,r->cf));
1490  p_Test(p, r);
1491  poly result = p;
1492  poly prev = NULL;
1493  while (p!=NULL)
1494  {
1495  number nc = n_Div(pGetCoeff(p),n,r->cf);
1496  if (!n_IsZero(nc,r->cf))
1497  {
1498  p_SetCoeff(p,nc,r);
1499  prev=p;
1500  pIter(p);
1501  }
1502  else
1503  {
1504  if (prev==NULL)
1505  {
1506  p_LmDelete(&result,r);
1507  p=result;
1508  }
1509  else
1510  {
1511  p_LmDelete(&pNext(prev),r);
1512  p=pNext(prev);
1513  }
1514  }
1515  }
1516  p_Test(result,r);
1517  return(result);
1518 }
#define pAssume(cond)
Definition: monomials.h:90
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_DivideM()

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

Definition at line 1560 of file p_polys.cc.

1561 {
1562  if (a==NULL) { p_Delete(&b,r); return NULL; }
1563  poly result=a;
1564 
1565  if(!p_IsConstant(b,r))
1566  {
1567  if (rIsLPRing(r))
1568  {
1569  WerrorS("not implemented for letterplace rings");
1570  return NULL;
1571  }
1572  poly prev=NULL;
1573  while (a!=NULL)
1574  {
1575  if (p_DivisibleBy(b,a,r))
1576  {
1577  p_ExpVectorSub(a,b,r);
1578  prev=a;
1579  pIter(a);
1580  }
1581  else
1582  {
1583  if (prev==NULL)
1584  {
1585  p_LmDelete(&result,r);
1586  a=result;
1587  }
1588  else
1589  {
1590  p_LmDelete(&pNext(prev),r);
1591  a=pNext(prev);
1592  }
1593  }
1594  }
1595  }
1596  if (result!=NULL)
1597  {
1598  number inv=pGetCoeff(b);
1599  //if ((!rField_is_Ring(r)) || n_IsUnit(inv,r->cf))
1600  if (rField_is_Zp(r))
1601  {
1602  inv = n_Invers(inv,r->cf);
1603  __p_Mult_nn(result,inv,r);
1604  n_Delete(&inv, r->cf);
1605  }
1606  else
1607  {
1608  result = p_Div_nn(result,inv,r);
1609  }
1610  }
1611  p_Delete(&b, r);
1612  return result;
1613 }
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1487
void WerrorS(const char *s)
Definition: feFopen.cc:24
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408
#define pIter(p)
Definition: monomials.h:37
CanonicalForm b
Definition: cfModGcd.cc:4044
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1927
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1828
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:564
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1375
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:926
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
return result
Definition: facAbsBiFact.cc:76

◆ p_DivisibleBy() [1/2]

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

Definition at line 1828 of file p_polys.h.

1829 {
1831  pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r));
1832 
1833  if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)))
1834  return _p_LmDivisibleByNoComp(a,b,r);
1835  return FALSE;
1836 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pIfThen1(cond, check)
Definition: monomials.h:179
#define NULL
Definition: omList.c:12

◆ p_DivisibleBy() [2/2]

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

Definition at line 1837 of file p_polys.h.

1838 {
1839  pIfThen1(b!=NULL, p_LmCheckPolyRing1(b, r_b));
1840  pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r_a));
1841  if (a != NULL) {
1842  return _p_LmDivisibleBy(a, r_a, b, r_b);
1843  }
1844  return FALSE;
1845 }
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1793
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pIfThen1(cond, check)
Definition: monomials.h:179
#define NULL
Definition: omList.c:12

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

1618 {
1619  int exponent;
1620  for(int i = (int)rVar(r); i>0; i--)
1621  {
1622  exponent = p_GetExp(g, i, r) - p_GetExp(f, i, r);
1623  if (exponent < 0) return FALSE;
1624  }
1625  return n_DivBy(pGetCoeff(g), pGetCoeff(f), r->cf);
1626 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
g
Definition: cfModGcd.cc:4031
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:125
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )

◆ p_EqualPolys() [1/2]

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

Definition at line 4418 of file p_polys.cc.

4419 {
4420  while ((p1 != NULL) && (p2 != NULL))
4421  {
4422  if (! p_LmEqual(p1, p2,r))
4423  return FALSE;
4424  if (! n_Equal(p_GetCoeff(p1,r), p_GetCoeff(p2,r),r->cf ))
4425  return FALSE;
4426  pIter(p1);
4427  pIter(p2);
4428  }
4429  return (p1==p2);
4430 }
#define FALSE
Definition: auxiliary.h:94
#define pIter(p)
Definition: monomials.h:37
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1647
#define NULL
Definition: omList.c:12
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:50

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

4457 {
4458  assume( r1 == r2 || rSamePolyRep(r1, r2) ); // will be used in rEqual!
4459  assume( r1->cf == r2->cf );
4460 
4461  while ((p1 != NULL) && (p2 != NULL))
4462  {
4463  // returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !!
4464  // #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r)
4465 
4466  if (! p_ExpVectorEqual(p1, p2, r1, r2))
4467  return FALSE;
4468 
4469  if (! n_Equal(p_GetCoeff(p1,r1), p_GetCoeff(p2,r2), r1->cf ))
4470  return FALSE;
4471 
4472  pIter(p1);
4473  pIter(p2);
4474  }
4475  return (p1==p2);
4476 }
#define FALSE
Definition: auxiliary.h:94
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
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:1708
#define NULL
Definition: omList.c:12
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4432

◆ p_ExpVectorAdd()

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

Definition at line 1346 of file p_polys.h.

1347 {
1348  p_LmCheckPolyRing1(p1, r);
1349  p_LmCheckPolyRing1(p2, r);
1350 #if PDEBUG >= 1
1351  for (int i=1; i<=r->N; i++)
1352  pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
1353  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
1354 #endif
1355 
1356  p_MemAdd_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
1357  p_MemAdd_NegWeightAdjust(p1, r);
1358 }
#define p_GetComp(p, r)
Definition: monomials.h:64
#define p_MemAdd_LengthGeneral(r, s, length)
Definition: p_MemAdd.h:173
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1227
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_ExpVectorAddSub()

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

Definition at line 1391 of file p_polys.h.

1392 {
1393  p_LmCheckPolyRing1(p1, r);
1394  p_LmCheckPolyRing1(p2, r);
1395  p_LmCheckPolyRing1(p3, r);
1396 #if PDEBUG >= 1
1397  for (int i=1; i<=r->N; i++)
1398  pAssume1(p_GetExp(p1, i, r) + p_GetExp(p2, i, r) >= p_GetExp(p3, i, r));
1399  pAssume1(p_GetComp(p1, r) == 0 ||
1400  (p_GetComp(p2, r) - p_GetComp(p3, r) == 0) ||
1401  (p_GetComp(p1, r) == p_GetComp(p2, r) - p_GetComp(p3, r)));
1402 #endif
1403 
1404  p_MemAddSub_LengthGeneral(p1->exp, p2->exp, p3->exp, r->ExpL_Size);
1405  // no need to adjust in case of NegWeights
1406 }
#define p_GetComp(p, r)
Definition: monomials.h:64
#define p_MemAddSub_LengthGeneral(r, s, t, length)
Definition: p_MemAdd.h:312
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_ExpVectorCopy()

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

Definition at line 1248 of file p_polys.h.

1249 {
1250  p_LmCheckPolyRing1(d_p, r);
1251  p_LmCheckPolyRing1(s_p, r);
1252  memcpy(d_p->exp, s_p->exp, r->ExpL_Size*sizeof(long));
1253 }
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177

◆ p_ExpVectorDiff()

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

Definition at line 1409 of file p_polys.h.

1410 {
1411  p_LmCheckPolyRing1(p1, r);
1412  p_LmCheckPolyRing1(p2, r);
1413  p_LmCheckPolyRing1(pr, r);
1414 #if PDEBUG >= 2
1415  for (int i=1; i<=r->N; i++)
1416  pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
1417  pAssume1(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
1418 #endif
1419 
1420  p_MemDiff_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
1421  p_MemSub_NegWeightAdjust(pr, r);
1422 }
#define p_GetComp(p, r)
Definition: monomials.h:64
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1237
#define p_MemDiff_LengthGeneral(r, s1, s2, length)
Definition: p_MemAdd.h:262
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define rRing_has_Comp(r)
Definition: monomials.h:266
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_ExpVectorEqual()

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

Definition at line 1424 of file p_polys.h.

1425 {
1426  p_LmCheckPolyRing1(p1, r);
1427  p_LmCheckPolyRing1(p2, r);
1428 
1429  unsigned i = r->ExpL_Size;
1430  unsigned long *ep = p1->exp;
1431  unsigned long *eq = p2->exp;
1432 
1433  do
1434  {
1435  i--;
1436  if (ep[i] != eq[i]) return FALSE;
1437  }
1438  while (i!=0);
1439  return TRUE;
1440 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177

◆ p_ExpVectorSub()

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

Definition at line 1375 of file p_polys.h.

1376 {
1377  p_LmCheckPolyRing1(p1, r);
1378  p_LmCheckPolyRing1(p2, r);
1379 #if PDEBUG >= 1
1380  for (int i=1; i<=r->N; i++)
1381  pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
1382  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0 ||
1383  p_GetComp(p1, r) == p_GetComp(p2, r));
1384 #endif
1385 
1386  p_MemSub_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
1387  p_MemSub_NegWeightAdjust(p1, r);
1388 }
#define p_GetComp(p, r)
Definition: monomials.h:64
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1237
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define p_MemSub_LengthGeneral(r, s, length)
Definition: p_MemAdd.h:291
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_ExpVectorSum()

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

Definition at line 1360 of file p_polys.h.

1361 {
1362  p_LmCheckPolyRing1(p1, r);
1363  p_LmCheckPolyRing1(p2, r);
1364  p_LmCheckPolyRing1(pr, r);
1365 #if PDEBUG >= 1
1366  for (int i=1; i<=r->N; i++)
1367  pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
1368  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
1369 #endif
1370 
1371  p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
1372  p_MemAdd_NegWeightAdjust(pr, r);
1373 }
#define p_MemSum_LengthGeneral(r, s1, s2, length)
Definition: p_MemAdd.h:86
#define p_GetComp(p, r)
Definition: monomials.h:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1227
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_Farey()

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

Definition at line 50 of file p_polys.cc.

51 {
52  poly h=p_Copy(p,r);
53  poly hh=h;
54  while(h!=NULL)
55  {
56  number c=pGetCoeff(h);
57  pSetCoeff0(h,n_Farey(c,N,r->cf));
58  n_Delete(&c,r->cf);
59  pIter(h);
60  }
61  while((hh!=NULL)&&(n_IsZero(pGetCoeff(hh),r->cf)))
62  {
63  p_LmDelete(&hh,r);
64  }
65  h=hh;
66  while((h!=NULL) && (pNext(h)!=NULL))
67  {
68  if(n_IsZero(pGetCoeff(pNext(h)),r->cf))
69  {
70  p_LmDelete(&pNext(h),r);
71  }
72  else pIter(h);
73  }
74  return hh;
75 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define pIter(p)
Definition: monomials.h:37
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:789
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ p_FDeg()

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

Definition at line 379 of file p_polys.h.

379 { return r->pFDeg(p,r); }
int p
Definition: cfModGcd.cc:4019

◆ p_GcdMon()

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

polynomial gcd for f=mon

Definition at line 4846 of file p_polys.cc.

4847 {
4848  assume(f!=NULL);
4849  assume(g!=NULL);
4850  assume(pNext(f)==NULL);
4851  poly G=p_Head(f,r);
4852  poly h=g;
4853  int *mf=(int*)omAlloc((r->N+1)*sizeof(int));
4854  p_GetExpV(f,mf,r);
4855  int *mh=(int*)omAlloc((r->N+1)*sizeof(int));
4856  BOOLEAN const_mon;
4857  BOOLEAN one_coeff=n_IsOne(pGetCoeff(G),r->cf);
4858  loop
4859  {
4860  if (h==NULL) break;
4861  if(!one_coeff)
4862  {
4863  number n=n_SubringGcd(pGetCoeff(G),pGetCoeff(h),r->cf);
4864  one_coeff=n_IsOne(n,r->cf);
4865  p_SetCoeff(G,n,r);
4866  }
4867  p_GetExpV(h,mh,r);
4868  const_mon=TRUE;
4869  for(unsigned j=r->N;j!=0;j--)
4870  {
4871  if (mh[j]<mf[j]) mf[j]=mh[j];
4872  if (mf[j]>0) const_mon=FALSE;
4873  }
4874  if (one_coeff && const_mon) break;
4875  pIter(h);
4876  }
4877  mf[0]=0;
4878  p_SetExpV(G,mf,r); // included is p_SetComp, p_Setm
4879  omFreeSize(mf,(r->N+1)*sizeof(int));
4880  omFreeSize(mh,(r->N+1)*sizeof(int));
4881  return G;
4882 }
int j
Definition: facHensel.cc:105
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1455
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
g
Definition: cfModGcd.cc:4031
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static TreeM * G
Definition: janet.cc:31
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1470
#define pIter(p)
Definition: monomials.h:37
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
#define assume(x)
Definition: mod2.h:390
FILE * f
Definition: checklibs.c:9
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85

◆ p_GetCoeffRat()

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

Definition at line 1697 of file p_polys.cc.

1698 {
1699  poly q = pNext(p);
1700  poly res; // = p_Head(p,r);
1701  res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally
1702  p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r);
1703  poly s;
1704  long cmp = p_GetComp(p, r);
1705  while ( (q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r)) && (p_GetComp(q, r) == cmp) )
1706  {
1707  s = p_GetExp_k_n(q, ishift+1, r->N, r);
1708  p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r);
1709  res = p_Add_q(res,s,r);
1710  q = pNext(q);
1711  }
1712  cmp = 0;
1713  p_SetCompP(res,cmp,r);
1714  return res;
1715 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define p_GetComp(p, r)
Definition: monomials.h:64
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:639
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:253
CanonicalForm res
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
#define pNext(p)
Definition: monomials.h:36
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1307
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891

◆ p_GetExp() [1/3]

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

get a single variable exponent : the integer VarOffset encodes:

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

Definition at line 468 of file p_polys.h.

469 {
470  pAssume2((VarOffset >> (24 + 6)) == 0);
471 #if 0
472  int pos=(VarOffset & 0xffffff);
473  int bitpos=(VarOffset >> 24);
474  unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask;
475  return exp;
476 #else
477  return (long)
478  ((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24))
479  & iBitmask);
480 #endif
481 }
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
#define pAssume2(cond)
Definition: monomials.h:193
int p
Definition: cfModGcd.cc:4019

◆ p_GetExp() [2/3]

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

Definition at line 554 of file p_polys.h.

555 {
556  p_LmCheckPolyRing2(p, r);
557  pAssume2(VarOffset != -1);
558  return p_GetExp(p, r->bitmask, VarOffset);
559 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int p
Definition: cfModGcd.cc:4019

◆ p_GetExp() [3/3]

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

get v^th exponent for a monomial

Definition at line 571 of file p_polys.h.

572 {
573  p_LmCheckPolyRing2(p, r);
574  pAssume2(v>0 && v <= r->N);
575  pAssume2(r->VarOffset[v] != -1);
576  return p_GetExp(p, r->bitmask, r->VarOffset[v]);
577 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int p
Definition: cfModGcd.cc:4019

◆ p_GetExp_k_n()

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

Definition at line 1307 of file p_polys.h.

1308 {
1309  if (p == NULL) return NULL;
1310  p_LmCheckPolyRing1(p, r);
1311  poly np;
1312  omTypeAllocBin(poly, np, r->PolyBin);
1313  p_SetRingOfLm(np, r);
1314  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
1315  pNext(np) = NULL;
1316  pSetCoeff0(np, n_Init(1, r->cf));
1317  int i;
1318  for(i=l;i<=k;i++)
1319  {
1320  //np->exp[(r->VarOffset[i] & 0xffffff)] =0;
1321  p_SetExp(np,i,0,r);
1322  }
1323  p_Setm(np,r);
1324  return np;
1325 }
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
int k
Definition: cfEzgcd.cc:92
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
#define p_SetRingOfLm(p, r)
Definition: monomials.h:144
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ p_GetExpDiff()

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

Definition at line 634 of file p_polys.h.

635 {
636  return p_GetExp(p1,i,r) - p_GetExp(p2,i,r);
637 }
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125

◆ p_GetExpSum()

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

Definition at line 628 of file p_polys.h.

629 {
630  p_LmCheckPolyRing2(p1, r);
631  p_LmCheckPolyRing2(p2, r);
632  return p_GetExp(p1,i,r) + p_GetExp(p2,i,r);
633 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125

◆ p_GetExpV()

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

Definition at line 1455 of file p_polys.h.

1456 {
1457  p_LmCheckPolyRing1(p, r);
1458  for (unsigned j = r->N; j!=0; j--)
1459  ev[j] = p_GetExp(p, j, r);
1460 
1461  ev[0] = p_GetComp(p, r);
1462 }
int j
Definition: facHensel.cc:105
#define p_GetComp(p, r)
Definition: monomials.h:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
int p
Definition: cfModGcd.cc:4019

◆ p_GetExpVL()

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

Definition at line 1464 of file p_polys.h.

1465 {
1466  p_LmCheckPolyRing1(p, r);
1467  for (unsigned j = r->N; j!=0; j--)
1468  ev[j-1] = p_GetExp(p, j, r);
1469 }
int j
Definition: facHensel.cc:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
int p
Definition: cfModGcd.cc:4019

◆ p_GetMaxExp() [1/2]

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

Definition at line 746 of file p_polys.h.

747 {
748  unsigned long bitmask = r->bitmask;
749  unsigned long max = (l & bitmask);
750  unsigned long j = r->ExpPerLong - 1;
751 
752  if (j > 0)
753  {
754  unsigned long i = r->BitsPerExp;
755  long e;
756  loop
757  {
758  e = ((l >> i) & bitmask);
759  if ((unsigned long) e > max)
760  max = e;
761  j--;
762  if (j==0) break;
763  i += r->BitsPerExp;
764  }
765  }
766  return max;
767 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:80
static int max(int a, int b)
Definition: fast_mult.cc:264
int i
Definition: cfEzgcd.cc:125
int l
Definition: cfEzgcd.cc:93

◆ p_GetMaxExp() [2/2]

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

Definition at line 769 of file p_polys.h.

770 {
771  return p_GetMaxExp(p_GetMaxExpL(p, r), r);
772 }
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:746
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:1165
int p
Definition: cfModGcd.cc:4019

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

1166 {
1167  unsigned long l_p, divmask = r->divmask;
1168  int i;
1169 
1170  while (p != NULL)
1171  {
1172  l_p = p->exp[r->VarL_Offset[0]];
1173  if (l_p > l_max ||
1174  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1175  l_max = p_GetMaxExpL2(l_max, l_p, r);
1176  for (i=1; i<r->VarL_Size; i++)
1177  {
1178  l_p = p->exp[r->VarL_Offset[i]];
1179  // do the divisibility trick to find out whether l has an exponent
1180  if (l_p > l_max ||
1181  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1182  l_max = p_GetMaxExpL2(l_max, l_p, r);
1183  }
1184  pIter(p);
1185  }
1186  return l_max;
1187 }
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1097
int p
Definition: cfModGcd.cc:4019

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

1129 {
1130  p_CheckPolyRing(p, r);
1131  if (p == NULL) return p_Init(r);
1132  poly max = p_LmInit(p, r);
1133  pIter(p);
1134  if (p == NULL) return max;
1135  int i, offset;
1136  unsigned long l_p, l_max;
1137  unsigned long divmask = r->divmask;
1138 
1139  do
1140  {
1141  offset = r->VarL_Offset[0];
1142  l_p = p->exp[offset];
1143  l_max = max->exp[offset];
1144  // do the divisibility trick to find out whether l has an exponent
1145  if (l_p > l_max ||
1146  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1147  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1148 
1149  for (i=1; i<r->VarL_Size; i++)
1150  {
1151  offset = r->VarL_Offset[i];
1152  l_p = p->exp[offset];
1153  l_max = max->exp[offset];
1154  // do the divisibility trick to find out whether l has an exponent
1155  if (l_p > l_max ||
1156  (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1157  max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
1158  }
1159  pIter(p);
1160  }
1161  while (p != NULL);
1162  return max;
1163 }
#define pIter(p)
Definition: monomials.h:37
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1270
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition: p_polys.cc:1097
int p
Definition: cfModGcd.cc:4019
int offset
Definition: libparse.cc:1091
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_GetOrder()

static long p_GetOrder ( poly  p,
ring  r 
)
inlinestatic

Definition at line 420 of file p_polys.h.

421 {
422  p_LmCheckPolyRing2(p, r);
423  if (r->typ==NULL) return ((p)->exp[r->pOrdIndex]);
424  int i=0;
425  loop
426  {
427  switch(r->typ[i].ord_typ)
428  {
429  case ro_am:
430  case ro_wp_neg:
431  return ((p->exp[r->pOrdIndex])-POLY_NEGWEIGHT_OFFSET);
432  case ro_syzcomp:
433  case ro_syz:
434  case ro_cp:
435  i++;
436  break;
437  //case ro_dp:
438  //case ro_wp:
439  default:
440  return ((p)->exp[r->pOrdIndex]);
441  }
442  }
443 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
Definition: ring.h:60
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:236
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
#define loop
Definition: structs.h:80
Definition: ring.h:58
Definition: ring.h:56
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
Definition: ring.h:54
int p
Definition: cfModGcd.cc:4019

◆ p_GetSetmProc()

p_SetmProc p_GetSetmProc ( const ring  r)

Definition at line 550 of file p_polys.cc.

551 {
552  // covers lp, rp, ls,
553  if (r->typ == NULL) return p_Setm_Dummy;
554 
555  if (r->OrdSize == 1)
556  {
557  if (r->typ[0].ord_typ == ro_dp &&
558  r->typ[0].data.dp.start == 1 &&
559  r->typ[0].data.dp.end == r->N &&
560  r->typ[0].data.dp.place == r->pOrdIndex)
561  return p_Setm_TotalDegree;
562  if (r->typ[0].ord_typ == ro_wp &&
563  r->typ[0].data.wp.start == 1 &&
564  r->typ[0].data.wp.end == r->N &&
565  r->typ[0].data.wp.place == r->pOrdIndex &&
566  r->typ[0].data.wp.weights == r->firstwv)
568  }
569  return p_Setm_General;
570 }
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:152
Definition: ring.h:53
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:544
void p_Setm_TotalDegree(poly p, const ring r)
Definition: p_polys.cc:537
void p_Setm_Dummy(poly p, const ring r)
Definition: p_polys.cc:531
#define NULL
Definition: omList.c:12
Definition: ring.h:52

◆ p_GetShortExpVector() [1/2]

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

Definition at line 4687 of file p_polys.cc.

4688 {
4689  assume(p != NULL);
4690  unsigned long ev = 0; // short exponent vector
4691  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4692  unsigned int m1; // highest bit which is filled with (n+1)
4693  int i=0,j=1;
4694 
4695  if (n == 0)
4696  {
4697  if (r->N <2*BIT_SIZEOF_LONG)
4698  {
4699  n=1;
4700  m1=0;
4701  }
4702  else
4703  {
4704  for (; j<=r->N; j++)
4705  {
4706  if (p_GetExp(p,j,r) > 0) i++;
4707  if (i == BIT_SIZEOF_LONG) break;
4708  }
4709  if (i>0)
4710  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4711  return ev;
4712  }
4713  }
4714  else
4715  {
4716  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4717  }
4718 
4719  n++;
4720  while (i<m1)
4721  {
4722  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4723  i += n;
4724  j++;
4725  }
4726 
4727  n--;
4728  while (i<BIT_SIZEOF_LONG)
4729  {
4730  ev |= GetBitFields(p_GetExp(p, j,r), i, n);
4731  i += n;
4732  j++;
4733  }
4734  return ev;
4735 }
int j
Definition: facHensel.cc:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4654
#define NULL
Definition: omList.c:12
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78
int p
Definition: cfModGcd.cc:4019

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

4740 {
4741  assume(p != NULL);
4742  assume(pp != NULL);
4743 
4744  unsigned long ev = 0; // short exponent vector
4745  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
4746  unsigned int m1; // highest bit which is filled with (n+1)
4747  int j=1;
4748  unsigned long i = 0L;
4749 
4750  if (n == 0)
4751  {
4752  if (r->N <2*BIT_SIZEOF_LONG)
4753  {
4754  n=1;
4755  m1=0;
4756  }
4757  else
4758  {
4759  for (; j<=r->N; j++)
4760  {
4761  if (p_GetExp(p,j,r) > 0 || p_GetExp(pp,j,r) > 0) i++;
4762  if (i == BIT_SIZEOF_LONG) break;
4763  }
4764  if (i>0)
4765  ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
4766  return ev;
4767  }
4768  }
4769  else
4770  {
4771  m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
4772  }
4773 
4774  n++;
4775  while (i<m1)
4776  {
4777  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4778  i += n;
4779  j++;
4780  }
4781 
4782  n--;
4783  while (i<BIT_SIZEOF_LONG)
4784  {
4785  ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
4786  i += n;
4787  j++;
4788  }
4789  return ev;
4790 }
int j
Definition: facHensel.cc:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int i
Definition: cfEzgcd.cc:125
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition: p_polys.cc:4654
#define NULL
Definition: omList.c:12
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:78
int p
Definition: cfModGcd.cc:4019

◆ p_GetTotalDegree()

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

Definition at line 775 of file p_polys.h.

776 {
777  const unsigned long bitmask = r->bitmask;
778  unsigned long sum = (l & bitmask);
779  unsigned long j = number_of_exps - 1;
780 
781  if (j > 0)
782  {
783  unsigned long i = r->BitsPerExp;
784  loop
785  {
786  sum += ((l >> i) & bitmask);
787  j--;
788  if (j==0) break;
789  i += r->BitsPerExp;
790  }
791  }
792  return sum;
793 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
int l
Definition: cfEzgcd.cc:93

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

1258 {
1259  int i;
1260  int n=0;
1261  while(p!=NULL)
1262  {
1263  n=0;
1264  for(i=r->N; i>0; i--)
1265  {
1266  if(e[i]==0)
1267  {
1268  if (p_GetExp(p,i,r)>0)
1269  {
1270  e[i]=1;
1271  n++;
1272  }
1273  }
1274  else
1275  n++;
1276  }
1277  if (n==r->N) break;
1278  pIter(p);
1279  }
1280  return n;
1281 }
#define pIter(p)
Definition: monomials.h:37
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_HasNotCF()

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

Definition at line 1319 of file p_polys.cc.

1320 {
1321 
1322  if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
1323  return FALSE;
1324  int i = rVar(r);
1325  loop
1326  {
1327  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1328  return FALSE;
1329  i--;
1330  if (i == 0)
1331  return TRUE;
1332  }
1333 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define TRUE
Definition: auxiliary.h:98
#define loop
Definition: structs.h:80
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125

◆ p_HasNotCFRing()

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

Definition at line 1335 of file p_polys.cc.

1336 {
1337 
1338  if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
1339  return FALSE;
1340  int i = rVar(r);
1341  loop
1342  {
1343  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
1344  return FALSE;
1345  i--;
1346  if (i == 0) {
1347  if (n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf) ||
1348  n_DivBy(pGetCoeff(p2), pGetCoeff(p1), r->cf)) {
1349  return FALSE;
1350  } else {
1351  return TRUE;
1352  }
1353  }
1354  }
1355 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define loop
Definition: structs.h:80
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
int i
Definition: cfEzgcd.cc:125

◆ p_Head()

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

Definition at line 824 of file p_polys.h.

825 {
826  if (p == NULL) return NULL;
827  p_LmCheckPolyRing1(p, r);
828  poly np;
829  omTypeAllocBin(poly, np, r->PolyBin);
830  p_SetRingOfLm(np, r);
831  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
832  pNext(np) = NULL;
833  pSetCoeff0(np, n_Copy(pGetCoeff(p), r->cf));
834  return np;
835 }
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define p_SetRingOfLm(p, r)
Definition: monomials.h:144
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int p
Definition: cfModGcd.cc:4019

◆ p_Homogen()

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

Definition at line 3217 of file p_polys.cc.

3218 {
3219  pFDegProc deg;
3220  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3221  deg=p_Totaldegree;
3222  else
3223  deg=r->pFDeg;
3224 
3225  poly q=NULL, qn;
3226  int o,ii;
3227  sBucket_pt bp;
3228 
3229  if (p!=NULL)
3230  {
3231  if ((varnum < 1) || (varnum > rVar(r)))
3232  {
3233  return NULL;
3234  }
3235  o=deg(p,r);
3236  q=pNext(p);
3237  while (q != NULL)
3238  {
3239  ii=deg(q,r);
3240  if (ii>o) o=ii;
3241  pIter(q);
3242  }
3243  q = p_Copy(p,r);
3244  bp = sBucketCreate(r);
3245  while (q != NULL)
3246  {
3247  ii = o-deg(q,r);
3248  if (ii!=0)
3249  {
3250  p_AddExp(q,varnum, (long)ii,r);
3251  p_Setm(q,r);
3252  }
3253  qn = pNext(q);
3254  pNext(q) = NULL;
3255  sBucket_Add_m(bp, q);
3256  q = qn;
3257  }
3258  sBucketDestroyAdd(bp, &q, &ii);
3259  }
3260  return q;
3261 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:68
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define pIter(p)
Definition: monomials.h:37
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96
#define NULL
Definition: omList.c:12
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:38
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:605
int p
Definition: cfModGcd.cc:4019
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition: sbuckets.cc:173

◆ p_IncrExp()

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

Definition at line 590 of file p_polys.h.

591 {
592  p_LmCheckPolyRing2(p, r);
593  int e = p_GetExp(p,v,r);
594  e++;
595  return p_SetExp(p,v,e,r);
596 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_Init() [1/2]

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

Definition at line 1255 of file p_polys.h.

1256 {
1257  p_CheckRing1(r);
1258  pAssume1(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
1259  poly p;
1260  omTypeAlloc0Bin(poly, p, bin);
1262  p_SetRingOfLm(p, r);
1263  return p;
1264 }
#define p_CheckRing1(r)
Definition: monomials.h:178
#define p_SetRingOfLm(p, r)
Definition: monomials.h:144
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition: p_polys.h:1227
#define omTypeAlloc0Bin(type, addr, bin)
Definition: omAllocDecl.h:204
#define NULL
Definition: omList.c:12
#define omSizeWOfBin(bin_ptr)
int p
Definition: cfModGcd.cc:4019
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_Init() [2/2]

static poly p_Init ( const ring  r)
inlinestatic

Definition at line 1265 of file p_polys.h.

1266 {
1267  return p_Init(r, r->PolyBin);
1268 }
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_InitContent()

number p_InitContent ( poly  ph,
const ring  r 
)

Definition at line 2581 of file p_polys.cc.

2584 {
2586  assume(ph!=NULL);
2587  assume(pNext(ph)!=NULL);
2588  assume(rField_is_Q(r));
2589  if (pNext(pNext(ph))==NULL)
2590  {
2591  return n_GetNumerator(pGetCoeff(pNext(ph)),r->cf);
2592  }
2593  poly p=ph;
2594  number n1=n_GetNumerator(pGetCoeff(p),r->cf);
2595  pIter(p);
2596  number n2=n_GetNumerator(pGetCoeff(p),r->cf);
2597  pIter(p);
2598  number d;
2599  number t;
2600  loop
2601  {
2602  nlNormalize(pGetCoeff(p),r->cf);
2603  t=n_GetNumerator(pGetCoeff(p),r->cf);
2604  if (nlGreaterZero(t,r->cf))
2605  d=nlAdd(n1,t,r->cf);
2606  else
2607  d=nlSub(n1,t,r->cf);
2608  nlDelete(&t,r->cf);
2609  nlDelete(&n1,r->cf);
2610  n1=d;
2611  pIter(p);
2612  if (p==NULL) break;
2613  nlNormalize(pGetCoeff(p),r->cf);
2614  t=n_GetNumerator(pGetCoeff(p),r->cf);
2615  if (nlGreaterZero(t,r->cf))
2616  d=nlAdd(n2,t,r->cf);
2617  else
2618  d=nlSub(n2,t,r->cf);
2619  nlDelete(&t,r->cf);
2620  nlDelete(&n2,r->cf);
2621  n2=d;
2622  pIter(p);
2623  if (p==NULL) break;
2624  }
2625  d=nlGcd(n1,n2,r->cf);
2626  nlDelete(&n1,r->cf);
2627  nlDelete(&n2,r->cf);
2628  return d;
2629 }
2630 #else
2631 {
2632  /* ph has al least 2 terms */
2633  number d=pGetCoeff(ph);
2634  int s=n_Size(d,r->cf);
2635  pIter(ph);
2636  number d2=pGetCoeff(ph);
2637  int s2=n_Size(d2,r->cf);
2638  pIter(ph);
2639  if (ph==NULL)
2640  {
2641  if (s<s2) return n_Copy(d,r->cf);
2642  else return n_Copy(d2,r->cf);
2643  }
2644  do
2645  {
2646  number nd=pGetCoeff(ph);
2647  int ns=n_Size(nd,r->cf);
2648  if (ns<=2)
2649  {
2650  s2=s;
2651  d2=d;
2652  d=nd;
2653  s=ns;
2654  break;
2655  }
2656  else if (ns<s)
2657  {
2658  s2=s;
2659  d2=d;
2660  d=nd;
2661  s=ns;
2662  }
2663  pIter(ph);
2664  }
2665  while(ph!=NULL);
2666  return n_SubringGcd(d,d2,r->cf);
2667 }
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
LINLINE number nlSub(number la, number li, const coeffs r)
Definition: longrat.cc:2598
const CanonicalForm int s
Definition: facAbsFact.cc:55
BOOLEAN nlGreaterZero(number za, const coeffs r)
Definition: longrat.cc:1165
#define TEST_OPT_CONTENTSB
Definition: options.h:125
LINLINE number nlAdd(number la, number li, const coeffs r)
Definition: longrat.cc:2532
number nlGcd(number a, number b, const coeffs r)
Definition: longrat.cc:1202
#define loop
Definition: structs.h:80
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
void nlNormalize(number &x, const coeffs r)
Definition: longrat.cc:1344
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
LINLINE void nlDelete(number *a, const coeffs r)
Definition: longrat.cc:2497
#define pNext(p)
Definition: monomials.h:36
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
int p
Definition: cfModGcd.cc:4019
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

◆ p_IsConstant()

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

Definition at line 1927 of file p_polys.h.

1928 {
1929  if (p == NULL) return TRUE;
1930  p_Test(p, r);
1931  return (pNext(p)==NULL) && p_LmIsConstant(p, r);
1932 }
#define TRUE
Definition: auxiliary.h:98
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:978
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_IsConstantComp()

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

like the respective p_LmIs* routines, except that p might be empty

Definition at line 1921 of file p_polys.h.

1922 {
1923  if (p == NULL) return TRUE;
1924  return (pNext(p)==NULL) && p_LmIsConstantComp(p, r);
1925 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:961
#define TRUE
Definition: auxiliary.h:98
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_IsConstantPoly()

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

Definition at line 1941 of file p_polys.h.

1942 {
1943  p_Test(p, r);
1944  poly pp=p;
1945  while(pp!=NULL)
1946  {
1947  if (! p_LmIsConstantComp(pp, r))
1948  return FALSE;
1949  pIter(pp);
1950  }
1951  return TRUE;
1952 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:961
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:37
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_ISet()

poly p_ISet ( long  i,
const ring  r 
)

returns the poly representing the integer i

Definition at line 1287 of file p_polys.cc.

1288 {
1289  poly rc = NULL;
1290  if (i!=0)
1291  {
1292  rc = p_Init(r);
1293  pSetCoeff0(rc,n_Init(i,r->cf));
1294  if (n_IsZero(pGetCoeff(rc),r->cf))
1295  p_LmDelete(&rc,r);
1296  }
1297  return rc;
1298 }
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
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_IsHomogeneous()

BOOLEAN p_IsHomogeneous ( poly  p,
const ring  r 
)

Definition at line 3266 of file p_polys.cc.

3267 {
3268  poly qp=p;
3269  int o;
3270 
3271  if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
3272  pFDegProc d;
3273  if (r->pLexOrder && (r->order[0]==ringorder_lp))
3274  d=p_Totaldegree;
3275  else
3276  d=r->pFDeg;
3277  o = d(p,r);
3278  do
3279  {
3280  if (d(qp,r) != o) return FALSE;
3281  pIter(qp);
3282  }
3283  while (qp != NULL);
3284  return TRUE;
3285 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
#define pIter(p)
Definition: monomials.h:37
#define NULL
Definition: omList.c:12
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:38
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_IsOne()

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

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

Definition at line 1935 of file p_polys.h.

1936 {
1937  p_Test(p, R);
1938  return (p_IsConstant(p, R) && n_IsOne(p_GetCoeff(p, R), R->cf));
1939 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1927
#define p_Test(p, r)
Definition: p_polys.h:162
#define R
Definition: sirandom.c:26
#define p_GetCoeff(p, r)
Definition: monomials.h:50
int p
Definition: cfModGcd.cc:4019

◆ p_IsPurePower()

int p_IsPurePower ( const poly  p,
const ring  r 
)

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

Definition at line 1216 of file p_polys.cc.

1217 {
1218  int i,k=0;
1219 
1220  for (i=r->N;i;i--)
1221  {
1222  if (p_GetExp(p,i, r)!=0)
1223  {
1224  if(k!=0) return 0;
1225  k=i;
1226  }
1227  }
1228  return k;
1229 }
int k
Definition: cfEzgcd.cc:92
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019

◆ p_IsUnit()

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

Definition at line 1954 of file p_polys.h.

1955 {
1956  if (p == NULL) return FALSE;
1957  if (rField_is_Ring(r))
1958  return (p_LmIsConstant(p, r) && n_IsUnit(pGetCoeff(p),r->cf));
1959  return p_LmIsConstant(p, r);
1960 }
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
#define FALSE
Definition: auxiliary.h:94
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:978
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_IsUnivariate()

int p_IsUnivariate ( poly  p,
const ring  r 
)

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

Definition at line 1237 of file p_polys.cc.

1238 {
1239  int i,k=-1;
1240 
1241  while (p!=NULL)
1242  {
1243  for (i=r->N;i;i--)
1244  {
1245  if (p_GetExp(p,i, r)!=0)
1246  {
1247  if((k!=-1)&&(k!=i)) return 0;
1248  k=i;
1249  }
1250  }
1251  pIter(p);
1252  }
1253  return k;
1254 }
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Jet()

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

Definition at line 4292 of file p_polys.cc.

4293 {
4294  while((p!=NULL) && (p_Totaldegree(p,R)>m)) p_LmDelete(&p,R);
4295  if (p==NULL) return NULL;
4296  poly r=p;
4297  while (pNext(p)!=NULL)
4298  {
4299  if (p_Totaldegree(pNext(p),R)>m)
4300  {
4301  p_LmDelete(&pNext(p),R);
4302  }
4303  else
4304  pIter(p);
4305  }
4306  return r;
4307 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
#define pIter(p)
Definition: monomials.h:37
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019

◆ p_JetW()

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

Definition at line 4336 of file p_polys.cc.

4337 {
4338  while((p!=NULL) && (totaldegreeWecart_IV(p,R,w)>m)) p_LmDelete(&p,R);
4339  if (p==NULL) return NULL;
4340  poly r=p;
4341  while (pNext(p)!=NULL)
4342  {
4343  if (totaldegreeWecart_IV(pNext(p),R,w)>m)
4344  {
4345  p_LmDelete(&pNext(p),R);
4346  }
4347  else
4348  pIter(p);
4349  }
4350  return r;
4351 }
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:231
#define pIter(p)
Definition: monomials.h:37
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019

◆ p_Last()

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

Definition at line 4527 of file p_polys.cc.

4528 {
4529  if (p == NULL)
4530  {
4531  l = 0;
4532  return NULL;
4533  }
4534  l = 1;
4535  poly a = p;
4536  if (! rIsSyzIndexRing(r))
4537  {
4538  poly next = pNext(a);
4539  while (next!=NULL)
4540  {
4541  a = next;
4542  next = pNext(a);
4543  l++;
4544  }
4545  }
4546  else
4547  {
4548  int curr_limit = rGetCurrSyzLimit(r);
4549  poly pp = a;
4550  while ((a=pNext(a))!=NULL)
4551  {
4552  if (__p_GetComp(a,r)<=curr_limit/*syzComp*/)
4553  l++;
4554  else break;
4555  pp = a;
4556  }
4557  a=pp;
4558  }
4559  return a;
4560 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93
ListNode * next
Definition: janet.h:31

◆ p_Lcm() [1/2]

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

Definition at line 1630 of file p_polys.cc.

1631 {
1632  for (int i=r->N; i; --i)
1633  p_SetExp(m,i, si_max( p_GetExp(a,i,r), p_GetExp(b,i,r)),r);
1634 
1635  p_SetComp(m, si_max(p_GetComp(a,r), p_GetComp(b,r)),r);
1636  /* Don't do a pSetm here, otherwise hres/lres chockes */
1637 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_GetComp(p, r)
Definition: monomials.h:64
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int m
Definition: cfEzgcd.cc:121
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487

◆ p_Lcm() [2/2]

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

Definition at line 1639 of file p_polys.cc.

1640 {
1641  poly m=p_Init(r);
1642  p_Lcm(a, b, m, r);
1643  p_Setm(m,r);
1644  return(m);
1645 }
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1630
CanonicalForm b
Definition: cfModGcd.cc:4044
int m
Definition: cfEzgcd.cc:121
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_LcmRat()

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

Definition at line 1652 of file p_polys.cc.

1653 {
1654  poly m = // p_One( r);
1655  p_Init(r);
1656 
1657 // const int (currRing->N) = r->N;
1658 
1659  // for (int i = (currRing->N); i>=r->real_var_start; i--)
1660  for (int i = r->real_var_end; i>=r->real_var_start; i--)
1661  {
1662  const int lExpA = p_GetExp (a, i, r);
1663  const int lExpB = p_GetExp (b, i, r);
1664 
1665  p_SetExp (m, i, si_max(lExpA, lExpB), r);
1666  }
1667 
1668  p_SetComp (m, lCompM, r);
1669  p_Setm(m,r);
1670  n_New(&(p_GetCoeff(m, r)), r);
1671 
1672  return(m);
1673 };
#define n_New(n, r)
Definition: coeffs.h:440
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int m
Definition: cfEzgcd.cc:121
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_LDeg()

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

Definition at line 380 of file p_polys.h.

380 { return r->pLDeg(p,l,r); }
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ p_LmCheckIsFromRing()

BOOLEAN p_LmCheckIsFromRing ( poly  p,
ring  r 
)

Definition at line 69 of file pDebug.cc.

70 {
71  if (p != NULL)
72  {
73  #if (OM_TRACK > 0) && defined(OM_TRACK_CUSTOM)
74  void* custom = omGetCustomOfAddr(p);
75  if (custom != NULL)
76  {
77  pPolyAssumeReturnMsg(custom == r ||
78  // be more sloppy for qrings
79  (r->qideal != NULL &&
80  omIsBinPageAddr(p) &&
81  omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin)) ||
82  rSamePolyRep((ring) custom, r),
83  "monomial not from specified ring",p,r);
84  return TRUE;
85  }
86  else
87  #endif
88  #ifndef X_OMALLOC
89  {
92  return TRUE;
93  }
94  return FALSE;
95  #endif
96  }
97  return TRUE;
98 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define _pPolyAssumeReturn(cond, p, r)
Definition: monomials.h:101
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:1708
#define NULL
Definition: omList.c:12
#define omSizeWOfAddr(P)
Definition: xalloc.h:258
#define omIsBinPageAddr(addr)
Definition: omBinPage.h:68
#define omSizeWOfBin(bin_ptr)
#define pPolyAssumeReturnMsg(cond, msg)
Definition: monomials.h:137
int p
Definition: cfModGcd.cc:4019

◆ p_LmCheckPolyRing()

BOOLEAN p_LmCheckPolyRing ( poly  p,
ring  r 
)

Definition at line 118 of file pDebug.cc.

119 {
120  #ifndef X_OMALLOC
121  pAssumeReturn(r != NULL && r->PolyBin != NULL);
122  #endif
123  pAssumeReturn(p != NULL);
124  return p_LmCheckIsFromRing(p, r);
125 }
#define pAssumeReturn(cond)
Definition: monomials.h:78
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:69
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_LmCmp()

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

Definition at line 1496 of file p_polys.h.

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

◆ p_LmDelete() [1/2]

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

Definition at line 710 of file p_polys.h.

711 {
712  p_LmCheckPolyRing2(p, r);
713  n_Delete(&pGetCoeff(p), r->cf);
714  omFreeBinAddr(p);
715 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019

◆ p_LmDelete() [2/2]

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

Definition at line 716 of file p_polys.h.

717 {
718  p_LmCheckPolyRing2(*p, r);
719  poly h = *p;
720  *p = pNext(h);
721  n_Delete(&pGetCoeff(h), r->cf);
722  omFreeBinAddr(h);
723 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:36
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ p_LmDeleteAndNext()

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

Definition at line 724 of file p_polys.h.

725 {
726  p_LmCheckPolyRing2(p, r);
727  poly pnext = pNext(p);
728  n_Delete(&pGetCoeff(p), r->cf);
729  omFreeBinAddr(p);
730  return pnext;
731 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:36
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019

◆ p_LmDeleteAndNextRat()

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

Definition at line 1675 of file p_polys.cc.

1676 {
1677  /* modifies p*/
1678  // Print("start: "); Print(" "); p_wrp(*p,r);
1679  p_LmCheckPolyRing2(*p, r);
1680  poly q = p_Head(*p,r);
1681  const long cmp = p_GetComp(*p, r);
1682  while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) ) && (p_GetComp(*p, r) == cmp) )
1683  {
1684  p_LmDelete(p,r);
1685  // Print("while: ");p_wrp(*p,r);Print(" ");
1686  }
1687  // p_wrp(*p,r);Print(" ");
1688  // PrintS("end\n");
1689  p_LmDelete(&q,r);
1690 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define p_GetComp(p, r)
Definition: monomials.h:64
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition: p_polys.h:639
#define NULL
Definition: omList.c:12
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019

◆ p_LmDivisibleBy() [1/2]

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

Definition at line 1819 of file p_polys.h.

1820 {
1821  p_LmCheckPolyRing1(b, r);
1822  pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
1823  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1824  return _p_LmDivisibleByNoComp(a, b, r);
1825  return FALSE;
1826 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pIfThen1(cond, check)
Definition: monomials.h:179
#define NULL
Definition: omList.c:12

◆ p_LmDivisibleBy() [2/2]

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

Definition at line 1846 of file p_polys.h.

1847 {
1848  p_LmCheckPolyRing(a, r_a);
1849  p_LmCheckPolyRing(b, r_b);
1850  return _p_LmDivisibleBy(a, r_a, b, r_b);
1851 }
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1793
CanonicalForm b
Definition: cfModGcd.cc:4044
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118

◆ p_LmDivisibleByNoComp() [1/2]

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

Definition at line 1805 of file p_polys.h.

1806 {
1807  p_LmCheckPolyRing1(a, r);
1808  p_LmCheckPolyRing1(b, r);
1809  return _p_LmDivisibleByNoComp(a, b, r);
1810 }
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177

◆ p_LmDivisibleByNoComp() [2/2]

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

Definition at line 1812 of file p_polys.h.

1813 {
1814  p_LmCheckPolyRing1(a, ra);
1815  p_LmCheckPolyRing1(b, rb);
1816  return _p_LmDivisibleByNoComp(a, ra, b, rb);
1817 }
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177

◆ p_LmDivisibleByPart()

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

Definition at line 1784 of file p_polys.h.

1785 {
1786  p_LmCheckPolyRing1(b, r);
1787  pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
1788  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
1789  return _p_LmDivisibleByNoCompPart(a, r, b, r,start, end);
1790  return FALSE;
1791 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pIfThen1(cond, check)
Definition: monomials.h:179
#define NULL
Definition: omList.c:12
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:1759

◆ p_LmExpVectorAddIsOk()

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

Definition at line 1962 of file p_polys.h.

1964 {
1965  p_LmCheckPolyRing(p1, r);
1966  p_LmCheckPolyRing(p2, r);
1967  unsigned long l1, l2, divmask = r->divmask;
1968  int i;
1969 
1970  for (i=0; i<r->VarL_Size; i++)
1971  {
1972  l1 = p1->exp[r->VarL_Offset[i]];
1973  l2 = p2->exp[r->VarL_Offset[i]];
1974  // do the divisiblity trick
1975  if ( (l1 > ULONG_MAX - l2) ||
1976  (((l1 & divmask) ^ (l2 & divmask)) != ((l1 + l2) & divmask)))
1977  return FALSE;
1978  }
1979  return TRUE;
1980 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int i
Definition: cfEzgcd.cc:125
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118

◆ p_LmFree() [1/2]

static void p_LmFree ( poly  p,
ring   
)
inlinestatic

Definition at line 682 of file p_polys.h.

684 {
685  p_LmCheckPolyRing2(p, r);
686  omFreeBinAddr(p);
687 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
int p
Definition: cfModGcd.cc:4019

◆ p_LmFree() [2/2]

static void p_LmFree ( poly *  p,
ring   
)
inlinestatic

Definition at line 691 of file p_polys.h.

693 {
694  p_LmCheckPolyRing2(*p, r);
695  poly h = *p;
696  *p = pNext(h);
697  omFreeBinAddr(h);
698 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ p_LmFreeAndNext()

static poly p_LmFreeAndNext ( poly  p,
ring   
)
inlinestatic

Definition at line 702 of file p_polys.h.

704 {
705  p_LmCheckPolyRing2(p, r);
706  poly pnext = pNext(p);
707  omFreeBinAddr(p);
708  return pnext;
709 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_LmInit() [1/3]

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

Definition at line 1270 of file p_polys.h.

1271 {
1272  p_LmCheckPolyRing1(p, r);
1273  poly np;
1274  omTypeAllocBin(poly, np, r->PolyBin);
1275  p_SetRingOfLm(np, r);
1276  memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
1277  pNext(np) = NULL;
1278  pSetCoeff0(np, NULL);
1279  return np;
1280 }
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
#define p_SetRingOfLm(p, r)
Definition: monomials.h:144
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int p
Definition: cfModGcd.cc:4019

◆ p_LmInit() [2/3]

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

Definition at line 1281 of file p_polys.h.

1282 {
1283  p_LmCheckPolyRing1(s_p, s_r);
1284  p_CheckRing(d_r);
1285  pAssume1(d_r->N <= s_r->N);
1286  poly d_p = p_Init(d_r, d_bin);
1287  for (unsigned i=d_r->N; i!=0; i--)
1288  {
1289  p_SetExp(d_p, i, p_GetExp(s_p, i,s_r), d_r);
1290  }
1291  if (rRing_has_Comp(d_r))
1292  {
1293  p_SetComp(d_p, p_GetComp(s_p,s_r), d_r);
1294  }
1295  p_Setm(d_p, d_r);
1296  return d_p;
1297 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_GetComp(p, r)
Definition: monomials.h:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define rRing_has_Comp(r)
Definition: monomials.h:266
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:126
#define pAssume1(cond)
Definition: monomials.h:171
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_LmInit() [3/3]

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

Definition at line 1298 of file p_polys.h.

1299 {
1300  pAssume1(d_r != NULL);
1301  return p_LmInit(s_p, s_r, d_r, d_r->PolyBin);
1302 }
#define NULL
Definition: omList.c:12
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1270
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_LmIsConstant()

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

Definition at line 978 of file p_polys.h.

979 {
980  if (p_LmIsConstantComp(p, r))
981  return (p_GetComp(p, r) == 0);
982  return FALSE;
983 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:961
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
int p
Definition: cfModGcd.cc:4019

◆ p_LmIsConstantComp()

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

Definition at line 961 of file p_polys.h.

962 {
963  //p_LmCheckPolyRing(p, r);
964  int i = r->VarL_Size - 1;
965 
966  do
967  {
968  if (p->exp[r->VarL_Offset[i]] != 0)
969  return FALSE;
970  i--;
971  }
972  while (i >= 0);
973  return TRUE;
974 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019

◆ p_LmShallowCopyDelete()

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

Definition at line 1328 of file p_polys.h.

1329 {
1330  p_LmCheckPolyRing1(p, r);
1331  pAssume1(omSizeWOfBin(bin) == omSizeWOfBin(r->PolyBin));
1332  poly new_p = p_New(r);
1333  memcpy(new_p->exp, p->exp, r->ExpL_Size*sizeof(long));
1334  pSetCoeff0(new_p, pGetCoeff(p));
1335  pNext(new_p) = pNext(p);
1336  omFreeBinAddr(p);
1337  return new_p;
1338 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define omSizeWOfBin(bin_ptr)
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int p
Definition: cfModGcd.cc:4019
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:663
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_LmShortDivisibleBy() [1/2]

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

Definition at line 1853 of file p_polys.h.

1855 {
1856  p_LmCheckPolyRing1(a, r);
1857  p_LmCheckPolyRing1(b, r);
1858 #ifndef PDIV_DEBUG
1859  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
1860  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
1861 
1862  if (sev_a & not_sev_b)
1863  {
1865  return FALSE;
1866  }
1867  return p_LmDivisibleBy(a, b, r);
1868 #else
1869  return pDebugLmShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);
1870 #endif
1871 }
#define FALSE
Definition: auxiliary.h:94
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4687
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1805
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:195
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1819
#define pAssume1(cond)
Definition: monomials.h:171
BOOLEAN pDebugLmShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:364

◆ p_LmShortDivisibleBy() [2/2]

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

Definition at line 1893 of file p_polys.h.

1895 {
1896  p_LmCheckPolyRing1(a, r_a);
1897  p_LmCheckPolyRing1(b, r_b);
1898 #ifndef PDIV_DEBUG
1899  _pPolyAssume2(p_GetShortExpVector(a, r_a) == sev_a, a, r_a);
1900  _pPolyAssume2(p_GetShortExpVector(b, r_b) == ~ not_sev_b, b, r_b);
1901 
1902  if (sev_a & not_sev_b)
1903  {
1904  pAssume1(_p_LmDivisibleByNoComp(a, r_a, b, r_b) == FALSE);
1905  return FALSE;
1906  }
1907  return _p_LmDivisibleBy(a, r_a, b, r_b);
1908 #else
1909  return pDebugLmShortDivisibleBy(a, sev_a, r_a, b, not_sev_b, r_b);
1910 #endif
1911 }
#define FALSE
Definition: auxiliary.h:94
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4687
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:195
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1793
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:1689
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pAssume1(cond)
Definition: monomials.h:171
BOOLEAN pDebugLmShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:364

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

1875 {
1876  p_LmCheckPolyRing1(a, r);
1877  p_LmCheckPolyRing1(b, r);
1878 #ifndef PDIV_DEBUG
1879  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
1880  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
1881 
1882  if (sev_a & not_sev_b)
1883  {
1885  return FALSE;
1886  }
1887  return p_LmDivisibleByNoComp(a, b, r);
1888 #else
1889  return pDebugLmShortDivisibleByNoComp(a, sev_a, r, b, not_sev_b, r);
1890 #endif
1891 }
BOOLEAN pDebugLmShortDivisibleByNoComp(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
Definition: pDebug.cc:387
#define FALSE
Definition: auxiliary.h:94
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition: p_polys.cc:4687
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1805
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:195
CanonicalForm b
Definition: cfModGcd.cc:4044
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pAssume1(cond)
Definition: monomials.h:171

◆ p_LowVar()

int p_LowVar ( poly  p,
const ring  r 
)

the minimal index of used variables - 1

Definition at line 4586 of file p_polys.cc.

4587 {
4588  int k,l,lex;
4589 
4590  if (p == NULL) return -1;
4591 
4592  k = 32000;/*a very large dummy value*/
4593  while (p != NULL)
4594  {
4595  l = 1;
4596  lex = p_GetExp(p,l,r);
4597  while ((l < (rVar(r))) && (lex == 0))
4598  {
4599  l++;
4600  lex = p_GetExp(p,l,r);
4601  }
4602  l--;
4603  if (l < k) k = l;
4604  pIter(p);
4605  }
4606  return k;
4607 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ p_LtCmp()

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

Definition at line 1537 of file p_polys.h.

1538 {
1539  int res = p_LmCmp(p,q,r);
1540  if(res == 0)
1541  {
1542  if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
1543  return res;
1544  number pc = n_Copy(p_GetCoeff(p,r),r->cf);
1545  number qc = n_Copy(p_GetCoeff(q,r),r->cf);
1546  if(!n_GreaterZero(pc,r->cf))
1547  pc = n_InpNeg(pc,r->cf);
1548  if(!n_GreaterZero(qc,r->cf))
1549  qc = n_InpNeg(qc,r->cf);
1550  if(n_Greater(pc,qc,r->cf))
1551  res = 1;
1552  else if(n_Greater(qc,pc,r->cf))
1553  res = -1;
1554  else if(n_Equal(pc,qc,r->cf))
1555  res = 0;
1556  n_Delete(&pc,r->cf);
1557  n_Delete(&qc,r->cf);
1558  }
1559  return res;
1560 }
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff &#39;a&#39; is larger than &#39;b&#39;; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:511
CanonicalForm res
Definition: facAbsFact.cc:64
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
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
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019

◆ p_LtCmpNoAbs()

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

Definition at line 1563 of file p_polys.h.

1564 {
1565  int res = p_LmCmp(p,q,r);
1566  if(res == 0)
1567  {
1568  if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
1569  return res;
1570  number pc = p_GetCoeff(p,r);
1571  number qc = p_GetCoeff(q,r);
1572  if(n_Greater(pc,qc,r->cf))
1573  res = 1;
1574  if(n_Greater(qc,pc,r->cf))
1575  res = -1;
1576  if(n_Equal(pc,qc,r->cf))
1577  res = 0;
1578  }
1579  return res;
1580 }
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff &#39;a&#39; is larger than &#39;b&#39;; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:511
CanonicalForm res
Definition: facAbsFact.cc:64
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
#define NULL
Definition: omList.c:12
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff &#39;a&#39; and &#39;b&#39; represent the same number; they may have different representations.
Definition: coeffs.h:460
#define p_GetCoeff(p, r)
Definition: monomials.h:50
int p
Definition: cfModGcd.cc:4019

◆ p_LtCmpOrdSgnDiffM()

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

Definition at line 1585 of file p_polys.h.

1586 {
1587  if(r->OrdSgn == 1)
1588  {
1589  return(p_LtCmp(p,q,r) == 1);
1590  }
1591  else
1592  {
1593  return(p_LmCmp(p,q,r) == -1);
1594  }
1595 }
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1537
int p
Definition: cfModGcd.cc:4019

◆ p_LtCmpOrdSgnDiffP()

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

Definition at line 1601 of file p_polys.h.

1602 {
1603  if(r->OrdSgn == 1)
1604  {
1605  return(p_LmCmp(p,q,r) == -1);
1606  }
1607  else
1608  {
1609  return(p_LtCmp(p,q,r) != -1);
1610  }
1611 
1612 }
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1496
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1537
int p
Definition: cfModGcd.cc:4019

◆ p_LtCmpOrdSgnEqM()

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

Definition at line 1618 of file p_polys.h.

1619 {
1620  return(p_LtCmp(p,q,r) == -r->OrdSgn);
1621 }
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1537
int p
Definition: cfModGcd.cc:4019

◆ p_LtCmpOrdSgnEqP()

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

Definition at line 1627 of file p_polys.h.

1628 {
1629  return(p_LtCmp(p,q,r) == r->OrdSgn);
1630 }
static int p_LtCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1537
int p
Definition: cfModGcd.cc:4019

◆ p_MaxComp() [1/2]

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

Definition at line 291 of file p_polys.h.

292 {
293  long result,i;
294 
295  if(p==NULL) return 0;
296  result = p_GetComp(p, lmRing);
297  if (result != 0)
298  {
299  loop
300  {
301  pIter(p);
302  if(p==NULL) break;
303  i = p_GetComp(p, tailRing);
304  if (i>result) result = i;
305  }
306  }
307  return result;
308 }
#define p_GetComp(p, r)
Definition: monomials.h:64
#define loop
Definition: structs.h:80
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_MaxComp() [2/2]

static long p_MaxComp ( poly  p,
ring  lmRing 
)
inlinestatic

Definition at line 310 of file p_polys.h.

310 {return p_MaxComp(p,lmRing,lmRing);}
int p
Definition: cfModGcd.cc:4019
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291

◆ p_MDivide()

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

Definition at line 1474 of file p_polys.cc.

1475 {
1476  assume((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(b,r)==0));
1477  int i;
1478  poly result = p_Init(r);
1479 
1480  for(i=(int)r->N; i; i--)
1481  p_SetExp(result,i, p_GetExp(a,i,r)- p_GetExp(b,i,r),r);
1482  p_SetComp(result, p_GetComp(a,r) - p_GetComp(b,r),r);
1483  p_Setm(result,r);
1484  return result;
1485 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_GetComp(p, r)
Definition: monomials.h:64
CanonicalForm b
Definition: cfModGcd.cc:4044
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255
return result
Definition: facAbsBiFact.cc:76

◆ p_MemAdd_NegWeightAdjust()

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

Definition at line 1227 of file p_polys.h.

1228 {
1229  if (r->NegWeightL_Offset != NULL)
1230  {
1231  for (int i=r->NegWeightL_Size-1; i>=0; i--)
1232  {
1233  p->exp[r->NegWeightL_Offset[i]] -= POLY_NEGWEIGHT_OFFSET;
1234  }
1235  }
1236 }
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:236
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_MemSub_NegWeightAdjust()

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

Definition at line 1237 of file p_polys.h.

1238 {
1239  if (r->NegWeightL_Offset != NULL)
1240  {
1241  for (int i=r->NegWeightL_Size-1; i>=0; i--)
1242  {
1243  p->exp[r->NegWeightL_Offset[i]] += POLY_NEGWEIGHT_OFFSET;
1244  }
1245  }
1246 }
#define POLY_NEGWEIGHT_OFFSET
Definition: monomials.h:236
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Merge_q()

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

Definition at line 1147 of file p_polys.h.

1148 {
1149  assume( (p != q) || (p == NULL && q == NULL) );
1150  return r->p_Procs->p_Merge_q(p, q, r);
1151 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_MinComp() [1/2]

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

Definition at line 312 of file p_polys.h.

313 {
314  long result,i;
315 
316  if(p==NULL) return 0;
317  result = p_GetComp(p,lmRing);
318  if (result != 0)
319  {
320  loop
321  {
322  pIter(p);
323  if(p==NULL) break;
324  i = p_GetComp(p,tailRing);
325  if (i<result) result = i;
326  }
327  }
328  return result;
329 }
#define p_GetComp(p, r)
Definition: monomials.h:64
#define loop
Definition: structs.h:80
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_MinComp() [2/2]

static long p_MinComp ( poly  p,
ring  lmRing 
)
inlinestatic

Definition at line 331 of file p_polys.h.

331 {return p_MinComp(p,lmRing,lmRing);}
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:312
int p
Definition: cfModGcd.cc:4019

◆ p_MinDeg()

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

Definition at line 4354 of file p_polys.cc.

4355 {
4356  if(p==NULL)
4357  return -1;
4358  int d=-1;
4359  while(p!=NULL)
4360  {
4361  int d0=0;
4362  for(int j=0;j<rVar(R);j++)
4363  if(w==NULL||j>=w->length())
4364  d0+=p_GetExp(p,j+1,R);
4365  else
4366  d0+=(*w)[j]*p_GetExp(p,j+1,R);
4367  if(d0<d||d==-1)
4368  d=d0;
4369  pIter(p);
4370  }
4371  return d;
4372 }
int j
Definition: facHensel.cc:105
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
#define pIter(p)
Definition: monomials.h:37
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define NULL
Definition: omList.c:12
int length() const
Definition: intvec.h:94
#define R
Definition: sirandom.c:26
int p
Definition: cfModGcd.cc:4019

◆ p_mInit()

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

Definition at line 1432 of file p_polys.cc.

1433 {
1434  poly p;
1435  const char *s=p_Read(st,p,r);
1436  if (*s!='\0')
1437  {
1438  if ((s!=st)&&isdigit(st[0]))
1439  {
1441  }
1442  ok=FALSE;
1443  p_Delete(&p,r);
1444  return NULL;
1445  }
1446  p_Test(p,r);
1447  ok=!errorreported;
1448  return p;
1449 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1360
#define p_Test(p, r)
Definition: p_polys.h:162
short errorreported
Definition: feFopen.cc:23
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Minus_mm_Mult_qq() [1/2]

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

Definition at line 1005 of file p_polys.h.

1007 {
1008  int shorter;
1009  const poly res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, spNoether, r);
1010  lp += lq - shorter;
1011 // assume( lp == pLength(res) );
1012  return res;
1013 }
CanonicalForm res
Definition: facAbsFact.cc:64
int m
Definition: cfEzgcd.cc:121
Definition: lq.h:39
int p
Definition: cfModGcd.cc:4019

◆ p_Minus_mm_Mult_qq() [2/2]

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

Definition at line 1016 of file p_polys.h.

1017 {
1018  int shorter;
1019 
1020  return r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
1021 }
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Mult_mm()

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

Definition at line 996 of file p_polys.h.

997 {
998  if (p==NULL) return NULL;
999  if (p_LmIsConstant(m, r))
1000  return __p_Mult_nn(p, pGetCoeff(m), r);
1001  else
1002  return r->p_Procs->p_Mult_mm(p, m, r);
1003 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:978
int m
Definition: cfEzgcd.cc:121
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:926
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Mult_nn() [1/2]

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

Definition at line 913 of file p_polys.h.

914 {
915  if (p==NULL) return NULL;
916  if (n_IsOne(n, r->cf))
917  return p;
918  else if (n_IsZero(n, r->cf))
919  {
920  p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
921  return NULL;
922  }
923  else
924  return r->p_Procs->p_Mult_nn(p, n, r);
925 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_Mult_nn() [2/2]

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

Definition at line 928 of file p_polys.h.

930 {
931  assume(p!=NULL);
932 #ifndef PDEBUG
933  if (lmRing == tailRing)
934  return p_Mult_nn(p, n, tailRing);
935 #endif
936  poly pnext = pNext(p);
937  pNext(p) = NULL;
938  p = lmRing->p_Procs->p_Mult_nn(p, n, lmRing);
939  if (pnext!=NULL)
940  {
941  pNext(p) = tailRing->p_Procs->p_Mult_nn(pnext, n, tailRing);
942  }
943  return p;
944 }
#define assume(x)
Definition: mod2.h:390
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:913
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_Mult_q()

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

Definition at line 1049 of file p_polys.h.

1050 {
1051  assume( (p != q) || (p == NULL && q == NULL) );
1052 
1053  if (p == NULL)
1054  {
1055  p_Delete(&q, r);
1056  return NULL;
1057  }
1058  if (q == NULL)
1059  {
1060  p_Delete(&p, r);
1061  return NULL;
1062  }
1063 
1064  if (pNext(p) == NULL)
1065  {
1066  q = r->p_Procs->p_mm_Mult(q, p, r);
1067  p_LmDelete(&p, r);
1068  return q;
1069  }
1070 
1071  if (pNext(q) == NULL)
1072  {
1073  p = r->p_Procs->p_Mult_mm(p, q, r);
1074  p_LmDelete(&q, r);
1075  return p;
1076  }
1077 #ifdef HAVE_PLURAL
1078  if (rIsNCRing(r))
1079  return _nc_p_Mult_q(p, q, r);
1080  else
1081 #endif
1082  return _p_Mult_q(p, q, 0, r);
1083 }
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
#define assume(x)
Definition: mod2.h:390
poly _nc_p_Mult_q(poly p, poly q, const ring r)
general NC-multiplication with destruction
Definition: old.gring.cc:215
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
static BOOLEAN rIsNCRing(const ring r)
Definition: ring.h:418

◆ p_MultExp()

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

Definition at line 620 of file p_polys.h.

621 {
622  p_LmCheckPolyRing2(p, r);
623  long e = p_GetExp(p,v,r);
624  e *= ee;
625  return p_SetExp(p,v,e,r);
626 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_Neg()

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

Definition at line 1042 of file p_polys.h.

1043 {
1044  return r->p_Procs->p_Neg(p, r);
1045 }
int p
Definition: cfModGcd.cc:4019

◆ p_New() [1/2]

static poly p_New ( const ring  ,
omBin  bin 
)
inlinestatic

Definition at line 663 of file p_polys.h.

665 {
666  p_CheckRing2(r);
667  pAssume2(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
668  poly p;
669  omTypeAllocBin(poly, p, bin);
670  p_SetRingOfLm(p, r);
671  return p;
672 }
#define p_CheckRing2(r)
Definition: monomials.h:200
#define omTypeAllocBin(type, addr, bin)
Definition: omAllocDecl.h:203
#define pAssume2(cond)
Definition: monomials.h:193
#define p_SetRingOfLm(p, r)
Definition: monomials.h:144
#define NULL
Definition: omList.c:12
#define omSizeWOfBin(bin_ptr)
int p
Definition: cfModGcd.cc:4019

◆ p_New() [2/2]

static poly p_New ( ring  r)
inlinestatic

Definition at line 674 of file p_polys.h.

675 {
676  return p_New(r, r->PolyBin);
677 }
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:663

◆ p_Norm()

void p_Norm ( poly  p1,
const ring  r 
)

Definition at line 3679 of file p_polys.cc.

3680 {
3681  if (rField_is_Ring(r))
3682  {
3683  if (!n_IsUnit(pGetCoeff(p1), r->cf)) return;
3684  // Werror("p_Norm not possible in the case of coefficient rings.");
3685  }
3686  else if (p1!=NULL)
3687  {
3688  if (pNext(p1)==NULL)
3689  {
3690  p_SetCoeff(p1,n_Init(1,r->cf),r);
3691  return;
3692  }
3693  poly h;
3694  if (!n_IsOne(pGetCoeff(p1),r->cf))
3695  {
3696  number k, c;
3697  n_Normalize(pGetCoeff(p1),r->cf);
3698  k = pGetCoeff(p1);
3699  c = n_Init(1,r->cf);
3700  pSetCoeff0(p1,c);
3701  h = pNext(p1);
3702  while (h!=NULL)
3703  {
3704  c=n_Div(pGetCoeff(h),k,r->cf);
3705  // no need to normalize: Z/p, R
3706  // normalize already in nDiv: Q_a, Z/p_a
3707  // remains: Q
3708  if (rField_is_Q(r) && (!n_IsOne(c,r->cf))) n_Normalize(c,r->cf);
3709  p_SetCoeff(h,c,r);
3710  pIter(h);
3711  }
3712  n_Delete(&k,r->cf);
3713  }
3714  else
3715  {
3716  //if (r->cf->cfNormalize != nDummy2) //TODO: OPTIMIZE
3717  {
3718  h = pNext(p1);
3719  while (h!=NULL)
3720  {
3721  n_Normalize(pGetCoeff(h),r->cf);
3722  pIter(h);
3723  }
3724  }
3725  }
3726  }
3727 }
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
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
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
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
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static Poly * h
Definition: janet.cc:971

◆ p_Normalize()

void p_Normalize ( poly  p,
const ring  r 
)

Definition at line 3732 of file p_polys.cc.

3733 {
3734  if (rField_has_simple_inverse(r)) return; /* Z/p, GF(p,n), R, long R/C */
3735  while (p!=NULL)
3736  {
3737  // no test befor n_Normalize: n_Normalize should fix problems
3738  n_Normalize(pGetCoeff(p),r->cf);
3739  pIter(p);
3740  }
3741 }
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
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:543
#define pIter(p)
Definition: monomials.h:37
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_NSet()

poly p_NSet ( number  n,
const ring  r 
)

returns the poly representing the number n, destroys n

Definition at line 1455 of file p_polys.cc.

1456 {
1457  if (n_IsZero(n,r->cf))
1458  {
1459  n_Delete(&n, r->cf);
1460  return NULL;
1461  }
1462  else
1463  {
1464  poly rc = p_Init(r);
1465  pSetCoeff0(rc,n);
1466  return rc;
1467  }
1468 }
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:12
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_One()

poly p_One ( const ring  r)

Definition at line 1303 of file p_polys.cc.

1304 {
1305  poly rc = p_Init(r);
1306  pSetCoeff0(rc,n_Init(1,r->cf));
1307  return rc;
1308 }
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
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_OneComp()

BOOLEAN p_OneComp ( poly  p,
const ring  r 
)

return TRUE if all monoms have the same component

Definition at line 1198 of file p_polys.cc.

1199 {
1200  if(p!=NULL)
1201  {
1202  long i = p_GetComp(p, r);
1203  while (pNext(p)!=NULL)
1204  {
1205  pIter(p);
1206  if(i != p_GetComp(p, r)) return FALSE;
1207  }
1208  }
1209  return TRUE;
1210 }
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:64
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

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

4038 {
4039 #if 0
4040  p_Test(p, oldRing);
4041  PrintS("p_PermPoly::p: "); p_Write(p, oldRing, oldRing);
4042 #endif
4043  const int OldpVariables = rVar(oldRing);
4044  poly result = NULL;
4045  poly result_last = NULL;
4046  poly aq = NULL; /* the map coefficient */
4047  poly qq; /* the mapped monomial */
4048  assume(dst != NULL);
4049  assume(dst->cf != NULL);
4050  #ifdef HAVE_PLURAL
4051  poly tmp_mm=p_One(dst);
4052  #endif
4053  while (p != NULL)
4054  {
4055  // map the coefficient
4056  if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing) || (nMap==ndCopyMap))
4057  && (nMap != NULL) )
4058  {
4059  qq = p_Init(dst);
4060  assume( nMap != NULL );
4061  number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
4062  n_Test (n,dst->cf);
4063  if ( nCoeff_is_algExt(dst->cf) )
4064  n_Normalize(n, dst->cf);
4065  p_GetCoeff(qq, dst) = n;// Note: n can be a ZERO!!!
4066  }
4067  else
4068  {
4069  qq = p_One(dst);
4070 // aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst???
4071 // poly n_PermNumber(const number z, const int *par_perm, const int P, const ring src, const ring dst)
4072  aq = n_PermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing, dst);
4073  p_Test(aq, dst);
4074  if ( nCoeff_is_algExt(dst->cf) )
4075  p_Normalize(aq,dst);
4076  if (aq == NULL)
4077  p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!!
4078  p_Test(aq, dst);
4079  }
4080  if (rRing_has_Comp(dst))
4081  p_SetComp(qq, p_GetComp(p, oldRing), dst);
4082  if ( n_IsZero(pGetCoeff(qq), dst->cf) )
4083  {
4084  p_LmDelete(&qq,dst);
4085  qq = NULL;
4086  }
4087  else
4088  {
4089  // map pars:
4090  int mapped_to_par = 0;
4091  for(int i = 1; i <= OldpVariables; i++)
4092  {
4093  int e = p_GetExp(p, i, oldRing);
4094  if (e != 0)
4095  {
4096  if (perm==NULL)
4097  p_SetExp(qq, i, e, dst);
4098  else if (perm[i]>0)
4099  {
4100  #ifdef HAVE_PLURAL
4101  if(use_mult)
4102  {
4103  p_SetExp(tmp_mm,perm[i],e,dst);
4104  p_Setm(tmp_mm,dst);
4105  qq=p_Mult_mm(qq,tmp_mm,dst);
4106  p_SetExp(tmp_mm,perm[i],0,dst);
4107 
4108  }
4109  else
4110  #endif
4111  p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst);
4112  }
4113  else if (perm[i]<0)
4114  {
4115  number c = p_GetCoeff(qq, dst);
4116  if (rField_is_GF(dst))
4117  {
4118  assume( dst->cf->extRing == NULL );
4119  number ee = n_Param(1, dst);
4120  number eee;
4121  n_Power(ee, e, &eee, dst->cf); //nfDelete(ee,dst);
4122  ee = n_Mult(c, eee, dst->cf);
4123  //nfDelete(c,dst);nfDelete(eee,dst);
4124  pSetCoeff0(qq,ee);
4125  }
4126  else if (nCoeff_is_Extension(dst->cf))
4127  {
4128  const int par = -perm[i];
4129  assume( par > 0 );
4130 // WarnS("longalg missing 3");
4131 #if 1
4132  const coeffs C = dst->cf;
4133  assume( C != NULL );
4134  const ring R = C->extRing;
4135  assume( R != NULL );
4136  assume( par <= rVar(R) );
4137  poly pcn; // = (number)c
4138  assume( !n_IsZero(c, C) );
4139  if( nCoeff_is_algExt(C) )
4140  pcn = (poly) c;
4141  else // nCoeff_is_transExt(C)
4142  pcn = NUM((fraction)c);
4143  if (pNext(pcn) == NULL) // c->z
4144  p_AddExp(pcn, -perm[i], e, R);
4145  else /* more difficult: we have really to multiply: */
4146  {
4147  poly mmc = p_ISet(1, R);
4148  p_SetExp(mmc, -perm[i], e, R);
4149  p_Setm(mmc, R);
4150  number nnc;
4151  // convert back to a number: number nnc = mmc;
4152  if( nCoeff_is_algExt(C) )
4153  nnc = (number) mmc;
4154  else // nCoeff_is_transExt(C)
4155  nnc = ntInit(mmc, C);
4156  p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C);
4157  n_Delete((number *)&c, C);
4158  n_Delete((number *)&nnc, C);
4159  }
4160  mapped_to_par=1;
4161 #endif
4162  }
4163  }
4164  else
4165  {
4166  /* this variable maps to 0 !*/
4167  p_LmDelete(&qq, dst);
4168  break;
4169  }
4170  }
4171  }
4172  if ( mapped_to_par && (qq!= NULL) && nCoeff_is_algExt(dst->cf) )
4173  {
4174  number n = p_GetCoeff(qq, dst);
4175  n_Normalize(n, dst->cf);
4176  p_GetCoeff(qq, dst) = n;
4177  }
4178  }
4179  pIter(p);
4180 
4181 #if 0
4182  p_Test(aq,dst);
4183  PrintS("aq: "); p_Write(aq, dst, dst);
4184 #endif
4185 
4186 
4187 #if 1
4188  if (qq!=NULL)
4189  {
4190  p_Setm(qq,dst);
4191 
4192  p_Test(aq,dst);
4193  p_Test(qq,dst);
4194 
4195 #if 0
4196  PrintS("qq: "); p_Write(qq, dst, dst);
4197 #endif
4198 
4199  if (aq!=NULL)
4200  qq=p_Mult_q(aq,qq,dst);
4201  aq = qq;
4202  while (pNext(aq) != NULL) pIter(aq);
4203  if (result_last==NULL)
4204  {
4205  result=qq;
4206  }
4207  else
4208  {
4209  pNext(result_last)=qq;
4210  }
4211  result_last=aq;
4212  aq = NULL;
4213  }
4214  else if (aq!=NULL)
4215  {
4216  p_Delete(&aq,dst);
4217  }
4218  }
4219  result=p_SortAdd(result,dst);
4220 #else
4221  // if (qq!=NULL)
4222  // {
4223  // pSetm(qq);
4224  // pTest(qq);
4225  // pTest(aq);
4226  // if (aq!=NULL) qq=pMult(aq,qq);
4227  // aq = qq;
4228  // while (pNext(aq) != NULL) pIter(aq);
4229  // pNext(aq) = result;
4230  // aq = NULL;
4231  // result = qq;
4232  // }
4233  // else if (aq!=NULL)
4234  // {
4235  // pDelete(&aq);
4236  // }
4237  //}
4238  //p = result;
4239  //result = NULL;
4240  //while (p != NULL)
4241  //{
4242  // qq = p;
4243  // pIter(p);
4244  // qq->next = NULL;
4245  // result = pAdd(result, qq);
4246  //}
4247 #endif
4248  p_Test(result,dst);
4249 #if 0
4250  p_Test(result,dst);
4251  PrintS("result: "); p_Write(result,dst,dst);
4252 #endif
4253  #ifdef HAVE_PLURAL
4254  p_LmDelete(&tmp_mm,dst);
4255  #endif
4256  return result;
4257 }
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:996
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:251
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_GetComp(p, r)
Definition: monomials.h:64
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
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
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
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:516
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1..n_NumberOfParameters(...)
Definition: coeffs.h:805
#define pIter(p)
Definition: monomials.h:37
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition: p_polys.h:1154
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
poly p_One(const ring r)
Definition: p_polys.cc:1303
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
number ntInit(long i, const coeffs cf)
Definition: transext.cc:704
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define p_Test(p, r)
Definition: p_polys.h:162
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3732
#define rRing_has_Comp(r)
Definition: monomials.h:266
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
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
#define NULL
Definition: omList.c:12
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
Definition: p_polys.cc:3933
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:605
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:868
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:249
int p
Definition: cfModGcd.cc:4019
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1287
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049
return result
Definition: facAbsBiFact.cc:76

◆ p_Plus_mm_Mult_qq() [1/2]

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

Definition at line 1118 of file p_polys.h.

1120 {
1121 #ifdef HAVE_PLURAL
1122  if (rIsPluralRing(r))
1123  return nc_p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
1124 #endif
1125 
1126 // this should be implemented more efficiently
1127  poly res;
1128  int shorter;
1129  number n_old = pGetCoeff(m);
1130  number n_neg = n_Copy(n_old, r->cf);
1131  n_neg = n_InpNeg(n_neg, r->cf);
1132  pSetCoeff0(m, n_neg);
1133  res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
1134  lp = (lp + lq) - shorter;
1135  pSetCoeff0(m, n_old);
1136  n_Delete(&n_neg, r->cf);
1137  return res;
1138 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
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
CanonicalForm res
Definition: facAbsFact.cc:64
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
int m
Definition: cfEzgcd.cc:121
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
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:451
#define pSetCoeff0(p, n)
Definition: monomials.h:59
Definition: lq.h:39
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019

◆ p_Plus_mm_Mult_qq() [2/2]

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

Definition at line 1140 of file p_polys.h.

1141 {
1142  int lp = 0, lq = 0;
1143  return p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
1144 }
int m
Definition: cfEzgcd.cc:121
Definition: lq.h:39
int p
Definition: cfModGcd.cc:4019
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
Definition: p_polys.h:1118

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

1846 {
1847  assume(divisor != NULL);
1848  if (p == NULL) return NULL;
1849 
1850  poly result = NULL;
1851  number divisorLC = p_GetCoeff(divisor, r);
1852  int divisorLE = p_GetExp(divisor, 1, r);
1853  while ((p != NULL) && (p_Deg(p, r) >= p_Deg(divisor, r)))
1854  {
1855  /* determine t = LT(p) / LT(divisor) */
1856  poly t = p_ISet(1, r);
1857  number c = n_Div(p_GetCoeff(p, r), divisorLC, r->cf);
1858  n_Normalize(c,r->cf);
1859  p_SetCoeff(t, c, r);
1860  int e = p_GetExp(p, 1, r) - divisorLE;
1861  p_SetExp(t, 1, e, r);
1862  p_Setm(t, r);
1863  if (needResult) result = p_Add_q(result, p_Copy(t, r), r);
1864  p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
1865  }
1866  return result;
1867 }
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
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
#define NULL
Definition: omList.c:12
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1287
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049
return result
Definition: facAbsBiFact.cc:76

◆ p_Power()

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

Definition at line 2172 of file p_polys.cc.

2173 {
2174  poly rc=NULL;
2175 
2176  if (i==0)
2177  {
2178  p_Delete(&p,r);
2179  return p_One(r);
2180  }
2181 
2182  if(p!=NULL)
2183  {
2184  if ( (i > 0) && ((unsigned long ) i > (r->bitmask))
2185  #ifdef HAVE_SHIFTBBA
2186  && (!rIsLPRing(r))
2187  #endif
2188  )
2189  {
2190  Werror("exponent %d is too large, max. is %ld",i,r->bitmask);
2191  return NULL;
2192  }
2193  switch (i)
2194  {
2195 // cannot happen, see above
2196 // case 0:
2197 // {
2198 // rc=pOne();
2199 // pDelete(&p);
2200 // break;
2201 // }
2202  case 1:
2203  rc=p;
2204  break;
2205  case 2:
2206  rc=p_Mult_q(p_Copy(p,r),p,r);
2207  break;
2208  default:
2209  if (i < 0)
2210  {
2211  p_Delete(&p,r);
2212  return NULL;
2213  }
2214  else
2215  {
2216 #ifdef HAVE_PLURAL
2217  if (rIsNCRing(r)) /* in the NC case nothing helps :-( */
2218  {
2219  int j=i;
2220  rc = p_Copy(p,r);
2221  while (j>1)
2222  {
2223  rc = p_Mult_q(p_Copy(p,r),rc,r);
2224  j--;
2225  }
2226  p_Delete(&p,r);
2227  return rc;
2228  }
2229 #endif
2230  rc = pNext(p);
2231  if (rc == NULL)
2232  return p_MonPower(p,i,r);
2233  /* else: binom ?*/
2234  int char_p=rChar(r);
2235  if ((char_p>0) && (i>char_p)
2236  && ((rField_is_Zp(r,char_p)
2237  || (rField_is_Zp_a(r,char_p)))))
2238  {
2239  poly h=p_Pow_charp(p_Copy(p,r),char_p,r);
2240  int rest=i-char_p;
2241  while (rest>=char_p)
2242  {
2243  rest-=char_p;
2244  h=p_Mult_q(h,p_Pow_charp(p_Copy(p,r),char_p,r),r);
2245  }
2246  poly res=h;
2247  if (rest>0)
2248  res=p_Mult_q(p_Power(p_Copy(p,r),rest,r),h,r);
2249  p_Delete(&p,r);
2250  return res;
2251  }
2252  if ((pNext(rc) != NULL)
2253  || rField_is_Ring(r)
2254  )
2255  return p_Pow(p,i,r);
2256  if ((char_p==0) || (i<=char_p))
2257  return p_TwoMonPower(p,i,r);
2258  return p_Pow(p,i,r);
2259  }
2260  /*end default:*/
2261  }
2262  }
2263  return rc;
2264 }
static poly p_MonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:1975
int j
Definition: facHensel.cc:105
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:524
int rChar(ring r)
Definition: ring.cc:713
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408
static poly p_TwoMonPower(poly p, int exp, const ring r)
Definition: p_polys.cc:2081
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
CanonicalForm res
Definition: facAbsFact.cc:64
poly p_One(const ring r)
Definition: p_polys.cc:1303
int i
Definition: cfEzgcd.cc:125
static poly p_Pow(poly p, int i, const ring r)
Definition: p_polys.cc:2146
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
static poly p_Pow_charp(poly p, int i, const ring r)
Definition: p_polys.cc:2160
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
static BOOLEAN rIsNCRing(const ring r)
Definition: ring.h:418
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2172
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ p_ProjectiveUnique()

void p_ProjectiveUnique ( poly  p,
const ring  r 
)

Definition at line 3089 of file p_polys.cc.

3090 {
3091  if( ph == NULL )
3092  return;
3093 
3094  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
3095 
3096  number h;
3097  poly p;
3098 
3099  if (rField_is_Ring(r))
3100  {
3101  p_ContentForGB(ph,r);
3102  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3103  assume( n_GreaterZero(pGetCoeff(ph),C) );
3104  return;
3105  }
3106 
3108  {
3109  assume( n_GreaterZero(pGetCoeff(ph),C) );
3110  if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3111  return;
3112  }
3113  p = ph;
3114 
3115  assume(p != NULL);
3116 
3117  if(pNext(p)==NULL) // a monomial
3118  {
3119  p_SetCoeff(p, n_Init(1, C), r);
3120  return;
3121  }
3122 
3123  assume(pNext(p)!=NULL);
3124 
3125  if(!rField_is_Q(r) && !nCoeff_is_transExt(C))
3126  {
3127  h = p_GetCoeff(p, C);
3128  number hInv = n_Invers(h, C);
3129  pIter(p);
3130  while (p!=NULL)
3131  {
3132  p_SetCoeff(p, n_Mult(p_GetCoeff(p, C), hInv, C), r);
3133  pIter(p);
3134  }
3135  n_Delete(&hInv, C);
3136  p = ph;
3137  p_SetCoeff(p, n_Init(1, C), r);
3138  }
3139 
3140  p_Cleardenom(ph, r); //removes also Content
3141 
3142 
3143  /* normalize ph over a transcendental extension s.t.
3144  lead (ph) is > 0 if extRing->cf == Q
3145  or lead (ph) is monic if extRing->cf == Zp*/
3146  if (nCoeff_is_transExt(C))
3147  {
3148  p= ph;
3149  h= p_GetCoeff (p, C);
3150  fraction f = (fraction) h;
3151  number n=p_GetCoeff (NUM (f),C->extRing->cf);
3152  if (rField_is_Q (C->extRing))
3153  {
3154  if (!n_GreaterZero(n,C->extRing->cf))
3155  {
3156  p=p_Neg (p,r);
3157  }
3158  }
3159  else if (rField_is_Zp(C->extRing))
3160  {
3161  if (!n_IsOne (n, C->extRing->cf))
3162  {
3163  n=n_Invers (n,C->extRing->cf);
3164  nMapFunc nMap;
3165  nMap= n_SetMap (C->extRing->cf, C);
3166  number ninv= nMap (n,C->extRing->cf, C);
3167  p=__p_Mult_nn (p, ninv, r);
3168  n_Delete (&ninv, C);
3169  n_Delete (&n, C->extRing->cf);
3170  }
3171  }
3172  p= ph;
3173  }
3174 
3175  return;
3176 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
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
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2315
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define assume(x)
Definition: mod2.h:390
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of &#39;a&#39;; raise an error if &#39;a&#39; is not invertible ...
Definition: coeffs.h:564
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
FILE * f
Definition: checklibs.c:9
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
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
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:926
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2791

◆ p_Read()

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

Definition at line 1360 of file p_polys.cc.

1361 {
1362  if (r==NULL) { rc=NULL;return st;}
1363  int i,j;
1364  rc = p_Init(r);
1365  const char *s = n_Read(st,&(p_GetCoeff(rc, r)),r->cf);
1366  if (s==st)
1367  /* i.e. it does not start with a coeff: test if it is a ringvar*/
1368  {
1369  j = r_IsRingVar(s,r->names,r->N);
1370  if (j >= 0)
1371  {
1372  p_IncrExp(rc,1+j,r);
1373  while (*s!='\0') s++;
1374  goto done;
1375  }
1376  }
1377  while (*s!='\0')
1378  {
1379  char ss[2];
1380  ss[0] = *s++;
1381  ss[1] = '\0';
1382  j = r_IsRingVar(ss,r->names,r->N);
1383  if (j >= 0)
1384  {
1385  const char *s_save=s;
1386  s = eati(s,&i);
1387  if (((unsigned long)i) > r->bitmask/2)
1388  {
1389  // exponent to large: it is not a monomial
1390  p_LmDelete(&rc,r);
1391  return s_save;
1392  }
1393  p_AddExp(rc,1+j, (long)i, r);
1394  }
1395  else
1396  {
1397  // 1st char of is not a varname
1398  // We return the parsed polynomial nevertheless. This is needed when
1399  // we are parsing coefficients in a rational function field.
1400  s--;
1401  break;
1402  }
1403  }
1404 done:
1405  if (n_IsZero(pGetCoeff(rc),r->cf)) p_LmDelete(&rc,r);
1406  else
1407  {
1408 #ifdef HAVE_PLURAL
1409  // in super-commutative ring
1410  // squares of anti-commutative variables are zeroes!
1411  if(rIsSCA(r))
1412  {
1413  const unsigned int iFirstAltVar = scaFirstAltVar(r);
1414  const unsigned int iLastAltVar = scaLastAltVar(r);
1415 
1416  assume(rc != NULL);
1417 
1418  for(unsigned int k = iFirstAltVar; k <= iLastAltVar; k++)
1419  if( p_GetExp(rc, k, r) > 1 )
1420  {
1421  p_LmDelete(&rc, r);
1422  goto finish;
1423  }
1424  }
1425 #endif
1426 
1427  p_Setm(rc,r);
1428  }
1429 finish:
1430  return s;
1431 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const char * eati(const char *s, int *i)
Definition: reporter.cc:373
int j
Definition: facHensel.cc:105
static FORCE_INLINE const char * n_Read(const char *s, number *a, const coeffs r)
!!! Recommendation: This method is too cryptic to be part of the user- !!! interface. As defined here, it is merely a helper !!! method for parsing number input strings.
Definition: coeffs.h:598
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:590
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:212
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define NULL
Definition: omList.c:12
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:190
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:605
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1255

◆ p_Series()

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

Definition at line 4404 of file p_polys.cc.

4405 {
4406  short *ww=iv2array(w,R);
4407  if(p!=NULL)
4408  {
4409  if(u==NULL)
4410  p=p_JetW(p,n,ww,R);
4411  else
4412  p=p_JetW(p_Mult_q(p,p_Invers(n-p_MinDeg(p,w,R),u,w,R),R),n,ww,R);
4413  }
4414  omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(short));
4415  return p;
4416 }
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:200
int p_MinDeg(poly p, intvec *w, const ring R)
Definition: p_polys.cc:4354
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
void * ADDRESS
Definition: auxiliary.h:133
poly p_JetW(poly p, int m, short *w, const ring R)
Definition: p_polys.cc:4336
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
static poly p_Invers(int n, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4375
int p
Definition: cfModGcd.cc:4019
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1049

◆ p_SetCoeff()

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

Definition at line 411 of file p_polys.h.

412 {
413  p_LmCheckPolyRing2(p, r);
414  n_Delete(&(p->coef), r->cf);
415  (p)->coef=n;
416  return n;
417 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
int p
Definition: cfModGcd.cc:4019

◆ p_SetComp()

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

Definition at line 246 of file p_polys.h.

247 {
248  p_LmCheckPolyRing2(p, r);
249  if (r->pCompIndex>=0) __p_GetComp(p,r) = c;
250  return c;
251 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define __p_GetComp(p, r)
Definition: monomials.h:63
int p
Definition: cfModGcd.cc:4019

◆ p_SetCompP() [1/2]

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

Definition at line 253 of file p_polys.h.

254 {
255  if (p != NULL)
256  {
257  p_Test(p, r);
259  {
260  do
261  {
262  p_SetComp(p, i, r);
263  p_SetmComp(p, r);
264  pIter(p);
265  }
266  while (p != NULL);
267  }
268  else
269  {
270  do
271  {
272  p_SetComp(p, i, r);
273  pIter(p);
274  }
275  while(p != NULL);
276  }
277  }
278 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition: ring.cc:1902
#define p_Test(p, r)
Definition: p_polys.h:162
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_SetCompP() [2/2]

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

Definition at line 280 of file p_polys.h.

281 {
282  if (p != NULL)
283  {
284  p_SetComp(p, i, lmRing);
285  p_SetmComp(p, lmRing);
286  p_SetCompP(pNext(p), i, tailRing);
287  }
288 }
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:253
int i
Definition: cfEzgcd.cc:125
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_SetExp() [1/3]

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

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

See also
p_GetExp

Definition at line 487 of file p_polys.h.

488 {
489  pAssume2(e>=0);
490  pAssume2(e<=iBitmask);
491  pAssume2((VarOffset >> (24 + 6)) == 0);
492 
493  // shift e to the left:
494  REGISTER int shift = VarOffset >> 24;
495  unsigned long ee = e << shift /*(VarOffset >> 24)*/;
496  // find the bits in the exponent vector
497  REGISTER int offset = (VarOffset & 0xffffff);
498  // clear the bits in the exponent vector:
499  p->exp[offset] &= ~( iBitmask << shift );
500  // insert e with |
501  p->exp[ offset ] |= ee;
502  return e;
503 }
#define REGISTER
Definition: omalloc.h:27
#define pAssume2(cond)
Definition: monomials.h:193
int p
Definition: cfModGcd.cc:4019
int offset
Definition: libparse.cc:1091

◆ p_SetExp() [2/3]

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

Definition at line 561 of file p_polys.h.

562 {
563  p_LmCheckPolyRing2(p, r);
564  pAssume2(VarOffset != -1);
565  return p_SetExp(p, e, r->bitmask, VarOffset);
566 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_SetExp() [3/3]

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

set v^th exponent for a monomial

Definition at line 581 of file p_polys.h.

582 {
583  p_LmCheckPolyRing2(p, r);
584  pAssume2(v>0 && v <= r->N);
585  pAssume2(r->VarOffset[v] != -1);
586  return p_SetExp(p, e, r->bitmask, r->VarOffset[v]);
587 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_SetExpV()

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

Definition at line 1470 of file p_polys.h.

1471 {
1472  p_LmCheckPolyRing1(p, r);
1473  for (unsigned j = r->N; j!=0; j--)
1474  p_SetExp(p, j, ev[j], r);
1475 
1476  if(ev[0]!=0) p_SetComp(p, ev[0],r);
1477  p_Setm(p, r);
1478 }
int j
Definition: facHensel.cc:105
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
int p
Definition: cfModGcd.cc:4019

◆ p_SetExpVL()

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

Definition at line 1480 of file p_polys.h.

1481 {
1482  p_LmCheckPolyRing1(p, r);
1483  for (unsigned j = r->N; j!=0; j--)
1484  p_SetExp(p, j, ev[j], r);
1485 
1486  if(ev[0]!=0) p_SetComp(p, ev[0],r);
1487  p_Setm(p, r);
1488 }
int j
Definition: facHensel.cc:105
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
int p
Definition: cfModGcd.cc:4019

◆ p_Setm()

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

Definition at line 232 of file p_polys.h.

233 {
234  p_CheckRing2(r);
235  r->p_Setm(p, r);
236 }
#define p_CheckRing2(r)
Definition: monomials.h:200
int p
Definition: cfModGcd.cc:4019

◆ p_SetModDeg()

void p_SetModDeg ( intvec w,
ring  r 
)

Definition at line 3633 of file p_polys.cc.

3634 {
3635  if (w!=NULL)
3636  {
3637  r->pModW = w;
3638  pOldFDeg = r->pFDeg;
3639  pOldLDeg = r->pLDeg;
3640  pOldLexOrder = r->pLexOrder;
3641  pSetDegProcs(r,pModDeg);
3642  r->pLexOrder = TRUE;
3643  }
3644  else
3645  {
3646  r->pModW = NULL;
3648  r->pLexOrder = pOldLexOrder;
3649  }
3650 }
static BOOLEAN pOldLexOrder
Definition: p_polys.cc:3622
static long pModDeg(poly p, ring r)
Definition: p_polys.cc:3624
#define TRUE
Definition: auxiliary.h:98
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
static pLDegProc pOldLDeg
Definition: p_polys.cc:3621
#define NULL
Definition: omList.c:12
static pFDegProc pOldFDeg
Definition: p_polys.cc:3620
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ p_ShallowCopyDelete()

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

Definition at line 883 of file p_polys.h.

884 {
885  p_LmCheckPolyRing2(p, r);
886  pAssume2(omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
887  return r->p_Procs->p_ShallowCopyDelete(p, r, bin);
888 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
#define omSizeWOfBin(bin_ptr)
int p
Definition: cfModGcd.cc:4019

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

4613 {
4614  poly qp1 = *p,qp2 = *p;/*working pointers*/
4615  int j = p_MaxComp(*p,r),k = p_MinComp(*p,r);
4616 
4617  if (j+i < 0) return ;
4618  BOOLEAN toPoly= ((j == -i) && (j == k));
4619  while (qp1 != NULL)
4620  {
4621  if (toPoly || (__p_GetComp(qp1,r)+i > 0))
4622  {
4623  p_AddComp(qp1,i,r);
4624  p_SetmComp(qp1,r);
4625  qp2 = qp1;
4626  pIter(qp1);
4627  }
4628  else
4629  {
4630  if (qp2 == *p)
4631  {
4632  pIter(*p);
4633  p_LmDelete(&qp2,r);
4634  qp2 = *p;
4635  qp1 = *p;
4636  }
4637  else
4638  {
4639  qp2->next = qp1->next;
4640  if (qp1!=NULL) p_LmDelete(&qp1,r);
4641  qp1 = qp2->next;
4642  }
4643  }
4644  }
4645 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static unsigned long p_AddComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:446
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:312
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291
return
Definition: cfGcdAlgExt.cc:218

◆ p_SimpleContent()

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

Definition at line 2524 of file p_polys.cc.

2525 {
2526  if(TEST_OPT_CONTENTSB) return;
2527  if (ph==NULL) return;
2528  if (pNext(ph)==NULL)
2529  {
2530  p_SetCoeff(ph,n_Init(1,r->cf),r);
2531  return;
2532  }
2533  if ((pNext(pNext(ph))==NULL)||(!rField_is_Q(r)))
2534  {
2535  return;
2536  }
2537  number d=p_InitContent(ph,r);
2538  if (n_Size(d,r->cf)<=smax)
2539  {
2540  //if (TEST_OPT_PROT) PrintS("G");
2541  return;
2542  }
2543 
2544  poly p=ph;
2545  number h=d;
2546  if (smax==1) smax=2;
2547  while (p!=NULL)
2548  {
2549 #if 0
2550  d=n_Gcd(h,pGetCoeff(p),r->cf);
2551  n_Delete(&h,r->cf);
2552  h = d;
2553 #else
2554  STATISTIC(n_Gcd); nlInpGcd(h,pGetCoeff(p),r->cf);
2555 #endif
2556  if(n_Size(h,r->cf)<smax)
2557  {
2558  //if (TEST_OPT_PROT) PrintS("g");
2559  return;
2560  }
2561  pIter(p);
2562  }
2563  p = ph;
2564  if (!n_GreaterZero(pGetCoeff(p),r->cf)) h=n_InpNeg(h,r->cf);
2565  if(n_IsOne(h,r->cf)) return;
2566  //if (TEST_OPT_PROT) PrintS("c");
2567  while (p!=NULL)
2568  {
2569 #if 1
2570  d = n_ExactDiv(pGetCoeff(p),h,r->cf);
2571  p_SetCoeff(p,d,r);
2572 #else
2573  STATISTIC(n_ExactDiv); nlInpExactDiv(pGetCoeff(p),h,r->cf); // no such function... ?
2574 #endif
2575  pIter(p);
2576  }
2577  n_Delete(&h,r->cf);
2578 }
#define STATISTIC(f)
Definition: numstats.h:16
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:686
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
#define TEST_OPT_CONTENTSB
Definition: options.h:125
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
void nlInpGcd(number &a, number b, const coeffs r)
Definition: longrat.cc:2776
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
#define pIter(p)
Definition: monomials.h:37
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
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
number p_InitContent(poly ph, const ring r)
Definition: p_polys.cc:2581
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
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
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
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

◆ p_Size()

int p_Size ( poly  p,
const ring  r 
)

Definition at line 3200 of file p_polys.cc.

3201 {
3202  int count = 0;
3203  if (r->cf->has_simple_Alloc)
3204  return pLength(p);
3205  while ( p != NULL )
3206  {
3207  count+= n_Size( pGetCoeff( p ), r->cf );
3208  pIter( p );
3209  }
3210  return count;
3211 }
int status int void size_t count
Definition: si_signals.h:59
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define pIter(p)
Definition: monomials.h:37
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019
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

◆ p_SortAdd()

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

Definition at line 1154 of file p_polys.h.

1155 {
1156  if (revert) p = pReverse(p);
1157  return sBucketSortAdd(p, r);
1158 }
poly sBucketSortAdd(poly p, const ring r)
Sorts p with bucketSort: p may have equal monomials.
Definition: sbuckets.cc:368
static poly pReverse(poly p)
Definition: p_polys.h:334
int p
Definition: cfModGcd.cc:4019

◆ p_SortMerge()

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

Definition at line 1164 of file p_polys.h.

1165 {
1166  if (revert) p = pReverse(p);
1167  return sBucketSortMerge(p, r);
1168 }
poly sBucketSortMerge(poly p, const ring r)
Sorts p with bucketSort: assumes all monomials of p are different.
Definition: sbuckets.cc:332
static poly pReverse(poly p)
Definition: p_polys.h:334
int p
Definition: cfModGcd.cc:4019

◆ p_Split()

void p_Split ( poly  p,
poly *  r 
)

Definition at line 1310 of file p_polys.cc.

1311 {
1312  *h=pNext(p);
1313  pNext(p)=NULL;
1314 }
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971

◆ p_String() [1/2]

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

Definition at line 229 of file polys0.cc.

230 {
231  StringSetS("");
232  p_String0(p, lmRing, tailRing);
233  return StringEndS();
234 }
char * StringEndS()
Definition: reporter.cc:151
void StringSetS(const char *st)
Definition: reporter.cc:128
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:179
int p
Definition: cfModGcd.cc:4019

◆ p_String() [2/2]

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

Definition at line 1175 of file p_polys.h.

1176 {
1177  return p_String(p, p_ring, p_ring);
1178 }
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:229
int p
Definition: cfModGcd.cc:4019

◆ p_String0() [1/2]

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

print p according to ShortOut in lmRing & tailRing

Definition at line 179 of file polys0.cc.

180 {
181  if (p == NULL)
182  {
183  StringAppendS("0");
184  return;
185  }
186  p_Normalize(p,lmRing);
187  if ((n_GetChar(lmRing->cf) == 0)
188  && (nCoeff_is_transExt(lmRing->cf)))
189  p_Normalize(p,lmRing); /* Manual/absfact.tst */
190  if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
191  {
192  writemon(p,0, lmRing);
193  p = pNext(p);
194  while (p!=NULL)
195  {
196  assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
197  if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
198  StringAppendS("+");
199  writemon(p,0, tailRing);
200  p = pNext(p);
201  }
202  return;
203  }
204 
205  long k = 1;
206  StringAppendS("[");
207  loop
208  {
209  while (k < p_GetComp(p,lmRing))
210  {
211  StringAppendS("0,");
212  k++;
213  }
214  writemon(p,k,lmRing);
215  pIter(p);
216  while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
217  {
218  if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
219  writemon(p,k,tailRing);
220  pIter(p);
221  }
222  if (p == NULL) break;
223  StringAppendS(",");
224  k++;
225  }
226  StringAppendS("]");
227 }
#define p_GetComp(p, r)
Definition: monomials.h:64
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
void StringAppendS(const char *st)
Definition: reporter.cc:107
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3732
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff &#39;n&#39; is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
Definition: coeffs.h:494
int p
Definition: cfModGcd.cc:4019
static void writemon(poly p, int ko, const ring r)
Definition: polys0.cc:24

◆ p_String0() [2/2]

static void p_String0 ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1179 of file p_polys.h.

1180 {
1181  p_String0(p, p_ring, p_ring);
1182 }
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:179
int p
Definition: cfModGcd.cc:4019

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

160 {
161  // NOTE: the following (non-thread-safe!) UGLYNESS
162  // (changing naRing->ShortOut for a while) is due to Hans!
163  // Just think of other ring using the VERY SAME naRing and possible
164  // side-effects...
165  // but this is not a problem: i/o is not thread-safe anyway.
166  const BOOLEAN bLMShortOut = rShortOut(lmRing);
167  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
168 
169  lmRing->ShortOut = FALSE;
170  tailRing->ShortOut = FALSE;
171 
172  p_String0(p, lmRing, tailRing);
173 
174  lmRing->ShortOut = bLMShortOut;
175  tailRing->ShortOut = bTAILShortOut;
176 }
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:575
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:179
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85

◆ p_String0Short()

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

print p in a short way, if possible

print p in a short way, if possible

Definition at line 140 of file polys0.cc.

141 {
142  // NOTE: the following (non-thread-safe!) UGLYNESS
143  // (changing naRing->ShortOut for a while) is due to Hans!
144  // Just think of other ring using the VERY SAME naRing and possible
145  // side-effects...
146  const BOOLEAN bLMShortOut = rShortOut(lmRing);
147  const BOOLEAN bTAILShortOut = rShortOut(tailRing);
148 
149  lmRing->ShortOut = rCanShortOut(lmRing);
150  tailRing->ShortOut = rCanShortOut(tailRing);
151 
152  p_String0(p, lmRing, tailRing);
153 
154  lmRing->ShortOut = bLMShortOut;
155  tailRing->ShortOut = bTAILShortOut;
156 }
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:575
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:580
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:179
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85

◆ p_Sub()

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

Definition at line 1965 of file p_polys.cc.

1966 {
1967  return p_Add_q(p1, p_Neg(p2,r),r);
1968 }
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1042
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891

◆ p_SubComp()

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

Definition at line 452 of file p_polys.h.

453 {
454  p_LmCheckPolyRing2(p, r);
456  _pPolyAssume2(__p_GetComp(p,r) >= v,p,r);
457  return __p_GetComp(p,r) -= v;
458 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define _pPolyAssume2(cond, p, r)
Definition: monomials.h:195
#define pAssume2(cond)
Definition: monomials.h:193
#define rRing_has_Comp(r)
Definition: monomials.h:266
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int p
Definition: cfModGcd.cc:4019

◆ p_SubExp()

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

Definition at line 612 of file p_polys.h.

613 {
614  p_LmCheckPolyRing2(p, r);
615  long e = p_GetExp(p,v,r);
616  pAssume2(e >= ee);
617  e -= ee;
618  return p_SetExp(p,v,e,r);
619 }
#define p_LmCheckPolyRing2(p, r)
Definition: monomials.h:199
#define pAssume2(cond)
Definition: monomials.h:193
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:487
int p
Definition: cfModGcd.cc:4019

◆ p_Subst()

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

Definition at line 3874 of file p_polys.cc.

3875 {
3876  if (e == NULL) return p_Subst0(p, n,r);
3877 
3878  if (p_IsConstant(e,r))
3879  {
3880  if (n_IsOne(pGetCoeff(e),r->cf)) return p_Subst1(p,n,r);
3881  else return p_Subst2(p, n, pGetCoeff(e),r);
3882  }
3883 
3884 #ifdef HAVE_PLURAL
3885  if (rIsPluralRing(r))
3886  {
3887  return nc_pSubst(p,n,e,r);
3888  }
3889 #endif
3890 
3891  int exponent,i;
3892  poly h, res, m;
3893  int *me,*ee;
3894  number nu,nu1;
3895 
3896  me=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3897  ee=(int *)omAlloc((rVar(r)+1)*sizeof(int));
3898  if (e!=NULL) p_GetExpV(e,ee,r);
3899  res=NULL;
3900  h=p;
3901  while (h!=NULL)
3902  {
3903  if ((e!=NULL) || (p_GetExp(h,n,r)==0))
3904  {
3905  m=p_Head(h,r);
3906  p_GetExpV(m,me,r);
3907  exponent=me[n];
3908  me[n]=0;
3909  for(i=rVar(r);i>0;i--)
3910  me[i]+=exponent*ee[i];
3911  p_SetExpV(m,me,r);
3912  if (e!=NULL)
3913  {
3914  n_Power(pGetCoeff(e),exponent,&nu,r->cf);
3915  nu1=n_Mult(pGetCoeff(m),nu,r->cf);
3916  n_Delete(&nu,r->cf);
3917  p_SetCoeff(m,nu1,r);
3918  }
3919  res=p_Add_q(res,m,r);
3920  }
3921  p_LmDelete(&h,r);
3922  }
3923  omFreeSize((ADDRESS)me,(rVar(r)+1)*sizeof(int));
3924  omFreeSize((ADDRESS)ee,(rVar(r)+1)*sizeof(int));
3925  return res;
3926 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1455
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static poly p_Subst1(poly p, int n, const ring r)
Definition: p_polys.cc:3781
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
void * ADDRESS
Definition: auxiliary.h:133
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1470
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:636
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
CanonicalForm res
Definition: facAbsFact.cc:64
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1927
static poly p_Subst0(poly p, int n, const ring r)
Definition: p_polys.cc:3849
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
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
#define NULL
Definition: omList.c:12
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
int exponent(const CanonicalForm &f, int q)
int exponent ( const CanonicalForm & f, int q )
static poly p_Subst2(poly p, int n, number e, const ring r)
Definition: p_polys.cc:3808
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
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
int p
Definition: cfModGcd.cc:4019
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:891
static Poly * h
Definition: janet.cc:971

◆ p_TakeOutComp() [1/2]

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

Definition at line 3455 of file p_polys.cc.

3456 {
3457  spolyrec pp, qq;
3458  poly p, q, p_prev;
3459  int l = 0;
3460 
3461 #ifndef SING_NDEBUG
3462  int lp = pLength(*r_p);
3463 #endif
3464 
3465  pNext(&pp) = *r_p;
3466  p = *r_p;
3467  p_prev = &pp;
3468  q = &qq;
3469 
3470  while(p != NULL)
3471  {
3472  while (__p_GetComp(p,r) == comp)
3473  {
3474  pNext(q) = p;
3475  pIter(q);
3476  p_SetComp(p, 0,r);
3477  p_SetmComp(p,r);
3478  pIter(p);
3479  l++;
3480  if (p == NULL)
3481  {
3482  pNext(p_prev) = NULL;
3483  goto Finish;
3484  }
3485  }
3486  pNext(p_prev) = p;
3487  p_prev = p;
3488  pIter(p);
3489  }
3490 
3491  Finish:
3492  pNext(q) = NULL;
3493  *r_p = pNext(&pp);
3494  *r_q = pNext(&qq);
3495  *lq = l;
3496 #ifndef SING_NDEBUG
3497  assume(pLength(*r_p) + pLength(*r_q) == lp);
3498 #endif
3499  p_Test(*r_p,r);
3500  p_Test(*r_q,r);
3501 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define pIter(p)
Definition: monomials.h:37
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define p_Test(p, r)
Definition: p_polys.h:162
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
Definition: lq.h:39
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ p_TakeOutComp() [2/2]

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

Definition at line 3394 of file p_polys.cc.

3395 {
3396  poly q = *p,qq=NULL,result = NULL;
3397 
3398  if (q==NULL) return NULL;
3399  BOOLEAN use_setmcomp=rOrd_SetCompRequiresSetm(r);
3400  if (__p_GetComp(q,r)==k)
3401  {
3402  result = q;
3403  do
3404  {
3405  p_SetComp(q,0,r);
3406  if (use_setmcomp) p_SetmComp(q,r);
3407  qq = q;
3408  pIter(q);
3409  }
3410  while ((q!=NULL) && (__p_GetComp(q,r)==k));
3411  *p = q;
3412  pNext(qq) = NULL;
3413  }
3414  if (q==NULL) return result;
3415  if (__p_GetComp(q,r) > k)
3416  {
3417  p_SubComp(q,1,r);
3418  if (use_setmcomp) p_SetmComp(q,r);
3419  }
3420  poly pNext_q;
3421  while ((pNext_q=pNext(q))!=NULL)
3422  {
3423  if (__p_GetComp(pNext_q,r)==k)
3424  {
3425  if (result==NULL)
3426  {
3427  result = pNext_q;
3428  qq = result;
3429  }
3430  else
3431  {
3432  pNext(qq) = pNext_q;
3433  pIter(qq);
3434  }
3435  pNext(q) = pNext(pNext_q);
3436  pNext(qq) =NULL;
3437  p_SetComp(qq,0,r);
3438  if (use_setmcomp) p_SetmComp(qq,r);
3439  }
3440  else
3441  {
3442  /*pIter(q);*/ q=pNext_q;
3443  if (__p_GetComp(q,r) > k)
3444  {
3445  p_SubComp(q,1,r);
3446  if (use_setmcomp) p_SetmComp(q,r);
3447  }
3448  }
3449  }
3450  return result;
3451 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition: ring.cc:1902
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition: p_polys.h:452
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:85
return result
Definition: facAbsBiFact.cc:76

◆ p_TakeOutComp1()

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

Definition at line 3343 of file p_polys.cc.

3344 {
3345  poly q = *p;
3346 
3347  if (q==NULL) return NULL;
3348 
3349  poly qq=NULL,result = NULL;
3350 
3351  if (__p_GetComp(q,r)==k)
3352  {
3353  result = q; /* *p */
3354  while ((q!=NULL) && (__p_GetComp(q,r)==k))
3355  {
3356  p_SetComp(q,0,r);
3357  p_SetmComp(q,r);
3358  qq = q;
3359  pIter(q);
3360  }
3361  *p = q;
3362  pNext(qq) = NULL;
3363  }
3364  if (q==NULL) return result;
3365 // if (pGetComp(q) > k) pGetComp(q)--;
3366  while (pNext(q)!=NULL)
3367  {
3368  if (__p_GetComp(pNext(q),r)==k)
3369  {
3370  if (result==NULL)
3371  {
3372  result = pNext(q);
3373  qq = result;
3374  }
3375  else
3376  {
3377  pNext(qq) = pNext(q);
3378  pIter(qq);
3379  }
3380  pNext(q) = pNext(pNext(q));
3381  pNext(qq) =NULL;
3382  p_SetComp(qq,0,r);
3383  p_SetmComp(qq,r);
3384  }
3385  else
3386  {
3387  pIter(q);
3388 // if (pGetComp(q) > k) pGetComp(q)--;
3389  }
3390  }
3391  return result;
3392 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
#define p_SetmComp
Definition: p_polys.h:243
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
return result
Definition: facAbsBiFact.cc:76

◆ p_Totaldegree()

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

Definition at line 1442 of file p_polys.h.

1443 {
1444  p_LmCheckPolyRing1(p, r);
1445  unsigned long s = p_GetTotalDegree(p->exp[r->VarL_Offset[0]],
1446  r,
1447  r->ExpPerLong);
1448  for (unsigned i=r->VarL_Size-1; i!=0; i--)
1449  {
1450  s += p_GetTotalDegree(p->exp[r->VarL_Offset[i]], r,r->ExpPerLong);
1451  }
1452  return (long)s;
1453 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps)
Definition: p_polys.h:775
int i
Definition: cfEzgcd.cc:125
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
int p
Definition: cfModGcd.cc:4019

◆ p_Var()

int p_Var ( poly  mi,
const ring  r 
)

Definition at line 4562 of file p_polys.cc.

4563 {
4564  if (m==NULL) return 0;
4565  if (pNext(m)!=NULL) return 0;
4566  int i,e=0;
4567  for (i=rVar(r); i>0; i--)
4568  {
4569  int exp=p_GetExp(m,i,r);
4570  if (exp==1)
4571  {
4572  if (e==0) e=i;
4573  else return 0;
4574  }
4575  else if (exp!=0)
4576  {
4577  return 0;
4578  }
4579  }
4580  return e;
4581 }
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36

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

3553 {
3554  poly h;
3555  int k;
3556 
3557  for(int i=len-1;i>=0;i--) p[i]=NULL;
3558  while (v!=NULL)
3559  {
3560  h=p_Head(v,r);
3561  k=__p_GetComp(h,r);
3562  if (k>len) { Werror("wrong rank:%d, should be %d",len,k); }
3563  else
3564  {
3565  p_SetComp(h,0,r);
3566  p_Setm(h,r);
3567  pNext(h)=p[k-1];p[k-1]=h;
3568  }
3569  pIter(v);
3570  }
3571  for(int i=len-1;i>=0;i--)
3572  {
3573  if (p[i]!=NULL) p[i]=pReverse(p[i]);
3574  }
3575 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
int i
Definition: cfEzgcd.cc:125
static poly pReverse(poly p)
Definition: p_polys.h:334
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ p_Vec2Poly()

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

Definition at line 3531 of file p_polys.cc.

3532 {
3533  poly h;
3534  poly res=NULL;
3535 
3536  while (v!=NULL)
3537  {
3538  if (__p_GetComp(v,r)==k)
3539  {
3540  h=p_Head(v,r);
3541  p_SetComp(h,0,r);
3542  pNext(h)=res;res=h;
3543  }
3544  pIter(v);
3545  }
3546  if (res!=NULL) res=pReverse(res);
3547  return res;
3548 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:246
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
CanonicalForm res
Definition: facAbsFact.cc:64
static poly pReverse(poly p)
Definition: p_polys.h:334
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
static Poly * h
Definition: janet.cc:971

◆ p_Vec2Polys()

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

Definition at line 3582 of file p_polys.cc.

3583 {
3584  poly h;
3585  int k;
3586 
3587  *len=p_MaxComp(v,r);
3588  if (*len==0) *len=1;
3589  *p=(poly*)omAlloc((*len)*sizeof(poly));
3590  p_Vec2Array(v,*p,*len,r);
3591 }
int k
Definition: cfEzgcd.cc:92
#define omAlloc(size)
Definition: omAllocDecl.h:210
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:3552
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:291

◆ p_VectorHasUnit()

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

Definition at line 3311 of file p_polys.cc.

3312 {
3313  poly q=p,qq;
3314  int i,j=0;
3315 
3316  *len = 0;
3317  while (q!=NULL)
3318  {
3319  if (p_LmIsConstantComp(q,r))
3320  {
3321  i = __p_GetComp(q,r);
3322  qq = p;
3323  while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
3324  if (qq == q)
3325  {
3326  j = 0;
3327  while (qq!=NULL)
3328  {
3329  if (__p_GetComp(qq,r)==i) j++;
3330  pIter(qq);
3331  }
3332  if ((*len == 0) || (j<*len))
3333  {
3334  *len = j;
3335  *k = i;
3336  }
3337  }
3338  }
3339  pIter(q);
3340  }
3341 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int j
Definition: facHensel.cc:105
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:961
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_VectorHasUnitB()

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

Definition at line 3288 of file p_polys.cc.

3289 {
3290  poly q=p,qq;
3291  int i;
3292 
3293  while (q!=NULL)
3294  {
3295  if (p_LmIsConstantComp(q,r))
3296  {
3297  i = __p_GetComp(q,r);
3298  qq = p;
3299  while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
3300  if (qq == q)
3301  {
3302  *k = i;
3303  return TRUE;
3304  }
3305  }
3306  pIter(q);
3307  }
3308  return FALSE;
3309 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:961
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ p_WDegree()

long p_WDegree ( poly  p,
const ring  r 
)

Definition at line 704 of file p_polys.cc.

705 {
706  if (r->firstwv==NULL) return p_Totaldegree(p, r);
707  p_LmCheckPolyRing(p, r);
708  int i;
709  long j =0;
710 
711  for(i=1;i<=r->firstBlockEnds;i++)
712  j+=p_GetExp(p, i, r)*r->firstwv[i-1];
713 
714  for (;i<=rVar(r);i++)
715  j+=p_GetExp(p,i, r)*p_Weight(i, r);
716 
717  return j;
718 }
int j
Definition: facHensel.cc:105
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
int p_Weight(int i, const ring r)
Definition: p_polys.cc:695
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118
int p
Definition: cfModGcd.cc:4019

◆ p_Weight()

int p_Weight ( int  c,
const ring  r 
)

Definition at line 695 of file p_polys.cc.

696 {
697  if ((r->firstwv==NULL) || (i>r->firstBlockEnds))
698  {
699  return 1;
700  }
701  return r->firstwv[i-1];
702 }
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12

◆ p_WFirstTotalDegree()

long p_WFirstTotalDegree ( poly  p,
ring  r 
)

Definition at line 586 of file p_polys.cc.

587 {
588  int i;
589  long sum = 0;
590 
591  for (i=1; i<= r->firstBlockEnds; i++)
592  {
593  sum += p_GetExp(p, i, r)*r->firstwv[i-1];
594  }
595  return sum;
596 }
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019

◆ p_Write() [1/2]

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

Definition at line 249 of file polys0.cc.

250 {
251  p_Write0(p, lmRing, tailRing);
252  PrintLn();
253 }
void PrintLn()
Definition: reporter.cc:310
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:239
int p
Definition: cfModGcd.cc:4019

◆ p_Write() [2/2]

static void p_Write ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1183 of file p_polys.h.

1184 {
1185  p_Write(p, p_ring, p_ring);
1186 }
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:249
int p
Definition: cfModGcd.cc:4019

◆ p_Write0() [1/2]

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

Definition at line 239 of file polys0.cc.

240 {
241  char *s=p_String(p, lmRing, tailRing);
242  PrintS(s);
243  omFree(s);
244 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * p_String(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:229
#define omFree(addr)
Definition: omAllocDecl.h:261
void PrintS(const char *s)
Definition: reporter.cc:284
int p
Definition: cfModGcd.cc:4019

◆ p_Write0() [2/2]

static void p_Write0 ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1187 of file p_polys.h.

1188 {
1189  p_Write0(p, p_ring, p_ring);
1190 }
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:239
int p
Definition: cfModGcd.cc:4019

◆ p_wrp() [1/2]

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

Definition at line 280 of file polys0.cc.

281 {
282  poly r;
283 
284  if (p==NULL) PrintS("NULL");
285  else if (pNext(p)==NULL) p_Write0(p, lmRing);
286  else
287  {
288  r = pNext(pNext(p));
289  pNext(pNext(p)) = NULL;
290  p_Write0(p, tailRing);
291  if (r!=NULL)
292  {
293  PrintS("+...");
294  pNext(pNext(p)) = r;
295  }
296  }
297 }
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:239
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ p_wrp() [2/2]

static void p_wrp ( poly  p,
ring  p_ring 
)
inlinestatic

Definition at line 1191 of file p_polys.h.

1192 {
1193  p_wrp(p, p_ring, p_ring);
1194 }
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:280
int p
Definition: cfModGcd.cc:4019

◆ p_WTotaldegree()

long p_WTotaldegree ( poly  p,
const ring  r 
)

Definition at line 603 of file p_polys.cc.

604 {
605  p_LmCheckPolyRing(p, r);
606  int i, k;
607  long j =0;
608 
609  // iterate through each block:
610  for (i=0;r->order[i]!=0;i++)
611  {
612  int b0=r->block0[i];
613  int b1=r->block1[i];
614  switch(r->order[i])
615  {
616  case ringorder_M:
617  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
618  { // in jedem block:
619  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/]*r->OrdSgn;
620  }
621  break;
622  case ringorder_am:
623  b1=si_min(b1,r->N);
624  /* no break, continue as ringorder_a*/
625  case ringorder_a:
626  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
627  { // only one line
628  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
629  }
630  return j*r->OrdSgn;
631  case ringorder_wp:
632  case ringorder_ws:
633  case ringorder_Wp:
634  case ringorder_Ws:
635  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
636  { // in jedem block:
637  j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
638  }
639  break;
640  case ringorder_lp:
641  case ringorder_ls:
642  case ringorder_rs:
643  case ringorder_dp:
644  case ringorder_ds:
645  case ringorder_Dp:
646  case ringorder_Ds:
647  case ringorder_rp:
648  for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
649  {
650  j+= p_GetExp(p,k,r);
651  }
652  break;
653  case ringorder_a64:
654  {
655  int64* w=(int64*)r->wvhdl[i];
656  for (k=0;k<=(b1 /*r->block1[i]*/ - b0 /*r->block0[i]*/);k++)
657  {
658  //there should be added a line which checks if w[k]>2^31
659  j+= p_GetExp(p,k+1, r)*(long)w[k];
660  }
661  //break;
662  return j;
663  }
664  case ringorder_c: /* nothing to do*/
665  case ringorder_C: /* nothing to do*/
666  case ringorder_S: /* nothing to do*/
667  case ringorder_s: /* nothing to do*/
668  case ringorder_IS: /* nothing to do */
669  case ringorder_unspec: /* to make clang happy, does not occur*/
670  case ringorder_no: /* to make clang happy, does not occur*/
671  case ringorder_L: /* to make clang happy, does not occur*/
672  case ringorder_aa: /* ignored by p_WTotaldegree*/
673  break;
674  /* no default: all orderings covered */
675  }
676  }
677  return j;
678 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:91
int j
Definition: facHensel.cc:105
for int64 weights
Definition: ring.h:71
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
opposite of ls
Definition: ring.h:92
long int64
Definition: auxiliary.h:66
int k
Definition: cfEzgcd.cc:92
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
for(int i=0;i<=n;i++) degsf[i]
Definition: cfEzgcd.cc:65
int i
Definition: cfEzgcd.cc:125
Induced (Schreyer) ordering.
Definition: ring.h:93
S?
Definition: ring.h:75
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118
const CanonicalForm & w
Definition: facAbsFact.cc:55
int p
Definition: cfModGcd.cc:4019
s?
Definition: ring.h:76

◆ pEnlargeSet()

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

Definition at line 3656 of file p_polys.cc.

3657 {
3658  poly* h;
3659 
3660  if (*p==NULL)
3661  {
3662  if (increment==0) return;
3663  h=(poly*)omAlloc0(increment*sizeof(poly));
3664  }
3665  else
3666  {
3667  h=(poly*)omReallocSize((poly*)*p,l*sizeof(poly),(l+increment)*sizeof(poly));
3668  if (increment>0)
3669  {
3670  memset(&(h[l]),0,increment*sizeof(poly));
3671  }
3672  }
3673  *p=h;
3674 }
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019
static Poly * h
Definition: janet.cc:971
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:93

◆ pHaveCommonMonoms()

BOOLEAN pHaveCommonMonoms ( poly  p,
poly  q 
)

Definition at line 173 of file pDebug.cc.

174 {
175  while (p != NULL)
176  {
177  if (pIsMonomOf(q, p))
178  {
179  return TRUE;
180  }
181  pIter(p);
182  }
183  return FALSE;
184 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:37
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:163
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ pIsMonomOf()

BOOLEAN pIsMonomOf ( poly  p,
poly  m 
)

Definition at line 163 of file pDebug.cc.

164 {
165  if (m == NULL) return TRUE;
166  while (p != NULL)
167  {
168  if (p == m) return TRUE;
169  pIter(p);
170  }
171  return FALSE;
172 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define pIter(p)
Definition: monomials.h:37
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ pLDeg0()

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

Definition at line 729 of file p_polys.cc.

730 {
731  p_CheckPolyRing(p, r);
732  long k= p_GetComp(p, r);
733  int ll=1;
734 
735  if (k > 0)
736  {
737  while ((pNext(p)!=NULL) && (__p_GetComp(pNext(p), r)==k))
738  {
739  pIter(p);
740  ll++;
741  }
742  }
743  else
744  {
745  while (pNext(p)!=NULL)
746  {
747  pIter(p);
748  ll++;
749  }
750  }
751  *l=ll;
752  return r->pFDeg(p, r);
753 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define p_GetComp(p, r)
Definition: monomials.h:64
int k
Definition: cfEzgcd.cc:92
#define pIter(p)
Definition: monomials.h:37
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg0c()

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

Definition at line 760 of file p_polys.cc.

761 {
762  assume(p!=NULL);
763  p_Test(p,r);
764  p_CheckPolyRing(p, r);
765  long o;
766  int ll=1;
767 
768  if (! rIsSyzIndexRing(r))
769  {
770  while (pNext(p) != NULL)
771  {
772  pIter(p);
773  ll++;
774  }
775  o = r->pFDeg(p, r);
776  }
777  else
778  {
779  int curr_limit = rGetCurrSyzLimit(r);
780  poly pp = p;
781  while ((p=pNext(p))!=NULL)
782  {
783  if (__p_GetComp(p, r)<=curr_limit/*syzComp*/)
784  ll++;
785  else break;
786  pp = p;
787  }
788  p_Test(pp,r);
789  o = r->pFDeg(pp, r);
790  }
791  *l=ll;
792  return o;
793 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
#define pIter(p)
Definition: monomials.h:37
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define p_Test(p, r)
Definition: p_polys.h:162
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1()

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

Definition at line 831 of file p_polys.cc.

832 {
833  p_CheckPolyRing(p, r);
834  long k= p_GetComp(p, r);
835  int ll=1;
836  long t,max;
837 
838  max=r->pFDeg(p, r);
839  if (k > 0)
840  {
841  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
842  {
843  t=r->pFDeg(p, r);
844  if (t>max) max=t;
845  ll++;
846  }
847  }
848  else
849  {
850  while ((p=pNext(p))!=NULL)
851  {
852  t=r->pFDeg(p, r);
853  if (t>max) max=t;
854  ll++;
855  }
856  }
857  *l=ll;
858  return max;
859 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define p_GetComp(p, r)
Definition: monomials.h:64
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1_Deg()

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

Definition at line 900 of file p_polys.cc.

901 {
902  assume(r->pFDeg == p_Deg);
903  p_CheckPolyRing(p, r);
904  long k= p_GetComp(p, r);
905  int ll=1;
906  long t,max;
907 
908  max=p_GetOrder(p, r);
909  if (k > 0)
910  {
911  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
912  {
913  t=p_GetOrder(p, r);
914  if (t>max) max=t;
915  ll++;
916  }
917  }
918  else
919  {
920  while ((p=pNext(p))!=NULL)
921  {
922  t=p_GetOrder(p, r);
923  if (t>max) max=t;
924  ll++;
925  }
926  }
927  *l=ll;
928  return max;
929 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define p_GetComp(p, r)
Definition: monomials.h:64
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:390
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:420
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1_Totaldegree()

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

Definition at line 965 of file p_polys.cc.

966 {
967  p_CheckPolyRing(p, r);
968  long k= p_GetComp(p, r);
969  int ll=1;
970  long t,max;
971 
972  max=p_Totaldegree(p, r);
973  if (k > 0)
974  {
975  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
976  {
977  t=p_Totaldegree(p, r);
978  if (t>max) max=t;
979  ll++;
980  }
981  }
982  else
983  {
984  while ((p=pNext(p))!=NULL)
985  {
986  t=p_Totaldegree(p, r);
987  if (t>max) max=t;
988  ll++;
989  }
990  }
991  *l=ll;
992  return max;
993 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define p_GetComp(p, r)
Definition: monomials.h:64
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1_WFirstTotalDegree()

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

Definition at line 1028 of file p_polys.cc.

1029 {
1030  p_CheckPolyRing(p, r);
1031  long k= p_GetComp(p, r);
1032  int ll=1;
1033  long t,max;
1034 
1035  max=p_WFirstTotalDegree(p, r);
1036  if (k > 0)
1037  {
1038  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
1039  {
1040  t=p_WFirstTotalDegree(p, r);
1041  if (t>max) max=t;
1042  ll++;
1043  }
1044  }
1045  else
1046  {
1047  while ((p=pNext(p))!=NULL)
1048  {
1049  t=p_WFirstTotalDegree(p, r);
1050  if (t>max) max=t;
1051  ll++;
1052  }
1053  }
1054  *l=ll;
1055  return max;
1056 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define p_GetComp(p, r)
Definition: monomials.h:64
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:586
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c()

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

Definition at line 867 of file p_polys.cc.

868 {
869  p_CheckPolyRing(p, r);
870  int ll=1;
871  long t,max;
872 
873  max=r->pFDeg(p, r);
874  if (rIsSyzIndexRing(r))
875  {
876  long limit = rGetCurrSyzLimit(r);
877  while ((p=pNext(p))!=NULL)
878  {
879  if (__p_GetComp(p, r)<=limit)
880  {
881  if ((t=r->pFDeg(p, r))>max) max=t;
882  ll++;
883  }
884  else break;
885  }
886  }
887  else
888  {
889  while ((p=pNext(p))!=NULL)
890  {
891  if ((t=r->pFDeg(p, r))>max) max=t;
892  ll++;
893  }
894  }
895  *l=ll;
896  return max;
897 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c_Deg()

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

Definition at line 931 of file p_polys.cc.

932 {
933  assume(r->pFDeg == p_Deg);
934  p_CheckPolyRing(p, r);
935  int ll=1;
936  long t,max;
937 
938  max=p_GetOrder(p, r);
939  if (rIsSyzIndexRing(r))
940  {
941  long limit = rGetCurrSyzLimit(r);
942  while ((p=pNext(p))!=NULL)
943  {
944  if (__p_GetComp(p, r)<=limit)
945  {
946  if ((t=p_GetOrder(p, r))>max) max=t;
947  ll++;
948  }
949  else break;
950  }
951  }
952  else
953  {
954  while ((p=pNext(p))!=NULL)
955  {
956  if ((t=p_GetOrder(p, r))>max) max=t;
957  ll++;
958  }
959  }
960  *l=ll;
961  return max;
962 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:390
static long p_GetOrder(poly p, ring r)
Definition: p_polys.h:420
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c_Totaldegree()

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

Definition at line 995 of file p_polys.cc.

996 {
997  p_CheckPolyRing(p, r);
998  int ll=1;
999  long t,max;
1000 
1001  max=p_Totaldegree(p, r);
1002  if (rIsSyzIndexRing(r))
1003  {
1004  long limit = rGetCurrSyzLimit(r);
1005  while ((p=pNext(p))!=NULL)
1006  {
1007  if (__p_GetComp(p, r)<=limit)
1008  {
1009  if ((t=p_Totaldegree(p, r))>max) max=t;
1010  ll++;
1011  }
1012  else break;
1013  }
1014  }
1015  else
1016  {
1017  while ((p=pNext(p))!=NULL)
1018  {
1019  if ((t=p_Totaldegree(p, r))>max) max=t;
1020  ll++;
1021  }
1022  }
1023  *l=ll;
1024  return max;
1025 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDeg1c_WFirstTotalDegree()

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

Definition at line 1058 of file p_polys.cc.

1059 {
1060  p_CheckPolyRing(p, r);
1061  int ll=1;
1062  long t,max;
1063 
1064  max=p_WFirstTotalDegree(p, r);
1065  if (rIsSyzIndexRing(r))
1066  {
1067  long limit = rGetCurrSyzLimit(r);
1068  while ((p=pNext(p))!=NULL)
1069  {
1070  if (__p_GetComp(p, r)<=limit)
1071  {
1072  if ((t=p_Totaldegree(p, r))>max) max=t;
1073  ll++;
1074  }
1075  else break;
1076  }
1077  }
1078  else
1079  {
1080  while ((p=pNext(p))!=NULL)
1081  {
1082  if ((t=p_Totaldegree(p, r))>max) max=t;
1083  ll++;
1084  }
1085  }
1086  *l=ll;
1087  return max;
1088 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:714
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:717
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
static int max(int a, int b)
Definition: fast_mult.cc:264
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:586
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLDegb()

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

Definition at line 801 of file p_polys.cc.

802 {
803  p_CheckPolyRing(p, r);
804  long k= p_GetComp(p, r);
805  long o = r->pFDeg(p, r);
806  int ll=1;
807 
808  if (k != 0)
809  {
810  while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
811  {
812  ll++;
813  }
814  }
815  else
816  {
817  while ((p=pNext(p)) !=NULL)
818  {
819  ll++;
820  }
821  }
822  *l=ll;
823  return o;
824 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
#define p_GetComp(p, r)
Definition: monomials.h:64
int k
Definition: cfEzgcd.cc:92
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:110
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019
int l
Definition: cfEzgcd.cc:93

◆ pLength()

static unsigned pLength ( poly  a)
inlinestatic

Definition at line 191 of file p_polys.h.

192 {
193  unsigned l = 0;
194  while (a!=NULL)
195  {
196  pIter(a);
197  l++;
198  }
199  return l;
200 }
#define pIter(p)
Definition: monomials.h:37
#define NULL
Definition: omList.c:12
int l
Definition: cfEzgcd.cc:93

◆ pp_Jet()

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

Definition at line 4264 of file p_polys.cc.

4265 {
4266  poly r=NULL;
4267  poly t=NULL;
4268 
4269  while (p!=NULL)
4270  {
4271  if (p_Totaldegree(p,R)<=m)
4272  {
4273  if (r==NULL)
4274  r=p_Head(p,R);
4275  else
4276  if (t==NULL)
4277  {
4278  pNext(r)=p_Head(p,R);
4279  t=pNext(r);
4280  }
4281  else
4282  {
4283  pNext(t)=p_Head(p,R);
4284  pIter(t);
4285  }
4286  }
4287  pIter(p);
4288  }
4289  return r;
4290 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1442
#define pIter(p)
Definition: monomials.h:37
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ pp_JetW()

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

Definition at line 4309 of file p_polys.cc.

4310 {
4311  poly r=NULL;
4312  poly t=NULL;
4313  while (p!=NULL)
4314  {
4315  if (totaldegreeWecart_IV(p,R,w)<=m)
4316  {
4317  if (r==NULL)
4318  r=p_Head(p,R);
4319  else
4320  if (t==NULL)
4321  {
4322  pNext(r)=p_Head(p,R);
4323  t=pNext(r);
4324  }
4325  else
4326  {
4327  pNext(t)=p_Head(p,R);
4328  pIter(t);
4329  }
4330  }
4331  pIter(p);
4332  }
4333  return r;
4334 }
long totaldegreeWecart_IV(poly p, ring r, const short *w)
Definition: weight.cc:231
#define pIter(p)
Definition: monomials.h:37
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:824
int m
Definition: cfEzgcd.cc:121
#define NULL
Definition: omList.c:12
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

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

1026 {
1027  int shorter;
1028  return r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1029 }
int m
Definition: cfEzgcd.cc:121
int p
Definition: cfModGcd.cc:4019

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

1034 {
1035  int shorter;
1036  poly pp = r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1037  lp -= shorter;
1038  return pp;
1039 }
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int m
Definition: cfEzgcd.cc:121
int p
Definition: cfModGcd.cc:4019

◆ pp_Mult_mm()

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

Definition at line 986 of file p_polys.h.

987 {
988  if (p==NULL) return NULL;
989  if (p_LmIsConstant(m, r))
990  return __pp_Mult_nn(p, pGetCoeff(m), r);
991  else
992  return r->p_Procs->pp_Mult_mm(p, m, r);
993 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:44
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:978
int m
Definition: cfEzgcd.cc:121
#define __pp_Mult_nn(p, n, r)
Definition: p_polys.h:957
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ pp_Mult_nn()

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

Definition at line 947 of file p_polys.h.

948 {
949  if (p==NULL) return NULL;
950  if (n_IsOne(n, r->cf))
951  return p_Copy(p, r);
952  else if (n_IsZero(n, r->cf))
953  return NULL;
954  else
955  return r->p_Procs->pp_Mult_nn(p, n, r);
956 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:468
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the zero element.
Definition: coeffs.h:464
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ pp_Mult_qq()

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

Definition at line 1086 of file p_polys.h.

1087 {
1088  if (p == NULL || q == NULL) return NULL;
1089 
1090  if (pNext(p) == NULL)
1091  {
1092  return r->p_Procs->pp_mm_Mult(q, p, r);
1093  }
1094 
1095  if (pNext(q) == NULL)
1096  {
1097  return r->p_Procs->pp_Mult_mm(p, q, r);
1098  }
1099 
1100  poly qq = q;
1101  if (p == q)
1102  qq = p_Copy(q, r);
1103 
1104  poly res;
1105 #ifdef HAVE_PLURAL
1106  if (rIsPluralRing(r))
1107  res = _nc_pp_Mult_qq(p, qq, r);
1108  else
1109 #endif
1110  res = _p_Mult_q(p, qq, 1, r);
1111 
1112  if (qq != q)
1113  p_Delete(&qq, r);
1114  return res;
1115 }
poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r)
general NC-multiplication without destruction
Definition: old.gring.cc:254
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
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
CanonicalForm res
Definition: facAbsFact.cc:64
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ pRestoreDegProcs()

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

Definition at line 3609 of file p_polys.cc.

3610 {
3611  assume(old_FDeg != NULL && old_lDeg != NULL);
3612  r->pFDeg = old_FDeg;
3613  r->pLDeg = old_lDeg;
3614 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12

◆ pReverse()

static poly pReverse ( poly  p)
inlinestatic

Definition at line 334 of file p_polys.h.

335 {
336  if (p == NULL || pNext(p) == NULL) return p;
337 
338  poly q = pNext(p), // == pNext(p)
339  qn;
340  pNext(p) = NULL;
341  do
342  {
343  qn = pNext(q);
344  pNext(q) = p;
345  p = q;
346  q = qn;
347  }
348  while (qn != NULL);
349  return p;
350 }
#define NULL
Definition: omList.c:12
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ pSetDegProcs()

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

Definition at line 3597 of file p_polys.cc.

3598 {
3599  assume(new_FDeg != NULL);
3600  r->pFDeg = new_FDeg;
3601 
3602  if (new_lDeg == NULL)
3603  new_lDeg = r->pLDegOrig;
3604 
3605  r->pLDeg = new_lDeg;
3606 }
#define assume(x)
Definition: mod2.h:390
#define NULL
Definition: omList.c:12