My Project
Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
polys.h File Reference

Compatibility layer for legacy polynomial operations (over currRing) More...

#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "coeffs/numbers.h"

Go to the source code of this file.

Macros

#define pSetCoeff(p, n)   p_SetCoeff(p,n,currRing)
 deletes old coeff before setting the new one
 
#define pGetOrder(p)   p_GetOrder(p, currRing)
 Order.
 
#define pGetComp(p)   (int)__p_GetComp(p, currRing)
 Component.
 
#define pSetComp(p, v)   p_SetComp(p,v, currRing)
 
#define pGetExp(p, i)   p_GetExp(p, i, currRing)
 Exponent.
 
#define pSetExp(p, i, v)   p_SetExp(p, i, v, currRing)
 
#define pIncrExp(p, i)   p_IncrExp(p,i, currRing)
 
#define pDecrExp(p, i)   p_DecrExp(p,i, currRing)
 
#define pAddExp(p, i, v)   p_AddExp(p,i,v, currRing)
 
#define pSubExp(p, i, v)   p_SubExp(p,i,v, currRing)
 
#define pMultExp(p, i, v)   p_MultExp(p,i,v, currRing)
 
#define pGetExpSum(p1, p2, i)   p_GetExpSum(p1, p2, i, currRing)
 
#define pGetExpDiff(p1, p2, i)   p_GetExpDiff(p1, p2, i, currRing)
 
#define pNew()   p_New(currRing)
 allocates the space for a new monomial – no initialization !!!
 
#define pInit()   p_Init(currRing,currRing->PolyBin)
 allocates a new monomial and initializes everything to 0
 
#define pLmInit(p)   p_LmInit(p, currRing)
 like pInit, except that expvector is initialized to that of p, p must be != NULL
 
#define pHead(p)   p_Head(p, currRing)
 returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
 
#define pLmFreeAndNext(p)   p_LmFreeAndNext(p, currRing)
 assumes p != NULL, deletes p, returns pNext(p)
 
#define pLmDelete(p)   p_LmDelete(p, currRing)
 assume p != NULL, deletes Lm(p)->coef and Lm(p)
 
#define pLmDeleteAndNext(p)   p_LmDeleteAndNext(p, currRing)
 like pLmDelete, returns pNext(p)
 
#define pExpVectorCopy(d_p, s_p)   p_ExpVectorCopy(d_p, s_p, currRing)
 
#define pExpVectorAdd(p1, p2)   p_ExpVectorAdd(p1, p2, currRing)
 
#define pExpVectorSub(p1, p2)   p_ExpVectorSub(p1, p2, currRing)
 
#define pExpVectorAddSub(p1, p2, p3)   p_ExpVectorAddSub(p1, p2, p3, currRing)
 
#define pExpVectorSum(pr, p1, p2)   p_ExpVectorSum(pr, p1, p2, currRing)
 
#define pExpVectorDiff(pr, p1, p2)   p_ExpVectorDiff(pr, p1, p2, currRing)
 
#define pGetExpV(p, e)   p_GetExpV(p, e, currRing)
 Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long) memory. Exponents are filled in as follows: comp, e_1, .., e_n.
 
#define pSetExpV(p, e)   p_SetExpV(p, e, currRing)
 
#define pLmCmp(p, q)   p_LmCmp(p,q,currRing)
 returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
 
#define pLmCmpAction(p, q, actionE, actionG, actionS)    _p_LmCmpAction(p,q,currRing, actionE, actionG,actionS)
 executes axtionE|actionG|actionS if p=q|p>q|p<q w.r.t monomial ordering action should be a "goto ..."
 
#define pLmEqual(p1, p2)   p_ExpVectorEqual(p1, p2, currRing)
 
#define pCmp(p1, p2)   p_Cmp(p1, p2, currRing)
 pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
 
#define pLtCmp(p, q)   p_LtCmp(p,q,currRing)
 
#define pLtCmpNoAbs(p, q)   p_LtCmpNoAbs(p,q,currRing)
 
#define pLtCmpOrdSgnDiffM(p, q)   p_LtCmpOrdSgnDiffM(p,q,currRing)
 
#define pLtCmpOrdSgnDiffP(p, q)   p_LtCmpOrdSgnDiffP(p,q,currRing)
 
#define pLtCmpOrdSgnEqM(p, q)   p_LtCmpOrdSgnEqM(p,q,currRing)
 
#define pLtCmpOrdSgnEqP(p, q)   p_LtCmpOrdSgnEqP(p,q,currRing)
 
#define pDivisibleBy(a, b)   p_DivisibleBy(a,b,currRing)
 returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > 0, s.t. b = a + c;
 
#define pLmDivisibleBy(a, b)   p_LmDivisibleBy(a,b,currRing)
 like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
 
#define pLmDivisibleByNoComp(a, b)   p_LmDivisibleByNoComp(a,b,currRing)
 like pLmDivisibleBy, does not check components
 
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)    p_LmShortDivisibleBy(a, sev_a, b, not_sev_b, currRing)
 Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGetShortExpVector(b)
 
#define pLmRingShortDivisibleBy(a, sev_a, b, not_sev_b)    p_LmRingShortDivisibleBy(a, sev_a, b, not_sev_b, currRing)
 
#define pGetShortExpVector(a)   p_GetShortExpVector(a, currRing)
 returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
 
#define pDivisibleByRingCase(f, g)   p_DivisibleByRingCase(f,g,currRing)
 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 *‍/
 
#define pCopy(p)   p_Copy(p, currRing)
 return a copy of the poly
 
#define pDelete(p_ptr)   p_Delete(p_ptr, currRing)
 
#define pNeg(p)   p_Neg(p, currRing)
 
#define ppMult_nn(p, n)   pp_Mult_nn(p, n, currRing)
 
#define pMult_nn(p, n)   p_Mult_nn(p, n, currRing)
 
#define ppMult_mm(p, m)   pp_Mult_mm(p, m, currRing)
 
#define pMult_mm(p, m)   p_Mult_mm(p, m, currRing)
 
#define pAdd(p, q)   p_Add_q(p, q, currRing)
 
#define pPower(p, q)   p_Power(p, q, currRing)
 
#define pMinus_mm_Mult_qq(p, m, q)   p_Minus_mm_Mult_qq(p, m, q, currRing)
 
#define pPlus_mm_Mult_qq(p, m, q)   p_Plus_mm_Mult_qq(p, m, q, currRing)
 
#define pMult(p, q)   p_Mult_q(p, q, currRing)
 
#define ppMult_qq(p, q)   pp_Mult_qq(p, q, currRing)
 
#define ppMult_Coeff_mm_DivSelect(p, m)   pp_Mult_Coeff_mm_DivSelect(p, m, currRing)
 
#define pSortMerger(p)   p_SortMerge(p, currRing)
 sorts p, assumes all monomials in p are different
 
#define pSort(p)   p_SortMerge(p, currRing)
 
#define pSortAdd(p)   p_SortAdd(p, currRing)
 sorts p, p may have equal monomials
 
#define pSortCompCorrect(p)   pSort(p)
 Assume: If considered only as poly in any component of p (say, monomials of other components of p are set to 0), then p is already sorted correctly.
 
#define pIsConstantComp(p)   p_IsConstantComp(p, currRing)
 return true if p is either NULL, or if all exponents of p are 0, Comp of p might be != 0
 
#define pIsConstant(p)   p_IsConstant(p,currRing)
 like above, except that Comp must be 0
 
#define pIsUnit(p)   p_IsUnit(p,currRing)
 return true if the Lm is a constant <>0
 
#define pLmIsConstantComp(p)   p_LmIsConstantComp(p, currRing)
 like above, except that p must be != NULL
 
#define pLmIsConstant(p)   p_LmIsConstant(p,currRing)
 
