My Project
Loading...
Searching...
No Matches
polys.h File Reference

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

Go to the source code of this file.

Macros

#define pSetCoeff(p, n)
 deletes old coeff before setting the new one
 
#define pGetOrder(p)
 Order.
 
#define pGetComp(p)
 Component.
 
#define pSetComp(p, v)
 
#define pGetExp(p, i)
 Exponent.
 
#define pSetExp(p, i, v)
 
#define pIncrExp(p, i)
 
#define pDecrExp(p, i)
 
#define pAddExp(p, i, v)
 
#define pSubExp(p, i, v)
 
#define pMultExp(p, i, v)
 
#define pGetExpSum(p1, p2, i)
 
#define pGetExpDiff(p1, p2, i)
 
#define pNew()
 allocates the space for a new monomial – no initialization !!!
 
#define pInit()
 allocates a new monomial and initializes everything to 0
 
#define pLmInit(p)
 like pInit, except that expvector is initialized to that of p, p must be != NULL
 
#define pHead(p)
 returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
 
#define pLmFreeAndNext(p)
 assumes p != NULL, deletes p, returns pNext(p)
 
#define pLmDelete(p)
 assume p != NULL, deletes Lm(p)->coef and Lm(p)
 
#define pLmDeleteAndNext(p)
 like pLmDelete, returns pNext(p)
 
#define pExpVectorCopy(d_p, s_p)
 
#define pExpVectorAdd(p1, p2)
 
#define pExpVectorSub(p1, p2)
 
#define pExpVectorAddSub(p1, p2, p3)
 
#define pExpVectorSum(pr, p1, p2)
 
#define pExpVectorDiff(pr, p1, p2)
 
#define pGetExpV(p, e)
 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)
 
#define pLmCmp(p, q)
 returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
 
#define pLmCmpAction(p, q, 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)
 
#define pCmp(p1, p2)
 pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
 
#define pLtCmp(p, q)
 
#define pLtCmpNoAbs(p, q)
 
#define pLtCmpOrdSgnDiffM(p, q)
 
#define pLtCmpOrdSgnDiffP(p, q)
 
#define pLtCmpOrdSgnEqM(p, q)
 
#define pLtCmpOrdSgnEqP(p, q)
 
#define pDivisibleBy(a, b)
 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)
 like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
 
#define pLmDivisibleByNoComp(a, b)
 like pLmDivisibleBy, does not check components
 
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
 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)
 
#define pGetShortExpVector(a)
 returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
 
#define pDivisibleByRingCase(f, g)
 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)
 return a copy of the poly
 
#define pDelete(p_ptr)
 
#define pNeg(p)
 
#define ppMult_nn(p, n)
 
#define pMult_nn(p, n)
 
#define ppMult_mm(p, m)
 
#define pMult_mm(p, m)
 
#define pAdd(p, q)
 
#define pPower(p, q)
 
#define pMinus_mm_Mult_qq(p, m, q)
 
#define pPlus_mm_Mult_qq(p, m, q)
 
#define pMult(p, q)
 
#define ppMult_qq(p, q)
 
#define ppMult_Coeff_mm_DivSelect(p, m)
 
#define pSortMerger(p)
 sorts p, assumes all monomials in p are different
 
#define pSort(p)
 
#define pSortAdd(p)
 sorts p, p may have equal monomials
 
#define pSortCompCorrect(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)
 return true if p is either NULL, or if all exponents of p are 0, Comp of p might be != 0
 
#define pIsConstant(p)
 like above, except that Comp must be 0
 
#define pIsUnit(p)
 return true if the Lm is a constant <>0
 
#define pLmIsConstantComp(p)
 like above, except that p must be != NULL
 
#define pLmIsConstant(p)
 
#define pIsConstantPoly(p)
 return TRUE if all monomials of p are constant
 
#define pIsPurePower(p)
 
#define pIsUnivariate(p)
 
#define pIsVector(p)
 
#define pGetVariables(p, e)
 
#define pHasNotCFRing(p1, p2)
 
#define pHasNotCF(p1, p2)
 
#define pSplit(p, r)
 
#define pSetm(p)
 
#define pSetmComp(p)
 TODO:
 
#define pWeight(i)
 
#define pWTotaldegree(p)
 
#define pWDegree(p)
 
#define pSub(a, b)
 
#define pmInit(a, b)
 
#define pMDivide(a, b)
 
#define pDivideM(a, b)
 
#define pLcm(a, b, m)
 
#define pDiff(a, b)
 
#define pDiffOp(a, b, m)
 
#define pMaxComp(p)
 
#define pMinComp(p)
 
#define pOneComp(p)
 
#define pSetCompP(a, i)
 
#define pISet(i)
 
#define pNSet(n)
 
#define pOne()
 
#define pNormalize(p)
 
#define pSize(p)
 
