Loading...
Searching...
No Matches
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)
#define | p_Test(p, r)
#define | p_LmTest(p, r)
#define | pp_Test(p, lmRing, tailRing)
#define | p_SetmComp p_Setm
#define | __p_Mult_nn(p, n, r)
#define | __pp_Mult_nn(p, n, r)
#define | _p_LmCmpAction(p, q, r, actionE, actionG, actionS)
#define | pDivAssume(x)
#define | p_LmCmpAction(p, q, r, actionE, actionG, actionS)
#define | p_LmEqual(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_GetShortExpVector0 (const poly a, const ring r)
unsigned long | p_GetShortExpVector1 (const poly a, const ring r)
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
poly | p_One (const ring r)
int | p_MinDeg (poly p, intvec *w, const ring R)
long | p_DegW (poly p, const int *w, const ring R)
BOOLEAN | p_OneComp (poly p, const ring r)
| return TRUE if all monoms have the same component
int | p_IsPurePower (const poly p, const ring r)
| return i, if head depends only on var(i)
int | p_IsUnivariate (poly p, const ring r)
| return i, if poly depends only on var(i)
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)
poly | p_ISet (long i, const ring r)
| returns the poly representing the integer i
poly | p_NSet (number n, const ring r)
| returns the poly representing the number n, destroys n
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))
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 int | 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)
poly | p_HomogenDP (poly p, int varnum, const ring r)
BOOLEAN | p_IsHomogeneous (poly p, const ring r)
BOOLEAN | p_IsHomogeneousDP (poly p, const ring r)
BOOLEAN | p_IsHomogeneousW (poly p, const intvec *w, const ring r)
BOOLEAN | p_IsHomogeneousW (poly p, const intvec *w, const intvec *module_w, 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
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
void | p_String0Long (const poly p, ring lmRing, ring tailRing)
| print p in a long way
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
long | p_Deg (poly a, const ring r)
static number | p_SetCoeff (poly p, number n, ring r)
static long | p_GetOrder (poly p, ring r)
static unsigned long | p_AddComp (poly p, unsigned long v, ring r)
static unsigned long | p_SubComp (poly p, unsigned long v, ring r)
static long | p_GetExp (const poly p, const unsigned long iBitmask, const int VarOffset)
| get a single variable exponent @Note: the integer VarOffset encodes:
static unsigned long | p_SetExp (poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
| set a single variable exponent @Note: VarOffset encodes the position in p->exp
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
static long | p_SetExp (poly p, const int v, const long e, const ring r)
| set v^th exponent for a monomial
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_LmDelete0 (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
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
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)
static poly | p_Copy (poly p, const ring r)
| returns a copy of p
static poly | p_Head (const poly p, const ring r)
| copy the (leading) term of p
poly | p_Head0 (const poly p, const ring r)
| like p_Head, but allow NULL coeff
poly | p_CopyPowerProduct (const poly p, const ring r)
| like p_Head, but with coefficient 1
poly | p_CopyPowerProduct0 (const poly p, const number n, const ring r)
| like p_Head, but with coefficient n
static poly | p_Copy (poly p, const ring lmRing, const ring tailRing)
| returns a copy of p with Lm(p) from lmRing and Tail(p) from 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)
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 | pp_mm_Mult (poly p, poly m, const ring r)
static poly | p_Mult_mm (poly p, poly m, const ring r)
static poly | p_mm_Mult (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, !rIsPluralRing(r), nCoeff_is_Domain.
poly | _p_Mult_q_Normal_ZeroDiv (poly p, poly q, const int copy, const ring r)
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 int64 | p_GetExpVLV (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 void | p_SetExpVLV (poly p, int64 *ev, int64 comp, 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
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
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_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_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_IsConstantComp (const poly p, const ring r)
| like the respective p_LmIs* routines, except that p might be empty
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)?!
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 | pp_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:
BOOLEAN | p_VectorHasUnitB (poly p, int *k, const ring r)
void | p_VectorHasUnit (poly p, int *k, int *len, const ring r)
void | p_TakeOutComp (poly *p, long comp, poly *q, int *lq, const ring r)
| Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other monoms *lq == pLength(*q) On return all components pf *q == 0.
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 | pp_Jet0 (poly p, const ring R)
poly | p_Jet (poly p, int m, const ring R)
poly | pp_JetW (poly p, int m, int *w, const ring R)
poly | p_JetW (poly p, int m, int *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
void | p_Shift (poly *p, int i, const ring r)
| shifts components of the vector p by i
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
poly | p_Div_mm (poly p, const poly m, const ring r)
| divide polynomial by monomial
int | p_MaxExpPerVar (poly p, int i, const ring r)
| max exponent of variable x_i in p

## Macro Definition Documentation

## __p_Mult_nn

#define __p_Mult_nn | ( |  | p,
|  |  | n,
|  |  | r )

Value:
r->p_Procs->p_Mult_nn(p, n, r)
p
int p
Definition cfModGcd.cc:4086

Definition at line 973 of file p_polys.h.

## __pp_Mult_nn

#define __pp_Mult_nn | ( |  | p,
|  |  | n,
|  |  | r )

Value:
r->p_Procs->pp_Mult_nn(p, n, r)

Definition at line 1004 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)
p_MemCmp_LengthGeneral_OrdGeneral
#define p_MemCmp_LengthGeneral_OrdGeneral(s1, s2, length, ordsgn, actionE, actionG, actionS)
Definition p_MemCmp.h:719

Definition at line 1297 of file p_polys.h.

#define _p_LmCmpAction(p, q, r, actionE, actionG, actionS) \
p_MemCmp_LengthGeneral_OrdGeneral(p->exp, q->exp, r->CmpL_Size, r->ordsgn, \
actionE, actionG, actionS)

## p_LmCmpAction

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

Value:
_p_LmCmpAction(p, q, r, actionE, actionG, actionS)
_p_LmCmpAction
#define _p_LmCmpAction(p, q, r, actionE, actionG, actionS)
Definition p_polys.h:1297

Definition at line 1740 of file p_polys.h.

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

## p_LmEqual

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

Value:
p_ExpVectorEqual(p1, p2, r)
p_ExpVectorEqual
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition p_polys.cc:4680

Definition at line 1744 of file p_polys.h.

## p_LmTest

#define p_LmTest | ( |  | p,
|  |  | r )

Value:
_p_LmTest(p, r, PDEBUG)
PDEBUG
#define PDEBUG
Definition auxiliary.h:171
_p_LmTest
BOOLEAN _p_LmTest(poly p, ring r, int level)
Definition pDebug.cc:322

Definition at line 162 of file p_polys.h.

## p_SetmComp

#define p_SetmComp p_Setm

Definition at line 246 of file p_polys.h.

## p_Test

#define p_Test | ( |  | p,
|  |  | r )

Value:
_p_Test(p, r, PDEBUG)
_p_Test
BOOLEAN _p_Test(poly p, ring r, int level)
Definition pDebug.cc:211

Definition at line 161 of file p_polys.h.

## pDivAssume

#define pDivAssume | ( |  | x | ) |

Value:
do {} while (0)

Definition at line 1303 of file p_polys.h.

## pIfThen

#define pIfThen | ( |  | cond,
|  |  | check )

Value:
do {if (cond) {check;}} while (0)
check
VAR int check
Definition libparse.cc:1106

Definition at line 155 of file p_polys.h.

## pp_Test

#define pp_Test | ( |  | p,
|  |  | lmRing,
|  |  | tailRing )

Value:
_pp_Test(p, lmRing, tailRing, PDEBUG)
_pp_Test
BOOLEAN _pp_Test(poly p, ring lmRing, ring tailRing, int level)
Definition pDebug.cc:332

Definition at line 163 of file p_polys.h.

## Function Documentation

## _p_LmDivisibleBy()

BOOLEAN _p_LmDivisibleBy | ( | poly | a,
|  | poly | b,
|  | const ring | r )

inline static

Definition at line 1892 of file p_polys.h.

{
if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
return _p_LmDivisibleByNoComp(a, b, r);
return FALSE;
}
FALSE
#define FALSE
Definition auxiliary.h:97
b
CanonicalForm b
Definition cfModGcd.cc:4111
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
_p_LmDivisibleByNoComp
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
Definition p_polys.h:1786

## _p_LmDivisibleByNoComp() [1/2]

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

inline static

Definition at line 1835 of file p_polys.h.

{
int i=r_a->N;
pAssume1(r_a->N == r_b->N);
do
{
if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
{
return FALSE;
}
i--;
}
while (i);
/*#ifdef HAVE_RINGS
return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
#else
*/
return TRUE;
//#endif
}
TRUE
#define TRUE
Definition auxiliary.h:101
i
int i
Definition cfEzgcd.cc:132
pAssume1
#define pAssume1(cond)
Definition monomials.h:171
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471

## _p_LmDivisibleByNoComp() [2/2]

BOOLEAN _p_LmDivisibleByNoComp | ( | poly | a,
|  | poly | b,
|  | const ring | r )

inline static

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