#define pIsConstantPoly(p)   p_IsConstantPoly(p, currRing)
 return TRUE if all monomials of p are constant
 
#define pIsPurePower(p)   p_IsPurePower(p, currRing)
 
#define pIsUnivariate(p)   p_IsUnivariate(p, currRing)
 
#define pIsVector(p)   (pGetComp(p)>0)
 
#define pGetVariables(p, e)   p_GetVariables(p, e, currRing)
 
#define pHasNotCFRing(p1, p2)   p_HasNotCFRing(p1,p2,currRing)
 
#define pHasNotCF(p1, p2)   p_HasNotCF(p1,p2,currRing)
 
#define pSplit(p, r)   p_Split(p,r)
 
#define pSetm(p)   p_Setm(p, currRing)
 
#define pSetmComp(p)   p_Setm(p, currRing)
 TODO:
 
#define pWeight(i)   p_Weight(i,currRing)
 
#define pWTotaldegree(p)   p_WTotaldegree(p,currRing)
 
#define pWDegree(p)   p_WDegree(p,currRing)
 
#define pSub(a, b)   p_Sub(a,b,currRing)
 
#define pmInit(a, b)   p_mInit(a,b,currRing)
 
#define pMDivide(a, b)   p_MDivide(a,b,currRing)
 
#define pDivideM(a, b)   p_DivideM(a,b,currRing)
 
#define pLcm(a, b, m)   p_Lcm(a,b,m,currRing)
 
#define pDiff(a, b)   p_Diff(a,b,currRing)
 
#define pDiffOp(a, b, m)   p_DiffOp(a,b,m,currRing)
 
#define pMaxComp(p)   p_MaxComp(p, currRing)
 
#define pMinComp(p)   p_MinComp(p, currRing)
 
#define pOneComp(p)   p_OneComp(p, currRing)
 
#define pSetCompP(a, i)   p_SetCompP(a, i, currRing)
 
#define pISet(i)   p_ISet(i,currRing)
 
#define pNSet(n)   p_NSet(n,currRing)
 
#define pOne()   p_One(currRing)
 
#define pNormalize(p)   p_Normalize(p,currRing)
 
#define pSize(p)   p_Size(p,currRing)
 
#define pHomogen(p, varnum)   p_Homogen(p,varnum,currRing)
 homogenizes p by multiplying certain powers of the varnum-th variable
 
#define pIsHomogen(p)   p_IsHomogen(p,currRing)
 
#define pVectorHasUnitB(p, k)   p_VectorHasUnitB(p,k,currRing)
 
#define pVectorHasUnit(p, k, l)   p_VectorHasUnit(p,k,l,currRing)
 
#define pDeleteComp(p, k)   p_DeleteComp(p,k,currRing)
 
#define pSubst(p, n, e)   p_Subst(p,n,e,currRing)
 
#define ppJet(p, m)   pp_Jet(p,m,currRing)
 
#define pJet(p, m)   p_Jet(p,m,currRing)
 
#define ppJetW(p, m, iv)   pp_JetW(p,m,iv,currRing)
 
#define pJetW(p, m, iv)   p_JetW(p,m,iv,currRing)
 
#define pMinDeg(p, w)   p_MinDeg(p,w,currRing)
 
#define pSeries(n, p, u, w)   p_Series(n,p,u,w,currRing)
 
#define pDegW(p, w)   p_DegW(p,w,currRing)
 Deprecated: only for compatibility with older code!
 
#define pVar(m)   p_Var(m,currRing)
 
#define pEqualPolys(p1, p2)   p_EqualPolys(p1,p2,currRing)
 
#define pTest(p)   _p_Test(p, currRing, PDEBUG)
 
#define pLmTest(p)   _p_LmTest(p, currRing, PDEBUG)
 

Typedefs

typedef poly * polyset
 

Functions

void rChangeCurrRing (ring r)
 
static void pLmFree (poly p)
 frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
 
static void pLmFree (poly *p)
 like pLmFree, but advances p
 
poly p_Divide (poly a, poly b, const ring r)
 polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift destroys a,b
 
poly pp_Divide (poly a, poly b, const ring r)
 polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift does not destroy a,b
 
poly p_DivRem (poly a, poly b, poly &rest, const ring r)
 
poly singclap_gcd (poly f, poly g, const ring r)
 polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
 
static long pTotaldegree (poly p)
 
charpString (poly p)
 
void pString0 (poly p)
 
void pWrite (poly p)
 
void pWrite0 (poly p)
 
void wrp (poly p)
 
BOOLEAN pIsHomogeneous (poly p)
 
void pTakeOutComp (poly *p, long comp, poly *q, int *lq, const ring R=currRing)
 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 pTakeOutComp (poly *p, int k, const ring R=currRing)
 This is something weird – Don't use it, unless you know what you are doing.
 
void pSetPolyComp (poly p, int comp)
 
void pNorm (poly p)
 
BOOLEAN pCompareChain (poly p, poly p1, poly p2, poly lcm, const ring R=currRing)
 Returns TRUE if.
 
BOOLEAN pCompareChainPart (poly p, poly p1, poly p2, poly lcm, const ring R=currRing)
 
static poly pLast (poly a, int &length)
 returns the length of a polynomial (numbers of monomials) respect syzComp
 
static poly pLast (poly a)
 

Variables

EXTERN_VAR ring currRing
 
EXTERN_VAR coeffs coeffs_BIGINT
 

Detailed Description

Compatibility layer for legacy polynomial operations (over currRing)

Macro defines for legacy polynomial operations used in Several involved mathematical algorithms (kernel) and Singular Interpreter and related functionality. They take no ring argument since they work with currRing by default. Notice that they have different prefix: p instead of p_.

See also related global ring variable and the correct ring changing routine:

Definition in file polys.h.

Macro Definition Documentation

◆ pAdd

#define pAdd (   p,
 
)    p_Add_q(p, q, currRing)

Definition at line 204 of file polys.h.

◆ pAddExp

#define pAddExp (   p,
  i,
  v 
)    p_AddExp(p,i,v, currRing)

Definition at line 46 of file polys.h.

◆ pCmp

#define pCmp (   p1,
  p2 
)    p_Cmp(p1, p2, currRing)

pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))

Definition at line 116 of file polys.h.

◆ pCopy

#define pCopy (   p)    p_Copy(p, currRing)

return a copy of the poly

Definition at line 186 of file polys.h.

◆ pDecrExp

#define pDecrExp (   p,
  i 
)    p_DecrExp(p,i, currRing)

Definition at line 45 of file polys.h.

◆ pDegW

#define pDegW (   p,
  w 
)    p_DegW(p,w,currRing)

Deprecated: only for compatibility with older code!

Definition at line 377 of file polys.h.

◆ pDelete

#define pDelete (   p_ptr)    p_Delete(p_ptr, currRing)

Definition at line 187 of file polys.h.

◆ pDeleteComp

#define pDeleteComp (   p,
  k 
)    p_DeleteComp(p,k,currRing)

Definition at line 361 of file polys.h.

◆ pDiff

#define pDiff (   a,
  b 
)    p_Diff(a,b,currRing)

Definition at line 297 of file polys.h.

◆ pDiffOp

#define pDiffOp (   a,
  b,
  m 
)    p_DiffOp(a,b,m,currRing)

Definition at line 298 of file polys.h.

◆ pDivideM

#define pDivideM (   a,
  b 
)    p_DivideM(a,b,currRing)

Definition at line 295 of file polys.h.

◆ pDivisibleBy

#define pDivisibleBy (   a,
  b 
)    p_DivisibleBy(a,b,currRing)

returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > 0, s.t. b = a + c;

Definition at line 139 of file polys.h.

◆ pDivisibleByRingCase

#define pDivisibleByRingCase (   f,
  g 
)    p_DivisibleByRingCase(f,g,currRing)

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 160 of file polys.h.