#define pHomogen(p, varnum)
 homogenizes p by multiplying certain powers of the varnum-th variable
 
#define pIsHomogen(p)
 
#define pVectorHasUnitB(p, k)
 
#define pVectorHasUnit(p, k, l)
 
#define pDeleteComp(p, k)
 
#define pSubst(p, n, e)
 
#define ppJet(p, m)
 
#define pJet(p, m)
 
#define ppJetW(p, m, iv)
 
#define pJetW(p, m, iv)
 
#define pMinDeg(p, w)
 
#define pSeries(n, p, u, w)
 
#define pDegW(p, w)
 Deprecated: only for compatibility with older code!
 
#define pVar(m)
 
#define pEqualPolys(p1, p2)
 
#define pTest(p)
 
#define pLmTest(p)
 

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)
 
char * pString (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
 

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,
q )
Value:
int p
Definition cfModGcd.cc:4086
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:936
EXTERN_VAR ring currRing
Definition polys.h:18

Definition at line 203 of file polys.h.

◆ pAddExp

#define pAddExp ( p,
i,
v )
Value:
int i
Definition cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
static long p_AddExp(poly p, int v, long ee, ring r)
Definition p_polys.h:606

Definition at line 45 of file polys.h.

◆ pCmp

#define pCmp ( p1,
p2 )
Value:
p_Cmp(p1, p2, currRing)
static int p_Cmp(poly p1, poly p2, ring r)
Definition p_polys.h:1741

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

Definition at line 115 of file polys.h.

◆ pCopy

#define pCopy ( p)
Value:
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:846

return a copy of the poly

Definition at line 185 of file polys.h.

◆ pDecrExp

#define pDecrExp ( p,
i )
Value:
static long p_DecrExp(poly p, int v, ring r)
Definition p_polys.h:598

Definition at line 44 of file polys.h.

◆ pDegW

#define pDegW ( p,
w )
Value:
const CanonicalForm & w
Definition facAbsFact.cc:51
long p_DegW(poly p, const int *w, const ring R)
Definition p_polys.cc:691

Deprecated: only for compatibility with older code!

Definition at line 376 of file polys.h.

◆ pDelete

#define pDelete ( p_ptr)
Value:
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:901

Definition at line 186 of file polys.h.

◆ pDeleteComp

#define pDeleteComp ( p,
k )
Value:
int k
Definition cfEzgcd.cc:99
void p_DeleteComp(poly *p, int k, const ring r)
Definition p_polys.cc:3564

Definition at line 360 of file polys.h.

◆ pDiff

#define pDiff ( a,
b )
Value:
CanonicalForm b
Definition cfModGcd.cc:4111
poly p_Diff(poly a, int k, const ring r)
Definition p_polys.cc:1902

Definition at line 296 of file polys.h.

◆ pDiffOp

#define pDiffOp ( a,
b,
m )
Value:
int m
Definition cfEzgcd.cc:128
poly p_DiffOp(poly a, poly b, BOOLEAN multiply, const ring r)
Definition p_polys.cc:1977

Definition at line 297 of file polys.h.

◆ pDivideM

#define pDivideM ( a,
b )
Value:
poly p_DivideM(poly a, poly b, const ring r)
Definition p_polys.cc:1582

Definition at line 294 of file polys.h.

◆ pDivisibleBy

#define pDivisibleBy ( a,
b )
Value:
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1914

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

◆ pDivisibleByRingCase

#define pDivisibleByRingCase ( f,
g )
Value:
g
Definition cfModGcd.cc:4098
FILE * f
Definition checklibs.c:9
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),...
Definition p_polys.cc:1646

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

◆ pEqualPolys

#define pEqualPolys ( p1,
p2 )
Value:
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition p_polys.cc:4562

Definition at line 399 of file polys.h.

◆ pExpVectorAdd

#define pExpVectorAdd ( p1,
p2 )
Value:
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition p_polys.h:1425

Definition at line 87 of file polys.h.

◆ pExpVectorAddSub

#define pExpVectorAddSub ( p1,
p2,
p3 )
Value:
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition p_polys.h:1470

Definition at line 89 of file polys.h.

◆ pExpVectorCopy

#define pExpVectorCopy ( d_p,
s_p )
Value:
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition p_polys.h:1327

Definition at line 86 of file polys.h.

◆ pExpVectorDiff

#define pExpVectorDiff ( pr,
p1,
p2 )
Value:
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition p_polys.h:1488

Definition at line 91 of file polys.h.

◆ pExpVectorSub

#define pExpVectorSub ( p1,
p2 )
Value:
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition p_polys.h:1454

Definition at line 88 of file polys.h.

◆ pExpVectorSum

#define pExpVectorSum ( pr,
p1,
p2 )
Value:
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition p_polys.h:1439

Definition at line 90 of file polys.h.

◆ pGetComp