{
int i=r->VarL_Size - 1;
unsigned long divmask = r->divmask;
unsigned long la, lb;
if (r->VarL_LowIndex >= 0)
{
i += r->VarL_LowIndex;
do
{
la = a->exp[i];
lb = b->exp[i];
if ((la > lb) ||
(((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
{
pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == FALSE);
return FALSE;
}
i--;
}
while (i>=r->VarL_LowIndex);
}
else
{
do
{
la = a->exp[r->VarL_Offset[i]];
lb = b->exp[r->VarL_Offset[i]];
if ((la > lb) ||
(((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
{
pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == FALSE);
return FALSE;
}
i--;
}
while (i>=0);
}
/*#ifdef HAVE_RINGS
pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf));
return (!rField_is_Ring(r)) || n_DivBy(p_GetCoeff(b, r), p_GetCoeff(a, r), r->cf);
#else
*/
pDivAssume(p_DebugLmDivisibleByNoComp(a, b, r) == TRUE);
return TRUE;
//#endif
}
p_DebugLmDivisibleByNoComp
BOOLEAN p_DebugLmDivisibleByNoComp(poly a, poly b, ring r)
Definition pDebug.cc:144
pDivAssume
#define pDivAssume(x)
Definition p_polys.h:1303

## _p_LmDivisibleByNoCompPart()

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

inline static

Definition at line 1858 of file p_polys.h.

{
int i=end;
pAssume1(r_a->N == r_b->N);
do
{
if (p_GetExp(a,i,r_a) > p_GetExp(b,i,r_b))
return FALSE;
i--;
}
while (i>=start);
/*#ifdef HAVE_RINGS
return n_DivBy(p_GetCoeff(b, r_b), p_GetCoeff(a, r_a), r_a->cf);
#else
*/
return TRUE;
//#endif
}

## _p_LmDivisibleByPart()

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

inline static

Definition at line 1877 of file p_polys.h.

{
if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
return _p_LmDivisibleByNoCompPart(a, r_a, b, r_b,start,end);
return FALSE;
}
_p_LmDivisibleByNoCompPart
static BOOLEAN _p_LmDivisibleByNoCompPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition p_polys.h:1858

## _p_LmTest()

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

Definition at line 322 of file pDebug.cc.

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

## _p_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, !rIsPluralRing(r), nCoeff_is_Domain.

Definition at line 309 of file p_Mult_q.cc.

{
assume(r != NULL);
int lp=0, lq=0;
poly pt;
BOOLEAN pure_polys=(p_GetComp(p,r)==0) && (p_GetComp(q,r)==0);
#ifdef HAVE_FLINT
#if __FLINT_RELEASE >= 20503
if (pure_polys)
{
pqLengthApprox(p, q, lp, lq, MIN_LENGTH_MAX);
if (lp < lq)
{
int l;
pt = p;
p = q;
q = pt;
l = lp;
lp = lq;
lq = l;
}
if ((lq>MIN_FLINT_QQ) && rField_is_Q(r))
{
fmpq_mpoly_ctx_t ctx;
if (!convSingRFlintR(ctx,r))
{
// lq is a lower bound for the length of p and q
poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
if (!copy)
{
p_Delete(&p,r);
p_Delete(&q,r);
}
return res;
}
}
else if ((lq>MIN_FLINT_Zp) && rField_is_Zp(r))
{
nmod_mpoly_ctx_t ctx;
if (!convSingRFlintR(ctx,r))
{
// lq is a lower bound for the length of p and q
poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
if (!copy)
{
p_Delete(&p,r);
p_Delete(&q,r);
}
return res;
}
}
else if ((lq>MIN_FLINT_Z) && rField_is_Z(r))
{
fmpz_mpoly_ctx_t ctx;
if (!convSingRFlintR(ctx,r))
{
// lq is a lower bound for the length of p and q
poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
if (!copy)
{
p_Delete(&p,r);
p_Delete(&q,r);
}
return res;
}
}
}
#endif
#endif
if (lp==0)
pqLengthApprox(p, q, lp, lq, MIN_LENGTH_BUCKET);
if (lp < lq)
{
int l;
pt = p;
p = q;
q = pt;
l = lp;
lp = lq;
lq = l;
}
if (lq < MIN_LENGTH_BUCKET || TEST_OPT_NOT_BUCKETS)
return _p_Mult_q_Normal(p, q, copy, r);
#if 0
else if (pure_polys
&& ((r->cf->extRing==NULL)||(r->cf->extRing->qideal!=NULL))
/* exclude trans. extensions: may contain rat.funct as cf */
&& (lq >= MIN_LENGTH_FACTORY)
&& (r->cf->convSingNFactoryN!=ndConvSingNFactoryN))
{
poly h=singclap_pmult(p,q,r);
if (!copy)
{
p_Delete(&p,r);
p_Delete(&q,r);
}
return h;
}
#endif
else
{
lp=pLength(p);
lq=pLength(q);
if (lp < lq)
{
int l;
pt = p;
p = q;
q = pt;
l = lp;
lp = lq;
lq = l;
}
return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
}
}
l
int l
Definition cfEzgcd.cc:100
singclap_pmult
poly singclap_pmult(poly f, poly g, const ring r)
Definition clapsing.cc:597
res
CanonicalForm res
Definition facAbsFact.cc:60
copy
CFArray copy(const CFList &list)
write elements of list into an array
Definition facFqBivarUtil.cc:364
h
STATIC_VAR Poly * h
Definition janet.cc:971
assume
#define assume(x)
Definition mod2.h:389
lq
Definition lq.h:40
ndConvSingNFactoryN
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition numbers.cc:313
TEST_OPT_NOT_BUCKETS
#define TEST_OPT_NOT_BUCKETS
Definition options.h:107
pqLengthApprox
static void pqLengthApprox(poly p, poly q, int &lp, int &lq, const int min)
Definition p_Mult_q.cc:69
_p_Mult_q_Normal
poly _p_Mult_q_Normal(poly p, poly q, const int copy, const ring r)
Definition p_Mult_q.cc:223
MIN_FLINT_Z
#define MIN_FLINT_Z
Definition p_Mult_q.cc:304
_p_Mult_q_Bucket
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:100
MIN_LENGTH_MAX
#define MIN_LENGTH_MAX
Definition p_Mult_q.cc:301
MIN_FLINT_QQ
#define MIN_FLINT_QQ
Definition p_Mult_q.cc:302
MIN_FLINT_Zp
#define MIN_FLINT_Zp
Definition p_Mult_q.cc:303
MIN_LENGTH_BUCKET
#define MIN_LENGTH_BUCKET
Definition p_Mult_q.h:21
pLength
static int pLength(poly a)
Definition p_polys.h:190
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
rField_is_Z
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:515
rField_is_Zp
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
rField_is_Q
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:512

## _p_Mult_q_Normal_ZeroDiv()

poly _p_Mult_q_Normal_ZeroDiv | ( | poly | p,
|  | poly | q,
|  | const int | copy,
|  | const ring | r )

Definition at line 195 of file p_Mult_q.cc.

{
assume(p != NULL && pNext(p) != NULL && q != NULL && pNext(q) != NULL);
pAssume1(! pHaveCommonMonoms(p, q));
p_Test(p, r);
p_Test(q, r);
poly res = pp_Mult_mm(p,q,r); // holds initially q1*p
poly qq = pNext(q); // we iter of this
while (qq != NULL)
{
res = p_Plus_mm_Mult_qq(res, qq, p, r);
pIter(qq);
}
if (!copy)
{
p_Delete(&p, r);
p_Delete(&q, r);
}
p_Test(res, r);
return res;
}
pIter
#define pIter(p)
Definition monomials.h:37
pp_Mult_mm
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1033
p_Plus_mm_Mult_qq
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
Definition p_polys.h:1204
pHaveCommonMonoms
BOOLEAN pHaveCommonMonoms(poly p, poly q)
Definition pDebug.cc:174
p_Test
#define p_Test(p, r)
Definition p_polys.h:161

## _p_Test()

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

Definition at line 211 of file pDebug.cc.

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

## _pp_Test()

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

Definition at line 332 of file pDebug.cc.

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

## n_PermNumber()

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

Definition at line 4153 of file p_polys.cc.

{
#if 0
PrintS("\nSource Ring: \n");
rWrite(src);
if(0)
{
number zz = n_Copy(z, src->cf);
PrintS("z: "); n_Write(zz, src);
n_Delete(&zz, src->cf);
}
PrintS("\nDestination Ring: \n");
rWrite(dst);
/*Print("\nOldPar: %d\n", OldPar);
for( int i = 1; i <= OldPar; i++ )
{
Print("par(%d) -> par/var (%d)\n", i, par_perm[i-1]);
}*/
#endif
if( z == NULL )
return NULL;
const coeffs srcCf = src->cf;
assume( srcCf != NULL );
assume( !nCoeff_is_GF(srcCf) );
assume( src->cf->extRing!=NULL );
poly zz = NULL;
const ring srcExtRing = srcCf->extRing;
assume( srcExtRing != NULL );
const coeffs dstCf = dst->cf;
assume( dstCf != NULL );
if( nCoeff_is_algExt(srcCf) ) // nCoeff_is_GF(srcCf)?
{
zz = (poly) z;
if( zz == NULL ) return NULL;
}
else if (nCoeff_is_transExt(srcCf))
{
assume( !IS0(z) );
zz = NUM((fraction)z);
p_Test (zz, srcExtRing);
if( zz == NULL ) return NULL;
if( !DENIS1((fraction)z) )
{
if (!p_IsConstant(DEN((fraction)z),srcExtRing))
WarnS("Not defined: Cannot map a rational fraction and make a polynomial out of it! Ignoring the denominator.");
}
}
else
{
assume (FALSE);
WerrorS("Number permutation is not implemented for this data yet!");
return NULL;
}
assume( zz != NULL );
p_Test (zz, srcExtRing);
nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf);
assume( nMap != NULL );
poly qq;
if ((par_perm == NULL) && (rPar(dst) != 0 && rVar (srcExtRing) > 0))
{
int* perm;
perm=(int *)omAlloc0((rVar(srcExtRing)+1)*sizeof(int));
for(int i=si_min(rVar(srcExtRing),rPar(dst));i>0;i--)
perm[i]=-i;
qq = p_PermPoly(zz, perm, srcExtRing, dst, nMap, NULL, rVar(srcExtRing)-1);
omFreeSize ((ADDRESS)perm, (rVar(srcExtRing)+1)*sizeof(int));
}
else
qq = p_PermPoly(zz, par_perm-1, srcExtRing, dst, nMap, NULL, rVar (srcExtRing)-1);
if(nCoeff_is_transExt(srcCf)
&& (!DENIS1((fraction)z))
&& p_IsConstant(DEN((fraction)z),srcExtRing))
{
number n=nMap(pGetCoeff(DEN((fraction)z)),srcExtRing->cf, dstCf);
qq=p_Div_nn(qq,n,dst);
n_Delete(&n,dstCf);
p_Normalize(qq,dst);
}
p_Test (qq, dst);
return qq;
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
si_min
static int si_min(const int a, const int b)
Definition auxiliary.h:126
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457
nCoeff_is_GF
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition coeffs.h:834
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:703
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
n_Write
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:594
nCoeff_is_algExt
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:905
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
nCoeff_is_transExt
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition coeffs.h:913
WarnS
#define WarnS
Definition emacs.cc:78
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
p_PermPoly
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition p_polys.cc:4256
p_Div_nn
poly p_Div_nn(poly p, const number n, const ring r)
Definition p_polys.cc:1506
p_Normalize
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3939
p_IsConstant
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition p_polys.h:1985
NUM
#define NUM
Definition readcf.cc:180
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
rWrite
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
rPar
static int rPar(const ring r)
(r->cf->P)
Definition ring.h:605
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598

## p_Add_q() [1/2]

poly p_Add_q | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 938 of file p_polys.h.

{
assume( (p != q) || (p == NULL && q == NULL) );
if (q==NULL) return p;
if (p==NULL) return q;
int shorter;
return r->p_Procs->p_Add_q(p, q, shorter, r);
}

## p_Add_q() [2/2]

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

inline static

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

Definition at line 948 of file p_polys.h.

{
assume( (p != q) || (p == NULL && q == NULL) );
if (q==NULL) return p;
if (p==NULL) { lp=lq; return q; }
int shorter;
poly res = r->p_Procs->p_Add_q(p, q, shorter, r);
lp += lq - shorter;
return res;
}

## p_AddComp()

unsigned long p_AddComp | ( | poly | p,
|  | unsigned long | v,
|  | ring | r )

inline static

Definition at line 449 of file p_polys.h.

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

## p_AddExp()

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

inline static

Definition at line 608 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
int e = p_GetExp(p,v,r);
e += ee;
return p_SetExp(p,v,e,r);
}
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490

## p_CheckIsFromRing()

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

Definition at line 105 of file pDebug.cc.

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

## p_CheckPolyRing()

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

Definition at line 115 of file pDebug.cc.

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

## p_CheckRing()

BOOLEAN p_CheckRing | ( | ring | r | ) |

Definition at line 131 of file pDebug.cc.

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

## p_ChineseRemainder()

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

Definition at line 88 of file p_polys.cc.

{
poly r,h,hh;
int j;
poly res_p=NULL;
loop
{
/* search the lead term */
r=NULL;
for(j=rl-1;j>=0;j--)
{
h=xx[j];
if ((h!=NULL)
&&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
r=h;
}
/* nothing found -> return */
if (r==NULL) break;
/* create the monomial in h */
h=p_Head(r,R);
/* collect the coeffs in x[..]*/
for(j=rl-1;j>=0;j--)
{
hh=xx[j];
if ((hh!=NULL) && (p_LmCmp(h,hh,R)==0))
{
x[j]=pGetCoeff(hh);
hh=p_LmFreeAndNext(hh,R);
xx[j]=hh;
}
else
x[j]=n_Init(0, R->cf);
}
number n=n_ChineseRemainderSym(x,q,rl,TRUE,inv_cache,R->cf);
for(j=rl-1;j>=0;j--)
{
x[j]=NULL; // n_Init(0...) takes no memory
}
if (n_IsZero(n,R->cf)) p_Delete(&h,R);
else
{
//Print("new mon:");pWrite(h);
p_SetCoeff(h,n,R);
pNext(h)=res_p;
res_p=h; // building res_p in reverse order!
}
}
res_p=pReverse(res_p);
p_Test(res_p, R);
return res_p;
}
x
Variable x
Definition cfModGcd.cc:4090
n_ChineseRemainderSym
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition coeffs.h:759
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
j
int j
Definition facHensel.cc:110
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition p_polys.h:414
pReverse
static poly pReverse(poly p)
Definition p_polys.h:337
p_Head
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition p_polys.h:713
R
#define R
Definition sirandom.c:27
loop
#define loop
Definition structs.h:71

## p_Cleardenom()

poly p_Cleardenom | ( | poly | p,
|  | const ring | r )

Definition at line 2893 of file p_polys.cc.

{
if( p == NULL )
return NULL;
assume( r != NULL );
assume( r->cf != NULL );
const coeffs C = r->cf;
#if CLEARENUMERATORS
if( 0 )
{
CPolyCoeffsEnumerator itr(p);
n_ClearDenominators(itr, C);
n_ClearContent(itr, C); // divide out the content
p_Test(p, r); n_Test(pGetCoeff(p), C);
assume(n_GreaterZero(pGetCoeff(p), C)); // ??
// if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
return p;
}
#endif
number d, h;
if (rField_is_Ring(r))
{
if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
return p;
}
if (rField_is_Zp(r) && TEST_OPT_INTSTRATEGY)
{
if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
return p;
}
assume(p != NULL);
if(pNext(p)==NULL)
{
if (!TEST_OPT_CONTENTSB)
p_SetCoeff(p,n_Init(1,C),r);
else if(!n_GreaterZero(pGetCoeff(p),C))
p = p_Neg(p,r);
return p;
}
assume(pNext(p)!=NULL);
poly start=p;
#if 0 && CLEARENUMERATORS
//CF: does not seem to work that well..
if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
{
CPolyCoeffsEnumerator itr(p);
n_ClearDenominators(itr, C);
n_ClearContent(itr, C); // divide out the content
p_Test(p, r); n_Test(pGetCoeff(p), C);
assume(n_GreaterZero(pGetCoeff(p), C)); // ??
// if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
return start;
}
#endif
if(1)
{
// get lcm of all denominators ----------------------------------
h = n_Init(1,C);
while (p!=NULL)
{
n_Normalize(pGetCoeff(p),C);
d=n_NormalizeHelper(h,pGetCoeff(p),C);
n_Delete(&h,C);
h=d;
pIter(p);
}
/* h now contains the 1/lcm of all denominators */
if(!n_IsOne(h,C))
{
// multiply by the lcm of all denominators
p = start;
while (p!=NULL)
{
d=n_Mult(h,pGetCoeff(p),C);
n_Normalize(d,C);
p_SetCoeff(p,d,r);
pIter(p);
}
}
n_Delete(&h,C);
p=start;
p_ContentForGB(p,r);
#ifdef HAVE_RATGRING
if (rIsRatGRing(r))
{
/* quick unit detection in the rational case is done in gr_nc_bba */
p_ContentRat(p, r);
start=p;
}
#endif
}
if(!n_GreaterZero(pGetCoeff(p),C)) p = p_Neg(p,r);
return start;
}
CPolyCoeffsEnumerator
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
Definition PolyEnumerator.h:130
n_Mult
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition coeffs.h:639
n_NormalizeHelper
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition coeffs.h:698
n_GreaterZero
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition coeffs.h:500
nCoeff_is_Q
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition coeffs.h:801
n_ClearDenominators
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition coeffs.h:934
nCoeff_is_Q_a
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition coeffs.h:880
n_ClearContent
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition coeffs.h:927
n_Normalize
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition coeffs.h:581
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition coeffs.h:474
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
TEST_OPT_CONTENTSB
#define TEST_OPT_CONTENTSB
Definition options.h:129
p_ContentRat
void p_ContentRat(poly &ph, const ring r)
Definition p_polys.cc:1748
p_ContentForGB
void p_ContentForGB(poly ph, const ring r)
Definition p_polys.cc:2403
p_Neg
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1114
rIsRatGRing
static BOOLEAN rIsRatGRing(const ring r)
Definition ring.h:433
rField_is_Ring
#define rField_is_Ring(R)
Definition ring.h:491

## p_Cleardenom_n()

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

Definition at line 3002 of file p_polys.cc.

{
const coeffs C = r->cf;
number d, h;
assume( ph != NULL );
poly p = ph;
#if CLEARENUMERATORS
if( 0 )
{
CPolyCoeffsEnumerator itr(ph);
n_ClearDenominators(itr, d, C); // multiply with common denom. d
n_ClearContent(itr, h, C); // divide by the content h
c = n_Div(d, h, C); // d/h
n_Delete(&d, C);
n_Delete(&h, C);
n_Test(c, C);
p_Test(ph, r); n_Test(pGetCoeff(ph), C);
assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
/*
if(!n_GreaterZero(pGetCoeff(ph),C))
{
ph = p_Neg(ph,r);
c = n_InpNeg(c, C);
}
*/
return;
}
#endif
if( pNext(p) == NULL )
{
if(!TEST_OPT_CONTENTSB)
{
c=n_Invers(pGetCoeff(p), C);
p_SetCoeff(p, n_Init(1, C), r);
}
else
{
c=n_Init(1,C);
}
if(!n_GreaterZero(pGetCoeff(ph),C))
{
ph = p_Neg(ph,r);
c = n_InpNeg(c, C);
}
return;
}
if (TEST_OPT_CONTENTSB) { c=n_Init(1,C); return; }
assume( pNext(p) != NULL );
#if CLEARENUMERATORS
if( nCoeff_is_Q(C) || nCoeff_is_Q_a(C) )
{
CPolyCoeffsEnumerator itr(ph);
n_ClearDenominators(itr, d, C); // multiply with common denom. d
n_ClearContent(itr, h, C); // divide by the content h
c = n_Div(d, h, C); // d/h
n_Delete(&d, C);
n_Delete(&h, C);
n_Test(c, C);
p_Test(ph, r); n_Test(pGetCoeff(ph), C);
assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
/*
if(!n_GreaterZero(pGetCoeff(ph),C))
{
ph = p_Neg(ph,r);
c = n_InpNeg(c, C);
}
*/
return;
}
#endif
if(1)
{
h = n_Init(1,C);
while (p!=NULL)
{
n_Normalize(pGetCoeff(p),C);
d=n_NormalizeHelper(h,pGetCoeff(p),C);
n_Delete(&h,C);
h=d;
pIter(p);
}
c=h;
/* contains the 1/lcm of all denominators */
if(!n_IsOne(h,C))
{
p = ph;
while (p!=NULL)
{
/* should be: // NOTE: don't use ->coef!!!!
* number hh;
* nGetDenom(p->coef,&hh);
* nMult(&h,&hh,&d);
* nNormalize(d);
* nDelete(&hh);
* nMult(d,p->coef,&hh);
* nDelete(&d);
* nDelete(&(p->coef));
* p->coef =hh;
*/
d=n_Mult(h,pGetCoeff(p),C);
n_Normalize(d,C);
p_SetCoeff(p,d,r);
pIter(p);
}
if (rField_is_Q_a(r))
{
loop
{
h = n_Init(1,C);
p=ph;
while (p!=NULL)
{
d=n_NormalizeHelper(h,pGetCoeff(p),C);
n_Delete(&h,C);
h=d;
pIter(p);
}
/* contains the 1/lcm of all denominators */
if(!n_IsOne(h,C))
{
p = ph;
while (p!=NULL)
{
/* should be: // NOTE: don't use ->coef!!!!
* number hh;
* nGetDenom(p->coef,&hh);
* nMult(&h,&hh,&d);
* nNormalize(d);
* nDelete(&hh);
* nMult(d,p->coef,&hh);
* nDelete(&d);
* nDelete(&(p->coef));
* p->coef =hh;
*/
d=n_Mult(h,pGetCoeff(p),C);
n_Normalize(d,C);
p_SetCoeff(p,d,r);
pIter(p);
}
number t=n_Mult(c,h,C);
n_Delete(&c,C);
c=t;
}
else
{
break;
}
n_Delete(&h,C);
}
}
}
}
if(!n_GreaterZero(pGetCoeff(ph),C))
{
ph = p_Neg(ph,r);
c = n_InpNeg(c, C);
}
}
n_Invers
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition coeffs.h:567
n_InpNeg
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition coeffs.h:560
n_Div
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition coeffs.h:618
rField_is_Q_a
static BOOLEAN rField_is_Q_a(const ring r)
Definition ring.h:545

## p_Cmp()

int p_Cmp | ( | poly | p1,
|  | poly | p2,
|  | ring | r )

inline static

Definition at line 1748 of file p_polys.h.

{
if (p2==NULL)
{
if (p1==NULL) return 0;
return 1;
}
if (p1==NULL)
return -1;
return p_LmCmp(p1,p2,r);
}

## p_CmpPolys()

int p_CmpPolys | ( | poly | p1,
|  | poly | p2,
|  | ring | r )

inline static

Definition at line 1760 of file p_polys.h.

{
if (p2==NULL)
{
if (p1==NULL) return 0;
return 1;
}
if (p1==NULL)
return -1;
return p_ComparePolys(p1,p2,r);
}
p_ComparePolys
BOOLEAN p_ComparePolys(poly p1, poly p2, const ring r)
returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL
Definition p_polys.cc:4730

## p_Comp_k_n()

int p_Comp_k_n | ( | poly | a,
|  | poly | b,
|  | int | k,
|  | ring | r )

inline static

Definition at line 642 of file p_polys.h.

{
if ((a==NULL) || (b==NULL) ) return FALSE;
p_LmCheckPolyRing2(a, r);
p_LmCheckPolyRing2(b, r);
pAssume2(k > 0 && k <= r->N);
int i=k;
for(;i<=r->N;i++)
{
if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE;
// if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;
}
return TRUE;
}
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
k
int k
Definition cfEzgcd.cc:99

## p_Compare()

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

Definition at line 5050 of file p_polys.cc.

{
int r=p_Cmp(a,b,R);
if ((r==0)&&(a!=NULL))
{
number h=n_Sub(pGetCoeff(a),pGetCoeff(b),R->cf);
/* compare lead coeffs */
r = -1+n_IsZero(h,R->cf)+2*n_GreaterZero(h,R->cf); /* -1: <, 0:==, 1: > */
n_Delete(&h,R->cf);
}
else if (a==NULL)
{
if (b==NULL)
{
/* compare 0, 0 */
r=0;
}
else if(p_IsConstant(b,R))
{
/* compare 0, const */
r = 1-2*n_GreaterZero(pGetCoeff(b),R->cf); /* -1: <, 1: > */
}
}
else if (b==NULL)
{
if (p_IsConstant(a,R))
{
/* compare const, 0 */
r = -1+2*n_GreaterZero(pGetCoeff(a),R->cf); /* -1: <, 1: > */
}
}
return(r);
}
n_Sub
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition coeffs.h:658
p_Cmp
static int p_Cmp(poly p1, poly p2, ring r)
Definition p_polys.h:1748

## 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 4730 of file p_polys.cc.

{
number n,nn;
pAssume(p1 != NULL && p2 != NULL);
if (!p_LmEqual(p1,p2,r)) //compare leading mons
return FALSE;
if ((pNext(p1)==NULL) && (pNext(p2)!=NULL))
return FALSE;
if ((pNext(p2)==NULL) && (pNext(p1)!=NULL))
return FALSE;
if (pLength(p1) != pLength(p2))
return FALSE;
#ifdef HAVE_RINGS
if (rField_is_Ring(r))
{
if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf)) return FALSE;
}
#endif
n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf);
while ((p1 != NULL) /*&& (p2 != NULL)*/)
{
if ( ! p_LmEqual(p1, p2,r))
{
n_Delete(&n, r->cf);
return FALSE;
}
if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf))
{
n_Delete(&n, r->cf);
n_Delete(&nn, r->cf);
return FALSE;
}
n_Delete(&nn, r->cf);
pIter(p1);
pIter(p2);
}
n_Delete(&n, r->cf);
return TRUE;
}
n_DivBy
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition coeffs.h:750
n_Equal
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition coeffs.h:466
pAssume
#define pAssume(cond)
Definition monomials.h:90
p_LmEqual
#define p_LmEqual(p1, p2, r)
Definition p_polys.h:1744

## p_Content()

void p_Content | ( | poly | p,
|  | const ring | r )

Definition at line 2343 of file p_polys.cc.

{
if (ph==NULL) return;
const coeffs cf=r->cf;
if (pNext(ph)==NULL)
{
p_SetCoeff(ph,n_Init(1,cf),r);
return;
}
if ((cf->cfSubringGcd==ndGcd)
|| (cf->cfGcd==ndGcd)) /* trivial gcd*/
return;
number h;
if ((rField_is_Q(r))
|| (rField_is_Q_a(r))
|| (rField_is_Zp_a)(r)
|| (rField_is_Z(r))
)
{
h=p_InitContent(ph,r); /* first guess of a gcd of all coeffs */
}
else
{
h=n_Copy(pGetCoeff(ph),cf);
}
poly p;
if(n_IsOne(h,cf))
{
goto content_finish;
}
p=ph;
// take the SubringGcd of all coeffs
while (p!=NULL)
{
n_Normalize(pGetCoeff(p),cf);
number d=n_SubringGcd(h,pGetCoeff(p),cf);
n_Delete(&h,cf);
h = d;
if(n_IsOne(h,cf))
{
goto content_finish;
}
pIter(p);
}
// if found<>1, divide by it
p = ph;
while (p!=NULL)
{
number d = n_ExactDiv(pGetCoeff(p),h,cf);
p_SetCoeff(p,d,r);
pIter(p);
}
content_finish:
n_Delete(&h,r->cf);
// and last: check leading sign:
if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
}
cf
CanonicalForm cf
Definition cfModGcd.cc:4091
n_ExactDiv
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition coeffs.h:625
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:669
ndGcd
number ndGcd(number, number, const coeffs r)
Definition numbers.cc:193
p_InitContent
number p_InitContent(poly ph, const ring r)
Definition p_polys.cc:2683
rField_is_Zp_a
static BOOLEAN rField_is_Zp_a(const ring r)
Definition ring.h:535

## p_ContentForGB()

void p_ContentForGB | ( | poly | p,
|  | const ring | r )

Definition at line 2403 of file p_polys.cc.

{
if(TEST_OPT_CONTENTSB) return;
assume( ph != NULL );
assume( r != NULL ); assume( r->cf != NULL );
#if CLEARENUMERATORS
if( 0 )
{
const coeffs C = r->cf;
// experimentall (recursive enumerator treatment) of alg. Ext!
CPolyCoeffsEnumerator itr(ph);
n_ClearContent(itr, r->cf);
p_Test(ph, r); n_Test(pGetCoeff(ph), C);
assume(n_GreaterZero(pGetCoeff(ph), C)); // ??
// if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
return;
}
#endif
#ifdef HAVE_RINGS
if (rField_is_Ring(r))
{
if (rField_has_Units(r))
{
number k = n_GetUnit(pGetCoeff(ph),r->cf);
if (!n_IsOne(k,r->cf))
{
number tmpGMP = k;
k = n_Invers(k,r->cf);
n_Delete(&tmpGMP,r->cf);
poly h = pNext(ph);
p_SetCoeff(ph, n_Mult(pGetCoeff(ph), k,r->cf),r);
while (h != NULL)
{
p_SetCoeff(h, n_Mult(pGetCoeff(h), k,r->cf),r);
pIter(h);
}
// assume( n_GreaterZero(pGetCoeff(ph),r->cf) );
// if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
}
n_Delete(&k,r->cf);
}
return;
}
#endif
number h,d;
poly p;
if(pNext(ph)==NULL)
{
p_SetCoeff(ph,n_Init(1,r->cf),r);
}
else
{
assume( pNext(ph) != NULL );
#if CLEARENUMERATORS
if( nCoeff_is_Q(r->cf) )
{
// experimentall (recursive enumerator treatment) of alg. Ext!
CPolyCoeffsEnumerator itr(ph);
n_ClearContent(itr, r->cf);
p_Test(ph, r); n_Test(pGetCoeff(ph), r->cf);
assume(n_GreaterZero(pGetCoeff(ph), r->cf)); // ??
// if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
return;
}
#endif
n_Normalize(pGetCoeff(ph),r->cf);
if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
if (rField_is_Q(r)||(getCoeffType(r->cf)==n_transExt)) // should not be used anymore if CLEARENUMERATORS is 1
{
h=p_InitContent(ph,r);
p=ph;
}
else
{
h=n_Copy(pGetCoeff(ph),r->cf);
p = pNext(ph);
}
while (p!=NULL)
{
n_Normalize(pGetCoeff(p),r->cf);
d=n_SubringGcd(h,pGetCoeff(p),r->cf);
n_Delete(&h,r->cf);
h = d;
if(n_IsOne(h,r->cf))
{
break;
}
pIter(p);
}
//number tmp;
if(!n_IsOne(h,r->cf))
{
p = ph;
while (p!=NULL)
{
//d = nDiv(pGetCoeff(p),h);
//tmp = nExactDiv(pGetCoeff(p),h);
//if (!nEqual(d,tmp))
//{
// StringSetS("** div0:");nWrite(pGetCoeff(p));StringAppendS("/");
// nWrite(h);StringAppendS("=");nWrite(d);StringAppendS(" int:");
// nWrite(tmp);Print(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
//}
//nDelete(&tmp);
d = n_ExactDiv(pGetCoeff(p),h,r->cf);
p_SetCoeff(p,d,r);
pIter(p);
}
}
n_Delete(&h,r->cf);
if (rField_is_Q_a(r))
{
// special handling for alg. ext.:
if (getCoeffType(r->cf)==n_algExt)
{
h = n_Init(1, r->cf->extRing->cf);
p=ph;
while (p!=NULL)
{ // each monom: coeff in Q_a
poly c_n_n=(poly)pGetCoeff(p);
poly c_n=c_n_n;
while (c_n!=NULL)
{ // each monom: coeff in Q
d=n_NormalizeHelper(h,pGetCoeff(c_n),r->cf->extRing->cf);
n_Delete(&h,r->cf->extRing->cf);
h=d;
pIter(c_n);
}
pIter(p);
}
/* h contains the 1/lcm of all denominators in c_n_n*/
//n_Normalize(h,r->cf->extRing->cf);
if(!n_IsOne(h,r->cf->extRing->cf))
{
p=ph;
while (p!=NULL)
{ // each monom: coeff in Q_a
poly c_n=(poly)pGetCoeff(p);
while (c_n!=NULL)
{ // each monom: coeff in Q
d=n_Mult(h,pGetCoeff(c_n),r->cf->extRing->cf);
n_Normalize(d,r->cf->extRing->cf);
n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf);
pGetCoeff(c_n)=d;
pIter(c_n);
}
pIter(p);
}
}
n_Delete(&h,r->cf->extRing->cf);
}
/*else
{
// special handling for rat. functions.:
number hzz =NULL;
p=ph;
while (p!=NULL)
{ // each monom: coeff in Q_a (Z_a)
fraction f=(fraction)pGetCoeff(p);
poly c_n=NUM(f);
if (hzz==NULL)
{
hzz=n_Copy(pGetCoeff(c_n),r->cf->extRing->cf);
pIter(c_n);
}
while ((c_n!=NULL)&&(!n_IsOne(hzz,r->cf->extRing->cf)))
{ // each monom: coeff in Q (Z)
d=n_Gcd(hzz,pGetCoeff(c_n),r->cf->extRing->cf);
n_Delete(&hzz,r->cf->extRing->cf);
hzz=d;
pIter(c_n);
}
pIter(p);
}
// hzz contains the gcd of all numerators in f
h=n_Invers(hzz,r->cf->extRing->cf);
n_Delete(&hzz,r->cf->extRing->cf);
n_Normalize(h,r->cf->extRing->cf);
if(!n_IsOne(h,r->cf->extRing->cf))
{
p=ph;
while (p!=NULL)
{ // each monom: coeff in Q_a (Z_a)
fraction f=(fraction)pGetCoeff(p);
NUM(f)=__p_Mult_nn(NUM(f),h,r->cf->extRing);
p_Normalize(NUM(f),r->cf->extRing);
pIter(p);
}
}
n_Delete(&h,r->cf->extRing->cf);
}*/
}
}
if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
}
n_algExt
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
n_transExt
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
n_GetUnit
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
Definition coeffs.h:537
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
rField_has_Units
static BOOLEAN rField_has_Units(const ring r)
Definition ring.h:496

## p_ContentRat()

void p_ContentRat | ( | poly & | ph,
|  | const ring | r )

Definition at line 1748 of file p_polys.cc.