◆ pEqualPolys

#define pEqualPolys (   p1,
  p2 
)    p_EqualPolys(p1,p2,currRing)

Definition at line 400 of file polys.h.

◆ pExpVectorAdd

#define pExpVectorAdd (   p1,
  p2 
)    p_ExpVectorAdd(p1, p2, currRing)

Definition at line 88 of file polys.h.

◆ pExpVectorAddSub

#define pExpVectorAddSub (   p1,
  p2,
  p3 
)    p_ExpVectorAddSub(p1, p2, p3, currRing)

Definition at line 90 of file polys.h.

◆ pExpVectorCopy

#define pExpVectorCopy (   d_p,
  s_p 
)    p_ExpVectorCopy(d_p, s_p, currRing)

Definition at line 87 of file polys.h.

◆ pExpVectorDiff

#define pExpVectorDiff (   pr,
  p1,
  p2 
)    p_ExpVectorDiff(pr, p1, p2, currRing)

Definition at line 92 of file polys.h.

◆ pExpVectorSub

#define pExpVectorSub (   p1,
  p2 
)    p_ExpVectorSub(p1, p2, currRing)

Definition at line 89 of file polys.h.

◆ pExpVectorSum

#define pExpVectorSum (   pr,
  p1,
  p2 
)    p_ExpVectorSum(pr, p1, p2, currRing)

Definition at line 91 of file polys.h.

◆ pGetComp

#define pGetComp (   p)    (int)__p_GetComp(p, currRing)

Component.

Definition at line 38 of file polys.h.

◆ pGetExp

#define pGetExp (   p,
  i 
)    p_GetExp(p, i, currRing)

Exponent.

Definition at line 42 of file polys.h.

◆ pGetExpDiff

#define pGetExpDiff (   p1,
  p2,
  i 
)    p_GetExpDiff(p1, p2, i, currRing)

Definition at line 50 of file polys.h.

◆ pGetExpSum

#define pGetExpSum (   p1,
  p2,
  i 
)    p_GetExpSum(p1, p2, i, currRing)

Definition at line 49 of file polys.h.

◆ pGetExpV

#define pGetExpV (   p,
 
)    p_GetExpV(p, e, currRing)

Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long) memory. Exponents are filled in as follows: comp, e_1, .., e_n.

Definition at line 97 of file polys.h.

◆ pGetOrder

#define pGetOrder (   p)    p_GetOrder(p, currRing)

Order.

Definition at line 35 of file polys.h.

◆ pGetShortExpVector

#define pGetShortExpVector (   a)    p_GetShortExpVector(a, currRing)

returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )

Definition at line 153 of file polys.h.

◆ pGetVariables

#define pGetVariables (   p,
 
)    p_GetVariables(p, e, currRing)

Definition at line 252 of file polys.h.

◆ pHasNotCF

#define pHasNotCF (   p1,
  p2 
)    p_HasNotCF(p1,p2,currRing)

Definition at line 264 of file polys.h.

◆ pHasNotCFRing

#define pHasNotCFRing (   p1,
  p2 
)    p_HasNotCFRing(p1,p2,currRing)

Definition at line 263 of file polys.h.

◆ pHead

#define pHead (   p)    p_Head(p, currRing)

returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL

Definition at line 68 of file polys.h.

◆ pHomogen

#define pHomogen (   p,
  varnum 
)    p_Homogen(p,varnum,currRing)

homogenizes p by multiplying certain powers of the varnum-th variable

Definition at line 323 of file polys.h.

◆ pIncrExp

#define pIncrExp (   p,
  i 
)    p_IncrExp(p,i, currRing)

Definition at line 44 of file polys.h.

◆ pInit

#define pInit ( )    p_Init(currRing,currRing->PolyBin)

allocates a new monomial and initializes everything to 0

Definition at line 62 of file polys.h.

◆ pIsConstant

#define pIsConstant (   p)    p_IsConstant(p,currRing)

like above, except that Comp must be 0

Definition at line 239 of file polys.h.

◆ pIsConstantComp

#define pIsConstantComp (   p)    p_IsConstantComp(p, currRing)

return true if p is either NULL, or if all exponents of p are 0, Comp of p might be != 0

Definition at line 237 of file polys.h.

◆ pIsConstantPoly

#define pIsConstantPoly (   p)    p_IsConstantPoly(p, currRing)

return TRUE if all monomials of p are constant

Definition at line 247 of file polys.h.

◆ pISet

#define pISet (   i)    p_ISet(i,currRing)

Definition at line 313 of file polys.h.

◆ pIsHomogen

#define pIsHomogen (   p)    p_IsHomogen(p,currRing)

Definition at line 330 of file polys.h.

◆ pIsPurePower

#define pIsPurePower (   p)    p_IsPurePower(p, currRing)

Definition at line 249 of file polys.h.

◆ pIsUnit

#define pIsUnit (   p)    p_IsUnit(p,currRing)

return true if the Lm is a constant <>0

Definition at line 241 of file polys.h.

◆ pIsUnivariate

#define pIsUnivariate (   p)    p_IsUnivariate(p, currRing)

Definition at line 250 of file polys.h.

◆ pIsVector

#define pIsVector (   p)    (pGetComp(p)>0)

Definition at line 251 of file polys.h.

◆ pJet

#define pJet (   p,
  m 
)    p_Jet(p,m,currRing)

Definition at line 368 of file polys.h.

◆ pJetW

#define pJetW (   p,
  m,
  iv 
)    p_JetW(p,m,iv,currRing)

Definition at line 370 of file polys.h.

◆ pLcm

#define pLcm (   a,
  b,
  m 
)    p_Lcm(a,b,m,currRing)

Definition at line 296 of file polys.h.

◆ pLmCmp

#define pLmCmp (   p,
 
)    p_LmCmp(p,q,currRing)

returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering

Definition at line 106 of file polys.h.

◆ pLmCmpAction

#define pLmCmpAction (   p,
  q,
  actionE,
  actionG,
  actionS 
)     _p_LmCmpAction(p,q,currRing, actionE, actionG,actionS)

executes axtionE|actionG|actionS if p=q|p>q|p<q w.r.t monomial ordering action should be a "goto ..."

Definition at line 109 of file polys.h.