#define pGetComp ( p)
Value:
#define __p_GetComp(p, r)
Definition monomials.h:63

Component.

Definition at line 37 of file polys.h.

◆ pGetExp

#define pGetExp ( p,
i )
Value:
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:469

Exponent.

Definition at line 41 of file polys.h.

◆ pGetExpDiff

#define pGetExpDiff ( p1,
p2,
i )
Value:
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition p_polys.h:635

Definition at line 49 of file polys.h.

◆ pGetExpSum

#define pGetExpSum ( p1,
p2,
i )
Value:
static long p_GetExpSum(poly p1, poly p2, int i, ring r)
Definition p_polys.h:629

Definition at line 48 of file polys.h.

◆ pGetExpV

#define pGetExpV ( p,
e )
Value:
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1534

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

◆ pGetOrder

#define pGetOrder ( p)
Value:
static long p_GetOrder(poly p, ring r)
Definition p_polys.h:421

Order.

Definition at line 34 of file polys.h.

◆ pGetShortExpVector

#define pGetShortExpVector ( a)
Value:
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition p_polys.cc:4830

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

Definition at line 152 of file polys.h.

◆ pGetVariables

#define pGetVariables ( p,
e )
Value:
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 p_polys.cc:1268

Definition at line 251 of file polys.h.

◆ pHasNotCF

#define pHasNotCF ( p1,
p2 )
Value:
BOOLEAN p_HasNotCF(poly p1, poly p2, const ring r)
Definition p_polys.cc:1330

Definition at line 263 of file polys.h.

◆ pHasNotCFRing

#define pHasNotCFRing ( p1,
p2 )
Value:
BOOLEAN p_HasNotCFRing(poly p1, poly p2, const ring r)
Definition p_polys.cc:1346

Definition at line 262 of file polys.h.

◆ pHead

#define pHead ( p)
Value:
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:860

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

Definition at line 67 of file polys.h.

◆ pHomogen

#define pHomogen ( p,
varnum )
Value:
poly p_Homogen(poly p, int varnum, const ring r)
Definition p_polys.cc:3274

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

Definition at line 322 of file polys.h.

◆ pIncrExp

#define pIncrExp ( p,
i )
Value:
static long p_IncrExp(poly p, int v, ring r)
Definition p_polys.h:591

Definition at line 43 of file polys.h.

◆ pInit

#define pInit ( )
Value:
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1334

allocates a new monomial and initializes everything to 0

Definition at line 61 of file polys.h.

◆ pIsConstant

#define pIsConstant ( p)
Value:
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition p_polys.h:1978

like above, except that Comp must be 0

Definition at line 238 of file polys.h.

◆ pIsConstantComp

#define pIsConstantComp ( p)
Value:
static BOOLEAN p_IsConstantComp(const poly p, const ring r)
like the respective p_LmIs* routines, except that p might be empty
Definition p_polys.h:1972

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

Definition at line 236 of file polys.h.

◆ pIsConstantPoly

#define pIsConstantPoly ( p)
Value:
static BOOLEAN p_IsConstantPoly(const poly p, const ring r)
Definition p_polys.h:1992

return TRUE if all monomials of p are constant

Definition at line 246 of file polys.h.

◆ pISet

#define pISet ( i)
Value:
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298

Definition at line 312 of file polys.h.

◆ pIsHomogen

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

Definition at line 329 of file polys.h.

◆ pIsPurePower

#define pIsPurePower ( p)
Value:
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition p_polys.cc:1227

Definition at line 248 of file polys.h.

◆ pIsUnit

#define pIsUnit ( p)
Value:
static BOOLEAN p_IsUnit(const poly p, const ring r)
Definition p_polys.h:2005

return true if the Lm is a constant <>0

Definition at line 240 of file polys.h.

◆ pIsUnivariate

#define pIsUnivariate ( p)
Value:
int p_IsUnivariate(poly p, const ring r)
return i, if poly depends only on var(i)
Definition p_polys.cc:1248

Definition at line 249 of file polys.h.

◆ pIsVector

#define pIsVector ( p)
Value:
(pGetComp(p)>0)
#define pGetComp(p)
Component.
Definition polys.h:37

Definition at line 250 of file polys.h.

◆ pJet

#define pJet ( p,
m )
Value:
poly p_Jet(poly p, int m, const ring R)
Definition p_polys.cc:4436

Definition at line 367 of file polys.h.

◆ pJetW

#define pJetW ( p,
m,
iv )
Value:
poly p_JetW(poly p, int m, int *w, const ring R)
Definition p_polys.cc:4480

Definition at line 369 of file polys.h.

◆ pLcm

#define pLcm ( a,
b,
m )
Value:
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition p_polys.cc:1659

Definition at line 295 of file polys.h.

◆ pLmCmp

#define pLmCmp ( p,
q )
Value:
static int p_LmCmp(poly p, poly q, const ring r)
Definition p_polys.h:1594

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