{
// init array of RatLeadCoeffs
// poly p_GetCoeffRat(poly p, int ishift, ring r);
int len=pLength(ph);
poly *C = (poly *)omAlloc0((len+1)*sizeof(poly)); //rat coeffs
poly *LM = (poly *)omAlloc0((len+1)*sizeof(poly)); // rat lead terms
int *D = (int *)omAlloc0((len+1)*sizeof(int)); //degrees of coeffs
int *L = (int *)omAlloc0((len+1)*sizeof(int)); //lengths of coeffs
int k = 0;
poly p = p_Copy(ph, r); // ph will be needed below
int mintdeg = p_Totaldegree(p, r);
int minlen = len;
int dd = 0; int i;
int HasConstantCoef = 0;
int is = r->real_var_start - 1;
while (p!=NULL)
{
LM[k] = p_GetExp_k_n(p,1,is, r); // need LmRat instead of p_HeadRat(p, is, currRing); !
C[k] = p_GetCoeffRat(p, is, r);
D[k] = p_Totaldegree(C[k], r);
mintdeg = si_min(mintdeg,D[k]);
L[k] = pLength(C[k]);
minlen = si_min(minlen,L[k]);
if (p_IsConstant(C[k], r))
{
// C[k] = const, so the content will be numerical
HasConstantCoef = 1;
// smth like goto cleanup and return(pContent(p));
}
p_LmDeleteAndNextRat(&p, is, r);
k++;
}
// look for 1 element of minimal degree and of minimal length
k--;
poly d;
int mindeglen = len;
if (k<=0) // this poly is not a ratgring poly -> pContent
{
p_Delete(&C[0], r);
p_Delete(&LM[0], r);
p_ContentForGB(ph, r);
goto cleanup;
}
int pmindeglen;
for(i=0; i<=k; i++)
{
if (D[i] == mintdeg)
{
if (L[i] < mindeglen)
{
mindeglen=L[i];
pmindeglen = i;
}
}
}
d = p_Copy(C[pmindeglen], r);
// there are dd>=1 mindeg elements
// and pmideglen is the coordinate of one of the smallest among them
// poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r));
// return naGcd(d,d2,currRing);
// adjoin pContentRat here?
for(i=0; i<=k; i++)
{
d=singclap_gcd(d,p_Copy(C[i], r), r);
if (p_Totaldegree(d, r)==0)
{
// cleanup, pContent, return
p_Delete(&d, r);
for(;k>=0;k--)
{
p_Delete(&C[k], r);
p_Delete(&LM[k], r);
}
p_ContentForGB(ph, r);
goto cleanup;
}
}
for(i=0; i<=k; i++)
{
poly h=singclap_pdivide(C[i],d, r);
p_Delete(&C[i], r);
C[i]=h;
}
// zusammensetzen,
p=NULL; // just to be sure
for(i=0; i<=k; i++)
{
p = p_Add_q(p, p_Mult_q(C[i],LM[i], r), r);
C[i]=NULL; LM[i]=NULL;
}
p_Delete(&ph, r); // do not need it anymore
ph = p;
// aufraeumen, return
cleanup:
omFree(C);
omFree(LM);
omFree(D);
omFree(L);
}
singclap_pdivide
poly singclap_pdivide(poly f, poly g, const ring r)
Definition clapsing.cc:649
D
#define D(A)
Definition gentable.cc:128
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
p_LmDeleteAndNextRat
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
Definition p_polys.cc:1704
p_GetCoeffRat
poly p_GetCoeffRat(poly p, int ishift, ring r)
Definition p_polys.cc:1726
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
p_GetExp_k_n
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition p_polys.h:1393
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1528
singclap_gcd
poly singclap_gcd(poly f, poly g, const ring r)
polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
Definition polys.cc:409

## p_Copy() [1/2]

poly p_Copy | ( | poly | p,
|  | const ring | lmRing,
|  | const ring | tailRing )

inline static

returns a copy of p with Lm(p) from lmRing and Tail(p) from tailRing

Definition at line 885 of file p_polys.h.

{
if (p != NULL)
{
#ifndef PDEBUG
if (tailRing == lmRing)
return p_Copy_noCheck(p, tailRing);
#endif
poly pres = p_Head(p, lmRing);
if (pNext(p)!=NULL)
pNext(pres) = p_Copy_noCheck(pNext(p), tailRing);
return pres;
}
else
return NULL;
}
p_Copy_noCheck
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition p_polys.h:838

## p_Copy() [2/2]

poly p_Copy | ( | poly | p,
|  | const ring | r )

inline static

returns a copy of p

Definition at line 848 of file p_polys.h.

{
if (p!=NULL)
{
p_Test(p,r);
const poly pp = p_Copy_noCheck(p, r);
p_Test(pp,r);
return pp;
}
else
return NULL;
}
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676

## p_Copy_noCheck()

poly p_Copy_noCheck | ( | poly | p,
|  | const ring | r )

inline static

returns a copy of p (without any additional testing)

Definition at line 838 of file p_polys.h.

{
/*assume(p!=NULL);*/
assume(r != NULL);
assume(r->p_Procs != NULL);
assume(r->p_Procs->p_Copy != NULL);
return r->p_Procs->p_Copy(p, r);
}

## p_CopyPowerProduct()

poly p_CopyPowerProduct | ( | const poly | p,
|  | const ring | r )

like p_Head, but with coefficient 1

Definition at line 5134 of file p_polys.cc.

{
if (p == NULL) return NULL;
return p_CopyPowerProduct0(p,n_Init(1,r->cf),r);
}
p_CopyPowerProduct0
poly p_CopyPowerProduct0(const poly p, number n, const ring r)
like p_Head, but with coefficient n
Definition p_polys.cc:5122

## p_CopyPowerProduct0()

poly p_CopyPowerProduct0 | ( | const poly | p,
|  | const number | n,
|  | const ring | r )

like p_Head, but with coefficient n

Definition at line 5122 of file p_polys.cc.

{
p_LmCheckPolyRing1(p, r);
poly np;
omTypeAllocBin(poly, np, r->PolyBin);
p_SetRingOfLm(np, r);
memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
pNext(np) = NULL;
pSetCoeff0(np, n);
return np;
}
p_LmCheckPolyRing1
#define p_LmCheckPolyRing1(p, r)
Definition monomials.h:177
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
p_SetRingOfLm
#define p_SetRingOfLm(p, r)
Definition monomials.h:144
omTypeAllocBin
#define omTypeAllocBin(type, addr, bin)
Definition omAllocDecl.h:203

## p_DecrExp()

long p_DecrExp | ( | poly | p,
|  | int | v,
|  | ring | r )

inline static

Definition at line 600 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
int e = p_GetExp(p,v,r);
pAssume2(e > 0);
e--;
return p_SetExp(p,v,e,r);
}

## p_Deg()

long p_Deg | ( | poly | a,
|  | const ring | r )

Definition at line 586 of file p_polys.cc.

{
p_LmCheckPolyRing(a, r);
// assume(p_GetOrder(a, r) == p_WTotaldegree(a, r)); // WRONG assume!
return p_GetOrder(a, r);
}
p_LmCheckPolyRing
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition pDebug.cc:123
p_GetOrder
static long p_GetOrder(poly p, ring r)
Definition p_polys.h:423

## p_DegW()

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

Definition at line 691 of file p_polys.cc.

{
p_Test(p, R);
assume( w != NULL );
long r=-LONG_MAX;
while (p!=NULL)
{
long t=totaldegreeWecart_IV(p,R,w);
if (t>r) r=t;
pIter(p);
}
return r;
}
w
const CanonicalForm & w
Definition facAbsFact.cc:51
totaldegreeWecart_IV
long totaldegreeWecart_IV(poly p, ring r, const int *w)
Definition weight.cc:231

## p_Delete() [1/2]

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

inline static

Definition at line 910 of file p_polys.h.

{
assume( p!= NULL );
if (*p != NULL)
{
#ifndef PDEBUG
if (tailRing == lmRing)
{
p_Delete(p, tailRing);
return;
}
#endif
if (pNext(*p) != NULL)
p_Delete(&pNext(*p), tailRing);
p_LmDelete(p, lmRing);
}
}
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725

## p_Delete() [2/2]

void p_Delete | ( | poly * | p,
|  | const ring | r )

inline static

Definition at line 903 of file p_polys.h.

{
assume( p!= NULL );
assume( r!= NULL );
if ((*p)!=NULL) r->p_Procs->p_Delete(p, r);
}

## p_DeleteComp()

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

Definition at line 3668 of file p_polys.cc.

{
poly q;
long unsigned kk=k;
while ((*p!=NULL) && (__p_GetComp(*p,r)==kk)) p_LmDelete(p,r);
if (*p==NULL) return;
q = *p;
if (__p_GetComp(q,r)>kk)
{
p_SubComp(q,1,r);
p_SetmComp(q,r);
}
while (pNext(q)!=NULL)
{
unsigned long c=__p_GetComp(pNext(q),r);
if (/*__p_GetComp(pNext(q),r)*/c==kk)
p_LmDelete(&(pNext(q)),r);
else
{
pIter(q);
if (/*__p_GetComp(q,r)*/c>kk)
{
p_SubComp(q,1,r);
p_SetmComp(q,r);
}
}
}
}
p_SubComp
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
Definition p_polys.h:455
p_SetmComp
#define p_SetmComp
Definition p_polys.h:246

## p_Diff()

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

Definition at line 1902 of file p_polys.cc.

{
poly res, f, last;
number t;
last = res = NULL;
while (a!=NULL)
{
if (p_GetExp(a,k,r)!=0)
{
f = p_LmInit(a,r);
t = n_Init(p_GetExp(a,k,r),r->cf);
pSetCoeff0(f,n_Mult(t,pGetCoeff(a),r->cf));
n_Delete(&t,r->cf);
if (n_IsZero(pGetCoeff(f),r->cf))
p_LmDelete(&f,r);
else
{
p_DecrExp(f,k,r);
p_Setm(f,r);
if (res==NULL)
{
res=last=f;
}
else
{
pNext(last)=f;
last=f;
}
}
}
pIter(a);
}
return res;
}
f
FILE * f
Definition checklibs.c:9
last
STATIC_VAR poly last
Definition hdegree.cc:1138
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition p_polys.h:1356
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_DecrExp
static long p_DecrExp(poly p, int v, ring r)
Definition p_polys.h:600

## p_DiffOp()

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

Definition at line 1977 of file p_polys.cc.

{
poly result=NULL;
poly h;
for(;a!=NULL;pIter(a))
{
for(h=b;h!=NULL;pIter(h))
{
result=p_Add_q(result,p_DiffOpM(a,h,multiply,r),r);
}
}
return result;
}
result
return result
Definition facAbsBiFact.cc:76
p_DiffOpM
static poly p_DiffOpM(poly a, poly b, BOOLEAN multiply, const ring r)
Definition p_polys.cc:1938

## p_Div_mm()

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

divide polynomial by monomial

Definition at line 1542 of file p_polys.cc.

{
p_Test(p, r);
p_Test(m, r);
poly result = p;
poly prev = NULL;
number n=pGetCoeff(m);
while (p!=NULL)
{
number nc = n_Div(pGetCoeff(p),n,r->cf);
n_Normalize(nc,r->cf);
if (!n_IsZero(nc,r->cf))
{
p_SetCoeff(p,nc,r);
prev=p;
p_ExpVectorSub(p,m,r);
pIter(p);
}
else
{
if (prev==NULL)
{
p_LmDelete(&result,r);
p=result;
}
else
{
p_LmDelete(&pNext(prev),r);
p=pNext(prev);
}
}
}
p_Test(result,r);
return(result);
}
m
int m
Definition cfEzgcd.cc:128
p_ExpVectorSub
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition p_polys.h:1461

## p_Div_nn()

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

Definition at line 1506 of file p_polys.cc.

{
pAssume(!n_IsZero(n,r->cf));
p_Test(p, r);
poly result = p;
poly prev = NULL;
if (!n_IsOne(n,r->cf))
{
while (p!=NULL)
{
number nc = n_Div(pGetCoeff(p),n,r->cf);
if (!n_IsZero(nc,r->cf))
{
p_SetCoeff(p,nc,r);
prev=p;
pIter(p);
}
else
{
if (prev==NULL)
{
p_LmDelete(&result,r);
p=result;
}
else
{
p_LmDelete(&pNext(prev),r);
p=pNext(prev);
}
}
}
p_Test(result,r);
}
return(result);
}

## p_DivideM()

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

Definition at line 1582 of file p_polys.cc.

{
if (a==NULL) { p_Delete(&b,r); return NULL; }
poly result=a;
if(!p_IsConstant(b,r))
{
if (rIsNCRing(r))
{
WerrorS("p_DivideM not implemented for non-commuative rings");
return NULL;
}
poly prev=NULL;
while (a!=NULL)
{
if (p_DivisibleBy(b,a,r))
{
p_ExpVectorSub(a,b,r);
prev=a;
pIter(a);
}
else
{
if (prev==NULL)
{
p_LmDelete(&result,r);
a=result;
}
else
{
p_LmDelete(&pNext(prev),r);
a=pNext(prev);
}
}
}
}
if (result!=NULL)
{
number inv=pGetCoeff(b);
//if ((!rField_is_Ring(r)) || n_IsUnit(inv,r->cf))
if (rField_is_Zp(r))
{
inv = n_Invers(inv,r->cf);
__p_Mult_nn(result,inv,r);
n_Delete(&inv, r->cf);
}
else
{
result = p_Div_nn(result,inv,r);
}
}
p_Delete(&b, r);
return result;
}
p_DivisibleBy
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1921
__p_Mult_nn
#define __p_Mult_nn(p, n, r)
Definition p_polys.h:973
rIsNCRing
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:427

## p_DivisibleBy()

BOOLEAN p_DivisibleBy | ( | poly | a,
|  | poly | b,
|  | const ring | r )

inline static

Definition at line 1921 of file p_polys.h.

{
pIfThen1(b!=NULL, p_LmCheckPolyRing1(b, r));
pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r));
if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)))
return _p_LmDivisibleByNoComp(a,b,r);
return FALSE;
}
pIfThen1
#define pIfThen1(cond, check)
Definition monomials.h:179

## 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 1646 of file p_polys.cc.

{
int exponent;
for(int i = (int)rVar(r); i>0; i--)
{
exponent = p_GetExp(g, i, r) - p_GetExp(f, i, r);
if (exponent < 0) return FALSE;
}
return n_DivBy(pGetCoeff(g), pGetCoeff(f), r->cf);
}
g
g
Definition cfModGcd.cc:4098
exponent
#define exponent
Definition interpolation.cc:31

## p_EqualPolys() [1/2]

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

Definition at line 4666 of file p_polys.cc.

{
while ((p1 != NULL) && (p2 != NULL))
{
if (! p_LmEqual(p1, p2,r))
return FALSE;
if (! n_Equal(p_GetCoeff(p1,r), p_GetCoeff(p2,r),r->cf ))
return FALSE;
pIter(p1);
pIter(p2);
}
return (p1==p2);
}
p_GetCoeff
#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 4704 of file p_polys.cc.

{
assume( r1 == r2 || rSamePolyRep(r1, r2) ); // will be used in rEqual!
assume( r1->cf == r2->cf );
while ((p1 != NULL) && (p2 != NULL))
{
// returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !!
// #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r)
if (! p_ExpVectorEqual(p1, p2, r1, r2))
return FALSE;
if (! n_Equal(p_GetCoeff(p1,r1), p_GetCoeff(p2,r2), r1->cf ))
return FALSE;
pIter(p1);
pIter(p2);
}
return (p1==p2);
}
rSamePolyRep
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition ring.cc:1805

## p_ExpVectorAdd()

void p_ExpVectorAdd | ( | poly | p1,
|  | poly | p2,
|  | const ring | r )

inline static

Definition at line 1432 of file p_polys.h.

{
p_LmCheckPolyRing1(p1, r);
p_LmCheckPolyRing1(p2, r);
#if PDEBUG >= 1
for (int i=1; i<=r->N; i++)
pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
#endif
p_MemAdd_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
p_MemAdd_NegWeightAdjust(p1, r);
}
p_MemAdd_LengthGeneral
#define p_MemAdd_LengthGeneral(r, s, length)
Definition p_MemAdd.h:173
p_MemAdd_NegWeightAdjust
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
Definition p_polys.h:1313

## p_ExpVectorAddSub()

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

inline static

Definition at line 1477 of file p_polys.h.

{
p_LmCheckPolyRing1(p1, r);
p_LmCheckPolyRing1(p2, r);
p_LmCheckPolyRing1(p3, r);
#if PDEBUG >= 1
for (int i=1; i<=r->N; i++)
pAssume1(p_GetExp(p1, i, r) + p_GetExp(p2, i, r) >= p_GetExp(p3, i, r));
pAssume1(p_GetComp(p1, r) == 0 ||
(p_GetComp(p2, r) - p_GetComp(p3, r) == 0) ||
(p_GetComp(p1, r) == p_GetComp(p2, r) - p_GetComp(p3, r)));
#endif
p_MemAddSub_LengthGeneral(p1->exp, p2->exp, p3->exp, r->ExpL_Size);
// no need to adjust in case of NegWeights
}
p_MemAddSub_LengthGeneral
#define p_MemAddSub_LengthGeneral(r, s, t, length)
Definition p_MemAdd.h:312

## p_ExpVectorCopy()

void p_ExpVectorCopy | ( | poly | d_p,
|  | poly | s_p,
|  | const ring | r )

inline static

Definition at line 1334 of file p_polys.h.

{
p_LmCheckPolyRing1(d_p, r);
p_LmCheckPolyRing1(s_p, r);
memcpy(d_p->exp, s_p->exp, r->ExpL_Size*sizeof(long));
}

## p_ExpVectorDiff()

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

inline static

Definition at line 1495 of file p_polys.h.

{
p_LmCheckPolyRing1(p1, r);
p_LmCheckPolyRing1(p2, r);
p_LmCheckPolyRing1(pr, r);
#if PDEBUG >= 2
for (int i=1; i<=r->N; i++)
pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
pAssume1(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
#endif
p_MemDiff_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
p_MemSub_NegWeightAdjust(pr, r);
}
p_MemDiff_LengthGeneral
#define p_MemDiff_LengthGeneral(r, s1, s2, length)
Definition p_MemAdd.h:262
p_MemSub_NegWeightAdjust
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
Definition p_polys.h:1323

## p_ExpVectorEqual()

BOOLEAN p_ExpVectorEqual | ( | poly | p1,
|  | poly | p2,
|  | const ring | r )

inline static

Definition at line 1510 of file p_polys.h.

{
p_LmCheckPolyRing1(p1, r);
p_LmCheckPolyRing1(p2, r);
unsigned i = r->ExpL_Size;
unsigned long *ep = p1->exp;
unsigned long *eq = p2->exp;
do
{
i--;
if (ep[i] != eq[i]) return FALSE;
}
while (i!=0);
return TRUE;
}

## p_ExpVectorSub()

void p_ExpVectorSub | ( | poly | p1,
|  | poly | p2,
|  | const ring | r )

inline static

Definition at line 1461 of file p_polys.h.

{
p_LmCheckPolyRing1(p1, r);
p_LmCheckPolyRing1(p2, r);
#if PDEBUG >= 1
for (int i=1; i<=r->N; i++)
pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0 ||
p_GetComp(p1, r) == p_GetComp(p2, r));
#endif
p_MemSub_LengthGeneral(p1->exp, p2->exp, r->ExpL_Size);
p_MemSub_NegWeightAdjust(p1, r);
}
p_MemSub_LengthGeneral
#define p_MemSub_LengthGeneral(r, s, length)
Definition p_MemAdd.h:291

## p_ExpVectorSum()

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

inline static

Definition at line 1446 of file p_polys.h.

{
p_LmCheckPolyRing1(p1, r);
p_LmCheckPolyRing1(p2, r);
p_LmCheckPolyRing1(pr, r);
#if PDEBUG >= 1
for (int i=1; i<=r->N; i++)
pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
#endif
p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpL_Size);
p_MemAdd_NegWeightAdjust(pr, r);
}
p_MemSum_LengthGeneral
#define p_MemSum_LengthGeneral(r, s1, s2, length)
Definition p_MemAdd.h:86

## p_Farey()

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

Definition at line 54 of file p_polys.cc.

{
poly h=p_Copy(p,r);
poly hh=h;
while(h!=NULL)
{
number c=pGetCoeff(h);
pSetCoeff0(h,n_Farey(c,N,r->cf));
n_Delete(&c,r->cf);
pIter(h);
}
while((hh!=NULL)&&(n_IsZero(pGetCoeff(hh),r->cf)))
{
p_LmDelete(&hh,r);
}
h=hh;
while((h!=NULL) && (pNext(h)!=NULL))
{
if(n_IsZero(pGetCoeff(pNext(h)),r->cf))
{
p_LmDelete(&pNext(h),r);
}
else pIter(h);
}
return hh;
}
n_Farey
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition coeffs.h:762

## p_FDeg()

long p_FDeg | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 382 of file p_polys.h.

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

## p_GcdMon()

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

polynomial gcd for f=mon

Definition at line 5084 of file p_polys.cc.

{
assume(f!=NULL);
assume(g!=NULL);
assume(pNext(f)==NULL);
poly G=p_Head(f,r);
poly h=g;
int *mf=(int*)omAlloc((r->N+1)*sizeof(int));
p_GetExpV(f,mf,r);
int *mh=(int*)omAlloc((r->N+1)*sizeof(int));
BOOLEAN const_mon;
BOOLEAN one_coeff=n_IsOne(pGetCoeff(G),r->cf);
loop
{
if (h==NULL) break;
if(!one_coeff)
{
number n=n_SubringGcd(pGetCoeff(G),pGetCoeff(h),r->cf);
one_coeff=n_IsOne(n,r->cf);
p_SetCoeff(G,n,r);
}
p_GetExpV(h,mh,r);
const_mon=TRUE;
for(unsigned j=r->N;j!=0;j--)
{
if (mh[j]<mf[j]) mf[j]=mh[j];
if (mf[j]>0) const_mon=FALSE;
}
if (one_coeff && const_mon) break;
pIter(h);
}
mf[0]=0;
p_SetExpV(G,mf,r); // included is p_SetComp, p_Setm
omFreeSize(mf,(r->N+1)*sizeof(int));
omFreeSize(mh,(r->N+1)*sizeof(int));
return G;
}
G
STATIC_VAR TreeM * G
Definition janet.cc:31
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
p_SetExpV
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1565
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541

## p_GetCoeffRat()

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

Definition at line 1726 of file p_polys.cc.

{
poly q = pNext(p);
poly res; // = p_Head(p,r);
res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally
p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r);
poly s;
long cmp = p_GetComp(p, r);
while ( (q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r)) && (p_GetComp(q, r) == cmp) )
{
s = p_GetExp_k_n(q, ishift+1, r->N, r);
p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r);
res = p_Add_q(res,s,r);
q = pNext(q);
}
cmp = 0;
p_SetCompP(res,cmp,r);
return res;
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51
p_Comp_k_n
static int p_Comp_k_n(poly a, poly b, int k, ring r)
Definition p_polys.h:642
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition p_polys.h:256

## p_GetExp() [1/3]

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

inline static

get v^th exponent for a monomial

Definition at line 574 of file p_polys.h.

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

## p_GetExp() [2/3]

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

inline static

Definition at line 557 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
pAssume2(VarOffset != -1);
return p_GetExp(p, r->bitmask, VarOffset);
}

## p_GetExp() [3/3]

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

inline static

get a single variable exponent @Note: the integer VarOffset encodes:

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

Definition at line 471 of file p_polys.h.

{
pAssume2((VarOffset >> (24 + 6)) == 0);
#if 0
int pos=(VarOffset & 0xffffff);
int bitpos=(VarOffset >> 24);
unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask;
return exp;
#else
return (long)
((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24))
& iBitmask);
#endif
}
exp
gmp_float exp(const gmp_float &a)
Definition mpr_complex.cc:349