282 { return p_Totaldegree(p,currRing); }
283#define pWTotaldegree(p) p_WTotaldegree(p,currRing)
284#define pWDegree(p) p_WDegree(p,currRing)
285
286/*-------------operations on polynomials:------------*/
287#define pSub(a,b) p_Sub(a,b,currRing)
288
289#define pmInit(a,b) p_mInit(a,b,currRing)
290
291/* ----------------- define to enable new p_procs -----*/
292
293#define pMDivide(a,b) p_MDivide(a,b,currRing)
294#define pDivideM(a,b) p_DivideM(a,b,currRing)
295#define pLcm(a,b,m) p_Lcm(a,b,m,currRing)
296#define pDiff(a,b) p_Diff(a,b,currRing)
297#define pDiffOp(a,b,m) p_DiffOp(a,b,m,currRing)
298
299#define pMaxComp(p) p_MaxComp(p, currRing)
300#define pMinComp(p) p_MinComp(p, currRing)
301
302#define pOneComp(p) p_OneComp(p, currRing)
303#define pSetCompP(a,i) p_SetCompP(a, i, currRing)
304
305// let's inline those, so that we can call them from the debugger
306inline char* pString(poly p) {return p_String(p, currRing, currRing);}
307inline void pString0(poly p) {p_String0(p, currRing, currRing);}
308inline void pWrite(poly p) {p_Write(p, currRing, currRing);}
309inline void pWrite0(poly p) {p_Write0(p, currRing, currRing);}
310inline void wrp(poly p) {p_wrp(p, currRing, currRing);}
311
312#define pISet(i) p_ISet(i,currRing)
313#define pNSet(n) p_NSet(n,currRing)
314
315#define pOne() p_One(currRing)
316
317#define pNormalize(p) p_Normalize(p,currRing)
318#define pSize(p) p_Size(p,currRing)
319
320
321/// homogenizes p by multiplying certain powers of the varnum-th variable
322#define pHomogen(p,varnum) p_Homogen(p,varnum,currRing)
323
325// // replaces the maximal powers of the leading monomial of p2 in p1 by
326// // the same powers of n, utility for dehomogenization
327// #define pDehomogen(p1,p2,n) p_Dehomgen(p1,p2,n,currRing)
328// #define pIsHomogen(p) p_IsHomggen(p,currRing)
329#define pIsHomogen(p) p_IsHomogen(p,currRing)
330
331/*BOOLEAN pVectorHasUnitM(poly p, int * k);*/
332#define pVectorHasUnitB(p,k) p_VectorHasUnitB(p,k,currRing)
333#define pVectorHasUnit(p,k,l) p_VectorHasUnit(p,k,l,currRing)
334
335/// Splits *p into two polys: *q which consists of all monoms with
336/// component == comp and *p of all other monoms *lq == pLength(*q)
337/// On return all components pf *q == 0
338inline void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R = currRing)
339{
340 return p_TakeOutComp(p, comp, q, lq, R);
341}
342
343
344/// This is something weird -- Don't use it, unless you know what you are doing
345inline poly pTakeOutComp(poly * p, int k, const ring R = currRing)
346{
347 return p_TakeOutComp(p, k, R);
348}
349
350/* old spielwiese
351#define pTakeOutComp(p,k,q,lq) p_TakeOutComp(p,k,q,lq,currRing)
352
353// Similar to pTakeOutComp, except that only those components are
354// taken out whose Order == order
355// ASSUME: monomial ordering is Order compatible, i.e., if m1, m2 Monoms then
356// m1 >= m2 ==> pGetOrder(m1) >= pGetOrder(m2)
357#define pDecrOrdTakeOutComp(p,c,o,q,lq) p_DecrOrdTakeOutComp(p,c,o,q,lq,currRing)
358*/
359void pSetPolyComp(poly p, int comp);
360#define pDeleteComp(p,k) p_DeleteComp(p,k,currRing)
361
362inline void pNorm(poly p){ p_Norm(p, currRing); }
363
364
365#define pSubst(p,n,e) p_Subst(p,n,e,currRing)
366#define ppJet(p,m) pp_Jet(p,m,currRing)
367#define pJet(p,m) p_Jet(p,m,currRing)
368#define ppJetW(p,m,iv) pp_JetW(p,m,iv,currRing)
369#define pJetW(p,m,iv) p_JetW(p,m,iv,currRing)
370#define pMinDeg(p,w) p_MinDeg(p,w,currRing)
371#define pSeries(n,p,u,w) p_Series(n,p,u,w,currRing)
372// maximum weighted degree of all monomials of p, w is indexed from
373// 1..pVariables
374
375/// Deprecated: only for compatibility with older code!
376#define pDegW(p,w) p_DegW(p,w,currRing)
377
378/*-----------type conversions ----------------------------*/
379// void pVec2Polys(poly v, polyset *p, int *len);
380#define pVar(m) p_Var(m,currRing)
381
382/*-----------specials for spoly-computations--------------*/
383
384/// Returns TRUE if
385/// * LM(p) | LM(lcm)
386/// * LC(p) | LC(lcm) only if ring
387/// * Exists i, j:
388/// * LE(p, i) != LE(lcm, i)
389/// * LE(p1, i) != LE(lcm, i) ==> LCM(p1, p) != lcm
390/// * LE(p, j) != LE(lcm, j)
391/// * LE(p2, j) != LE(lcm, j) ==> LCM(p2, p) != lcm
392BOOLEAN pCompareChain (poly p, poly p1, poly p2, poly lcm, const ring R = currRing);
393
394#ifdef HAVE_RATGRING
395BOOLEAN pCompareChainPart (poly p, poly p1, poly p2, poly lcm, const ring R = currRing);
396#endif
397
398
399#define pEqualPolys(p1,p2) p_EqualPolys(p1,p2,currRing)
400
401
402
403/// returns the length of a polynomial (numbers of monomials)
404/// respect syzComp
405static inline poly pLast(poly a, int &length) { return p_Last (a, length, currRing); }
406static inline poly pLast(poly a) { int l; return pLast(a, l); }
407
408/***************************************************************
409 *
410 * PDEBUG stuff
411 *
412 ***************************************************************/
413#ifdef PDEBUG
414#define pTest(p) _p_Test(p, currRing, PDEBUG)
415#define pLmTest(p) _p_LmTest(p, currRing, PDEBUG)
416
417#else // ! PDEBUG
418
419#define pTest(p) do {} while (0)
420#define pLmTest(p) do {} while (0)
421#endif
422
423#endif // POLYS_H
int BOOLEAN
Definition auxiliary.h:88
int l
Definition cfEzgcd.cc:100
int k
Definition cfEzgcd.cc:99
int p
Definition cfModGcd.cc:4086
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition p_polys.cc:3575
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709
Definition lq.h:40
void p_Norm(poly p1, const ring r)
Definition p_polys.cc:3799
poly p_Last(const poly p, int &l, const ring r)
Definition p_polys.cc:4730
char * p_String(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:322
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition polys0.cc:223
void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:332
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1523
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373
void pSetPolyComp(poly p, int comp)
void pNorm(poly p)
Definition polys.h:363
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R=currRing)
Returns TRUE if.
Definition kpolys.cc:17
void pWrite0(poly p)
Definition polys.h:310
BOOLEAN pIsHomogeneous(poly p)
void wrp(poly p)
Definition polys.h:311
void pWrite(poly p)
Definition polys.h:309
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R=currRing)
Definition kpolys.cc:71
void pString0(poly p)
Definition polys.h:308
static poly pLast(poly a, int &length)
returns the length of a polynomial (numbers of monomials) respect syzComp
Definition polys.h:406
EXTERN_VAR ring currRing
Definition polys.h:18
void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R=currRing)
Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other ...
Definition polys.h:339
char * pString(poly p)
Definition polys.h:307
#define R
Definition sirandom.c:27

◆ pLmDelete

#define pLmDelete (   p)    p_LmDelete(p, currRing)

assume p != NULL, deletes Lm(p)->coef and Lm(p)

Definition at line 77 of file polys.h.

◆ pLmDeleteAndNext

#define pLmDeleteAndNext (   p)    p_LmDeleteAndNext(p, currRing)

like pLmDelete, returns pNext(p)

Definition at line 79 of file polys.h.

◆ pLmDivisibleBy

#define pLmDivisibleBy (   a,
  b 
)    p_LmDivisibleBy(a,b,currRing)

like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL

Definition at line 141 of file polys.h.

◆ pLmDivisibleByNoComp

#define pLmDivisibleByNoComp (   a,
  b 
)    p_LmDivisibleByNoComp(a,b,currRing)

like pLmDivisibleBy, does not check components

Definition at line 143 of file polys.h.

◆ pLmEqual

#define pLmEqual (   p1,
  p2 
)    p_ExpVectorEqual(p1, p2, currRing)

Definition at line 112 of file polys.h.

◆ pLmFreeAndNext

#define pLmFreeAndNext (   p)    p_LmFreeAndNext(p, currRing)

assumes p != NULL, deletes p, returns pNext(p)

Definition at line 75 of file polys.h.

◆ pLmInit

#define pLmInit (   p)    p_LmInit(p, currRing)

like pInit, except that expvector is initialized to that of p, p must be != NULL

Definition at line 65 of file polys.h.

◆ pLmIsConstant

#define pLmIsConstant (   p)    p_LmIsConstant(p,currRing)