Definition at line 105 of file polys.h.

◆ pLmCmpAction

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

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

Definition at line 108 of file polys.h.

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

◆ pLmDelete

#define pLmDelete ( p)
Value:
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:723

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

Definition at line 76 of file polys.h.

◆ pLmDeleteAndNext

#define pLmDeleteAndNext ( p)
Value:
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:755

like pLmDelete, returns pNext(p)

Definition at line 78 of file polys.h.

◆ pLmDivisibleBy

#define pLmDivisibleBy ( a,
b )
Value:
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1905

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

Definition at line 140 of file polys.h.

◆ pLmDivisibleByNoComp

#define pLmDivisibleByNoComp ( a,
b )
Value:
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition p_polys.h:1891

like pLmDivisibleBy, does not check components

Definition at line 142 of file polys.h.

◆ pLmEqual

#define pLmEqual ( p1,
p2 )
Value:
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition p_polys.cc:4576

Definition at line 111 of file polys.h.

◆ pLmFreeAndNext

#define pLmFreeAndNext ( p)
Value:
static poly p_LmFreeAndNext(poly p, ring)
Definition p_polys.h:711

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

Definition at line 74 of file polys.h.

◆ pLmInit

#define pLmInit ( p)
Value:
static poly p_LmInit(poly p, const ring r)
Definition p_polys.h:1349

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

Definition at line 64 of file polys.h.

◆ pLmIsConstant

#define pLmIsConstant ( p)
Value:
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition p_polys.h:1023

Definition at line 243 of file polys.h.

◆ pLmIsConstantComp

#define pLmIsConstantComp ( p)
Value:
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition p_polys.h:1006

like above, except that p must be != NULL

Definition at line 242 of file polys.h.

◆ pLmRingShortDivisibleBy

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

Definition at line 148 of file polys.h.

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

◆ pLmShortDivisibleBy

#define pLmShortDivisibleBy ( a,
sev_a,
b,
not_sev_b )
Value:
p_LmShortDivisibleBy(a, sev_a, b, not_sev_b, currRing)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition p_polys.h:1924

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

Definition at line 146 of file polys.h.

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

◆ pLmTest

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

Definition at line 415 of file polys.h.

◆ pLtCmp

#define pLtCmp ( p,
q )
Value:
static int p_LtCmp(poly p, poly q, const ring r)
Definition p_polys.h:1635

Definition at line 123 of file polys.h.

◆ pLtCmpNoAbs

#define pLtCmpNoAbs ( p,
q )
Value:
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
Definition p_polys.h:1661

Definition at line 124 of file polys.h.

◆ pLtCmpOrdSgnDiffM

#define pLtCmpOrdSgnDiffM ( p,
q )
Value:
static int p_LtCmpOrdSgnDiffM(poly p, poly q, const ring r)
Definition p_polys.h:1683

Definition at line 125 of file polys.h.

◆ pLtCmpOrdSgnDiffP

#define pLtCmpOrdSgnDiffP ( p,
q )
Value:
static int p_LtCmpOrdSgnDiffP(poly p, poly q, const ring r)
Definition p_polys.h:1692

Definition at line 126 of file polys.h.

◆ pLtCmpOrdSgnEqM

#define pLtCmpOrdSgnEqM ( p,
q )
Value:
static int p_LtCmpOrdSgnEqM(poly p, poly q, const ring r)
Definition p_polys.h:1708

Definition at line 127 of file polys.h.

◆ pLtCmpOrdSgnEqP

#define pLtCmpOrdSgnEqP ( p,
q )
Value:
static int p_LtCmpOrdSgnEqP(poly p, poly q, const ring r)
Definition p_polys.h:1717

Definition at line 128 of file polys.h.

◆ pMaxComp

#define pMaxComp ( p)
Value:
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:292

Definition at line 299 of file polys.h.

◆ pMDivide

#define pMDivide ( a,
b )
Value:
poly p_MDivide(poly a, poly b, const ring r)
Definition p_polys.cc:1493

Definition at line 293 of file polys.h.

◆ pMinComp

#define pMinComp ( p)
Value:
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:313

Definition at line 300 of file polys.h.

◆ pMinDeg

#define pMinDeg ( p,
w )
Value:
int p_MinDeg(poly p, intvec *w, const ring R)
Definition p_polys.cc:4498

Definition at line 370 of file polys.h.

◆ pmInit

#define pmInit ( a,
b )
Value:
poly p_mInit(const char *st, BOOLEAN &ok, const ring r)
Definition p_polys.cc:1443

Definition at line 289 of file polys.h.

◆ pMinus_mm_Mult_qq

#define pMinus_mm_Mult_qq ( p,
m,
q )
Value:
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)
Definition p_polys.h:1070

Definition at line 205 of file polys.h.