## p_GetExp_k_n()

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

inline static

Definition at line 1393 of file p_polys.h.

{
if (p == NULL) return NULL;
p_LmCheckPolyRing1(p, r);
poly np;
omTypeAllocBin(poly, np, r->PolyBin);
p_SetRingOfLm(np, r);
memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
pNext(np) = NULL;
pSetCoeff0(np, n_Init(1, r->cf));
int i;
for(i=l;i<=k;i++)
{
//np->exp[(r->VarOffset[i] & 0xffffff)] =0;
p_SetExp(np,i,0,r);
}
p_Setm(np,r);
return np;
}

## p_GetExpDiff()

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

inline static

Definition at line 637 of file p_polys.h.

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

## p_GetExpSum()

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

inline static

Definition at line 631 of file p_polys.h.

{
p_LmCheckPolyRing2(p1, r);
p_LmCheckPolyRing2(p2, r);
return p_GetExp(p1,i,r) + p_GetExp(p2,i,r);
}

## p_GetExpV()

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

inline static

Definition at line 1541 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
for (unsigned j = r->N; j!=0; j--)
ev[j] = p_GetExp(p, j, r);
ev[0] = p_GetComp(p, r);
}

## p_GetExpVL()

void p_GetExpVL | ( | poly | p,
|  | int64 * | ev,
|  | const ring | r )

inline static

Definition at line 1550 of file p_polys.h.

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

## p_GetExpVLV()

int64 p_GetExpVLV | ( | poly | p,
|  | int64 * | ev,
|  | const ring | r )

inline static

Definition at line 1557 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
for (unsigned j = r->N; j!=0; j--)
ev[j-1] = p_GetExp(p, j, r);
return (int64)p_GetComp(p,r);
}
int64
long int64
Definition auxiliary.h:68

## p_GetMaxExp() [1/2]

unsigned long p_GetMaxExp | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 806 of file p_polys.h.

{
return p_GetMaxExp(p_GetMaxExpL(p, r), r);
}
p_GetMaxExp
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition p_polys.h:783
p_GetMaxExpL
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max=0)
return the maximal exponent of p in form of the maximal long var
Definition p_polys.cc:1176

## p_GetMaxExp() [2/2]

unsigned long p_GetMaxExp | ( | const unsigned long | l,
|  | const ring | r )

inline static

Definition at line 783 of file p_polys.h.

{
unsigned long bitmask = r->bitmask;
unsigned long max = (l & bitmask);
unsigned long j = r->ExpPerLong - 1;
if (j > 0)
{
unsigned long i = r->BitsPerExp;
long e;
loop
{
e = ((l >> i) & bitmask);
if ((unsigned long) e > max)
max = e;
j--;
if (j==0) break;
i += r->BitsPerExp;
}
}
return max;
}
max
static int max(int a, int b)
Definition fast_mult.cc:264

## p_GetMaxExpL()

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

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

Definition at line 1176 of file p_polys.cc.