Definition at line 244 of file polys.h.

◆ pLmIsConstantComp

#define pLmIsConstantComp (   p)    p_LmIsConstantComp(p, currRing)

like above, except that p must be != NULL

Definition at line 243 of file polys.h.

◆ pLmRingShortDivisibleBy

#define pLmRingShortDivisibleBy (   a,
  sev_a,
  b,
  not_sev_b 
)     p_LmRingShortDivisibleBy(a, sev_a, b, not_sev_b, currRing)

Definition at line 149 of file polys.h.

◆ pLmShortDivisibleBy

#define pLmShortDivisibleBy (   a,
  sev_a,
  b,
  not_sev_b 
)     p_LmShortDivisibleBy(a, sev_a, b, not_sev_b, currRing)

Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGetShortExpVector(b)

Definition at line 147 of file polys.h.

◆ pLmTest

#define pLmTest (   p)    _p_LmTest(p, currRing, PDEBUG)

Definition at line 416 of file polys.h.

◆ pLtCmp

#define pLtCmp (   p,
 
)    p_LtCmp(p,q,currRing)

Definition at line 124 of file polys.h.

◆ pLtCmpNoAbs

#define pLtCmpNoAbs (   p,
 
)    p_LtCmpNoAbs(p,q,currRing)

Definition at line 125 of file polys.h.

◆ pLtCmpOrdSgnDiffM

#define pLtCmpOrdSgnDiffM (   p,
 
)    p_LtCmpOrdSgnDiffM(p,q,currRing)

Definition at line 126 of file polys.h.

◆ pLtCmpOrdSgnDiffP

#define pLtCmpOrdSgnDiffP (   p,
 
)    p_LtCmpOrdSgnDiffP(p,q,currRing)

Definition at line 127 of file polys.h.

◆ pLtCmpOrdSgnEqM

#define pLtCmpOrdSgnEqM (   p,
 
)    p_LtCmpOrdSgnEqM(p,q,currRing)

Definition at line 128 of file polys.h.

◆ pLtCmpOrdSgnEqP

#define pLtCmpOrdSgnEqP (   p,
 
)    p_LtCmpOrdSgnEqP(p,q,currRing)

Definition at line 129 of file polys.h.

◆ pMaxComp

#define pMaxComp (   p)    p_MaxComp(p, currRing)

Definition at line 300 of file polys.h.

◆ pMDivide

#define pMDivide (   a,
  b 
)    p_MDivide(a,b,currRing)

Definition at line 294 of file polys.h.

◆ pMinComp

#define pMinComp (   p)    p_MinComp(p, currRing)

Definition at line 301 of file polys.h.

◆ pMinDeg

#define pMinDeg (   p,
  w 
)    p_MinDeg(p,w,currRing)

Definition at line 371 of file polys.h.

◆ pmInit

#define pmInit (   a,
  b 
)    p_mInit(a,b,currRing)

Definition at line 290 of file polys.h.

◆ pMinus_mm_Mult_qq

#define pMinus_mm_Mult_qq (   p,
  m,
 
)    p_Minus_mm_Mult_qq(p, m, q, currRing)

Definition at line 206 of file polys.h.

◆ pMult

#define pMult (   p,
 
)    p_Mult_q(p, q, currRing)

Definition at line 208 of file polys.h.

◆ pMult_mm

#define pMult_mm (   p,
  m 
)    p_Mult_mm(p, m, currRing)

Definition at line 203 of file polys.h.

◆ pMult_nn

#define pMult_nn (   p,
 
)    p_Mult_nn(p, n, currRing)

Definition at line 201 of file polys.h.

◆ pMultExp

#define pMultExp (   p,
  i,
  v 
)    p_MultExp(p,i,v, currRing)

Definition at line 48 of file polys.h.

◆ pNeg

#define pNeg (   p)    p_Neg(p, currRing)

Definition at line 199 of file polys.h.

◆ pNew

#define pNew ( )    p_New(currRing)

allocates the space for a new monomial – no initialization !!!

Definition at line 60 of file polys.h.

◆ pNormalize

#define pNormalize (   p)    p_Normalize(p,currRing)

Definition at line 318 of file polys.h.

◆ pNSet

#define pNSet (   n)    p_NSet(n,currRing)

Definition at line 314 of file polys.h.

◆ pOne

#define pOne ( )    p_One(currRing)

Definition at line 316 of file polys.h.

◆ pOneComp

#define pOneComp (   p)    p_OneComp(p, currRing)

Definition at line 303 of file polys.h.

◆ ppJet

#define ppJet (   p,
  m 
)    pp_Jet(p,m,currRing)

Definition at line 367 of file polys.h.

◆ ppJetW

#define ppJetW (   p,
  m,
  iv 
)    pp_JetW(p,m,iv,currRing)

Definition at line 369 of file polys.h.

◆ pPlus_mm_Mult_qq

#define pPlus_mm_Mult_qq (   p,
  m,
 
)    p_Plus_mm_Mult_qq(p, m, q, currRing)

Definition at line 207 of file polys.h.

◆ ppMult_Coeff_mm_DivSelect

#define ppMult_Coeff_mm_DivSelect (   p,
  m 
)    pp_Mult_Coeff_mm_DivSelect(p, m, currRing)

Definition at line 211 of file polys.h.

◆ ppMult_mm

#define ppMult_mm (   p,
  m 
)    pp_Mult_mm(p, m, currRing)

Definition at line 202 of file polys.h.

◆ ppMult_nn

#define ppMult_nn (   p,
 
)    pp_Mult_nn(p, n, currRing)

Definition at line 200 of file polys.h.

◆ ppMult_qq

#define ppMult_qq (   p,
 
)    pp_Mult_qq(p, q, currRing)

Definition at line 209 of file polys.h.

◆ pPower

#define pPower (   p,
 
)    p_Power(p, q, currRing)

Definition at line 205 of file polys.h.

◆ pSeries

#define pSeries (   n,
  p,
  u,
  w 
)    p_Series(n,p,u,w,currRing)

Definition at line 372 of file polys.h.

◆ pSetCoeff

#define pSetCoeff (   p,
 
)    p_SetCoeff(p,n,currRing)

deletes old coeff before setting the new one

Definition at line 32 of file polys.h.

◆ pSetComp

#define pSetComp (   p,
  v 
)    p_SetComp(p,v, currRing)

Definition at line 39 of file polys.h.

◆ pSetCompP

#define pSetCompP (   a,
  i 
)    p_SetCompP(a, i, currRing)

Definition at line 304 of file polys.h.

◆ pSetExp

#define pSetExp (   p,
  i,
  v 
)    p_SetExp(p, i, v, currRing)

Definition at line 43 of file polys.h.

◆ pSetExpV

#define pSetExpV (   p,
 
)    p_SetExpV(p, e, currRing)

Definition at line 98 of file polys.h.

◆ pSetm

#define pSetm (   p)    p_Setm(p, currRing)

Definition at line 272 of file polys.h.

◆ pSetmComp

#define pSetmComp (   p)    p_Setm(p, currRing)

TODO:

Definition at line 274 of file polys.h.

◆ pSize

#define pSize (   p)    p_Size(p,currRing)

Definition at line 319 of file polys.h.

◆ pSort

#define pSort (   p)    p_SortMerge(p, currRing)

Definition at line 219 of file polys.h.

◆ pSortAdd

#define pSortAdd (   p)    p_SortAdd(p, currRing)

sorts p, p may have equal monomials

Definition at line 222 of file polys.h.

◆ pSortCompCorrect

#define pSortCompCorrect (   p)    pSort(p)

Assume: If considered only as poly in any component of p (say, monomials of other components of p are set to 0), then p is already sorted correctly.

Definition at line 228 of file polys.h.

◆ pSortMerger

#define pSortMerger (   p)    p_SortMerge(p, currRing)