◆ pMult

#define pMult ( p,
q )
Value:
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1118

Definition at line 207 of file polys.h.

◆ pMult_mm

#define pMult_mm ( p,
m )
Value:
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1051

Definition at line 202 of file polys.h.

◆ pMult_nn

#define pMult_nn ( p,
n )
Value:
static poly p_Mult_nn(poly p, number n, const ring r)
Definition p_polys.h:958

Definition at line 200 of file polys.h.

◆ pMultExp

#define pMultExp ( p,
i,
v )
Value:
static long p_MultExp(poly p, int v, long ee, ring r)
Definition p_polys.h:621

Definition at line 47 of file polys.h.

◆ pNeg

#define pNeg ( p)
Value:
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1107

Definition at line 198 of file polys.h.

◆ pNew

#define pNew ( )
Value:
static poly p_New(const ring, omBin bin)
Definition p_polys.h:664

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

Definition at line 59 of file polys.h.

◆ pNormalize

#define pNormalize ( p)
Value:
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3835

Definition at line 317 of file polys.h.

◆ pNSet

#define pNSet ( n)
Value:
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition p_polys.cc:1474

Definition at line 313 of file polys.h.

◆ pOne

#define pOne ( )
Value:
poly p_One(const ring r)
Definition p_polys.cc:1314

Definition at line 315 of file polys.h.

◆ pOneComp

#define pOneComp ( p)
Value:
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition p_polys.cc:1209

Definition at line 302 of file polys.h.

◆ ppJet

#define ppJet ( p,
m )
Value:
poly pp_Jet(poly p, int m, const ring R)
Definition p_polys.cc:4380

Definition at line 366 of file polys.h.

◆ ppJetW

#define ppJetW ( p,
m,
iv )
Value:
poly pp_JetW(poly p, int m, int *w, const ring R)
Definition p_polys.cc:4453

Definition at line 368 of file polys.h.

◆ pPlus_mm_Mult_qq

#define pPlus_mm_Mult_qq ( p,
m,
q )
Value:
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
Definition p_polys.h:1197

Definition at line 206 of file polys.h.

◆ ppMult_Coeff_mm_DivSelect

#define ppMult_Coeff_mm_DivSelect ( p,
m )
Value:
static poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, const ring r)
Definition p_polys.h:1090

Definition at line 210 of file polys.h.

◆ ppMult_mm

#define ppMult_mm ( p,
m )
Value:
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1031

Definition at line 201 of file polys.h.

◆ ppMult_nn

#define ppMult_nn ( p,
n )
Value:
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition p_polys.h:992

Definition at line 199 of file polys.h.

◆ ppMult_qq

#define ppMult_qq ( p,
q )
Value:
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition p_polys.h:1160

Definition at line 208 of file polys.h.

◆ pPower

#define pPower ( p,
q )
Value:
poly p_Power(poly p, int i, const ring r)
Definition p_polys.cc:2201

Definition at line 204 of file polys.h.

◆ pSeries

#define pSeries ( n,
p,
u,
w )
Value:
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition p_polys.cc:4548

Definition at line 371 of file polys.h.

◆ pSetCoeff

#define pSetCoeff ( p,
n )
Value:
static number p_SetCoeff(poly p, number n, ring r)
Definition p_polys.h:412

deletes old coeff before setting the new one

Definition at line 31 of file polys.h.

◆ pSetComp

#define pSetComp ( p,
v )
Value:
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:247

Definition at line 38 of file polys.h.

◆ pSetCompP

#define pSetCompP ( a,
i )
Value:
static void p_SetCompP(poly p, int i, ring r)
Definition p_polys.h:254

Definition at line 303 of file polys.h.

◆ pSetExp

#define pSetExp ( p,
i,
v )
Value:
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:488

Definition at line 42 of file polys.h.

◆ pSetExpV

#define pSetExpV ( p,
e )
Value:
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1558

Definition at line 97 of file polys.h.

◆ pSetm

#define pSetm ( p)
Value:
static void p_Setm(poly p, const ring r)
Definition p_polys.h:233

Definition at line 271 of file polys.h.

◆ pSetmComp

#define pSetmComp ( p)
Value:

TODO:

Definition at line 273 of file polys.h.

◆ pSize

#define pSize ( p)
Value:
int p_Size(poly p, const ring r)
Definition p_polys.cc:3257

Definition at line 318 of file polys.h.

◆ pSort

#define pSort ( p)
Value:
static poly p_SortMerge(poly p, const ring r, BOOLEAN revert=FALSE)
Definition p_polys.h:1243

Definition at line 218 of file polys.h.

◆ pSortAdd

#define pSortAdd ( p)
Value:
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition p_polys.h:1233

sorts p, p may have equal monomials

Definition at line 221 of file polys.h.

◆ pSortCompCorrect