{
unsigned long l_p, divmask = r->divmask;
int i;
while (p != NULL)
{
l_p = p->exp[r->VarL_Offset[0]];
if (l_p > l_max ||
(((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
l_max = p_GetMaxExpL2(l_max, l_p, r);
for (i=1; i<r->VarL_Size; i++)
{
l_p = p->exp[r->VarL_Offset[i]];
// do the divisibility trick to find out whether l has an exponent
if (l_p > l_max ||
(((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
l_max = p_GetMaxExpL2(l_max, l_p, r);
}
pIter(p);
}
return l_max;
}
p_GetMaxExpL2
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
Definition p_polys.cc:1108

## p_GetMaxExpP()

poly p_GetMaxExpP | ( | poly | p,
|  | ring | r )

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

Definition at line 1139 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
if (p == NULL) return p_Init(r);
poly max = p_LmInit(p, r);
pIter(p);
if (p == NULL) return max;
int i, offset;
unsigned long l_p, l_max;
unsigned long divmask = r->divmask;
do
{
offset = r->VarL_Offset[0];
l_p = p->exp[offset];
l_max = max->exp[offset];
// do the divisibility trick to find out whether l has an exponent
if (l_p > l_max ||
(((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
for (i=1; i<r->VarL_Size; i++)
{
offset = r->VarL_Offset[i];
l_p = p->exp[offset];
l_max = max->exp[offset];
// do the divisibility trick to find out whether l has an exponent
if (l_p > l_max ||
(((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
}
pIter(p);
}
while (p != NULL);
return max;
}
offset
STATIC_VAR int offset
Definition janet.cc:29
p_CheckPolyRing
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition pDebug.cc:115
p_Init
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1341

## p_GetOrder()

long p_GetOrder | ( | poly | p,
|  | ring | r )

inline static

Definition at line 423 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
if (r->typ==NULL) return ((p)->exp[r->pOrdIndex]);
int i=0;
loop
{
switch(r->typ[i].ord_typ)
{
case ro_am:
case ro_wp_neg:
return ((p->exp[r->pOrdIndex])-POLY_NEGWEIGHT_OFFSET);
case ro_syzcomp:
case ro_syz:
case ro_cp:
i++;
break;
//case ro_dp:
//case ro_wp:
default:
return ((p)->exp[r->pOrdIndex]);
}
}
}
POLY_NEGWEIGHT_OFFSET
#define POLY_NEGWEIGHT_OFFSET
Definition monomials.h:236
ro_syz
@ ro_syz
Definition ring.h:61
ro_cp
@ ro_cp
Definition ring.h:59
ro_wp_neg
@ ro_wp_neg
Definition ring.h:57
ro_am
@ ro_am
Definition ring.h:55

## p_GetSetmProc()

p_SetmProc p_GetSetmProc | ( | const ring | r | ) |

Definition at line 559 of file p_polys.cc.

{
// covers lp, rp, ls,
if (r->typ == NULL) return p_Setm_Dummy;
if (r->OrdSize == 1)
{
if ((r->typ[0].ord_typ == ro_dp) &&
(r->typ[0].data.dp.start == 1) &&
(r->typ[0].data.dp.end == r->N) &&
(r->typ[0].data.dp.place == r->pOrdIndex))
return p_Setm_TotalDegree;
if ((r->typ[0].ord_typ == ro_wp) &&
(r->typ[0].data.wp.start == 1) &&
(r->typ[0].data.wp.end == r->N) &&
(r->typ[0].data.wp.place == r->pOrdIndex) &&
(r->typ[0].data.wp.weights == r->firstwv))
return p_Setm_WFirstTotalDegree;
}
return p_Setm_General;
}
p_Setm_WFirstTotalDegree
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:553
p_Setm_Dummy
void p_Setm_Dummy(poly p, const ring r)
Definition p_polys.cc:540
p_Setm_TotalDegree
void p_Setm_TotalDegree(poly p, const ring r)
Definition p_polys.cc:546
p_Setm_General
void p_Setm_General(poly p, const ring r)
Definition p_polys.cc:158
ro_dp
@ ro_dp
Definition ring.h:53
ro_wp
@ ro_wp
Definition ring.h:54

## p_GetShortExpVector()

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

Definition at line 4934 of file p_polys.cc.

{
assume(p != NULL);
unsigned long ev = 0; // short exponent vector
unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
unsigned int m1; // highest bit which is filled with (n+1)
unsigned int i=0;
int j=1;
if (n == 0)
{
if (r->N <2*BIT_SIZEOF_LONG)
{
n=1;
m1=0;
}
else
{
for (; j<=r->N; j++)
{
if (p_GetExp(p,j,r) > 0) i++;
if (i == BIT_SIZEOF_LONG) break;
}
if (i>0)
ev = ~(0UL) >> (BIT_SIZEOF_LONG - i);
return ev;
}
}
else
{
m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
}
n++;
while (i<m1)
{
ev |= GetBitFields(p_GetExp(p, j,r), i, n);
i += n;
j++;
}
n--;
while (i<BIT_SIZEOF_LONG)
{
ev |= GetBitFields(p_GetExp(p, j,r), i, n);
i += n;
j++;
}
return ev;
}
BIT_SIZEOF_LONG
#define BIT_SIZEOF_LONG
Definition auxiliary.h:80
GetBitFields
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
Definition p_polys.cc:4902

## p_GetShortExpVector0()

unsigned long p_GetShortExpVector0 | ( | const poly | a,
|  | const ring | r )

Definition at line 4985 of file p_polys.cc.

{
assume(p != NULL);
assume(r->N >=BIT_SIZEOF_LONG);
unsigned long ev = 0; // short exponent vector
for (int j=BIT_SIZEOF_LONG; j>0; j--)
{
if (p_GetExp(p, j,r)>0)
ev |= Sy_bitL(j-1);
}
return ev;
}
Sy_bitL
#define Sy_bitL(x)
Definition options.h:32

## p_GetShortExpVector1()

unsigned long p_GetShortExpVector1 | ( | const poly | a,
|  | const ring | r )

Definition at line 5000 of file p_polys.cc.

{
assume(p != NULL);
assume(r->N <BIT_SIZEOF_LONG);
assume(2*r->N >=BIT_SIZEOF_LONG);
unsigned long ev = 0; // short exponent vector
int rest=r->N;
int e;
// 2 bits per exp
int j=r->N;
for (; j>BIT_SIZEOF_LONG-r->N; j--)
{
if ((e=p_GetExp(p, j,r))>0)
{
ev |= Sy_bitL(j-1);
if (e>1)
{
ev|=Sy_bitL(rest+j-1);
}
}
}
// 1 bit per exp
for (; j>0; j--)
{
if (p_GetExp(p, j,r)>0)
{
ev |= Sy_bitL(j-1);
}
}
return ev;
}

## p_GetTotalDegree()

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

inline static

Definition at line 812 of file p_polys.h.

{
const unsigned long bitmask = r->bitmask;
unsigned long sum = (l & bitmask);
unsigned long j = number_of_exps - 1;
if (j > 0)
{
unsigned long i = r->BitsPerExp;
loop
{
sum += ((l >> i) & bitmask);
j--;
if (j==0) break;
i += r->BitsPerExp;
}
}
return sum;
}

## p_GetVariables()

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

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

Definition at line 1268 of file p_polys.cc.

{
int i;
int n=0;
while(p!=NULL)
{
n=0;
for(i=r->N; i>0; i--)
{
if(e[i]==0)
{
if (p_GetExp(p,i,r)>0)
{
e[i]=1;
n++;
}
}
else
n++;
}
if (n==r->N) break;
pIter(p);
}
return n;
}

## p_HasNotCF()

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

Definition at line 1330 of file p_polys.cc.

{
if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
return FALSE;
int i = rVar(r);
loop
{
if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
return FALSE;
i--;
if (i == 0)
return TRUE;
}
}

## p_HasNotCFRing()

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

Definition at line 1346 of file p_polys.cc.

{
if (p_GetComp(p1,r) > 0 || p_GetComp(p2,r) > 0)
return FALSE;
int i = rVar(r);
loop
{
if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
return FALSE;
i--;
if (i == 0) {
if (n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf) ||
n_DivBy(pGetCoeff(p2), pGetCoeff(p1), r->cf)) {
return FALSE;
} else {
return TRUE;
}
}
}
}

## p_Head()

poly p_Head | ( | const poly | p,
|  | const ring | r )

inline static

copy the (leading) term of p

Definition at line 862 of file p_polys.h.

{
if (p == NULL) return NULL;
p_LmCheckPolyRing1(p, r);
poly np;
omTypeAllocBin(poly, np, r->PolyBin);
p_SetRingOfLm(np, r);
memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
pNext(np) = NULL;
pSetCoeff0(np, n_Copy(pGetCoeff(p), r->cf));
return np;
}

## p_Head0()

poly p_Head0 | ( | const poly | p,
|  | const ring | r )

like p_Head, but allow NULL coeff

Definition at line 5140 of file p_polys.cc.

{
if (p==NULL) return NULL;
if (pGetCoeff(p)==NULL) return p_CopyPowerProduct0(p,NULL,r);
return p_Head(p,r);
}

## p_Homogen()

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

Definition at line 3319 of file p_polys.cc.

{
pFDegProc deg;
if (r->pLexOrder && (r->order[0]==ringorder_lp))
deg=p_Totaldegree;
else
deg=r->pFDeg;
poly q=NULL, qn;
int o,ii;
sBucket_pt bp;
if (p!=NULL)
{
if ((varnum < 1) || (varnum > rVar(r)))
{
return NULL;
}
o=deg(p,r);
q=pNext(p);
while (q != NULL)
{
ii=deg(q,r);
if (ii>o) o=ii;
pIter(q);
}
q = p_Copy(p,r);
bp = sBucketCreate(r);
while (q != NULL)
{
ii = o-deg(q,r);
if (ii!=0)
{
p_AddExp(q,varnum, (long)ii,r);
p_Setm(q,r);
}
qn = pNext(q);
pNext(q) = NULL;
sBucket_Add_m(bp, q);
q = qn;
}
sBucketDestroyAdd(bp, &q, &ii);
}
return q;
}
p_AddExp
static long p_AddExp(poly p, int v, long ee, ring r)
Definition p_polys.h:608
pFDegProc
long(* pFDegProc)(poly p, ring r)
Definition ring.h:39
ringorder_lp
@ ringorder_lp
Definition ring.h:78
sBucket_Add_m
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition sbuckets.cc:173
sBucketCreate
sBucket_pt sBucketCreate(const ring r)
Definition sbuckets.cc:96
sBucket_pt
sBucket * sBucket_pt
Definition sbuckets.h:16
sBucketDestroyAdd
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition sbuckets.h:68

## p_HomogenDP()

poly p_HomogenDP | ( | poly | p,
|  | int | varnum,
|  | const ring | r )

Definition at line 3365 of file p_polys.cc.

{
poly q=NULL, qn;
int o,ii;
sBucket_pt bp;
if (p!=NULL)
{
if ((varnum < 1) || (varnum > rVar(r)))
{
return NULL;
}
o=p_Totaldegree(p,r);
q=pNext(p);
while (q != NULL)
{
ii=p_Totaldegree(q,r);
if (ii>o) o=ii;
pIter(q);
}
q = p_Copy(p,r);
bp = sBucketCreate(r);
while (q != NULL)
{
ii = o-p_Totaldegree(q,r);
if (ii!=0)
{
p_AddExp(q,varnum, (long)ii,r);
p_Setm(q,r);
}
qn = pNext(q);
pNext(q) = NULL;
sBucket_Add_m(bp, q);
q = qn;
}
sBucketDestroyAdd(bp, &q, &ii);
}
return q;
}

## p_IncrExp()

long p_IncrExp | ( | poly | p,
|  | int | v,
|  | ring | r )

inline static

Definition at line 593 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
int e = p_GetExp(p,v,r);
e++;
return p_SetExp(p,v,e,r);
}

## p_Init() [1/2]

poly p_Init | ( | const ring | r | ) |

inline static

Definition at line 1351 of file p_polys.h.

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

## p_Init() [2/2]

poly p_Init | ( | const ring | r,
|  | omBin | bin )

inline static

Definition at line 1341 of file p_polys.h.

{
p_CheckRing1(r);
pAssume1(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
poly p;
omTypeAlloc0Bin(poly, p, bin);
p_MemAdd_NegWeightAdjust(p, r);
p_SetRingOfLm(p, r);
return p;
}
p_CheckRing1
#define p_CheckRing1(r)
Definition monomials.h:178
omTypeAlloc0Bin
#define omTypeAlloc0Bin(type, addr, bin)
Definition omAllocDecl.h:204

## p_InitContent()

number p_InitContent | ( | poly | ph,
|  | const ring | r )

Definition at line 2683 of file p_polys.cc.

{
assume(!TEST_OPT_CONTENTSB);
assume(ph!=NULL);
assume(pNext(ph)!=NULL);
assume(rField_is_Q(r));
if (pNext(pNext(ph))==NULL)
{
return n_GetNumerator(pGetCoeff(pNext(ph)),r->cf);
}
poly p=ph;
number n1=n_GetNumerator(pGetCoeff(p),r->cf);
pIter(p);
number n2=n_GetNumerator(pGetCoeff(p),r->cf);
pIter(p);
number d;
number t;
loop
{
nlNormalize(pGetCoeff(p),r->cf);
t=n_GetNumerator(pGetCoeff(p),r->cf);
if (nlGreaterZero(t,r->cf))
d=nlAdd(n1,t,r->cf);
else
d=nlSub(n1,t,r->cf);
nlDelete(&t,r->cf);
nlDelete(&n1,r->cf);
n1=d;
pIter(p);
if (p==NULL) break;
nlNormalize(pGetCoeff(p),r->cf);
t=n_GetNumerator(pGetCoeff(p),r->cf);
if (nlGreaterZero(t,r->cf))
d=nlAdd(n2,t,r->cf);
else
d=nlSub(n2,t,r->cf);
nlDelete(&t,r->cf);
nlDelete(&n2,r->cf);
n2=d;
pIter(p);
if (p==NULL) break;
}
d=nlGcd(n1,n2,r->cf);
nlDelete(&n1,r->cf);
nlDelete(&n2,r->cf);
return d;
}
#else
{
/* ph has al least 2 terms */
number d=pGetCoeff(ph);
int s=n_Size(d,r->cf);
pIter(ph);
number d2=pGetCoeff(ph);
int s2=n_Size(d2,r->cf);
pIter(ph);
if (ph==NULL)
{
if (s<s2) return n_Copy(d,r->cf);
else return n_Copy(d2,r->cf);
}
do
{
number nd=pGetCoeff(ph);
int ns=n_Size(nd,r->cf);
if (ns<=2)
{
s2=s;
d2=d;
d=nd;
s=ns;
break;
}
else if (ns<s)
{
s2=s;
d2=d;
d=nd;
s=ns;
}
pIter(ph);
}
while(ph!=NULL);
return n_SubringGcd(d,d2,r->cf);
}
n_Size
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition coeffs.h:573
n_GetNumerator
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition coeffs.h:611
nlAdd
LINLINE number nlAdd(number la, number li, const coeffs r)
Definition longrat.cc:2672
nlSub
LINLINE number nlSub(number la, number li, const coeffs r)
Definition longrat.cc:2738
nlDelete
LINLINE void nlDelete(number *a, const coeffs r)
Definition longrat.cc:2637
nlGreaterZero
BOOLEAN nlGreaterZero(number za, const coeffs r)
Definition longrat.cc:1303
nlGcd
number nlGcd(number a, number b, const coeffs r)
Definition longrat.cc:1340
nlNormalize
void nlNormalize(number &x, const coeffs r)
Definition longrat.cc:1481

## p_IsConstant()

BOOLEAN p_IsConstant | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 1985 of file p_polys.h.

{
if (p == NULL) return TRUE;
return (pNext(p)==NULL) && p_LmIsConstant(p, r);
}
p_LmIsConstant
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition p_polys.h:1025

## p_IsConstantComp()

BOOLEAN p_IsConstantComp | ( | const poly | p,
|  | const ring | r )

inline static

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

Definition at line 1979 of file p_polys.h.

{
if (p == NULL) return TRUE;
return (pNext(p)==NULL) && p_LmIsConstantComp(p, r);
}
p_LmIsConstantComp
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition p_polys.h:1008

## p_IsConstantPoly()

BOOLEAN p_IsConstantPoly | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 1999 of file p_polys.h.

{
p_Test(p, r);
poly pp=p;
while(pp!=NULL)
{
if (! p_LmIsConstantComp(pp, r))
return FALSE;
pIter(pp);
}
return TRUE;
}

## p_ISet()

poly p_ISet | ( | long | i,
|  | const ring | r )

returns the poly representing the integer i

Definition at line 1298 of file p_polys.cc.

{
poly rc = NULL;
if (i!=0)
{
rc = p_Init(r);
pSetCoeff0(rc,n_Init(i,r->cf));
if (n_IsZero(pGetCoeff(rc),r->cf))
p_LmDelete(&rc,r);
}
return rc;
}

## p_IsHomogeneous()

BOOLEAN p_IsHomogeneous | ( | poly | p,
|  | const ring | r )

Definition at line 3408 of file p_polys.cc.

{
poly qp=p;
int o;
if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
pFDegProc d;
if (r->pLexOrder && (r->order[0]==ringorder_lp))
d=p_Totaldegree;
else
d=r->pFDeg;
o = d(p,r);
do
{
if (d(qp,r) != o) return FALSE;
pIter(qp);
}
while (qp != NULL);
return TRUE;
}

## p_IsHomogeneousDP()

BOOLEAN p_IsHomogeneousDP | ( | poly | p,
|  | const ring | r )

Definition at line 3432 of file p_polys.cc.

{
poly qp=p;
int o;
if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
o = p_Totaldegree(p,r);
do
{
if (p_Totaldegree(qp,r) != o) return FALSE;
pIter(qp);
}
while (qp != NULL);
return TRUE;
}

## p_IsHomogeneousW() [1/2]

BOOLEAN p_IsHomogeneousW | ( | poly | p,
|  | const intvec * | w,
|  | const intvec * | module_w,
|  | const ring | r )

Definition at line 3468 of file p_polys.cc.

{
poly qp=p;
long o;
if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
pIter(qp);
o = totaldegreeWecart_IV(p,r,w->ivGetVec())+(*module_w)[p_GetComp(p,r)];
do
{
long oo=totaldegreeWecart_IV(qp,r,w->ivGetVec())+(*module_w)[p_GetComp(qp,r)];
if (oo != o) return FALSE;
pIter(qp);
}
while (qp != NULL);
return TRUE;
}

## p_IsHomogeneousW() [2/2]

BOOLEAN p_IsHomogeneousW | ( | poly | p,
|  | const intvec * | w,
|  | const ring | r )

Definition at line 3451 of file p_polys.cc.

{
poly qp=p;
long o;
if ((p == NULL) || (pNext(p) == NULL)) return TRUE;
pIter(qp);
o = totaldegreeWecart_IV(p,r,w->ivGetVec());
do
{
if (totaldegreeWecart_IV(qp,r,w->ivGetVec()) != o) return FALSE;
pIter(qp);
}
while (qp != NULL);
return TRUE;
}

## p_IsOne()

BOOLEAN p_IsOne | ( | const poly | p,
|  | const ring | R )

inline static

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

Definition at line 1992 of file p_polys.h.

{
if (p == NULL) return FALSE; /* TODO check if 0 == 1 */
p_Test(p, R);
return (p_IsConstant(p, R) && n_IsOne(p_GetCoeff(p, R), R->cf));
}

## p_IsPurePower()

int p_IsPurePower | ( | const poly | p,
|  | const ring | r )

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

Definition at line 1227 of file p_polys.cc.

{
int i,k=0;
for (i=r->N;i;i--)
{
if (p_GetExp(p,i, r)!=0)
{
if(k!=0) return 0;
k=i;
}
}
return k;
}

## p_IsUnit()

BOOLEAN p_IsUnit | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 2012 of file p_polys.h.

{
if (p == NULL) return FALSE;
if (rField_is_Ring(r))
return (p_LmIsConstant(p, r) && n_IsUnit(pGetCoeff(p),r->cf));
return p_LmIsConstant(p, r);
}
n_IsUnit
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition coeffs.h:521

## p_IsUnivariate()

int p_IsUnivariate | ( | poly | p,
|  | const ring | r )

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

Definition at line 1248 of file p_polys.cc.

{
int i,k=-1;
while (p!=NULL)
{
for (i=r->N;i;i--)
{
if (p_GetExp(p,i, r)!=0)
{
if((k!=-1)&&(k!=i)) return 0;
k=i;
}
}
pIter(p);
}
return k;
}

## p_Jet()

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

Definition at line 4540 of file p_polys.cc.

{
while((p!=NULL) && (p_Totaldegree(p,R)>m)) p_LmDelete(&p,R);
if (p==NULL) return NULL;
poly r=p;
while (pNext(p)!=NULL)
{
if (p_Totaldegree(pNext(p),R)>m)
{
p_LmDelete(&pNext(p),R);
}
else
pIter(p);
}
return r;
}

## p_JetW()

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

Definition at line 4584 of file p_polys.cc.

{
while((p!=NULL) && (totaldegreeWecart_IV(p,R,w)>m)) p_LmDelete(&p,R);
if (p==NULL) return NULL;
poly r=p;
while (pNext(p)!=NULL)
{
if (totaldegreeWecart_IV(pNext(p),R,w)>m)
{
p_LmDelete(&pNext(p),R);
}
else
pIter(p);
}
return r;
}

## p_Last()

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

Definition at line 4775 of file p_polys.cc.

{
if (p == NULL)
{
l = 0;
return NULL;
}
l = 1;
poly a = p;
if (! rIsSyzIndexRing(r))
{
poly next = pNext(a);
while (next!=NULL)
{
a = next;
next = pNext(a);
l++;
}
}
else
{
long unsigned curr_limit = rGetCurrSyzLimit(r);
poly pp = a;
while ((a=pNext(a))!=NULL)
{
if (__p_GetComp(a,r)<=curr_limit/*syzComp*/)
l++;
else break;
pp = a;
}
a=pp;
}
return a;
}
next
ListNode * next
Definition janet.h:31
rGetCurrSyzLimit
static int rGetCurrSyzLimit(const ring r)
Definition ring.h:729
rIsSyzIndexRing
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition ring.h:726

## p_Lcm() [1/2]

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

Definition at line 1668 of file p_polys.cc.

{
poly m=p_Init(r);
p_Lcm(a, b, m, r);
p_Setm(m,r);
return(m);
}
p_Lcm
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition p_polys.cc:1659

## p_Lcm() [2/2]

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

Definition at line 1659 of file p_polys.cc.

{
for (int i=r->N; i; --i)
p_SetExp(m,i, si_max( p_GetExp(a,i,r), p_GetExp(b,i,r)),r);
p_SetComp(m, si_max(p_GetComp(a,r), p_GetComp(b,r)),r);
/* Don't do a pSetm here, otherwise hres/lres chockes */
}
si_max
static int si_max(const int a, const int b)
Definition auxiliary.h:125
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249

## p_LcmRat()

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

Definition at line 1681 of file p_polys.cc.

{
poly m = // p_One( r);
p_Init(r);
// const int (currRing->N) = r->N;
// for (int i = (currRing->N); i>=r->real_var_start; i--)
for (int i = r->real_var_end; i>=r->real_var_start; i--)
{
const int lExpA = p_GetExp (a, i, r);
const int lExpB = p_GetExp (b, i, r);
p_SetExp (m, i, si_max(lExpA, lExpB), r);
}
p_SetComp (m, lCompM, r);
p_Setm(m,r);
p_GetCoeff(m, r)=NULL;
return(m);
};

## p_LDeg()

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

inline static

Definition at line 383 of file p_polys.h.

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

## p_LmCheckIsFromRing()

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

Definition at line 74 of file pDebug.cc.

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

## p_LmCheckPolyRing()

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

Definition at line 123 of file pDebug.cc.

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

## p_LmCmp()

int p_LmCmp | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1601 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
p_LmCheckPolyRing1(q, r);
const unsigned long* _s1 = ((unsigned long*) p->exp);
const unsigned long* _s2 = ((unsigned long*) q->exp);
REGISTER unsigned long _v1;
REGISTER unsigned long _v2;
const unsigned long _l = r->CmpL_Size;
REGISTER unsigned long _i=0;
LengthGeneral_OrdGeneral_LoopTop:
_v1 = _s1[_i];
_v2 = _s2[_i];
if (_v1 == _v2)
{
_i++;
if (_i == _l) return 0;
goto LengthGeneral_OrdGeneral_LoopTop;
}
const long* _ordsgn = (long*) r->ordsgn;
#if 1 /* two variants*/
if (_v1 > _v2)
{
return _ordsgn[_i];
}
return -(_ordsgn[_i]);
#else
if (_v1 > _v2)
{
if (_ordsgn[_i] == 1) return 1;
return -1;
}
if (_ordsgn[_i] == 1) return -1;
return 1;
#endif
}
REGISTER
#define REGISTER
Definition omalloc.h:27

## p_LmDelete() [1/2]

void p_LmDelete | ( | poly * | p,
|  | const ring | r )

inline static

Definition at line 745 of file p_polys.h.

{
p_LmCheckPolyRing2(*p, r);
poly h = *p;
*p = pNext(h);
n_Delete(&pGetCoeff(h), r->cf);
#ifdef XALLOC_BIN
omFreeBin(h,r->PolyBin);
#else
omFreeBinAddr(h);
#endif
}
omFreeBin
#define omFreeBin(addr, bin)
Definition omAllocDecl.h:259
omFreeBinAddr
#define omFreeBinAddr(addr)
Definition omAllocDecl.h:258

## p_LmDelete() [2/2]

void p_LmDelete | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 725 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
n_Delete(&pGetCoeff(p), r->cf);
#ifdef XALLOC_BIN
omFreeBin(p,r->PolyBin);
#else
omFreeBinAddr(p);
#endif
}

## p_LmDelete0()

void p_LmDelete0 | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 735 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
if (pGetCoeff(p)!=NULL) n_Delete(&pGetCoeff(p), r->cf);
#ifdef XALLOC_BIN
omFreeBin(p,r->PolyBin);
#else
omFreeBinAddr(p);
#endif
}

## p_LmDeleteAndNext()

poly p_LmDeleteAndNext | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 757 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
poly pnext = pNext(p);
n_Delete(&pGetCoeff(p), r->cf);
#ifdef XALLOC_BIN
omFreeBin(p,r->PolyBin);
#else
omFreeBinAddr(p);
#endif
return pnext;
}

## p_LmDeleteAndNextRat()

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

Definition at line 1704 of file p_polys.cc.

{
/* modifies p*/
// Print("start: "); Print(" "); p_wrp(*p,r);
p_LmCheckPolyRing2(*p, r);
poly q = p_Head(*p,r);
const long cmp = p_GetComp(*p, r);
while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) ) && (p_GetComp(*p, r) == cmp) )
{
p_LmDelete(p,r);
// Print("while: ");p_wrp(*p,r);Print(" ");
}
// p_wrp(*p,r);Print(" ");
// PrintS("end\n");
p_LmDelete(&q,r);
}

## p_LmDivisibleBy()

BOOLEAN p_LmDivisibleBy | ( | poly | a,
|  | poly | b,
|  | const ring | r )

inline static

Definition at line 1912 of file p_polys.h.

{
p_LmCheckPolyRing1(b, r);
pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
return _p_LmDivisibleByNoComp(a, b, r);
return FALSE;
}

## p_LmDivisibleByNoComp() [1/2]

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

inline static

Definition at line 1905 of file p_polys.h.

{
p_LmCheckPolyRing1(a, ra);
p_LmCheckPolyRing1(b, rb);
return _p_LmDivisibleByNoComp(a, ra, b, rb);
}

## p_LmDivisibleByNoComp() [2/2]

BOOLEAN p_LmDivisibleByNoComp | ( | poly | a,
|  | poly | b,
|  | const ring | r )

inline static

Definition at line 1898 of file p_polys.h.

{
p_LmCheckPolyRing1(a, r);
p_LmCheckPolyRing1(b, r);
return _p_LmDivisibleByNoComp(a, b, r);
}

## p_LmDivisibleByPart()

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

inline static

Definition at line 1883 of file p_polys.h.

{
p_LmCheckPolyRing1(b, r);
pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
return _p_LmDivisibleByNoCompPart(a, r, b, r,start, end);
return FALSE;
}

## p_LmExpVectorAddIsOk()

BOOLEAN p_LmExpVectorAddIsOk | ( | const poly | p1,
|  | const poly | p2,
|  | const ring | r )

inline static

Definition at line 2020 of file p_polys.h.

{
p_LmCheckPolyRing(p1, r);
p_LmCheckPolyRing(p2, r);
unsigned long l1, l2, divmask = r->divmask;
int i;
for (i=0; i<r->VarL_Size; i++)
{
l1 = p1->exp[r->VarL_Offset[i]];
l2 = p2->exp[r->VarL_Offset[i]];
// do the divisiblity trick
if ( (l1 > ULONG_MAX - l2) ||
(((l1 & divmask) ^ (l2 & divmask)) != ((l1 + l2) & divmask)))
return FALSE;
}
return TRUE;
}

## p_LmFree() [1/2]

void p_LmFree | ( | poly * | p,
|  | ring | )

inline static

Definition at line 698 of file p_polys.h.

{
p_LmCheckPolyRing2(*p, r);
poly h = *p;
*p = pNext(h);
#ifdef XALLOC_BIN
omFreeBin(h,r->PolyBin);
#else
omFreeBinAddr(h);
#endif
}

## p_LmFree() [2/2]

void p_LmFree | ( | poly | p,
|  | ring | )

inline static

Definition at line 685 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
#ifdef XALLOC_BIN
omFreeBin(p,r->PolyBin);
#else
omFreeBinAddr(p);
#endif
}

## p_LmFreeAndNext()

poly p_LmFreeAndNext | ( | poly | p,
|  | ring | )

inline static

Definition at line 713 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
poly pnext = pNext(p);
#ifdef XALLOC_BIN
omFreeBin(p,r->PolyBin);
#else
omFreeBinAddr(p);
#endif
return pnext;
}

## p_LmInit() [1/3]

poly p_LmInit | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 1356 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
poly np;
omTypeAllocBin(poly, np, r->PolyBin);
p_SetRingOfLm(np, r);
memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
pNext(np) = NULL;
pSetCoeff0(np, NULL);
return np;
}

## p_LmInit() [2/3]

poly p_LmInit | ( | poly | s_p,
|  | const ring | s_r,
|  | const ring | d_r )

inline static

Definition at line 1384 of file p_polys.h.

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

## p_LmInit() [3/3]

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

inline static

Definition at line 1367 of file p_polys.h.

{
p_LmCheckPolyRing1(s_p, s_r);
p_CheckRing(d_r);
pAssume1(d_r->N <= s_r->N);
poly d_p = p_Init(d_r, d_bin);
for (unsigned i=d_r->N; i!=0; i--)
{
p_SetExp(d_p, i, p_GetExp(s_p, i,s_r), d_r);
}
if (rRing_has_Comp(d_r))
{
p_SetComp(d_p, p_GetComp(s_p,s_r), d_r);
}
p_Setm(d_p, d_r);
return d_p;
}
p_CheckRing
BOOLEAN p_CheckRing(ring r)
Definition pDebug.cc:131

## p_LmIsConstant()

BOOLEAN p_LmIsConstant | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 1025 of file p_polys.h.

{
if (p_LmIsConstantComp(p, r))
return (p_GetComp(p, r) == 0);
return FALSE;
}

## p_LmIsConstantComp()

BOOLEAN p_LmIsConstantComp | ( | const poly | p,
|  | const ring | r )

inline static

Definition at line 1008 of file p_polys.h.

{
//p_LmCheckPolyRing(p, r);
int i = r->VarL_Size - 1;
do
{
if (p->exp[r->VarL_Offset[i]] != 0)
return FALSE;
i--;
}
while (i >= 0);
return TRUE;
}

## p_LmShallowCopyDelete()

poly p_LmShallowCopyDelete | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 1414 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
pAssume1(omSizeWOfBin(bin) == omSizeWOfBin(r->PolyBin));
poly new_p = p_New(r);
memcpy(new_p->exp, p->exp, r->ExpL_Size*sizeof(long));
pSetCoeff0(new_p, pGetCoeff(p));
pNext(new_p) = pNext(p);
omFreeBinAddr(p);
return new_p;
}
p_New
static poly p_New(const ring, omBin bin)
Definition p_polys.h:666

## p_LmShortDivisibleBy()

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

inline static

Definition at line 1931 of file p_polys.h.

{
p_LmCheckPolyRing1(a, r);
p_LmCheckPolyRing1(b, r);
#ifndef PDIV_DEBUG
_pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
_pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
if (sev_a & not_sev_b)
{
pAssume1(p_LmDivisibleByNoComp(a, b, r) == FALSE);
return FALSE;
}
return p_LmDivisibleBy(a, b, r);
#else
return pDebugLmShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);
#endif
}
_pPolyAssume2
#define _pPolyAssume2(cond, p, r)
Definition monomials.h:195
p_LmDivisibleByNoComp
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition p_polys.h:1898
p_LmDivisibleBy
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1912
p_GetShortExpVector
unsigned long p_GetShortExpVector(const poly a, const ring r)
Definition p_polys.cc:4934

## p_LmShortDivisibleByNoComp()

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

inline static

Definition at line 1951 of file p_polys.h.

{
p_LmCheckPolyRing1(a, r);
p_LmCheckPolyRing1(b, r);
#ifndef PDIV_DEBUG
_pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
_pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
if (sev_a & not_sev_b)
{
pAssume1(p_LmDivisibleByNoComp(a, b, r) == FALSE);
return FALSE;
}
return p_LmDivisibleByNoComp(a, b, r);
#else
return pDebugLmShortDivisibleByNoComp(a, sev_a, r, b, not_sev_b, r);
#endif
}

## p_LowVar()

int p_LowVar | ( | poly | p,
|  | const ring | r )

the minimal index of used variables - 1

Definition at line 4834 of file p_polys.cc.

{
int k,l,lex;
if (p == NULL) return -1;
k = 32000;/*a very large dummy value*/
while (p != NULL)
{
l = 1;
lex = p_GetExp(p,l,r);
while ((l < (rVar(r))) && (lex == 0))
{
l++;
lex = p_GetExp(p,l,r);
}
l--;
if (l < k) k = l;
pIter(p);
}
return k;
}

## p_LtCmp()

int p_LtCmp | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1642 of file p_polys.h.

{
int res = p_LmCmp(p,q,r);
if(res == 0)
{
if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
return res;
number pc = n_Copy(p_GetCoeff(p,r),r->cf);
number qc = n_Copy(p_GetCoeff(q,r),r->cf);
if(!n_GreaterZero(pc,r->cf))
pc = n_InpNeg(pc,r->cf);
if(!n_GreaterZero(qc,r->cf))
qc = n_InpNeg(qc,r->cf);
if(n_Greater(pc,qc,r->cf))
res = 1;
else if(n_Greater(qc,pc,r->cf))
res = -1;
else if(n_Equal(pc,qc,r->cf))
res = 0;
n_Delete(&pc,r->cf);
n_Delete(&qc,r->cf);
}
return res;
}
n_Greater
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition coeffs.h:517

## p_LtCmpNoAbs()

int p_LtCmpNoAbs | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1668 of file p_polys.h.

{
int res = p_LmCmp(p,q,r);
if(res == 0)
{
if(p_GetCoeff(p,r) == NULL || p_GetCoeff(q,r) == NULL)
return res;
number pc = p_GetCoeff(p,r);
number qc = p_GetCoeff(q,r);
if(n_Greater(pc,qc,r->cf))
res = 1;
if(n_Greater(qc,pc,r->cf))
res = -1;
if(n_Equal(pc,qc,r->cf))
res = 0;
}
return res;
}

## p_LtCmpOrdSgnDiffM()

int p_LtCmpOrdSgnDiffM | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1690 of file p_polys.h.

{
return(p_LtCmp(p,q,r) == r->OrdSgn);
}
p_LtCmp
static int p_LtCmp(poly p, poly q, const ring r)
Definition p_polys.h:1642

## p_LtCmpOrdSgnDiffP()

int p_LtCmpOrdSgnDiffP | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1699 of file p_polys.h.

{
if(r->OrdSgn == 1)
{
return(p_LmCmp(p,q,r) == -1);
}
else
{
return(p_LtCmp(p,q,r) != -1);
}
}

## p_LtCmpOrdSgnEqM()

int p_LtCmpOrdSgnEqM | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1715 of file p_polys.h.

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

## p_LtCmpOrdSgnEqP()

int p_LtCmpOrdSgnEqP | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1724 of file p_polys.h.

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

## p_MaxComp() [1/2]

long p_MaxComp | ( | poly | p,
|  | ring | lmRing )

inline static

Definition at line 313 of file p_polys.h.

{return p_MaxComp(p,lmRing,lmRing);}
p_MaxComp
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:294

## p_MaxComp() [2/2]

long p_MaxComp | ( | poly | p,
|  | ring | lmRing,
|  | ring | tailRing )

inline static

Definition at line 294 of file p_polys.h.

{
long result,i;
if(p==NULL) return 0;
result = p_GetComp(p, lmRing);
if (result != 0)
{
loop
{
pIter(p);
if(p==NULL) break;
i = p_GetComp(p, tailRing);
if (i>result) result = i;
}
}
return result;
}

## p_MaxExpPerVar()

int p_MaxExpPerVar | ( | poly | p,
|  | int | i,
|  | const ring | r )

max exponent of variable x_i in p

Definition at line 5146 of file p_polys.cc.

{
int m=0;
while(p!=NULL)
{
int mm=p_GetExp(p,i,r);
if (mm>m) m=mm;
pIter(p);
}
return m;
}

## p_MDivide()

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

Definition at line 1493 of file p_polys.cc.

{
assume((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(b,r)==0));
int i;
poly result = p_Init(r);
for(i=(int)r->N; i; i--)
p_SetExp(result,i, p_GetExp(a,i,r)- p_GetExp(b,i,r),r);
p_SetComp(result, p_GetComp(a,r) - p_GetComp(b,r),r);
p_Setm(result,r);
return result;
}

## p_MemAdd_NegWeightAdjust()

void p_MemAdd_NegWeightAdjust | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 1313 of file p_polys.h.

{
if (r->NegWeightL_Offset != NULL)
{
for (int i=r->NegWeightL_Size-1; i>=0; i--)
{
p->exp[r->NegWeightL_Offset[i]] -= POLY_NEGWEIGHT_OFFSET;
}
}
}

## p_MemSub_NegWeightAdjust()

void p_MemSub_NegWeightAdjust | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 1323 of file p_polys.h.

{
if (r->NegWeightL_Offset != NULL)
{
for (int i=r->NegWeightL_Size-1; i>=0; i--)
{
p->exp[r->NegWeightL_Offset[i]] += POLY_NEGWEIGHT_OFFSET;
}
}
}

## p_Merge_q()

poly p_Merge_q | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1233 of file p_polys.h.

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

## p_MinComp() [1/2]

long p_MinComp | ( | poly | p,
|  | ring | lmRing )

inline static

Definition at line 334 of file p_polys.h.

{return p_MinComp(p,lmRing,lmRing);}
p_MinComp
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:315

## p_MinComp() [2/2]

long p_MinComp | ( | poly | p,
|  | ring | lmRing,
|  | ring | tailRing )

inline static

Definition at line 315 of file p_polys.h.

{
long result,i;
if(p==NULL) return 0;
result = p_GetComp(p,lmRing);
if (result != 0)
{
loop
{
pIter(p);
if(p==NULL) break;
i = p_GetComp(p,tailRing);
if (i<result) result = i;
}
}
return result;
}

## p_MinDeg()

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

Definition at line 4602 of file p_polys.cc.

{
if(p==NULL)
return -1;
int d=-1;
while(p!=NULL)
{
int d0=0;
for(int j=0;j<rVar(R);j++)
if(w==NULL||j>=w->length())
d0+=p_GetExp(p,j+1,R);
else
d0+=(*w)[j]*p_GetExp(p,j+1,R);
if(d0<d||d==-1)
d=d0;
pIter(p);
}
return d;
}

## p_mInit()

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

Definition at line 1443 of file p_polys.cc.

{
poly p;
char *sst=(char*)st;
BOOLEAN neg=FALSE;
if (sst[0]=='-') { neg=TRUE; sst=sst+1; }
const char *s=p_Read(sst,p,r);
if (*s!='\0')
{
if ((s!=sst)&&isdigit(sst[0]))
{
errorreported=TRUE;
}
ok=FALSE;
if (p!=NULL)
{
if (pGetCoeff(p)==NULL) p_LmFree(p,r);
else p_LmDelete(p,r);
}
return NULL;
}
p_Test(p,r);
ok=!errorreported;
if (neg) p=p_Neg(p,r);
return p;
}
errorreported
VAR short errorreported
Definition feFopen.cc:23
p_Read
const char * p_Read(const char *st, poly &rc, const ring r)
Definition p_polys.cc:1371

## p_Minus_mm_Mult_qq() [1/2]

poly p_Minus_mm_Mult_qq | ( | poly | p,
|  | const poly | m,
|  | const poly | q,
|  | const ring | r )

inline static

Definition at line 1088 of file p_polys.h.

{
int shorter;
return r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
}

## p_Minus_mm_Mult_qq() [2/2]

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

inline static

Definition at line 1077 of file p_polys.h.

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

## p_mm_Mult()

poly p_mm_Mult | ( | poly | p,
|  | poly | m,
|  | const ring | r )

inline static

Definition at line 1068 of file p_polys.h.

{
if (p==NULL) return NULL;
if (p_LmIsConstant(m, r))
return __p_Mult_nn(p, pGetCoeff(m), r);
else
return r->p_Procs->p_mm_Mult(p, m, r);
}

## p_Mult_mm()

poly p_Mult_mm | ( | poly | p,
|  | poly | m,
|  | const ring | r )

inline static

Definition at line 1053 of file p_polys.h.

{
if (p==NULL) return NULL;
if (UNLIKELY(m==NULL)) /* && (p!=NULL) */
{
r->p_Procs->p_Delete(&p, r);
return NULL;
}
if (p_LmIsConstant(m, r))
return __p_Mult_nn(p, pGetCoeff(m), r);
else
return r->p_Procs->p_Mult_mm(p, m, r);
}
UNLIKELY
#define UNLIKELY(X)
Definition auxiliary.h:405

## p_Mult_nn() [1/2]

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

inline static

Definition at line 975 of file p_polys.h.

{
assume(p!=NULL);
#ifndef PDEBUG
if (lmRing == tailRing)
return p_Mult_nn(p, n, tailRing);
#endif
poly pnext = pNext(p);
pNext(p) = NULL;
p = lmRing->p_Procs->p_Mult_nn(p, n, lmRing);
if (pnext!=NULL)
{
pNext(p) = tailRing->p_Procs->p_Mult_nn(pnext, n, tailRing);
}
return p;
}
p_Mult_nn
static poly p_Mult_nn(poly p, number n, const ring r)
Definition p_polys.h:960

## p_Mult_nn() [2/2]

poly p_Mult_nn | ( | poly | p,
|  | number | n,
|  | const ring | r )

inline static

Definition at line 960 of file p_polys.h.

{
if (p==NULL) return NULL;
if (n_IsOne(n, r->cf))
return p;
else if (n_IsZero(n, r->cf))
{
p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
return NULL;
}
else
return r->p_Procs->p_Mult_nn(p, n, r);
}

## p_Mult_q()

poly p_Mult_q | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1125 of file p_polys.h.

{
assume( (p != q) || (p == NULL && q == NULL) );
if (UNLIKELY(p == NULL))
{
p_Delete(&q, r);
return NULL;
}
if (UNLIKELY(q == NULL))
{
p_Delete(&p, r);
return NULL;
}
if (pNext(p) == NULL)
{
q = r->p_Procs->p_mm_Mult(q, p, r);
p_LmDelete(&p, r);
return q;
}
if (pNext(q) == NULL)
{
p = r->p_Procs->p_Mult_mm(p, q, r);
p_LmDelete(&q, r);
return p;
}
#if defined(HAVE_PLURAL) || defined(HAVE_SHIFTBBA)
if (UNLIKELY(rIsNCRing(r)))
return _nc_p_Mult_q(p, q, r);
else
#endif
#ifdef HAVE_RINGS
if (UNLIKELY(!nCoeff_is_Domain(r->cf)))
return _p_Mult_q_Normal_ZeroDiv(p, q, 0, r);
else
#endif
return _p_Mult_q(p, q, 0, r);
}
nCoeff_is_Domain
static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
Definition coeffs.h:736
_nc_p_Mult_q
poly _nc_p_Mult_q(poly p, poly q, const ring r)
general NC-multiplication with destruction
Definition old.gring.cc:215
_p_Mult_q
poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2,...
Definition p_Mult_q.cc:309
_p_Mult_q_Normal_ZeroDiv
poly _p_Mult_q_Normal_ZeroDiv(poly p, poly q, const int copy, const ring r)
Definition p_Mult_q.cc:195

## p_MultExp()

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

inline static

Definition at line 623 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
long e = p_GetExp(p,v,r);
e *= ee;
return p_SetExp(p,v,e,r);
}

