Interface IUnivariatePolynomial<Poly extends IUnivariatePolynomial<Poly>>

• Method Detail

• 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
• 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 self
poly - other polynomial
indexInPoly - 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 quotient this / x^offset, it is polynomial with coefficient list formed by shifting coefficients of this to the left by offset.
Parameters:
offset - shift amount
Returns:
the quotient this / x^offset
• shiftRight

Poly shiftRight​(int offset)
Multiplies this by the x^offset.
Parameters:
offset - monomial exponent
Returns:
this * x^offset
• truncate

Poly truncate​(int newDegree)
Returns the remainder this rem x^(newDegree + 1), it is polynomial formed by coefficients of this from zero to newDegree (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 from from (inclusive) to to (exclusive)
Parameters:
from - the initial index of the range to be copied, inclusive
to - 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 monomial x^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
• setAndDestroy

Poly setAndDestroy​(Poly oth)
Sets the content of this with oth and 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)
• streamAsPolys

Stream<Poly> streamAsPolys()
Stream polynomial coefficients as constant polynomials
• ensureInternalCapacity

void ensureInternalCapacity​(int desiredCapacity)
ensures that internal storage has enough size to store desiredCapacity elements