#define pSortCompCorrect ( p)
Value:
#define pSort(p)
Definition polys.h:218

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

◆ pSortMerger

#define pSortMerger ( p)
Value:

sorts p, assumes all monomials in p are different

Definition at line 217 of file polys.h.

◆ pSplit

#define pSplit ( p,
r )
Value:
void p_Split(poly p, poly *h)
Definition p_polys.cc:1321

Definition at line 265 of file polys.h.

◆ pSub

#define pSub ( a,
b )
Value:
poly p_Sub(poly p1, poly p2, const ring r)
Definition p_polys.cc:1994

Definition at line 287 of file polys.h.

◆ pSubExp

#define pSubExp ( p,
i,
v )
Value:
static long p_SubExp(poly p, int v, long ee, ring r)
Definition p_polys.h:613

Definition at line 46 of file polys.h.

◆ pSubst

#define pSubst ( p,
n,
e )
Value:
poly p_Subst(poly p, int n, poly e, const ring r)
Definition p_polys.cc:3980

Definition at line 365 of file polys.h.

◆ pTest

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

Definition at line 414 of file polys.h.

◆ pVar

#define pVar ( m)
Value:
int p_Var(poly m, const ring r)
Definition p_polys.cc:4706

Definition at line 380 of file polys.h.

◆ pVectorHasUnit

#define pVectorHasUnit ( p,
k,
l )
Value:
int l
Definition cfEzgcd.cc:100
void p_VectorHasUnit(poly p, int *k, int *len, const ring r)
Definition p_polys.cc:3406

Definition at line 333 of file polys.h.

◆ pVectorHasUnitB

#define pVectorHasUnitB ( p,
k )
Value:
BOOLEAN p_VectorHasUnitB(poly p, int *k, const ring r)
Definition p_polys.cc:3383

Definition at line 332 of file polys.h.

◆ pWDegree

#define pWDegree ( p)
Value:
long p_WDegree(poly p, const ring r)
Definition p_polys.cc:715

Definition at line 284 of file polys.h.

◆ pWeight

#define pWeight ( i)
Value:
int p_Weight(int i, const ring r)
Definition p_polys.cc:706

Definition at line 280 of file polys.h.

◆ pWTotaldegree

#define pWTotaldegree ( p)
Value:
long p_WTotaldegree(poly p, const ring r)
Definition p_polys.cc:612

Definition at line 283 of file polys.h.

Typedef Documentation

◆ polyset

typedef poly* polyset

Definition at line 259 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 33 of file polys.cc.