sorts p, assumes all monomials in p are different

Definition at line 218 of file polys.h.

◆ pSplit

#define pSplit (   p,
 
)    p_Split(p,r)

Definition at line 266 of file polys.h.

◆ pSub

#define pSub (   a,
  b 
)    p_Sub(a,b,currRing)

Definition at line 288 of file polys.h.

◆ pSubExp

#define pSubExp (   p,
  i,
  v 
)    p_SubExp(p,i,v, currRing)

Definition at line 47 of file polys.h.

◆ pSubst

#define pSubst (   p,
  n,
 
)    p_Subst(p,n,e,currRing)

Definition at line 366 of file polys.h.

◆ pTest

#define pTest (   p)    _p_Test(p, currRing, PDEBUG)

Definition at line 415 of file polys.h.

◆ pVar

#define pVar (   m)    p_Var(m,currRing)

Definition at line 381 of file polys.h.

◆ pVectorHasUnit

#define pVectorHasUnit (   p,
  k,
  l 
)    p_VectorHasUnit(p,k,l,currRing)

Definition at line 334 of file polys.h.

◆ pVectorHasUnitB

#define pVectorHasUnitB (   p,
  k 
)    p_VectorHasUnitB(p,k,currRing)

Definition at line 333 of file polys.h.

◆ pWDegree

#define pWDegree (   p)    p_WDegree(p,currRing)

Definition at line 285 of file polys.h.

◆ pWeight

#define pWeight (   i)    p_Weight(i,currRing)

Definition at line 281 of file polys.h.

◆ pWTotaldegree

#define pWTotaldegree (   p)    p_WTotaldegree(p,currRing)

Definition at line 284 of file polys.h.

Typedef Documentation

◆ polyset

Definition at line 260 of file polys.h.

Function Documentation

◆ p_Divide()

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

polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift destroys a,b

Definition at line 34 of file polys.cc.

35{
36 assume(q!=NULL);
37 if (q==NULL)
38 {
39 WerrorS("div. by 0");
40 return NULL;
41 }
42 if (p==NULL)
43 {
44 p_Delete(&q,r);
45 return NULL;
46 }
47 if ((pNext(q)!=NULL)||rIsPluralRing(r))
48 { /* This means that q != 0 consists of at least two terms*/
49 if(p_GetComp(p,r)==0)
50 {
51 if((rFieldType(r)==n_transExt)
52 &&(convSingTrP(p,r))
53 &&(convSingTrP(q,r))
54 &&(!rIsNCRing(r)))
55 {
56 poly res=singclap_pdivide(p, q, r);
57 p_Delete(&p,r);
58 p_Delete(&q,r);
59 return res;
60 }
61 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
62 &&(!rField_is_Ring(r))
63 &&(!rIsNCRing(r)))
64 {
65 poly res=singclap_pdivide(p, q, r);
66 p_Delete(&p,r);
67 p_Delete(&q,r);
68 return res;
69 }
70 else
71 {
72 ideal vi=idInit(1,1); vi->m[0]=q;
73 ideal ui=idInit(1,1); ui->m[0]=p;
74 ideal R; matrix U;
76 if (r!=currRing) rChangeCurrRing(r);
83 p=m->m[0]; m->m[0]=NULL;
84 id_Delete(&m,r);
85 p_SetCompP(p,0,r);
86 id_Delete((ideal *)&U,r);
87 id_Delete(&R,r);
88 //vi->m[0]=NULL; ui->m[0]=NULL;
89 id_Delete(&vi,r);
90 id_Delete(&ui,r);
91 return p;
92 }
93 }
94 else
95 {
96 int comps=p_MaxComp(p,r);
98 poly h;
99 int i;
100 // conversion to a list of polys:
101 while (p!=NULL)
102 {
103 i=p_GetComp(p,r)-1;
104 h=pNext(p);
105 pNext(p)=NULL;
106 p_SetComp(p,0,r);
107 I->m[i]=p_Add_q(I->m[i],p,r);
108 p=h;
109 }
110 // division and conversion to vector:
111 h=NULL;
112 p=NULL;
113 for(i=comps-1;i>=0;i--)
114 {
115 if (I->m[i]!=NULL)
116 {
117 if((rFieldType(r)==n_transExt)
118 &&(convSingTrP(I->m[i],r))
119 &&(convSingTrP(q,r))
120 &&(!rIsNCRing(r)))
121 {
122 h=singclap_pdivide(I->m[i],q,r);
123 }
124 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
125 &&(!rField_is_Ring(r))
126 &&(!rIsNCRing(r)))
127 h=singclap_pdivide(I->m[i],q,r);
128 else
129 {
130 ideal vi=idInit(1,1); vi->m[0]=q;
131 ideal ui=idInit(1,1); ui->m[0]=I->m[i];
132 ideal R; matrix U;
134 if (r!=currRing) rChangeCurrRing(r);
137 si_opt_1 &= ~(Sy_bit(OPT_PROT));
138 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
141 if (idIs0(R))
142 {
144 p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
145 id_Delete((ideal *)&T,r);
146 }
147 else p=NULL;
148 id_Delete((ideal*)&U,r);
149 id_Delete(&R,r);
150 vi->m[0]=NULL; ui->m[0]=NULL;
151 id_Delete(&vi,r);
152 id_Delete(&ui,r);
153 }
154 p_SetCompP(h,i+1,r);
155 p=p_Add_q(p,h,r);
156 }
157 }
158 id_Delete(&I,r);
159 p_Delete(&q,r);
160 return p;
161 }
162 }
163 else
164 { /* This means that q != 0 consists of just one term, or LetterPlace */
165#ifdef HAVE_RINGS
166 if (pNext(q)!=NULL)
167 {
168 WerrorS("division over a coefficient domain only implemented for terms");
169 return NULL;
170 }
171#endif
172 return p_DivideM(p,q,r);
173 }
174 return NULL;
175}
#define BITSET
Definition auxiliary.h:85
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
BOOLEAN convSingTrP(poly p, const ring r)
Definition clapconv.cc:375
poly singclap_pdivide(poly f, poly g, const ring r)
Definition clapsing.cc:624
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
CanonicalForm res
Definition facAbsFact.cc:60
void WerrorS(const char *s)
Definition feFopen.cc:24
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition ideals.cc:1111
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
STATIC_VAR jList * T
Definition janet.cc:30
STATIC_VAR Poly * h
Definition janet.cc:971
#define MATELEM(mat, i, j)
1-based access to matrix
Definition matpol.h:29
#define assume(x)
Definition mod2.h:389
#define p_GetComp(p, r)
Definition monomials.h:64
#define pNext(p)
Definition monomials.h:36
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition numbers.cc:307
#define NULL
Definition omList.c:12
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_PROT
Definition options.h:76
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
#define Sy_bit(x)
Definition options.h:31
poly p_DivideM(poly a, poly b, const ring r)
Definition p_polys.cc:1582
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
static void p_SetCompP(poly p, int i, ring r)
Definition p_polys.h:256
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:294
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
void rChangeCurrRing(ring r)
Definition polys.cc:16
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
static n_coeffType rFieldType(const ring r)
the type of the coefficient filed of r (n_Zp, n_Q, etc)
Definition ring.h:562
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:427
#define rField_is_Ring(R)
Definition ring.h:491
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)

◆ p_DivRem()

poly p_DivRem ( poly  a,
poly  b,
poly &  rest,
const ring  r 
)

Definition at line 317 of file polys.cc.