## p_Neg()

poly p_Neg | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 1114 of file p_polys.h.

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

## p_New() [1/2]

poly p_New | ( | const ring | ,
|  | omBin | bin )

inline static

Definition at line 666 of file p_polys.h.

{
p_CheckRing2(r);
pAssume2(bin != NULL && omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
poly p;
omTypeAllocBin(poly, p, bin);
p_SetRingOfLm(p, r);
return p;
}
p_CheckRing2
#define p_CheckRing2(r)
Definition monomials.h:200

## p_New() [2/2]

poly p_New | ( | ring | r | ) |

inline static

Definition at line 677 of file p_polys.h.

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

## p_Norm()

void p_Norm | ( | poly | p1,
|  | const ring | r )

Definition at line 3844 of file p_polys.cc.

{
if (UNLIKELY(p1==NULL)) return;
if (rField_is_Ring(r))
{
if(!n_GreaterZero(pGetCoeff(p1),r->cf)) p1 = p_Neg(p1,r);
if (!n_IsUnit(pGetCoeff(p1), r->cf)) return;
// Werror("p_Norm not possible in the case of coefficient rings.");
}
else //(p1!=NULL)
{
if (!n_IsOne(pGetCoeff(p1),r->cf))
{
if (UNLIKELY(pNext(p1)==NULL))
{
p_SetCoeff(p1,n_Init(1,r->cf),r);
return;
}
number k = pGetCoeff(p1);
pSetCoeff0(p1,n_Init(1,r->cf));
poly h = pNext(p1);
if (LIKELY(rField_is_Zp(r)))
{
if (r->cf->ch>32003)
{
number inv=n_Invers(k,r->cf);
while (h!=NULL)
{
number c=n_Mult(pGetCoeff(h),inv,r->cf);
// no need to normalize
p_SetCoeff(h,c,r);
pIter(h);
}
// no need for n_Delete for Zp: n_Delete(&inv,r->cf);
}
else
{
while (h!=NULL)
{
number c=n_Div(pGetCoeff(h),k,r->cf);
// no need to normalize
p_SetCoeff(h,c,r);
pIter(h);
}
}
}
else if(getCoeffType(r->cf)==n_algExt)
{
n_Normalize(k,r->cf);
number inv=n_Invers(k,r->cf);
while (h!=NULL)
{
number c=n_Mult(pGetCoeff(h),inv,r->cf);
// no need to normalize
// normalize already in nMult: Zp_a, Q_a
p_SetCoeff(h,c,r);
pIter(h);
}
n_Delete(&inv,r->cf);
n_Delete(&k,r->cf);
}
else
{
n_Normalize(k,r->cf);
while (h!=NULL)
{
number c=n_Div(pGetCoeff(h),k,r->cf);
// no need to normalize: Z/p, R
// remains: Q
if (rField_is_Q(r)) n_Normalize(c,r->cf);
p_SetCoeff(h,c,r);
pIter(h);
}
n_Delete(&k,r->cf);
}
}
else
{
//if (r->cf->cfNormalize != nDummy2) //TODO: OPTIMIZE
if (rField_is_Q(r))
{
poly h = pNext(p1);
while (h!=NULL)
{
n_Normalize(pGetCoeff(h),r->cf);
pIter(h);
}
}
}
}
}
LIKELY
#define LIKELY(X)
Definition auxiliary.h:404

## p_Normalize()

void p_Normalize | ( | poly | p,
|  | const ring | r )

Definition at line 3939 of file p_polys.cc.

{
const coeffs cf=r->cf;
/* Z/p, GF(p,n), R, long R/C, Nemo rings */
if (cf->cfNormalize==ndNormalize)
return;
while (p!=NULL)
{
// no test before n_Normalize: n_Normalize should fix problems
n_Normalize(pGetCoeff(p),cf);
pIter(p);
}
}
ndNormalize
void ndNormalize(number &, const coeffs)
Definition numbers.cc:191

## p_NSet()

poly p_NSet | ( | number | n,
|  | const ring | r )

returns the poly representing the number n, destroys n

Definition at line 1474 of file p_polys.cc.

{
if (n_IsZero(n,r->cf))
{
n_Delete(&n, r->cf);
return NULL;
}
else
{
poly rc = p_Init(r);
pSetCoeff0(rc,n);
return rc;
}
}

## p_One()

poly p_One | ( | const ring | r | ) |

Definition at line 1314 of file p_polys.cc.

{
poly rc = p_Init(r);
pSetCoeff0(rc,n_Init(1,r->cf));
return rc;
}

## p_OneComp()

BOOLEAN p_OneComp | ( | poly | p,
|  | const ring | r )

return TRUE if all monoms have the same component

Definition at line 1209 of file p_polys.cc.

{
if(p!=NULL)
{
long i = p_GetComp(p, r);
while (pNext(p)!=NULL)
{
pIter(p);
if(i != p_GetComp(p, r)) return FALSE;
}
}
return TRUE;
}

## 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 4256 of file p_polys.cc.

{
#if 0
p_Test(p, oldRing);
PrintS("p_PermPoly::p: "); p_Write(p, oldRing, oldRing);
#endif
const int OldpVariables = rVar(oldRing);
poly result = NULL;
poly result_last = NULL;
poly aq = NULL; /* the map coefficient */
poly qq; /* the mapped monomial */
assume(dst != NULL);
assume(dst->cf != NULL);
#ifdef HAVE_PLURAL
poly tmp_mm=p_One(dst);
#endif
while (p != NULL)
{
// map the coefficient
if ( ((OldPar == 0) || (par_perm == NULL) || rField_is_GF(oldRing) || (nMap==ndCopyMap))
&& (nMap != NULL) )
{
qq = p_Init(dst);
assume( nMap != NULL );
number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf);
n_Test (n,dst->cf);
if ( nCoeff_is_algExt(dst->cf) )
n_Normalize(n, dst->cf);
p_GetCoeff(qq, dst) = n;// Note: n can be a ZERO!!!
}
else
{
qq = p_One(dst);
// aq = naPermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing); // no dst???
// poly n_PermNumber(const number z, const int *par_perm, const int P, const ring src, const ring dst)
aq = n_PermNumber(p_GetCoeff(p, oldRing), par_perm, OldPar, oldRing, dst);
p_Test(aq, dst);
if ( nCoeff_is_algExt(dst->cf) )
p_Normalize(aq,dst);
if (aq == NULL)
p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!!
p_Test(aq, dst);
}
if (rRing_has_Comp(dst))
p_SetComp(qq, p_GetComp(p, oldRing), dst);
if ( n_IsZero(pGetCoeff(qq), dst->cf) )
{
p_LmDelete(&qq,dst);
qq = NULL;
}
else
{
// map pars:
int mapped_to_par = 0;
for(int i = 1; i <= OldpVariables; i++)
{
int e = p_GetExp(p, i, oldRing);
if (e != 0)
{
if (perm==NULL)
p_SetExp(qq, i, e, dst);
else if (perm[i]>0)
{
#ifdef HAVE_PLURAL
if(use_mult)
{
p_SetExp(tmp_mm,perm[i],e,dst);
p_Setm(tmp_mm,dst);
qq=p_Mult_mm(qq,tmp_mm,dst);
p_SetExp(tmp_mm,perm[i],0,dst);
}
else
#endif
p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, dst);
}
else if (perm[i]<0)
{
number c = p_GetCoeff(qq, dst);
if (rField_is_GF(dst))
{
assume( dst->cf->extRing == NULL );
number ee = n_Param(1, dst);
number eee;
n_Power(ee, e, &eee, dst->cf); //nfDelete(ee,dst);
ee = n_Mult(c, eee, dst->cf);
//nfDelete(c,dst);nfDelete(eee,dst);
pSetCoeff0(qq,ee);
}
else if (nCoeff_is_Extension(dst->cf))
{
const int par = -perm[i];
assume( par > 0 );
// WarnS("longalg missing 3");
#if 1
const coeffs C = dst->cf;
assume( C != NULL );
const ring R = C->extRing;
assume( R != NULL );
assume( par <= rVar(R) );
poly pcn; // = (number)c
assume( !n_IsZero(c, C) );
if( nCoeff_is_algExt(C) )
pcn = (poly) c;
else // nCoeff_is_transExt(C)
pcn = NUM((fraction)c);
if (pNext(pcn) == NULL) // c->z
p_AddExp(pcn, -perm[i], e, R);
else /* more difficult: we have really to multiply: */
{
poly mmc = p_ISet(1, R);
p_SetExp(mmc, -perm[i], e, R);
p_Setm(mmc, R);
number nnc;
// convert back to a number: number nnc = mmc;
if( nCoeff_is_algExt(C) )
nnc = (number) mmc;
else // nCoeff_is_transExt(C)
nnc = ntInit(mmc, C);
p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C);
n_Delete((number *)&c, C);
n_Delete((number *)&nnc, C);
}
mapped_to_par=1;
#endif
}
}
else
{
/* this variable maps to 0 !*/
p_LmDelete(&qq, dst);
break;
}
}
}
if ( mapped_to_par && (qq!= NULL) && nCoeff_is_algExt(dst->cf) )
{
number n = p_GetCoeff(qq, dst);
n_Normalize(n, dst->cf);
p_GetCoeff(qq, dst) = n;
}
}
pIter(p);
#if 0
p_Test(aq,dst);
PrintS("aq: "); p_Write(aq, dst, dst);
#endif
#if 1
if (qq!=NULL)
{
p_Setm(qq,dst);
p_Test(aq,dst);
p_Test(qq,dst);
#if 0
PrintS("qq: "); p_Write(qq, dst, dst);
#endif
if (aq!=NULL)
qq=p_Mult_q(aq,qq,dst);
aq = qq;
while (pNext(aq) != NULL) pIter(aq);
if (result_last==NULL)
{
result=qq;
}
else
{
pNext(result_last)=qq;
}
result_last=aq;
aq = NULL;
}
else if (aq!=NULL)
{
p_Delete(&aq,dst);
}
}
result=p_SortAdd(result,dst);
#else
// if (qq!=NULL)
// {
// pSetm(qq);
// pTest(qq);
// pTest(aq);
// if (aq!=NULL) qq=pMult(aq,qq);
// aq = qq;
// while (pNext(aq) != NULL) pIter(aq);
// pNext(aq) = result;
// aq = NULL;
// result = qq;
// }
// else if (aq!=NULL)
// {
// pDelete(&aq);
// }
//}
//p = result;
//result = NULL;
//while (p != NULL)
//{
// qq = p;
// pIter(p);
// qq->next = NULL;
// result = pAdd(result, qq);
//}
#endif
p_Test(result,dst);
#if 0
p_Test(result,dst);
PrintS("result: "); p_Write(result,dst,dst);
#endif
#ifdef HAVE_PLURAL
p_LmDelete(&tmp_mm,dst);
#endif
return result;
}
n_Param
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition coeffs.h:778
nCoeff_is_Extension
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:841
ndCopyMap
number ndCopyMap(number a, const coeffs src, const coeffs dst)
Definition numbers.cc:293
n_Power
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition coeffs.h:635
n_PermNumber
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
Definition p_polys.cc:4153
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
p_One
poly p_One(const ring r)
Definition p_polys.cc:1314
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342
p_Mult_mm
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1053
p_SortAdd
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition p_polys.h:1240
rField_is_GF
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:527
ntInit
number ntInit(long i, const coeffs cf)
Definition transext.cc:704

## p_Plus_mm_Mult_qq() [1/2]

poly p_Plus_mm_Mult_qq | ( | poly | p,
|  | poly | m,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1226 of file p_polys.h.

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

## p_Plus_mm_Mult_qq() [2/2]

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

inline static

Definition at line 1204 of file p_polys.h.

{
#ifdef HAVE_PLURAL
if (rIsPluralRing(r))
return nc_p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
#endif
// this should be implemented more efficiently
poly res;
int shorter;
number n_old = pGetCoeff(m);
number n_neg = n_Copy(n_old, r->cf);
n_neg = n_InpNeg(n_neg, r->cf);
pSetCoeff0(m, n_neg);
res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r);
lp = (lp + lq) - shorter;
pSetCoeff0(m, n_old);
n_Delete(&n_neg, r->cf);
return res;
}
nc_p_Plus_mm_Mult_qq
poly nc_p_Plus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, const int, const ring r)
Definition old.gring.cc:168
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406

## 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 1874 of file p_polys.cc.

{
assume(divisor != NULL);
if (p == NULL) return NULL;
poly result = NULL;
number divisorLC = p_GetCoeff(divisor, r);
int divisorLE = p_GetExp(divisor, 1, r);
while ((p != NULL) && (p_Deg(p, r) >= p_Deg(divisor, r)))
{
/* determine t = LT(p) / LT(divisor) */
poly t = p_ISet(1, r);
number c = n_Div(p_GetCoeff(p, r), divisorLC, r->cf);
n_Normalize(c,r->cf);
p_SetCoeff(t, c, r);
int e = p_GetExp(p, 1, r) - divisorLE;
p_SetExp(t, 1, e, r);
p_Setm(t, r);
if (needResult) result = p_Add_q(result, p_Copy(t, r), r);
p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
}
return result;
}
p_Deg
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586

## p_Power()

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

Definition at line 2245 of file p_polys.cc.

{
poly rc=NULL;
if (i==0)
{
p_Delete(&p,r);
return p_One(r);
}
if(p!=NULL)
{
if ( (i > 0) && ((unsigned long ) i > (r->bitmask))
#ifdef HAVE_SHIFTBBA
&& (!rIsLPRing(r))
#endif
)
{
Werror("exponent %d is too large, max. is %ld",i,r->bitmask);
return NULL;
}
switch (i)
{
// cannot happen, see above
// case 0:
// {
// rc=pOne();
// pDelete(&p);
// break;
// }
case 1:
rc=p;
break;
case 2:
rc=p_Mult_q(p_Copy(p,r),p,r);
break;
default:
if (i < 0)
{
p_Delete(&p,r);
return NULL;
}
else
{
#ifdef HAVE_PLURAL
if (rIsNCRing(r)) /* in the NC case nothing helps :-( */
{
int j=i;
rc = p_Copy(p,r);
while (j>1)
{
rc = p_Mult_q(p_Copy(p,r),rc,r);
j--;
}
p_Delete(&p,r);
return rc;
}
#endif
rc = pNext(p);
if (rc == NULL)
return p_MonPower(p,i,r);
/* else: binom ?*/
int char_p=rInternalChar(r);
if ((char_p>0) && (i>char_p)
&& ((rField_is_Zp(r,char_p)
|| (rField_is_Zp_a(r,char_p)))))
{
poly h=p_Pow_charp(p_Copy(p,r),char_p,r);
int rest=i-char_p;
while (rest>=char_p)
{
rest-=char_p;
h=p_Mult_q(h,p_Pow_charp(p_Copy(p,r),char_p,r),r);
}
poly res=h;
if (rest>0)
res=p_Mult_q(p_Power(p_Copy(p,r),rest,r),h,r);
p_Delete(&p,r);
return res;
}
if ((pNext(rc) != NULL)
|| rField_is_Ring(r)
)
return p_Pow(p,i,r);
if ((char_p==0) || (i<=char_p)) /* && pNext(rc)==NULL */
return p_TwoMonPower(p,i,r);
return p_Pow(p,i,r);
}
/*end default:*/
}
}
return rc;
}
p_Power
poly p_Power(poly p, int i, const ring r)
Definition p_polys.cc:2245
p_TwoMonPower
static poly p_TwoMonPower(poly p, int exp, const ring r)
Definition p_polys.cc:2118
p_Pow_charp
static poly p_Pow_charp(poly p, int i, const ring r)
Definition p_polys.cc:2233
p_MonPower
static poly p_MonPower(poly p, int exp, const ring r)
Definition p_polys.cc:2004
p_Pow
static poly p_Pow(poly p, int i, const ring r)
Definition p_polys.cc:2183
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
rInternalChar
static int rInternalChar(const ring r)
Definition ring.h:695
rIsLPRing
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417

## p_ProjectiveUnique()

void p_ProjectiveUnique | ( | poly | p,
|  | const ring | r )

Definition at line 3191 of file p_polys.cc.

{
if( ph == NULL )
return;
const coeffs C = r->cf;
number h;
poly p;
if (nCoeff_is_Ring(C))
{
p_ContentForGB(ph,r);
if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
assume( n_GreaterZero(pGetCoeff(ph),C) );
return;
}
if (nCoeff_is_Zp(C) && TEST_OPT_INTSTRATEGY)
{
if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
return;
}
p = ph;
assume(p != NULL);
if(pNext(p)==NULL) // a monomial
{
p_SetCoeff(p, n_Init(1, C), r);
return;
}
assume(pNext(p)!=NULL);
if(!nCoeff_is_Q(C) && !nCoeff_is_transExt(C))
{
h = p_GetCoeff(p, C);
number hInv = n_Invers(h, C);
if(errorreported) return;
pIter(p);
while (p!=NULL)
{
p_SetCoeff(p, n_Mult(p_GetCoeff(p, C), hInv, C), r);
pIter(p);
}
n_Delete(&hInv, C);
p = ph;
p_SetCoeff(p, n_Init(1, C), r);
}
p_Cleardenom(ph, r); //removes also Content
/* normalize ph over a transcendental extension s.t.
lead (ph) is > 0 if extRing->cf == Q
or lead (ph) is monic if extRing->cf == Zp*/
if (nCoeff_is_transExt(C))
{
p= ph;
h= p_GetCoeff (p, C);
fraction f = (fraction) h;
number n=p_GetCoeff (NUM (f),C->extRing->cf);
if (rField_is_Q (C->extRing))
{
if (!n_GreaterZero(n,C->extRing->cf))
{
p=p_Neg (p,r);
}
}
else if (rField_is_Zp(C->extRing))
{
if (!n_IsOne (n, C->extRing->cf))
{
n=n_Invers (n,C->extRing->cf);
nMapFunc nMap;
nMap= n_SetMap (C->extRing->cf, C);
number ninv= nMap (n,C->extRing->cf, C);
p=__p_Mult_nn (p, ninv, r);
n_Delete (&ninv, C);
n_Delete (&n, C->extRing->cf);
}
}
p= ph;
}
return;
}
nCoeff_is_Ring
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition coeffs.h:732
nCoeff_is_Zp
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition coeffs.h:795
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2893

## p_Read()

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

Definition at line 1371 of file p_polys.cc.