34{
35 assume(q!=NULL);
36 if (q==NULL)
37 {
38 WerrorS("div. by 0");
39 return NULL;
40 }
41 if (p==NULL)
42 {
43 p_Delete(&q,r);
44 return NULL;
45 }
46 if ((pNext(q)!=NULL)||rIsPluralRing(r))
47 { /* This means that q != 0 consists of at least two terms*/
48 if(p_GetComp(p,r)==0)
49 {
50 if((rFieldType(r)==n_transExt)
51 &&(convSingTrP(p,r))
52 &&(convSingTrP(q,r))
53 &&(!rIsNCRing(r)))
54 {
55 poly res=singclap_pdivide(p, q, r);
56 p_Delete(&p,r);
57 p_Delete(&q,r);
58 return res;
59 }
60 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
61 &&(!rField_is_Ring(r))
62 &&(!rIsNCRing(r)))
63 {
64 poly res=singclap_pdivide(p, q, r);
65 p_Delete(&p,r);
66 p_Delete(&q,r);
67 return res;
68 }
69 else
70 {
71 ideal vi=idInit(1,1); vi->m[0]=q;
72 ideal ui=idInit(1,1); ui->m[0]=p;
73 ideal R; matrix U;
74 ring save_ring=currRing;
75 if (r!=currRing) rChangeCurrRing(r);
76 int save_opt;
77 SI_SAVE_OPT1(save_opt);
79 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
80 SI_RESTORE_OPT1(save_opt);
81 if (r!=save_ring) rChangeCurrRing(save_ring);
82 p=m->m[0]; m->m[0]=NULL;
83 id_Delete(&m,r);
84 p_SetCompP(p,0,r);
85 id_Delete((ideal *)&U,r);
86 id_Delete(&R,r);
87 //vi->m[0]=NULL; ui->m[0]=NULL;
88 id_Delete(&vi,r);
89 id_Delete(&ui,r);
90 return p;
91 }
92 }
93 else
94 {
95 int comps=p_MaxComp(p,r);
96 ideal I=idInit(comps,1);
97 poly h;
98 int i;
99 // conversion to a list of polys:
100 while (p!=NULL)
101 {
102 i=p_GetComp(p,r)-1;
103 h=pNext(p);
104 pNext(p)=NULL;
105 p_SetComp(p,0,r);
106 I->m[i]=p_Add_q(I->m[i],p,r);
107 p=h;
108 }
109 // division and conversion to vector:
110 h=NULL;
111 p=NULL;
112 for(i=comps-1;i>=0;i--)
113 {
114 if (I->m[i]!=NULL)
115 {
116 if((rFieldType(r)==n_transExt)
117 &&(convSingTrP(I->m[i],r))
118 &&(convSingTrP(q,r))
119 &&(!rIsNCRing(r)))
120 {
121 h=singclap_pdivide(I->m[i],q,r);
122 }
123 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
124 &&(!rField_is_Ring(r))
125 &&(!rIsNCRing(r)))
126 h=singclap_pdivide(I->m[i],q,r);
127 else
128 {
129 ideal vi=idInit(1,1); vi->m[0]=q;
130 ideal ui=idInit(1,1); ui->m[0]=I->m[i];
131 ideal R; matrix U;
132 ring save_ring=currRing;
133 if (r!=currRing) rChangeCurrRing(r);
134 int save_opt;
135 SI_SAVE_OPT1(save_opt);
136 si_opt_1 &= ~(Sy_bit(OPT_PROT));
137 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
138 SI_RESTORE_OPT1(save_opt);
139 if (r!=save_ring) rChangeCurrRing(save_ring);
140 if (idIs0(R))
141 {
143 p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
144 id_Delete((ideal *)&T,r);
145 }
146 else p=NULL;
147 id_Delete((ideal*)&U,r);
148 id_Delete(&R,r);
149 vi->m[0]=NULL; ui->m[0]=NULL;
150 id_Delete(&vi,r);
151 id_Delete(&ui,r);
152 }
153 p_SetCompP(h,i+1,r);
154 p=p_Add_q(p,h,r);
155 }
156 }
157 id_Delete(&I,r);
158 p_Delete(&q,r);
159 return p;
160 }
161 }
162 else
163 { /* This means that q != 0 consists of just one term, or LetterPlace */
164#ifdef HAVE_RINGS
165 if (pNext(q)!=NULL)
166 {
167 WerrorS("division over a coefficient domain only implemented for terms");
168 return NULL;
169 }
170#endif
171 return p_DivideM(p,q,r);
172 }
173 return NULL;
174}
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
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:1105
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:387
#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
void rChangeCurrRing(ring r)
Definition polys.cc:15
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:561
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:426
#define rField_is_Ring(R)
Definition ring.h:490
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)
#define R
Definition sirandom.c:27

◆ p_DivRem()

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

Definition at line 316 of file polys.cc.

317{
318 assume(q!=NULL);
319 rest=NULL;
320 if (q==NULL)
321 {
322 WerrorS("div. by 0");
323 return NULL;
324 }
325 if (p==NULL)
326 {
327 p_Delete(&q,r);
328 return NULL;
329 }
330 if(p_GetComp(p,r)==0)
331 {
332 if((rFieldType(r)==n_transExt)
333 &&(convSingTrP(p,r))
334 &&(convSingTrP(q,r))
335 &&(!rIsNCRing(r)))
336 {
337 poly res=singclap_pdivide(p, q, r);
338 rest=singclap_pmod(p,q,r);
339 p_Delete(&p,r);
340 p_Delete(&q,r);
341 return res;
342 }
343 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
344 &&(!rField_is_Ring(r))
345 &&(!rIsNCRing(r)))
346 {
347 poly res=singclap_pdivide(p, q, r);
348 rest=singclap_pmod(p,q,r);
349 p_Delete(&p,r);
350 p_Delete(&q,r);
351 return res;
352 }
353 else
354 {
355 ideal vi=idInit(1,1); vi->m[0]=q;
356 ideal ui=idInit(1,1); ui->m[0]=p;
357 ideal R; matrix U;
358 ring save_ring=currRing;
359 if (r!=currRing) rChangeCurrRing(r);
360 int save_opt;
361 SI_SAVE_OPT1(save_opt);
362 si_opt_1 &= ~(Sy_bit(OPT_PROT));
363 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
364 SI_RESTORE_OPT1(save_opt);
365 if (r!=save_ring) rChangeCurrRing(save_ring);
366 p=m->m[0]; m->m[0]=NULL;
367 id_Delete(&m,r);
368 p_SetCompP(p,0,r);
369 rest=R->m[0]; R->m[0]=NULL;
370 id_Delete(&R,r);
371 p_SetCompP(rest,0,r);
372 id_Delete((ideal *)&U,r);
373 //vi->m[0]=NULL; ui->m[0]=NULL;
374 id_Delete(&vi,r);
375 id_Delete(&ui,r);
376 return p;
377 }
378 }
379 return NULL;
380}
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
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709

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

406{ int l; return pLast(a, l); }
static poly pLast(poly a, int &length)
returns the length of a polynomial (numbers of monomials) respect syzComp
Definition polys.h:405

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

