Package cc.redberry.rings.poly.univar
Interface IUnivariatePolynomial<Poly extends IUnivariatePolynomial<Poly>>
-
- Type Parameters:
Poly- the type of polynomial (self type)
- All Superinterfaces:
Comparable<Poly>,IPolynomial<Poly>,Serializable,Stringifiable<Poly>
- All Known Implementing Classes:
UnivariatePolynomial,UnivariatePolynomialZ64,UnivariatePolynomialZp64
public interface IUnivariatePolynomial<Poly extends IUnivariatePolynomial<Poly>> extends IPolynomial<Poly>
Parent interface for univariate polynomials. Dense representation (array of coefficients) is used to hold univariate polynomials. Positional operations treat index so that i-th coefficient corresponds tox^imonomial.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default AMultivariatePolynomialasMultivariate()Convert to multivariate polynomialAMultivariatePolynomialasMultivariate(Comparator<DegreeVector> ordering)Convert to multivariate polynomialPolyclone()Deep copy of thisAMultivariatePolynomialcomposition(AMultivariatePolynomial value)Calculates the composition of this(oth)default Polycomposition(Ring<Poly> ring, Poly value)Calculates the composition of this(oth) (new instance, so the content of this is not changed))Polycomposition(Poly value)Calculates the composition of this(oth) (new instance, so the content of this is not changed))PolycreateMonomial(int degree)Creates new monomialx^degree(with the same coefficient ring)Polyderivative()Returns the formal derivative of this poly (new instance, so the content of this is not changed)voidensureInternalCapacity(int desiredCapacity)ensures that internal storage has enough size to storedesiredCapacityelementsdefault gnu.trove.set.hash.TIntHashSetexponents()Returns a set of exponents of non-zero termsintfirstNonZeroCoefficientPosition()Returns position of the first non-zero coefficient, that is common monomial exponent (e.g.PolygetAsPoly(int i)Returns i-th coefficient of this as a constant polynomialPolygetRange(int from, int to)Creates polynomial formed from the coefficients of this starting fromfrom(inclusive) toto(exclusive)default booleanisLinearExactly()Returns whether this polynomial is linear (i.e.default booleanisLinearOrConstant()Returns whether this polynomial is linear (i.e.booleanisZeroAt(int i)Returns whether i-th coefficient of this is zerodefault booleanisZeroCC()Returns true if constant term is zerodefault <E> UnivariatePolynomial<E>mapCoefficientsAsPolys(Ring<E> ring, Function<Poly,E> mapper)default intnNonZeroTerms()Returns the number of non zero terms in this polyPolyreverse()Reverses the coefficients of thisPolysetAndDestroy(Poly oth)Sets the content of this withothand destroys othPolysetFrom(int indexInThis, Poly poly, int indexInPoly)Sets i-th element of this by j-th element of other polyPolysetZero(int i)Fills i-th element with zeroPolyshiftLeft(int offset)Returns the quotientthis / x^offset, it is polynomial with coefficient list formed by shifting coefficients ofthisto the left byoffset.PolyshiftRight(int offset)Multipliesthisby thex^offset.default intsize()Returns the degree of this polynomialStream<Poly>streamAsPolys()Stream polynomial coefficients as constant polynomialsPolytruncate(int newDegree)Returns the remainderthis rem x^(newDegree + 1), it is polynomial formed by coefficients of this from zero tonewDegree(both inclusive)-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface cc.redberry.rings.poly.IPolynomial
add, add, assertSameCoefficientRingWith, canonical, ccAsPoly, coefficientRingCardinality, coefficientRingCharacteristic, coefficientRingPerfectPowerBase, coefficientRingPerfectPowerExponent, coefficientRingToString, coefficientRingToString, contentAsPoly, copy, createArray, createArray, createArray, createArray, createArray2d, createArray2d, createConstant, createOne, createZero, decrement, degree, divideByLC, increment, isConstant, isMonic, isMonomial, isOne, isOverField, isOverFiniteField, isOverPerfectPower, isOverZ, isUnitCC, isZero, lcAsPoly, monic, monicExact, monicWithLC, multiply, multiply, multiply, multiply, multiplyByBigInteger, multiplyByLC, negate, parsePoly, primitivePart, primitivePartSameSign, sameCoefficientRingWith, set, setCoefficientRingFrom, setCoefficientRingFromOptional, signumOfLC, square, subtract, subtract, toPositiveLC, toString, toZero
-
Methods inherited from interface cc.redberry.rings.io.Stringifiable
toString
-
-
-
-
Method Detail
-
size
default int size()
Returns the degree of this polynomial- Specified by:
sizein interfaceIPolynomial<Poly extends IUnivariatePolynomial<Poly>>- Returns:
- the degree of this polynomial
-
nNonZeroTerms
default int nNonZeroTerms()
Returns the number of non zero terms in this poly
-
isZeroAt
boolean isZeroAt(int i)
Returns whether i-th coefficient of this is zero- Parameters:
i- the position- Returns:
- whether i-th coefficient of this is zero
-
isZeroCC
default boolean isZeroCC()
Description copied from interface:IPolynomialReturns true if constant term is zero- Specified by:
isZeroCCin interfaceIPolynomial<Poly extends IUnivariatePolynomial<Poly>>- Returns:
- whether constant term is zero
-
setZero
Poly setZero(int i)
Fills i-th element with zero- Parameters:
i- position- Returns:
- self
-
setFrom
Poly setFrom(int indexInThis, Poly poly, int indexInPoly)
Sets i-th element of this by j-th element of other poly- Parameters:
indexInThis- index in selfpoly- other polynomialindexInPoly- index in other polynomial- Returns:
- self
-
getAsPoly
Poly getAsPoly(int i)
Returns i-th coefficient of this as a constant polynomial- Parameters:
i- index in this- Returns:
- i-th coefficient of this as a constant polynomial
-
exponents
default gnu.trove.set.hash.TIntHashSet exponents()
Returns a set of exponents of non-zero terms- Returns:
- a set of exponents of non-zero terms
-
firstNonZeroCoefficientPosition
int firstNonZeroCoefficientPosition()
Returns position of the first non-zero coefficient, that is common monomial exponent (e.g. 2 for x^2 + x^3 + ...). In the case of zero polynomial, -1 returned- Returns:
- position of the first non-zero coefficient or -1 if this is zero
-
shiftLeft
Poly shiftLeft(int offset)
Returns the quotientthis / x^offset, it is polynomial with coefficient list formed by shifting coefficients ofthisto the left byoffset.- Parameters:
offset- shift amount- Returns:
- the quotient
this / x^offset
-
shiftRight
Poly shiftRight(int offset)
Multipliesthisby thex^offset.- Parameters:
offset- monomial exponent- Returns:
this * x^offset
-
truncate
Poly truncate(int newDegree)
Returns the remainderthis rem x^(newDegree + 1), it is polynomial formed by coefficients of this from zero tonewDegree(both inclusive)- Parameters:
newDegree- new degree- Returns:
- remainder
this rem x^(newDegree + 1)
-
getRange
Poly getRange(int from, int to)
Creates polynomial formed from the coefficients of this starting fromfrom(inclusive) toto(exclusive)- Parameters:
from- the initial index of the range to be copied, inclusiveto- the final index of the range to be copied, exclusive.- Returns:
- polynomial formed from the range of coefficients of this
-
reverse
Poly reverse()
Reverses the coefficients of this- Returns:
- reversed polynomial
-
createMonomial
Poly createMonomial(int degree)
Creates new monomialx^degree(with the same coefficient ring)- Parameters:
degree- monomial degree- Returns:
- new monomial
coefficient * x^degree
-
derivative
Poly derivative()
Returns the formal derivative of this poly (new instance, so the content of this is not changed)- Returns:
- the formal derivative
-
clone
Poly clone()
Description copied from interface:IPolynomialDeep copy of this- Specified by:
clonein interfaceIPolynomial<Poly extends IUnivariatePolynomial<Poly>>- Returns:
- deep copy of this
-
setAndDestroy
Poly setAndDestroy(Poly oth)
Sets the content of this withothand destroys oth- Parameters:
oth- the polynomial (will be destroyed)- Returns:
- this := oth
-
composition
Poly composition(Poly value)
Calculates the composition of this(oth) (new instance, so the content of this is not changed))- Parameters:
value- polynomial- Returns:
- composition
this(oth)
-
composition
default Poly composition(Ring<Poly> ring, Poly value)
Calculates the composition of this(oth) (new instance, so the content of this is not changed))- Parameters:
value- polynomial- Returns:
- composition
this(oth)
-
mapCoefficientsAsPolys
default <E> UnivariatePolynomial<E> mapCoefficientsAsPolys(Ring<E> ring, Function<Poly,E> mapper)
-
composition
AMultivariatePolynomial composition(AMultivariatePolynomial value)
Calculates the composition of this(oth)- Parameters:
value- polynomial- Returns:
- composition
this(oth)
-
asMultivariate
AMultivariatePolynomial asMultivariate(Comparator<DegreeVector> ordering)
Convert to multivariate polynomial
-
asMultivariate
default AMultivariatePolynomial asMultivariate()
Convert to multivariate polynomial
-
ensureInternalCapacity
void ensureInternalCapacity(int desiredCapacity)
ensures that internal storage has enough size to storedesiredCapacityelements
-
isLinearOrConstant
default boolean isLinearOrConstant()
Description copied from interface:IPolynomialReturns whether this polynomial is linear (i.e. of the forma * X + b)- Specified by:
isLinearOrConstantin interfaceIPolynomial<Poly extends IUnivariatePolynomial<Poly>>
-
isLinearExactly
default boolean isLinearExactly()
Description copied from interface:IPolynomialReturns whether this polynomial is linear (i.e. of the forma * X + bwith nonzeroa)- Specified by:
isLinearExactlyin interfaceIPolynomial<Poly extends IUnivariatePolynomial<Poly>>
-
-