{
if (r==NULL) { rc=NULL;return st;}
int i,j;
rc = p_Init(r);
const char *s = n_Read(st,&(p_GetCoeff(rc, r)),r->cf);
if (s==st)
/* i.e. it does not start with a coeff: test if it is a ringvar*/
{
j = r_IsRingVar(s,r->names,r->N);
if (j >= 0)
{
p_IncrExp(rc,1+j,r);
while (*s!='\0') s++;
goto done;
}
}
while (*s!='\0')
{
char ss[2];
ss[0] = *s++;
ss[1] = '\0';
j = r_IsRingVar(ss,r->names,r->N);
if (j >= 0)
{
const char *s_save=s;
s = eati(s,&i);
if (((unsigned long)i) > r->bitmask/2)
{
// exponent to large: it is not a monomial
p_LmDelete(&rc,r);
return s_save;
}
p_AddExp(rc,1+j, (long)i, r);
}
else
{
// 1st char of is not a varname
// We return the parsed polynomial nevertheless. This is needed when
// we are parsing coefficients in a rational function field.
s--;
break;
}
}
done:
if (n_IsZero(pGetCoeff(rc),r->cf)) p_LmDelete(&rc,r);
else
{
#ifdef HAVE_PLURAL
// in super-commutative ring
// squares of anti-commutative variables are zeroes!
if(rIsSCA(r))
{
const unsigned int iFirstAltVar = scaFirstAltVar(r);
const unsigned int iLastAltVar = scaLastAltVar(r);
assume(rc != NULL);
for(unsigned int k = iFirstAltVar; k <= iLastAltVar; k++)
if( p_GetExp(rc, k, r) > 1 )
{
p_LmDelete(&rc, r);
goto finish;
}
}
#endif
p_Setm(rc,r);
}
finish:
return s;
}
n_Read
static FORCE_INLINE const char * n_Read(const char *s, number *a, const coeffs r)
!!! Recommendation: This method is too cryptic to be part of the user- !!! interface....
Definition coeffs.h:601
eati
const char * eati(const char *s, int *i)
Definition reporter.cc:377
rIsSCA
static bool rIsSCA(const ring r)
Definition nc.h:190
p_IncrExp
static long p_IncrExp(poly p, int v, ring r)
Definition p_polys.h:593
r_IsRingVar
int r_IsRingVar(const char *n, char **names, int N)
Definition ring.cc:213
scaLastAltVar
static short scaLastAltVar(ring r)
Definition sca.h:25
scaFirstAltVar
static short scaFirstAltVar(ring r)
Definition sca.h:18

## p_Series()

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

Definition at line 4652 of file p_polys.cc.

{
int *ww=iv2array(w,R);
if(p!=NULL)
{
if(u==NULL)
p=p_JetW(p,n,ww,R);
else
p=p_JetW(p_Mult_q(p,p_Invers(n-p_MinDeg(p,w,R),u,w,R),R),n,ww,R);
}
omFreeSize((ADDRESS)ww,(rVar(R)+1)*sizeof(int));
return p;
}
p_Invers
static poly p_Invers(int n, poly u, intvec *w, const ring R)
Definition p_polys.cc:4623
p_MinDeg
int p_MinDeg(poly p, intvec *w, const ring R)
Definition p_polys.cc:4602
p_JetW
poly p_JetW(poly p, int m, int *w, const ring R)
Definition p_polys.cc:4584
iv2array
int * iv2array(intvec *iv, const ring R)
Definition weight.cc:200

## p_SetCoeff()

number p_SetCoeff | ( | poly | p,
|  | number | n,
|  | ring | r )

inline static

Definition at line 414 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
n_Delete(&(p->coef), r->cf);
(p)->coef=n;
return n;
}

## p_SetComp()

unsigned long p_SetComp | ( | poly | p,
|  | unsigned long | c,
|  | ring | r )

inline static

Definition at line 249 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
if (r->pCompIndex>=0) __p_GetComp(p,r) = c;
return c;
}

## p_SetCompP() [1/2]

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

inline static

Definition at line 283 of file p_polys.h.

{
if (p != NULL)
{
p_SetComp(p, i, lmRing);
p_SetmComp(p, lmRing);
p_SetCompP(pNext(p), i, tailRing);
}
}

## p_SetCompP() [2/2]

void p_SetCompP | ( | poly | p,
|  | int | i,
|  | ring | r )

inline static

Definition at line 256 of file p_polys.h.

{
if (p != NULL)
{
p_Test(p, r);
if (rOrd_SetCompRequiresSetm(r))
{
do
{
p_SetComp(p, i, r);
p_SetmComp(p, r);
pIter(p);
}
while (p != NULL);
}
else
{
do
{
p_SetComp(p, i, r);
pIter(p);
}
while(p != NULL);
}
}
}
rOrd_SetCompRequiresSetm
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
Definition ring.cc:2023

## p_SetExp() [1/3]

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

inline static

set v^th exponent for a monomial

Definition at line 584 of file p_polys.h.

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

## p_SetExp() [2/3]

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

inline static

Definition at line 564 of file p_polys.h.

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

## p_SetExp() [3/3]

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

inline static

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

See also
  p_GetExp

Definition at line 490 of file p_polys.h.

{
pAssume2(e>=0);
pAssume2(e<=iBitmask);
pAssume2((VarOffset >> (24 + 6)) == 0);
// shift e to the left:
REGISTER int shift = VarOffset >> 24;
unsigned long ee = e << shift /*(VarOffset >> 24)*/;
// find the bits in the exponent vector
REGISTER int offset = (VarOffset & 0xffffff);
// clear the bits in the exponent vector:
p->exp[offset] &= ~( iBitmask << shift );
// insert e with |
p->exp[ offset ] |= ee;
return e;
}

## p_SetExpV()

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

inline static

Definition at line 1565 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
for (unsigned j = r->N; j!=0; j--)
p_SetExp(p, j, ev[j], r);
if(ev[0]!=0) p_SetComp(p, ev[0],r);
p_Setm(p, r);
}

## p_SetExpVL()

void p_SetExpVL | ( | poly | p,
|  | int64 * | ev,
|  | const ring | r )

inline static

Definition at line 1574 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
for (unsigned j = r->N; j!=0; j--)
p_SetExp(p, j, ev[j-1], r);
p_SetComp(p, 0,r);
p_Setm(p, r);
}

## p_SetExpVLV()

void p_SetExpVLV | ( | poly | p,
|  | int64 * | ev,
|  | int64 | comp,
|  | const ring | r )

inline static

Definition at line 1585 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
for (unsigned j = r->N; j!=0; j--)
p_SetExp(p, j, ev[j-1], r);
p_SetComp(p, comp,r);
p_Setm(p, r);
}
comp
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition facSparseHensel.h:25

## p_Setm()

void p_Setm | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 235 of file p_polys.h.

{
p_CheckRing2(r);
r->p_Setm(p, r);
}

## p_SetModDeg()

void p_SetModDeg | ( | intvec * | w,
|  | ring | r )

Definition at line 3798 of file p_polys.cc.

{
if (w!=NULL)
{
r->pModW = w;
pOldFDeg = r->pFDeg;
pOldLDeg = r->pLDeg;
pOldLexOrder = r->pLexOrder;
pSetDegProcs(r,pModDeg);
r->pLexOrder = TRUE;
}
else
{
r->pModW = NULL;
pRestoreDegProcs(r,pOldFDeg, pOldLDeg);
r->pLexOrder = pOldLexOrder;
}
}
pOldLDeg
STATIC_VAR pLDegProc pOldLDeg
Definition p_polys.cc:3786
pRestoreDegProcs
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3774
pOldLexOrder
STATIC_VAR BOOLEAN pOldLexOrder
Definition p_polys.cc:3787
pOldFDeg
STATIC_VAR pFDegProc pOldFDeg
Definition p_polys.cc:3785
pSetDegProcs
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3762
pModDeg
static long pModDeg(poly p, ring r)
Definition p_polys.cc:3789

## p_ShallowCopyDelete()

poly p_ShallowCopyDelete | ( | poly | p,
|  | const ring | r,
|  | omBin | bin )

inline static

Definition at line 930 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
pAssume2(omSizeWOfBin(r->PolyBin) == omSizeWOfBin(bin));
return r->p_Procs->p_ShallowCopyDelete(p, r, bin);
}

## 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 4860 of file p_polys.cc.

{
poly qp1 = *p,qp2 = *p;/*working pointers*/
int j = p_MaxComp(*p,r),k = p_MinComp(*p,r);
if (j+i < 0) return ;
BOOLEAN toPoly= ((j == -i) && (j == k));
while (qp1 != NULL)
{
if (toPoly || (__p_GetComp(qp1,r)+i > 0))
{
p_AddComp(qp1,i,r);
p_SetmComp(qp1,r);
qp2 = qp1;
pIter(qp1);
}
else
{
if (qp2 == *p)
{
pIter(*p);
p_LmDelete(&qp2,r);
qp2 = *p;
qp1 = *p;
}
else
{
qp2->next = qp1->next;
if (qp1!=NULL) p_LmDelete(&qp1,r);
qp1 = qp2->next;
}
}
}
}
return
return
Definition cfGcdAlgExt.cc:219
p_AddComp
static unsigned long p_AddComp(poly p, unsigned long v, ring r)
Definition p_polys.h:449

## p_SimpleContent()

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

Definition at line 2612 of file p_polys.cc.

{
if(TEST_OPT_CONTENTSB) return;
if (ph==NULL) return;
if (pNext(ph)==NULL)
{
p_SetCoeff(ph,n_Init(1,r->cf),r);
return;
}
if (pNext(pNext(ph))==NULL)
{
return;
}
if (!(rField_is_Q(r))
&& (!rField_is_Q_a(r))
&& (!rField_is_Zp_a(r))
&& (!rField_is_Z(r))
)
{
return;
}
number d=p_InitContent(ph,r);
number h=d;
if (n_Size(d,r->cf)<=smax)
{
n_Delete(&h,r->cf);
//if (TEST_OPT_PROT) PrintS("G");
return;
}
poly p=ph;
if (smax==1) smax=2;
while (p!=NULL)
{
#if 1
d=n_SubringGcd(h,pGetCoeff(p),r->cf);
n_Delete(&h,r->cf);
h = d;
#else
n_InpGcd(h,pGetCoeff(p),r->cf);
#endif
if(n_Size(h,r->cf)<smax)
{
//if (TEST_OPT_PROT) PrintS("g");
n_Delete(&h,r->cf);
return;
}
pIter(p);
}
p = ph;
if (!n_GreaterZero(pGetCoeff(p),r->cf)) h=n_InpNeg(h,r->cf);
if(n_IsOne(h,r->cf))
{
n_Delete(&h,r->cf);
return;
}
if (TEST_OPT_PROT) PrintS("c");
while (p!=NULL)
{
#if 1
d = n_ExactDiv(pGetCoeff(p),h,r->cf);
p_SetCoeff(p,d,r);
#else
STATISTIC(n_ExactDiv); nlInpExactDiv(pGetCoeff(p),h,r->cf); // no such function... ?
#endif
pIter(p);
}
n_Delete(&h,r->cf);
}
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition options.h:105

## p_Size()

int p_Size | ( | poly | p,
|  | const ring | r )

Definition at line 3302 of file p_polys.cc.

{
int count = 0;
if (r->cf->has_simple_Alloc)
return pLength(p);
while ( p != NULL )
{
count+= n_Size( pGetCoeff( p ), r->cf );
pIter( p );
}
return count;
}
count
int status int void size_t count
Definition si_signals.h:69

## p_SortAdd()

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

inline static

Definition at line 1240 of file p_polys.h.

{
if (revert) p = pReverse(p);
return sBucketSortAdd(p, r);
}
sBucketSortAdd
poly sBucketSortAdd(poly p, const ring r)
Sorts p with bucketSort: p may have equal monomials.
Definition sbuckets.cc:368

## p_SortMerge()

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

inline static

Definition at line 1250 of file p_polys.h.

{
if (revert) p = pReverse(p);
return sBucketSortMerge(p, r);
}
sBucketSortMerge
poly sBucketSortMerge(poly p, const ring r)
Sorts p with bucketSort: assumes all monomials of p are different.
Definition sbuckets.cc:332

## p_Split()

void p_Split | ( | poly | p,
|  | poly * | r )

Definition at line 1321 of file p_polys.cc.

{
*h=pNext(p);
pNext(p)=NULL;
}

## p_String() [1/2]

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

Definition at line 322 of file polys0.cc.

{
StringSetS("");
p_String0(p, lmRing, tailRing);
return StringEndS();
}
p_String0
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition polys0.cc:223
StringSetS
void StringSetS(const char *st)
Definition reporter.cc:128
StringEndS
char * StringEndS()
Definition reporter.cc:151

## p_String() [2/2]

char * p_String | ( | poly | p,
|  | ring | p_ring )

inline static

Definition at line 1261 of file p_polys.h.

{
return p_String(p, p_ring, p_ring);
}
p_String
char * p_String(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:322

## p_String0() [1/2]

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

print p according to ShortOut in lmRing & tailRing

Definition at line 223 of file polys0.cc.

{
if (p == NULL)
{
StringAppendS("0");
return;
}
p_Normalize(p,lmRing);
if ((n_GetChar(lmRing->cf) == 0)
&& (nCoeff_is_transExt(lmRing->cf)))
p_Normalize(p,lmRing); /* Manual/absfact.tst */
#ifdef HAVE_SHIFTBBA
if(lmRing->isLPring)
{
if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
{
writemonLP(p,0, lmRing);
p = pNext(p);
while (p!=NULL)
{
assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
StringAppendS("+");
writemonLP(p,0, tailRing);
p = pNext(p);
}
return;
}
}
else
#endif
{
if ((p_GetComp(p, lmRing) == 0) || (!lmRing->VectorOut))
{
writemon(p,0, lmRing);
p = pNext(p);
while (p!=NULL)
{
assume((p->coef==NULL)||(!n_IsZero(p->coef,tailRing->cf)));
if ((p->coef==NULL)||n_GreaterZero(p->coef,tailRing->cf))
StringAppendS("+");
writemon(p,0, tailRing);
p = pNext(p);
}
return;
}
}
long k = 1;
StringAppendS("[");
#ifdef HAVE_SHIFTBBA
if(lmRing->isLPring)
{
loop
{
while (k < p_GetComp(p,lmRing))
{
StringAppendS("0,");
k++;
}
writemonLP(p,k,lmRing);
pIter(p);
while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
{
if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
writemonLP(p,k,tailRing);
pIter(p);
}
if (p == NULL) break;
StringAppendS(",");
k++;
}
}
else
#endif
{
loop
{
while (k < p_GetComp(p,lmRing))
{
StringAppendS("0,");
k++;
}
writemon(p,k,lmRing);
pIter(p);
while ((p!=NULL) && (k == p_GetComp(p, tailRing)))
{
if (n_GreaterZero(p->coef,tailRing->cf)) StringAppendS("+");
writemon(p,k,tailRing);
pIter(p);
}
if (p == NULL) break;
StringAppendS(",");
k++;
}
}
StringAppendS("]");
}
writemon
static void writemon(poly p, int ko, const ring r)
Definition polys0.cc:24
writemonLP
static void writemonLP(poly p, int ko, const ring r)
Definition polys0.cc:104
StringAppendS
void StringAppendS(const char *st)
Definition reporter.cc:107

## p_String0() [2/2]

void p_String0 | ( | poly | p,
|  | ring | p_ring )

inline static

Definition at line 1265 of file p_polys.h.

{
p_String0(p, p_ring, p_ring);
}
p_String0
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition polys0.cc:223

## 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 203 of file polys0.cc.

{
// NOTE: the following (non-thread-safe!) UGLINESS
// (changing naRing->ShortOut for a while) is due to Hans!
// Just think of other ring using the VERY SAME naRing and possible
// side-effects...
// but this is not a problem: i/o is not thread-safe anyway.
const BOOLEAN bLMShortOut = rShortOut(lmRing);
const BOOLEAN bTAILShortOut = rShortOut(tailRing);
lmRing->ShortOut = FALSE;
tailRing->ShortOut = FALSE;
p_String0(p, lmRing, tailRing);
lmRing->ShortOut = bLMShortOut;
tailRing->ShortOut = bTAILShortOut;
}
rShortOut
static BOOLEAN rShortOut(const ring r)
Definition ring.h:587

## 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 184 of file polys0.cc.

{
// NOTE: the following (non-thread-safe!) UGLINESS
// (changing naRing->ShortOut for a while) is due to Hans!
// Just think of other ring using the VERY SAME naRing and possible
// side-effects...
const BOOLEAN bLMShortOut = rShortOut(lmRing);
const BOOLEAN bTAILShortOut = rShortOut(tailRing);
lmRing->ShortOut = rCanShortOut(lmRing);
tailRing->ShortOut = rCanShortOut(tailRing);
p_String0(p, lmRing, tailRing);
lmRing->ShortOut = bLMShortOut;
tailRing->ShortOut = bTAILShortOut;
}
rCanShortOut
static BOOLEAN rCanShortOut(const ring r)
Definition ring.h:592

## p_Sub()

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

Definition at line 1994 of file p_polys.cc.

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

## p_SubComp()

unsigned long p_SubComp | ( | poly | p,
|  | unsigned long | v,
|  | ring | r )

inline static

Definition at line 455 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
pAssume2(rRing_has_Comp(r));
_pPolyAssume2(__p_GetComp(p,r) >= v,p,r);
return __p_GetComp(p,r) -= v;
}

## p_SubExp()

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

inline static

Definition at line 615 of file p_polys.h.

{
p_LmCheckPolyRing2(p, r);
long e = p_GetExp(p,v,r);
pAssume2(e >= ee);
e -= ee;
return p_SetExp(p,v,e,r);
}

## p_Subst()

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

Definition at line 4084 of file p_polys.cc.

{
#ifdef HAVE_SHIFTBBA
// also don't even use p_Subst0 for Letterplace
if (rIsLPRing(r))
{
poly subst = p_LPSubst(p, n, e, r);
p_Delete(&p, r);
return subst;
}
#endif
if (e == NULL) return p_Subst0(p, n,r);
if (p_IsConstant(e,r))
{
if (n_IsOne(pGetCoeff(e),r->cf)) return p_Subst1(p,n,r);
else return p_Subst2(p, n, pGetCoeff(e),r);
}
#ifdef HAVE_PLURAL
if (rIsPluralRing(r))
{
return nc_pSubst(p,n,e,r);
}
#endif
int exponent,i;
poly h, res, m;
int *me,*ee;
number nu,nu1;
me=(int *)omAlloc((rVar(r)+1)*sizeof(int));
ee=(int *)omAlloc((rVar(r)+1)*sizeof(int));
if (e!=NULL) p_GetExpV(e,ee,r);
res=NULL;
h=p;
while (h!=NULL)
{
if ((e!=NULL) || (p_GetExp(h,n,r)==0))
{
m=p_Head(h,r);
p_GetExpV(m,me,r);
exponent=me[n];
me[n]=0;
for(i=rVar(r);i>0;i--)
me[i]+=exponent*ee[i];
p_SetExpV(m,me,r);
if (e!=NULL)
{
n_Power(pGetCoeff(e),exponent,&nu,r->cf);
nu1=n_Mult(pGetCoeff(m),nu,r->cf);
n_Delete(&nu,r->cf);
p_SetCoeff(m,nu1,r);
}
res=p_Add_q(res,m,r);
}
p_LmDelete(&h,r);
}
omFreeSize((ADDRESS)me,(rVar(r)+1)*sizeof(int));
omFreeSize((ADDRESS)ee,(rVar(r)+1)*sizeof(int));
return res;
}
subst
CanonicalForm subst(const CanonicalForm &f, const CFList &a, const CFList &b, const CanonicalForm &Rstar, bool isFunctionField)
Definition facAlgFuncUtil.cc:120
nc_pSubst
poly nc_pSubst(poly p, int n, poly e, const ring r)
substitute the n-th variable by e in p destroy p e is not a constant
Definition old.gring.cc:3185
p_Subst0
static poly p_Subst0(poly p, int n, const ring r)
Definition p_polys.cc:4059
p_Subst1
static poly p_Subst1(poly p, int n, const ring r)
Definition p_polys.cc:3991
p_Subst2
static poly p_Subst2(poly p, int n, number e, const ring r)
Definition p_polys.cc:4018
p_LPSubst
poly p_LPSubst(poly p, int n, poly e, const ring r)
Definition shiftop.cc:912

## p_TakeOutComp() [1/2]

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

Definition at line 3543 of file p_polys.cc.

{
poly q = *p,qq=NULL,result = NULL;
unsigned long kk=(unsigned long)k;
if (q==NULL) return NULL;
BOOLEAN use_setmcomp=rOrd_SetCompRequiresSetm(r);
if (__p_GetComp(q,r)==kk)
{
result = q;
if (UNLIKELY(use_setmcomp))
{
do
{
p_SetComp(q,0,r);
p_SetmComp(q,r);
qq = q;
pIter(q);
}
while ((q!=NULL) && (__p_GetComp(q,r)==kk));
}
else
{
do
{
p_SetComp(q,0,r);
qq = q;
pIter(q);
}
while ((q!=NULL) && (__p_GetComp(q,r)==kk));
}
*p = q;
pNext(qq) = NULL;
}
if (q==NULL) return result;
if (__p_GetComp(q,r) > kk)
{
p_SubComp(q,1,r);
if (use_setmcomp) p_SetmComp(q,r);
}
poly pNext_q;
while ((pNext_q=pNext(q))!=NULL)
{
unsigned long c=__p_GetComp(pNext_q,r);
if (/*__p_GetComp(pNext_q,r)*/c==kk)
{
if (result==NULL)
{
result = pNext_q;
qq = result;
}
else
{
pNext(qq) = pNext_q;
pIter(qq);
}
pNext(q) = pNext(pNext_q);
pNext(qq) =NULL;
p_SetComp(qq,0,r);
if (use_setmcomp) p_SetmComp(qq,r);
}
else
{
/*pIter(q);*/ q=pNext_q;
if (/*__p_GetComp(q,r)*/c > kk)
{
p_SubComp(q,1,r);
if (use_setmcomp) p_SetmComp(q,r);
}
}
}
return result;
}

## p_TakeOutComp() [2/2]

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

Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other monoms *lq == pLength(*q) On return all components pf *q == 0.

Definition at line 3620 of file p_polys.cc.

{
spolyrec pp, qq;
poly p, q, p_prev;
int l = 0;
#ifndef SING_NDEBUG
int lp = pLength(*r_p);
#endif
pNext(&pp) = *r_p;
p = *r_p;
p_prev = &pp;
q = &qq;
while(p != NULL)
{
while (__p_GetComp(p,r) == (unsigned long)comp)
{
pNext(q) = p;
pIter(q);
p_SetComp(p, 0,r);
p_SetmComp(p,r);
pIter(p);
l++;
if (p == NULL)
{
pNext(p_prev) = NULL;
goto Finish;
}
}
pNext(p_prev) = p;
p_prev = p;
pIter(p);
}
Finish:
pNext(q) = NULL;
*r_p = pNext(&pp);
*r_q = pNext(&qq);
*lq = l;
#ifndef SING_NDEBUG
assume(pLength(*r_p) + pLength(*r_q) == lp);
#endif
p_Test(*r_p,r);
p_Test(*r_q,r);
}
spolyrec
Definition monomials.h:23