405{ return p_Last (a, length, currRing); }
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
poly p_Last(const poly p, int &l, const ring r)
Definition p_polys.cc:4671

◆ pLmFree() [1/2]

static void pLmFree ( poly * p)
inlinestatic

like pLmFree, but advances p

Definition at line 72 of file polys.h.

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

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

◆ pNorm()

void pNorm ( poly p)
inline

Definition at line 362 of file polys.h.

362{ p_Norm(p, currRing); }
void p_Norm(poly p1, const ring r)
Definition p_polys.cc:3740

◆ 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 176 of file polys.cc.

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

◆ pSetPolyComp()

void pSetPolyComp ( poly p,
int comp )

◆ pString()

char * pString ( poly p)
inline

Definition at line 306 of file polys.h.

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

◆ pString0()

void pString0 ( poly p)
inline

Definition at line 307 of file polys.h.

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

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

346{
347 return p_TakeOutComp(p, k, R);
348}
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition p_polys.cc:3516

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

339{
340 return p_TakeOutComp(p, comp, q, lq, R);
341}
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition lq.h:40

◆ pTotaldegree()

static long pTotaldegree ( poly p)
inlinestatic

Definition at line 282 of file polys.h.

282{ return p_Totaldegree(p,currRing); }
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1521

◆ pWrite()

void pWrite ( poly p)
inline

Definition at line 308 of file polys.h.

void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342

◆ pWrite0()

void pWrite0 ( poly p)
inline

Definition at line 309 of file polys.h.

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

◆ rChangeCurrRing()

void rChangeCurrRing ( ring r)

Definition at line 15 of file polys.cc.

16{
17 if (currRing!=NULL)
19 //------------ set global ring vars --------------------------------
20 currRing = r;
21 if( r != NULL )
22 {
23 rTest(r);
24 //------------ global variables related to coefficients ------------
25 assume( r->cf!= NULL );
26 nSetChar(r->cf);
27 //------------ global variables related to polys
28 p_SetGlobals(r); // also setting TEST_RINGDEP_OPTS
29 //------------ global variables related to factory -----------------
30 }
31}
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:3432
#define rTest(r)
Definition ring.h:791

◆ 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 382 of file polys.cc.

383{
384 poly res=NULL;
385
386 if (f!=NULL)
387 {
388 //if (r->cf->has_simple_Inverse) p_Norm(f,r);
389 if (rField_is_Zp(r)) p_Norm(f,r);
390 else if (!rField_is_Ring(r)) p_Cleardenom(f, r);
391 }
392 if (g!=NULL)
393 {
394 //if (r->cf->has_simple_Inverse) p_Norm(g,r);
395 if (rField_is_Zp(r)) p_Norm(g,r);
396 else if (!rField_is_Ring(r)) p_Cleardenom(g, r);
397 }
398 else return f; // g==0 => gcd=f (but do a p_Cleardenom/pNorm)
399 if (f==NULL) return g; // f==0 => gcd=g (but do a p_Cleardenom/pNorm)
400 if(!rField_is_Ring(r)
401 && (p_IsConstant(f,r)
402 ||p_IsConstant(g,r)))
403 {
404 res=p_One(r);
405 }
406 else if (r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
407 {
409 }
410 else
411 {
412 ideal I=idInit(2,1);
413 I->m[0]=f;
414 I->m[1]=p_Copy(g,r);
415 intvec *w=NULL;
416 ring save_ring=currRing;
417 if (r!=currRing) rChangeCurrRing(r);
418 int save_opt;
419 SI_SAVE_OPT1(save_opt);
420 si_opt_1 &= ~(Sy_bit(OPT_PROT));
421 ideal S1=idSyzygies(I,testHomog,&w);
422 if (w!=NULL) delete w;
423 // expect S1->m[0]=(-g/gcd,f/gcd)
424 if (IDELEMS(S1)!=1) WarnS("error in syzygy computation for GCD");
425 int lp;
426 p_TakeOutComp(&S1->m[0],1,&res,&lp,r);
427 p_Delete(&S1->m[0],r);
428 // GCD is g divided iby (-g/gcd):
429 res=p_Divide(g,res,r);
430 // restore, r, opt:
431 SI_RESTORE_OPT1(save_opt);
432 if (r!=save_ring) rChangeCurrRing(save_ring);
433 // clean the result
435 if (nCoeff_is_Ring(r->cf)) p_Content(res,r);
436 return res;
437 }
438 p_Delete(&f, r);
439 p_Delete(&g, r);
440 return res;
441}
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
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition ideals.cc:830
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_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:33
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:505
#define IDELEMS(i)
@ testHomog
Definition structs.h:38

◆ wrp()

void wrp ( poly p)
inline

Definition at line 310 of file polys.h.

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

Variable Documentation

◆ currRing

EXTERN_VAR ring currRing

Definition at line 18 of file polys.h.