PolyRing is an abstract class representing rings of polynomials. The polynomials may be (dense) univariate or (sparse) multivariate. Only a few operations are available at this level of abstraction. Use SparsePolyRing or DUPolyRing for more operations on polynomials of known representation.
Currently there are two functions to create a polynomial ring:
NewPolyRing(CoeffRing, NumIndets) NewPolyRing(CoeffRing, NumIndets, IndetName)
- CoeffRing is the ring of coefficients (must be commutative),
- NumIndets specifies how many indeterminates there are; by default
the indet names will be x[0],..x[NumIndets-1], and the ordering is
StdDegRevLex -- see PPOrdering
.
- If the third parameter is
specified then it is used in place of "x" in the indet names; we
advise you to restrict to names comprising only letters (to be sure
of future compatibility).
Let P be an object of type [PolyRing]. Let R be an object of type [ring].
NumIndets(P) -- the number of indeterminates in P. CoeffRing(P) -- the ring of coefficients of P. IsPolyRing(R) -- returns true if the CoCoA::ring R is indeed a PolyRing. AsPolyRing(R) -- returns a PolyRing refering to the ring underlying R. indets(P) -- a const std::vector of RingElems whose i-th element is the i-th indeterminate in P. indet(P,i) -- the i-th indet of P as a RingElem. IndetPower(P,i,n) -- the n-th power of the i-th indet of P as a RingElem. CoeffEmbeddingHom(P)-- the homomorphism which embeds CoeffRing(P) into P
In addition to the standard ring operations, elements of a PolyRing may used in other functions. Let P denote a polynomial ring. Let f denote a non-const element of P. Let f1, f2 denote const elements of P.
owner(f1) -- the owner of f as a ring; NB to get the owner as a PolyRing use AsPolyRing(owner(f1)). NumTerms(f1) -- the number of terms in f1. StdDeg(f1) -- the standard degree of f1 (deg(x[i])=1); error if f1 is 0. deg(f1) -- same as StdDeg(f1). MaxExponent(f1, var) -- maximum exponent of var-th indet in f1 where var is the index of the indet in P (result is of type long). LC(f1) -- the leading coeff of f1; it is an element of CoeffRing(P). content(f1) -- gcd of the coeffs of f1; it is an element of CoeffRing(P). [content of zero poly is zero; if coeffs are in a field the content is 0 or 1] deriv(f1, var) -- formal derivative of f1 wrt. indet having index var. deriv(f1, t) -- ??? IsMonomial(f); -- true iff f is non zero and of the form coeff*pp IsConstant(f); -- true iff f is "constant", i.e. the image of an element of the coeff ring. IsIndet(f); -- equivalent to f == x[i] for some index i IsIndet(index, f); -- equivalent to f == x[i]; and sets index = i IsIrred(f) -- true iff f is irreducible in P
NOTE: to compute the "weighted degree" of a polynomial use the function [wdeg] defined for elements of a [SparsePolyRing].
The hard part has been deciding which member functions should be in [PolyRingBase] and which should be in less abstract classes. If you want to modify the code here, you should probably also look at SparsePolyRing and DUPolyRing... before messing with the code!
The implementations in PolyRing.C are all very simple: they just conduct some sanity checks on the function arguments before passing them to the PolyRing member function which will actually do the work.
What precisely should the "fancy" version of deriv do? What are permitted values for the second arg? Must coeff=1? What if the second arg does not have precisely one term?
The range of member functions on RawValues is rather a hotch-potch. Hopefully, experience and use of the code will bring some better order to the chaos.
Verify the true need for myRemoveBigContent, myMulByCoeff, myDivByCoeff. If the coeff ring has zero divisors then myMulByCoeff could change the structure of the poly!
Maintainer doc is largely absent.