318{
319 assume(q!=NULL);
320 rest=NULL;
321 if (q==NULL)
322 {
323 WerrorS("div. by 0");
324 return NULL;
325 }
326 if (p==NULL)
327 {
328 p_Delete(&q,r);
329 return NULL;
330 }
331 if(p_GetComp(p,r)==0)
332 {
333 if((rFieldType(r)==n_transExt)
334 &&(convSingTrP(p,r))
335 &&(convSingTrP(q,r))
336 &&(!rIsNCRing(r)))
337 {
338 poly res=singclap_pdivide(p, q, r);
339 rest=singclap_pmod(p,q,r);
340 p_Delete(&p,r);
341 p_Delete(&q,r);
342 return res;
343 }
344 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
345 &&(!rField_is_Ring(r))
346 &&(!rIsNCRing(r)))
347 {
348 poly res=singclap_pdivide(p, q, r);
349 rest=singclap_pmod(p,q,r);
350 p_Delete(&p,r);
351 p_Delete(&q,r);
352 return res;
353 }
354 else
355 {
356 ideal vi=idInit(1,1); vi->m[0]=q;
357 ideal ui=idInit(1,1); ui->m[0]=p;
358 ideal R; matrix U;
360 if (r!=currRing) rChangeCurrRing(r);
363 si_opt_1 &= ~(Sy_bit(OPT_PROT));
364 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
367 p=m->m[0]; m->m[0]=NULL;
368 id_Delete(&m,r);
369 p_SetCompP(p,0,r);
370 rest=R->m[0]; R->m[0]=NULL;
371 id_Delete(&R,r);
372 p_SetCompP(rest,0,r);
373 id_Delete((ideal *)&U,r);
374 //vi->m[0]=NULL; ui->m[0]=NULL;
375 id_Delete(&vi,r);
376 id_Delete(&ui,r);
377 return p;
378 }
379 }
380 return NULL;
381}
poly singclap_pmod(poly f, poly g, const ring r)
Definition clapsing.cc:702

◆ pCompareChain()

BOOLEAN pCompareChain ( poly  p,
poly  p1,
poly  p2,
poly  lcm,
const ring  R = currRing 
)

Returns TRUE if.

Definition at line 17 of file kpolys.cc.

18{
19 int k, j;
20
21 if (lcm==NULL) return FALSE;
22
23 for (j=(R->N); j; j--)
24 if ( p_GetExp(p,j, R) > p_GetExp(lcm,j, R)) return FALSE;
25 if ( pGetComp(p) != pGetComp(lcm)) return FALSE;
26 for (j=(R->N); j; j--)
27 {
28 if (p_GetExp(p1,j, R)!=p_GetExp(lcm,j, R))
29 {
30 if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
31 {
32 for (k=(R->N); k>j; k--)
33 {
34 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
35 && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
36 return TRUE;
37 }
38 for (k=j-1; k; k--)
39 {
40 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
41 && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
42 return TRUE;
43 }
44 return FALSE;
45 }
46 }
47 else if (p_GetExp(p2,j, R)!=p_GetExp(lcm,j, R))
48 {
49 if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
50 {
51 for (k=(R->N); k>j; k--)
52 {
53 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
54 && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
55 return TRUE;
56 }
57 for (k=j-1; k!=0 ; k--)
58 {
59 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
60 && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
61 return TRUE;
62 }
63 return FALSE;
64 }
65 }
66 }
67 return FALSE;
68}
int j
Definition facHensel.cc:110
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
#define pGetComp(p)
Component.
Definition polys.h:38

◆ pCompareChainPart()

BOOLEAN pCompareChainPart ( poly  p,
poly  p1,
poly  p2,
poly  lcm,
const ring  R = currRing 
)

Definition at line 71 of file kpolys.cc.

72{
73 int k, j;
74
75 if (lcm==NULL) return FALSE;
76
77 for (j=R->real_var_end; j>=R->real_var_start; j--)
78 if ( p_GetExp(p,j, R) > p_GetExp(lcm,j, R)) return FALSE;
79 if ( pGetComp(p) != pGetComp(lcm)) return FALSE;
80 for (j=R->real_var_end; j>=R->real_var_start; j--)
81 {
82 if (p_GetExp(p1,j, R)!=p_GetExp(lcm,j, R))
83 {
84 if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
85 {
86 for (k=(R->N); k>j; k--)
87 for (k=R->real_var_end; k>j; k--)
88 {
89 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
90 && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
91 return TRUE;
92 }
93 for (k=j-1; k>=R->real_var_start; k--)
94 {
95 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
96 && (p_GetExp(p2,k, R)!=p_GetExp(lcm,k, R)))
97 return TRUE;
98 }
99 return FALSE;
100 }
101 }
102 else if (p_GetExp(p2,j, R)!=p_GetExp(lcm,j, R))
103 {
104 if (p_GetExp(p,j, R)!=p_GetExp(lcm,j, R))
105 {
106 for (k=R->real_var_end; k>j; k--)
107 {
108 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
109 && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
110 return TRUE;
111 }
112 for (k=j-1; k>=R->real_var_start; k--)
113 {
114 if ((p_GetExp(p,k, R)!=p_GetExp(lcm,k, R))
115 && (p_GetExp(p1,k, R)!=p_GetExp(lcm,k, R)))
116 return TRUE;
117 }
118 return FALSE;
119 }
120 }
121 }
122 return FALSE;
123}

◆ pIsHomogeneous()

BOOLEAN pIsHomogeneous ( poly  p)

◆ pLast() [1/2]

static poly pLast ( poly  a)
inlinestatic

Definition at line 407 of file polys.h.

407{ int l; return pLast(a, l); }

◆ pLast() [2/2]

static poly pLast ( poly  a,
int length 
)
inlinestatic

returns the length of a polynomial (numbers of monomials) respect syzComp

Definition at line 406 of file polys.h.

406{ return p_Last (a, length, currRing); }

◆ pLmFree() [1/2]

static void pLmFree ( poly *  p)
inlinestatic

like pLmFree, but advances p

Definition at line 73 of file polys.h.

static void p_LmFree(poly p, ring)
Definition p_polys.h:685

◆ pLmFree() [2/2]

static void pLmFree ( poly  p)
inlinestatic

frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced

Definition at line 71 of file polys.h.

◆ pNorm()

void pNorm ( poly  p)
inline

Definition at line 363 of file polys.h.

363{ p_Norm(p, currRing); }

◆ pp_Divide()

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

polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift does not destroy a,b

Definition at line 177 of file polys.cc.