## p_Totaldegree()

long p_Totaldegree | ( | poly | p,
|  | const ring | r )

inline static

Definition at line 1528 of file p_polys.h.

{
p_LmCheckPolyRing1(p, r);
unsigned long s = p_GetTotalDegree(p->exp[r->VarL_Offset[0]],
r,
r->ExpPerLong);
for (unsigned i=r->VarL_Size-1; i!=0; i--)
{
s += p_GetTotalDegree(p->exp[r->VarL_Offset[i]], r,r->ExpPerLong);
}
return (long)s;
}
p_GetTotalDegree
static unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps)
Definition p_polys.h:812

## p_Var()

int p_Var | ( | poly | mi,
|  | const ring | r )

Definition at line 4810 of file p_polys.cc.

{
if (m==NULL) return 0;
if (pNext(m)!=NULL) return 0;
int i,e=0;
for (i=rVar(r); i>0; i--)
{
int exp=p_GetExp(m,i,r);
if (exp==1)
{
if (e==0) e=i;
else return 0;
}
else if (exp!=0)
{
return 0;
}
}
return e;
}

## 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 3720 of file p_polys.cc.

{
poly h;
int k;
for(int i=len-1;i>=0;i--) p[i]=NULL;
while (v!=NULL)
{
h=p_Head(v,r);
k=__p_GetComp(h,r);
if (k>len) { Werror("wrong rank:%d, should be %d",len,k); }
else
{
p_SetComp(h,0,r);
p_Setm(h,r);
pNext(h)=p[k-1];p[k-1]=h;
}
pIter(v);
}
for(int i=len-1;i>=0;i--)
{
if (p[i]!=NULL) p[i]=pReverse(p[i]);
}
}

## p_Vec2Poly()

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

Definition at line 3698 of file p_polys.cc.

{
poly h;
poly res=NULL;
long unsigned kk=k;
while (v!=NULL)
{
if (__p_GetComp(v,r)==kk)
{
h=p_Head(v,r);
p_SetComp(h,0,r);
pNext(h)=res;res=h;
}
pIter(v);
}
if (res!=NULL) res=pReverse(res);
return res;
}

## p_Vec2Polys()

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

Definition at line 3750 of file p_polys.cc.

{
*len=p_MaxComp(v,r);
if (*len==0) *len=1;
*p=(poly*)omAlloc((*len)*sizeof(poly));
p_Vec2Array(v,*p,*len,r);
}
p_Vec2Array
void p_Vec2Array(poly v, poly *p, int len, const ring r)
vector to already allocated array (len>=p_MaxComp(v,r))
Definition p_polys.cc:3720

## p_VectorHasUnit()

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

Definition at line 3510 of file p_polys.cc.

{
poly q=p,qq;
int j=0;
long unsigned i;
*len = 0;
while (q!=NULL)
{
if (p_LmIsConstantComp(q,r))
{
i = __p_GetComp(q,r);
qq = p;
while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
if (qq == q)
{
j = 0;
while (qq!=NULL)
{
if (__p_GetComp(qq,r)==i) j++;
pIter(qq);
}
if ((*len == 0) || (j<*len))
{
*len = j;
*k = i;
}
}
}
pIter(q);
}
}

## p_VectorHasUnitB()

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

Definition at line 3487 of file p_polys.cc.

{
poly q=p,qq;
long unsigned i;
while (q!=NULL)
{
if (p_LmIsConstantComp(q,r))
{
i = __p_GetComp(q,r);
qq = p;
while ((qq != q) && (__p_GetComp(qq,r) != i)) pIter(qq);
if (qq == q)
{
*k = i;
return TRUE;
}
}
pIter(q);
}
return FALSE;
}

## p_WDegree()

long p_WDegree | ( | poly | p,
|  | const ring | r )

Definition at line 715 of file p_polys.cc.

{
if (r->firstwv==NULL) return p_Totaldegree(p, r);
p_LmCheckPolyRing(p, r);
int i;
long j =0;
for(i=1;i<=r->firstBlockEnds;i++)
j+=p_GetExp(p, i, r)*r->firstwv[i-1];
for (;i<=rVar(r);i++)
j+=p_GetExp(p,i, r)*p_Weight(i, r);
return j;
}
p_Weight
int p_Weight(int i, const ring r)
Definition p_polys.cc:706

## p_Weight()

int p_Weight | ( | int | c,
|  | const ring | r )

Definition at line 706 of file p_polys.cc.

{
if ((r->firstwv==NULL) || (i>r->firstBlockEnds))
{
return 1;
}
return r->firstwv[i-1];
}

## p_WFirstTotalDegree()

long p_WFirstTotalDegree | ( | poly | p,
|  | ring | r )

Definition at line 595 of file p_polys.cc.

{
int i;
long sum = 0;
for (i=1; i<= r->firstBlockEnds; i++)
{
sum += p_GetExp(p, i, r)*r->firstwv[i-1];
}
return sum;
}

## p_Write() [1/2]

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

Definition at line 342 of file polys0.cc.

{
p_Write0(p, lmRing, tailRing);
PrintLn();
}
p_Write0
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:332
PrintLn
void PrintLn()
Definition reporter.cc:314

## p_Write() [2/2]

void p_Write | ( | poly | p,
|  | ring | p_ring )

inline static

Definition at line 1269 of file p_polys.h.

{
p_Write(p, p_ring, p_ring);
}

## p_Write0() [1/2]

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

Definition at line 332 of file polys0.cc.

{
char *s=p_String(p, lmRing, tailRing);
PrintS(s);
omFree(s);
}
p_String
char * p_String(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:322

## p_Write0() [2/2]

void p_Write0 | ( | poly | p,
|  | ring | p_ring )

inline static

Definition at line 1273 of file p_polys.h.

{
p_Write0(p, p_ring, p_ring);
}
p_Write0
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:332

## p_wrp() [1/2]

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

Definition at line 373 of file polys0.cc.

{
poly r;
if (p==NULL) PrintS("NULL");
else if (pNext(p)==NULL) p_Write0(p, lmRing);
else
{
r = pNext(pNext(p));
pNext(pNext(p)) = NULL;
p_Write0(p, tailRing);
if (r!=NULL)
{
PrintS("+...");
pNext(pNext(p)) = r;
}
}
}

## p_wrp() [2/2]

void p_wrp | ( | poly | p,
|  | ring | p_ring )

inline static

Definition at line 1277 of file p_polys.h.

{
p_wrp(p, p_ring, p_ring);
}
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373

## p_WTotaldegree()

long p_WTotaldegree | ( | poly | p,
|  | const ring | r )

Definition at line 612 of file p_polys.cc.

{
p_LmCheckPolyRing(p, r);
int i, k;
long j =0;
// iterate through each block:
for (i=0;r->order[i]!=0;i++)
{
int b0=r->block0[i];
int b1=r->block1[i];
switch(r->order[i])
{
case ringorder_M:
for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
{ // in jedem block:
j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/]*r->OrdSgn;
}
break;
case ringorder_am:
b1=si_min(b1,r->N); /* no break, continue as ringorder_a*/
case ringorder_a:
for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
{ // only one line
j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
}
return j*r->OrdSgn;
case ringorder_wp:
case ringorder_ws:
case ringorder_Wp:
case ringorder_Ws:
for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
{ // in jedem block:
j+= p_GetExp(p,k,r)*r->wvhdl[i][k - b0 /*r->block0[i]*/];
}
break;
case ringorder_lp:
case ringorder_ls:
case ringorder_rs:
case ringorder_dp:
case ringorder_ds:
case ringorder_Dp:
case ringorder_Ds:
case ringorder_rp:
for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
{
j+= p_GetExp(p,k,r);
}
break;
case ringorder_a64:
{
int64* w=(int64*)r->wvhdl[i];
for (k=0;k<=(b1 /*r->block1[i]*/ - b0 /*r->block0[i]*/);k++)
{
//there should be added a line which checks if w[k]>2^31
j+= p_GetExp(p,k+1, r)*(long)w[k];
}
//break;
return j;
}
default:
#if 0
case ringorder_c: /* nothing to do*/
case ringorder_C: /* nothing to do*/
case ringorder_S: /* nothing to do*/
case ringorder_s: /* nothing to do*/
case ringorder_IS: /* nothing to do */
case ringorder_unspec: /* to make clang happy, does not occur*/
case ringorder_no: /* to make clang happy, does not occur*/
case ringorder_L: /* to make clang happy, does not occur*/
case ringorder_aa: /* ignored by p_WTotaldegree*/
#endif
break;
/* no default: all orderings covered */
}
}
return j;
}
ringorder_rp
#define ringorder_rp
Definition ring.h:100
ringorder_a
@ ringorder_a
Definition ring.h:71
ringorder_am
@ ringorder_am
Definition ring.h:90
ringorder_a64
@ ringorder_a64
for int64 weights
Definition ring.h:72
ringorder_C
@ ringorder_C
Definition ring.h:74
ringorder_S
@ ringorder_S
S?
Definition ring.h:76
ringorder_ds
@ ringorder_ds
Definition ring.h:86
ringorder_Dp
@ ringorder_Dp
Definition ring.h:81
ringorder_unspec
@ ringorder_unspec
Definition ring.h:96
ringorder_L
@ ringorder_L
Definition ring.h:91
ringorder_Ds
@ ringorder_Ds
Definition ring.h:87
ringorder_dp
@ ringorder_dp
Definition ring.h:79
ringorder_c
@ ringorder_c
Definition ring.h:73
ringorder_aa
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition ring.h:93
ringorder_no
@ ringorder_no
Definition ring.h:70
ringorder_Wp
@ ringorder_Wp
Definition ring.h:83
ringorder_ws
@ ringorder_ws
Definition ring.h:88
ringorder_Ws
@ ringorder_Ws
Definition ring.h:89
ringorder_IS
@ ringorder_IS
Induced (Schreyer) ordering.
Definition ring.h:95
ringorder_ls
@ ringorder_ls
degree, ip
Definition ring.h:85
ringorder_s
@ ringorder_s
s?
Definition ring.h:77
ringorder_wp
@ ringorder_wp
Definition ring.h:82
ringorder_M
@ ringorder_M
Definition ring.h:75
ringorder_rs
#define ringorder_rs
Definition ring.h:101

## pEnlargeSet()

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

Definition at line 3821 of file p_polys.cc.

{
poly* h;
if (increment==0) return;
if (*p==NULL)
{
h=(poly*)omAlloc0(increment*sizeof(poly));
}
else
{
h=(poly*)omReallocSize((poly*)*p,l*sizeof(poly),(l+increment)*sizeof(poly));
if (increment>0)
{
memset(&(h[l]),0,increment*sizeof(poly));
}
}
*p=h;
}
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition omAllocDecl.h:220

## pHaveCommonMonoms()

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

Definition at line 174 of file pDebug.cc.

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

## pIsMonomOf()

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

Definition at line 164 of file pDebug.cc.

{
if (m == NULL) return TRUE;
while (p != NULL)
{
if (p == m) return TRUE;
pIter(p);
}
return FALSE;
}

## pLDeg0()

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

Definition at line 740 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
long unsigned k= p_GetComp(p, r);
int ll=1;
if (k > 0)
{
while ((pNext(p)!=NULL) && (__p_GetComp(pNext(p), r)==k))
{
pIter(p);
ll++;
}
}
else
{
while (pNext(p)!=NULL)
{
pIter(p);
ll++;
}
}
*l=ll;
return r->pFDeg(p, r);
}

## pLDeg0c()

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

Definition at line 771 of file p_polys.cc.

{
assume(p!=NULL);
p_Test(p,r);
p_CheckPolyRing(p, r);
long o;
int ll=1;
if (! rIsSyzIndexRing(r))
{
while (pNext(p) != NULL)
{
pIter(p);
ll++;
}
o = r->pFDeg(p, r);
}
else
{
long unsigned curr_limit = rGetCurrSyzLimit(r);
poly pp = p;
while ((p=pNext(p))!=NULL)
{
if (__p_GetComp(p, r)<=curr_limit/*syzComp*/)
ll++;
else break;
pp = p;
}
p_Test(pp,r);
o = r->pFDeg(pp, r);
}
*l=ll;
return o;
}

## pLDeg1()

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

Definition at line 842 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
long unsigned k= p_GetComp(p, r);
int ll=1;
long t,max;
max=r->pFDeg(p, r);
if (k > 0)
{
while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
{
t=r->pFDeg(p, r);
if (t>max) max=t;
ll++;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
t=r->pFDeg(p, r);
if (t>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDeg1_Deg()

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

Definition at line 911 of file p_polys.cc.

{
assume(r->pFDeg == p_Deg);
p_CheckPolyRing(p, r);
long unsigned k= p_GetComp(p, r);
int ll=1;
long t,max;
max=p_GetOrder(p, r);
if (k > 0)
{
while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
{
t=p_GetOrder(p, r);
if (t>max) max=t;
ll++;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
t=p_GetOrder(p, r);
if (t>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDeg1_Totaldegree()

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

Definition at line 976 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
long unsigned k= p_GetComp(p, r);
int ll=1;
long t,max;
max=p_Totaldegree(p, r);
if (k > 0)
{
while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
{
t=p_Totaldegree(p, r);
if (t>max) max=t;
ll++;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
t=p_Totaldegree(p, r);
if (t>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDeg1_WFirstTotalDegree()

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

Definition at line 1039 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
long unsigned k= p_GetComp(p, r);
int ll=1;
long t,max;
max=p_WFirstTotalDegree(p, r);
if (k > 0)
{
while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
{
t=p_WFirstTotalDegree(p, r);
if (t>max) max=t;
ll++;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
t=p_WFirstTotalDegree(p, r);
if (t>max) max=t;
ll++;
}
}
*l=ll;
return max;
}
p_WFirstTotalDegree
long p_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:595

## pLDeg1c()

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

Definition at line 878 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
int ll=1;
long t,max;
max=r->pFDeg(p, r);
if (rIsSyzIndexRing(r))
{
long unsigned limit = rGetCurrSyzLimit(r);
while ((p=pNext(p))!=NULL)
{
if (__p_GetComp(p, r)<=limit)
{
if ((t=r->pFDeg(p, r))>max) max=t;
ll++;
}
else break;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
if ((t=r->pFDeg(p, r))>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDeg1c_Deg()

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

Definition at line 942 of file p_polys.cc.

{
assume(r->pFDeg == p_Deg);
p_CheckPolyRing(p, r);
int ll=1;
long t,max;
max=p_GetOrder(p, r);
if (rIsSyzIndexRing(r))
{
long unsigned limit = rGetCurrSyzLimit(r);
while ((p=pNext(p))!=NULL)
{
if (__p_GetComp(p, r)<=limit)
{
if ((t=p_GetOrder(p, r))>max) max=t;
ll++;
}
else break;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
if ((t=p_GetOrder(p, r))>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDeg1c_Totaldegree()

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

Definition at line 1006 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
int ll=1;
long t,max;
max=p_Totaldegree(p, r);
if (rIsSyzIndexRing(r))
{
long unsigned limit = rGetCurrSyzLimit(r);
while ((p=pNext(p))!=NULL)
{
if (__p_GetComp(p, r)<=limit)
{
if ((t=p_Totaldegree(p, r))>max) max=t;
ll++;
}
else break;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
if ((t=p_Totaldegree(p, r))>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDeg1c_WFirstTotalDegree()

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

Definition at line 1069 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
int ll=1;
long t,max;
max=p_WFirstTotalDegree(p, r);
if (rIsSyzIndexRing(r))
{
long unsigned limit = rGetCurrSyzLimit(r);
while ((p=pNext(p))!=NULL)
{
if (__p_GetComp(p, r)<=limit)
{
if ((t=p_Totaldegree(p, r))>max) max=t;
ll++;
}
else break;
}
}
else
{
while ((p=pNext(p))!=NULL)
{
if ((t=p_Totaldegree(p, r))>max) max=t;
ll++;
}
}
*l=ll;
return max;
}

## pLDegb()

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

Definition at line 812 of file p_polys.cc.

{
p_CheckPolyRing(p, r);
long unsigned k= p_GetComp(p, r);
long o = r->pFDeg(p, r);
int ll=1;
if (k != 0)
{
while (((p=pNext(p))!=NULL) && (__p_GetComp(p, r)==k))
{
ll++;
}
}
else
{
while ((p=pNext(p)) !=NULL)
{
ll++;
}
}
*l=ll;
return o;
}

## pLength()

int pLength | ( | poly | a | ) |

inline static

Definition at line 190 of file p_polys.h.

{
int l = 0;
while (a!=NULL)
{
pIter(a);
l++;
}
return l;
}

## pp_DivideM()

poly pp_DivideM | ( | poly | a,
|  | poly | b,
|  | const ring | r )

Definition at line 1637 of file p_polys.cc.

{
if (a==NULL) { return NULL; }
// TODO: better implementation without copying a,b
return p_DivideM(p_Copy(a,r),p_Head(b,r),r);
}
p_DivideM
poly p_DivideM(poly a, poly b, const ring r)
Definition p_polys.cc:1582

## pp_Jet()

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

Definition at line 4484 of file p_polys.cc.

{
poly r=NULL;
poly t=NULL;
while (p!=NULL)
{
if (p_Totaldegree(p,R)<=m)
{
if (r==NULL)
r=p_Head(p,R);
else
if (t==NULL)
{
pNext(r)=p_Head(p,R);
t=pNext(r);
}
else
{
pNext(t)=p_Head(p,R);
pIter(t);
}
}
pIter(p);
}
return r;
}

## pp_Jet0()

poly pp_Jet0 | ( | poly | p,
|  | const ring | R )

Definition at line 4512 of file p_polys.cc.

{
poly r=NULL;
poly t=NULL;
while (p!=NULL)
{
if (p_LmIsConstantComp(p,R))
{
if (r==NULL)
r=p_Head(p,R);
else
if (t==NULL)
{
pNext(r)=p_Head(p,R);
t=pNext(r);
}
else
{
pNext(t)=p_Head(p,R);
pIter(t);
}
}
pIter(p);
}
return r;
}

## pp_JetW()

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

Definition at line 4557 of file p_polys.cc.

{
poly r=NULL;
poly t=NULL;
while (p!=NULL)
{
if (totaldegreeWecart_IV(p,R,w)<=m)
{
if (r==NULL)
r=p_Head(p,R);
else
if (t==NULL)
{
pNext(r)=p_Head(p,R);
t=pNext(r);
}
else
{
pNext(t)=p_Head(p,R);
pIter(t);
}
}
pIter(p);
}
return r;
}

## pp_mm_Mult()

poly pp_mm_Mult | ( | poly | p,
|  | poly | m,
|  | const ring | r )

inline static

Definition at line 1043 of file p_polys.h.

{
if ((p==NULL)||(m==NULL)) return NULL;
if (p_LmIsConstant(m, r))
return __pp_Mult_nn(p, pGetCoeff(m), r);
else
return r->p_Procs->pp_mm_Mult(p, m, r);
}
__pp_Mult_nn
#define __pp_Mult_nn(p, n, r)
Definition p_polys.h:1004

## pp_Mult_Coeff_mm_DivSelect() [1/2]

poly pp_Mult_Coeff_mm_DivSelect | ( | poly | p,
|  | const poly | m,
|  | const ring | r )

inline static

Definition at line 1097 of file p_polys.h.

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

## pp_Mult_Coeff_mm_DivSelect() [2/2]

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

inline static

Definition at line 1105 of file p_polys.h.

{
int shorter;
poly pp = r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
lp -= shorter;
return pp;
}

## pp_Mult_mm()

poly pp_Mult_mm | ( | poly | p,
|  | poly | m,
|  | const ring | r )

inline static

Definition at line 1033 of file p_polys.h.

{
if ((p==NULL)||(m==NULL)) return NULL;
if (p_LmIsConstant(m, r))
return __pp_Mult_nn(p, pGetCoeff(m), r);
else
return r->p_Procs->pp_Mult_mm(p, m, r);
}

## pp_Mult_nn()

poly pp_Mult_nn | ( | poly | p,
|  | number | n,
|  | const ring | r )

inline static

Definition at line 994 of file p_polys.h.

{
if (p==NULL) return NULL;
if (n_IsOne(n, r->cf))
return p_Copy(p, r);
else if (n_IsZero(n, r->cf))
return NULL;
else
return r->p_Procs->pp_Mult_nn(p, n, r);
}

## pp_Mult_qq()

poly pp_Mult_qq | ( | poly | p,
|  | poly | q,
|  | const ring | r )

inline static

Definition at line 1167 of file p_polys.h.

{
if (UNLIKELY(p == NULL || q == NULL)) return NULL;
if (pNext(p) == NULL)
{
return r->p_Procs->pp_mm_Mult(q, p, r);
}
if (pNext(q) == NULL)
{
return r->p_Procs->pp_Mult_mm(p, q, r);
}
poly qq = q;
if (UNLIKELY(p == q))
qq = p_Copy(q, r);
poly res;
#if defined(HAVE_PLURAL) || defined(HAVE_SHIFTBBA)
if (UNLIKELY(rIsNCRing(r)))
res = _nc_pp_Mult_qq(p, qq, r);
else
#endif
#ifdef HAVE_RINGS
if (UNLIKELY(!nCoeff_is_Domain(r->cf)))
res = _p_Mult_q_Normal_ZeroDiv(p, qq, 1, r);
else
#endif
res = _p_Mult_q(p, qq, 1, r);
if (UNLIKELY(qq != q))
p_Delete(&qq, r);
return res;
}
_nc_pp_Mult_qq
poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r)
general NC-multiplication without destruction
Definition old.gring.cc:254

## pRestoreDegProcs()

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

Definition at line 3774 of file p_polys.cc.

{
assume(old_FDeg != NULL && old_lDeg != NULL);
r->pFDeg = old_FDeg;
r->pLDeg = old_lDeg;
}

## pReverse()

poly pReverse | ( | poly | p | ) |

inline static

Definition at line 337 of file p_polys.h.

{
if (p == NULL || pNext(p) == NULL) return p;
poly q = pNext(p), // == pNext(p)
qn;
pNext(p) = NULL;
do
{
qn = pNext(q);
pNext(q) = p;
p = q;
q = qn;
}
while (qn != NULL);
return p;
}

## pSetDegProcs()

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

Definition at line 3762 of file p_polys.cc.

{
assume(new_FDeg != NULL);
r->pFDeg = new_FDeg;
if (new_lDeg == NULL)
new_lDeg = r->pLDegOrig;
r->pLDeg = new_lDeg;
}