178{
179 if (q==NULL)
180 {
181 WerrorS("div. by 0");
182 return NULL;
183 }
184 if (p==NULL)
185 {
186 return NULL;
187 }
188 if ((pNext(q)!=NULL)||rIsPluralRing(r))
189 { /* This means that q != 0 consists of at least two terms*/
190 if(p_GetComp(p,r)==0)
191 {
192 if((rFieldType(r)==n_transExt)
193 &&(convSingTrP(p,r))
194 &&(convSingTrP(q,r))
195 &&(!rIsNCRing(r)))
196 {
197 poly res=singclap_pdivide(p, q, r);
198 return res;
199 }
200 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
201 &&(!rField_is_Ring(r))
202 &&(!rIsNCRing(r)))
203 {
204 poly res=singclap_pdivide(p, q, r);
205 return res;
206 }
207 else
208 {
209 ideal vi=idInit(1,1); vi->m[0]=p_Copy(q,r);
210 ideal ui=idInit(1,1); ui->m[0]=p_Copy(p,r);
211 ideal R; matrix U;
213 if (r!=currRing) rChangeCurrRing(r);
216 si_opt_1 &= ~(Sy_bit(OPT_PROT));
217 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
221 p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
222 id_Delete((ideal *)&T,r);
223 id_Delete((ideal *)&U,r);
224 id_Delete(&R,r);
225 //vi->m[0]=NULL; ui->m[0]=NULL;
226 id_Delete(&vi,r);
227 id_Delete(&ui,r);
228 return p;
229 }
230 }
231 else
232 {
233 p=p_Copy(p,r);
234 int comps=p_MaxComp(p,r);
235 ideal I=idInit(comps,1);
236 poly h;
237 int i;
238 // conversion to a list of polys:
239 while (p!=NULL)
240 {
241 i=p_GetComp(p,r)-1;
242 h=pNext(p);
243 pNext(p)=NULL;
244 p_SetComp(p,0,r);
245 I->m[i]=p_Add_q(I->m[i],p,r);
246 p=h;
247 }
248 // division and conversion to vector:
249 h=NULL;
250 p=NULL;
251 q=p_Copy(q,r);
252 for(i=comps-1;i>=0;i--)
253 {
254 if (I->m[i]!=NULL)
255 {
256 if((rFieldType(r)==n_transExt)
257 &&(convSingTrP(I->m[i],r))
258 &&(convSingTrP(q,r))
259 &&(!rIsNCRing(r)))
260 {
261 h=singclap_pdivide(I->m[i],q,r);
262 }
263 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
264 &&(!rField_is_Ring(r))
265 &&(!rIsNCRing(r)))
266 h=singclap_pdivide(I->m[i],q,r);
267 else
268 {
269 ideal vi=idInit(1,1); vi->m[0]=q;
270 ideal ui=idInit(1,1); ui->m[0]=I->m[i];
271 ideal R; matrix U;
273 if (r!=currRing) rChangeCurrRing(r);
276 si_opt_1 &= ~(Sy_bit(OPT_PROT));
277 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
280 if (idIs0(R))
281 {
283 p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
284 id_Delete((ideal *)&T,r);
285 }
286 else p=NULL;
287 id_Delete((ideal*)&U,r);
288 id_Delete(&R,r);
289 vi->m[0]=NULL; ui->m[0]=NULL;
290 id_Delete(&vi,r);
291 id_Delete(&ui,r);
292 }
293 p_SetCompP(h,i+1,r);
294 p=p_Add_q(p,h,r);
295 }
296 }
297 id_Delete(&I,r);
298 p_Delete(&q,r);
299 return p;
300 }
301 }
302 else
303 { /* This means that q != 0 consists of just one term,
304 or that r is over a coefficient ring. */
305#ifdef HAVE_RINGS
306 if (pNext(q)!=NULL)
307 {
308 WerrorS("division over a coefficient domain only implemented for terms");
309 return NULL;
310 }
311#endif
312 return pp_DivideM(p,q,r);
313 }
314 return NULL;
315}
poly pp_DivideM(poly a, poly b, const ring r)
Definition p_polys.cc:1637
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

◆ pSetPolyComp()

void pSetPolyComp ( poly  p,
int  comp 
)

◆ pString()

char * pString ( poly  p)
inline

Definition at line 307 of file polys.h.

307{return p_String(p, currRing, currRing);}

◆ pString0()

void pString0 ( poly  p)
inline

Definition at line 308 of file polys.h.

◆ pTakeOutComp() [1/2]

poly pTakeOutComp ( poly *  p,
int  k,
const ring  R = currRing 
)
inline

This is something weird – Don't use it, unless you know what you are doing.

Definition at line 346 of file polys.h.

347{
348 return p_TakeOutComp(p, k, R);
349}

◆ pTakeOutComp() [2/2]

void pTakeOutComp ( poly *  p,
long  comp,
poly *  q,
int lq,
const ring  R = currRing 
)
inline

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 339 of file polys.h.

340{
341 return p_TakeOutComp(p, comp, q, lq, R);
342}

◆ pTotaldegree()

static long pTotaldegree ( poly  p)
inlinestatic

Definition at line 283 of file polys.h.

283{ return p_Totaldegree(p,currRing); }

◆ pWrite()

void pWrite ( poly  p)
inline

Definition at line 309 of file polys.h.

◆ pWrite0()

void pWrite0 ( poly  p)
inline

Definition at line 310 of file polys.h.

◆ rChangeCurrRing()

void rChangeCurrRing ( ring  r)

Definition at line 16 of file polys.cc.

17{
18 if (currRing!=NULL)
20 //------------ set global ring vars --------------------------------
21 currRing = r;
22 if( r != NULL )
23 {
24 rTest(r);
25 //------------ global variables related to coefficients ------------
26 assume( r->cf!= NULL );
27 nSetChar(r->cf);
28 //------------ global variables related to polys
29 p_SetGlobals(r); // also setting TEST_RINGDEP_OPTS
30 //------------ global variables related to factory -----------------
31 }
32}
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
Definition coeffs.h:444
#define TEST_RINGDEP_OPTS
Definition options.h:101
void p_SetGlobals(const ring r, BOOLEAN complete)
set all properties of a new ring - also called by rComplete
Definition ring.cc:3493
#define rTest(r)
Definition ring.h:794

◆ 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 at line 383 of file polys.cc.

384{
385 poly res=NULL;
386
387 if (f!=NULL)
388 {
389 //if (r->cf->has_simple_Inverse) p_Norm(f,r);
390 if (rField_is_Zp(r)) p_Norm(f,r);
391 else if (!rField_is_Ring(r)) p_Cleardenom(f, r);
392 }
393 if (g!=NULL)
394 {
395 //if (r->cf->has_simple_Inverse) p_Norm(g,r);
396 if (rField_is_Zp(r)) p_Norm(g,r);
397 else if (!rField_is_Ring(r)) p_Cleardenom(g, r);
398 }
399 else return f; // g==0 => gcd=f (but do a p_Cleardenom/pNorm)
400 if (f==NULL) return g; // f==0 => gcd=g (but do a p_Cleardenom/pNorm)
401 if(!rField_is_Ring(r)
402 && (p_IsConstant(f,r)
403 ||p_IsConstant(g,r)))
404 {
405 res=p_One(r);
406 }
407 else if (r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
408 {
410 }
411 else
412 {
413 ideal I=idInit(2,1);
414 I->m[0]=f;
415 I->m[1]=p_Copy(g,r);
416 intvec *w=NULL;
418 if (r!=currRing) rChangeCurrRing(r);
421 si_opt_1 &= ~(Sy_bit(OPT_PROT));
423 if (w!=NULL) delete w;
424 // expect S1->m[0]=(-g/gcd,f/gcd)
425 if (IDELEMS(S1)!=1) WarnS("error in syzygy computation for GCD");
426 int lp;
427 p_TakeOutComp(&S1->m[0],1,&res,&lp,r);
428 p_Delete(&S1->m[0],r);
429 // GCD is g divided iby (-g/gcd):
430 res=p_Divide(g,res,r);
431 // restore, r, opt:
434 // clean the result
436 if (nCoeff_is_Ring(r->cf)) p_Content(res,r);
437 return res;
438 }
439 p_Delete(&f, r);
440 p_Delete(&g, r);
441 return res;
442}
g
Definition cfModGcd.cc:4098
FILE * f
Definition checklibs.c:9
poly singclap_gcd_r(poly f, poly g, const ring r)
Definition clapsing.cc:68
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition coeffs.h:730
#define WarnS
Definition emacs.cc:78
const CanonicalForm & w
Definition facAbsFact.cc:51
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition ideals.cc:836
void p_Content(poly ph, const ring r)
Definition p_polys.cc:2299
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2849
poly p_One(const ring r)
Definition p_polys.cc:1314
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition p_polys.h:1980
poly p_Divide(poly p, poly q, const ring r)
polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift destroys a,...
Definition polys.cc:34
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
#define IDELEMS(i)
@ testHomog
Definition structs.h:34

◆ wrp()

void wrp ( poly  p)
inline

Definition at line 311 of file polys.h.

Variable Documentation

◆ coeffs_BIGINT

EXTERN_VAR coeffs coeffs_BIGINT

Definition at line 19 of file polys.h.

◆ currRing

EXTERN_VAR ring currRing

Definition at line 18 of file polys.h.