Package cc.redberry.rings.poly.multivar
Class MultivariatePolynomial<E>
- java.lang.Object
-
- cc.redberry.rings.poly.multivar.AMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
- cc.redberry.rings.poly.multivar.MultivariatePolynomial<E>
-
- All Implemented Interfaces:
Stringifiable<MultivariatePolynomial<E>>
,IPolynomial<MultivariatePolynomial<E>>
,Serializable
,Comparable<MultivariatePolynomial<E>>
,Iterable<Monomial<E>>
public final class MultivariatePolynomial<E> extends AMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultivariatePolynomial.HornerForm<E>
A representation of multivariate polynomial specifically optimized for fast evaluation of given variablesstatic class
MultivariatePolynomial.PrecomputedPowersHolder<E>
holds an array of precomputed powers-
Nested classes/interfaces inherited from class cc.redberry.rings.poly.multivar.AMultivariatePolynomial
AMultivariatePolynomial.PolynomialCollector<Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>>
-
-
Field Summary
-
Fields inherited from class cc.redberry.rings.poly.multivar.AMultivariatePolynomial
monomialAlgebra, nVariables, ordering
-
-
Method Summary
Modifier and Type Method Description MultivariatePolynomial<E>
add(E oth)
Addsoth
to this polynomialstatic <E> MultivariatePolynomial<E>
asMultivariate(UnivariatePolynomial<E> poly, int nVariables, int variable, Comparator<DegreeVector> ordering)
Converts univariate polynomial to multivariate.static <E> MultivariatePolynomial<E>
asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomial<E>> poly)
Converts multivariate polynomial over multivariate polynomial ring to a multivariate polynomial over coefficient ringstatic <E> MultivariatePolynomial<E>
asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomial<E>> poly, int[] coefficientVariables, int[] mainVariables)
Converts multivariate polynomial over multivariate polynomial ring to a multivariate polynomial over coefficient ringstatic <E> MultivariatePolynomial<E>
asNormalMultivariate(MultivariatePolynomial<UnivariatePolynomial<E>> poly, int variable)
Converts multivariate polynomial over univariate polynomial ring (R[variable][other_variables]) to a multivariate polynomial over coefficient ring (R[variables])MultivariatePolynomial<MultivariatePolynomial<E>>
asOverMultivariate(int... variables)
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials overvariables
that is polynomial in R[variables][other_variables]MultivariatePolynomial<MultivariatePolynomial<E>>
asOverMultivariateEliminate(int[] variables, Comparator<DegreeVector> ordering)
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials overvariables
that is polynomial in R[variables][other_variables]MultivariatePolynomial<UnivariatePolynomial<E>>
asOverUnivariate(int variable)
Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariable
MultivariatePolynomial<UnivariatePolynomial<E>>
asOverUnivariateEliminate(int variable)
Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariable
, the resulting polynomial have (nVariable - 1) multivariate variables (specifiedvariable
is eliminated)static MultivariatePolynomialZp64
asOverZp64(MultivariatePolynomial<BigInteger> poly)
Converts multivariate polynomial over BigIntegers to multivariate polynomial over machine modular integersstatic MultivariatePolynomialZp64
asOverZp64(MultivariatePolynomial<BigInteger> poly, IntegersZp64 ring)
Converts multivariate polynomial over BigIntegers to multivariate polynomial over machine modular integersstatic MultivariatePolynomial<BigInteger>
asPolyZ(MultivariatePolynomial<BigInteger> poly, boolean copy)
Returns Z[X] polynomial formed from the coefficients of the poly.static MultivariatePolynomial<BigInteger>
asPolyZSymmetric(MultivariatePolynomial<BigInteger> poly)
Converts Zp[x] polynomial to Z[x] polynomial formed from the coefficients of this represented in symmetric modular form (-modulus/2 <= cfx <= modulus/2
).UnivariatePolynomial<E>
asUnivariate()
Converts this to univariate polynomial or throws exception if conversion is impossible (more than one variable have non zero exponents)E
cc()
Returns the constant coefficient of this polynomial.MultivariatePolynomial<E>
ccAsPoly()
Returns the constant coefficient as a constant polyMultivariatePolynomial<E>
clone()
Deep copy of thisBigInteger
coefficientRingCardinality()
Returns cardinality of the coefficient ring of this polyBigInteger
coefficientRingCharacteristic()
Returns characteristic of the coefficient ring of this polyBigInteger
coefficientRingPerfectPowerBase()
Returnsbase
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finiteBigInteger
coefficientRingPerfectPowerExponent()
Returnsexponent
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finiteString
coefficientRingToString(IStringifier<MultivariatePolynomial<E>> stringifier)
String representation of the coefficient ring of thisIterable<E>
coefficients()
Returns iterable over polynomial coefficientsE[]
coefficientsArray()
Returns array of polynomial coefficientsint
compareTo(MultivariatePolynomial<E> oth)
E
content()
Returns the content of this polynomial.MultivariatePolynomial<E>
contentAsPoly()
Returns the content of this (gcd of coefficients) as a constant polyUnivariatePolynomial<E>
contentUnivariate(int variable)
Gives the content of this considered as R[variable][other_variables]static <E> MultivariatePolynomial<E>
create(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering, Monomial<E>... terms)
Creates multivariate polynomial from a list of monomial termsstatic <E> MultivariatePolynomial<E>
create(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering, Iterable<Monomial<E>> terms)
Creates multivariate polynomial from a list of monomial termsMultivariatePolynomial<E>[]
createArray(int length)
overcome Java generics...MultivariatePolynomial<E>[][]
createArray2d(int length)
overcome Java generics...MultivariatePolynomial<E>[][]
createArray2d(int length1, int length2)
overcome Java generics...MultivariatePolynomial<E>
createConstant(E val)
Creates constant polynomial with specified valueMultivariatePolynomial<E>
createConstantFromTerm(Monomial<E> monomial)
Creates multivariate polynomial over the same ring as this with the single constant element taken from given monomialMultivariatePolynomial<E>
createLinear(int variable, E cc, E lc)
Creates linear polynomial of the formcc + lc * variable
MultivariatePolynomial<E>
createOne()
Returns the new instance of unit polynomial (with the same coefficient ring)MultivariatePolynomial<E>
createZero()
Returns the new instance of zero polynomial (with the same coefficient ring)MultivariatePolynomial<E>
decrement()
Subtracts 1 from thisMultivariatePolynomial<E>
derivative(int variable, int order)
Gives partial derivative of specifiedorder
with respect to specified variable (new instance created)MultivariatePolynomial<E>
divideByLC(MultivariatePolynomial<E> other)
Divides this polynomial by the leading coefficient ofother
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by theother.lc()
.MultivariatePolynomial<E>
divideExact(E factor)
Divides this polynomial by afactor
or throws exception if exact division is not possibleMultivariatePolynomial<E>
divideOrNull(Monomial<E> monomial)
Divides this polynomial by amonomial
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by themonomial
.MultivariatePolynomial<E>
divideOrNull(E factor)
Divides this polynomial by afactor
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by thefactor
.MultivariatePolynomial<E>
eliminate(int[] variables, E[] values)
Returns a copy of this withvalues
substituted forvariables
MultivariatePolynomial<E>
eliminate(int variable, long value)
Substitutesvalue
forvariable
and eliminatesvariable
from the list of variables so that the resulting polynomial hasresult.nVariables = this.nVariables - 1
.MultivariatePolynomial<E>
eliminate(int variable, E value)
Substitutesvalue
forvariable
and eliminatesvariable
from the list of variables so that the resulting polynomial hasresult.nVariables = this.nVariables - 1
.MultivariatePolynomial<E>
evaluate(int[] variables, E[] values)
Returns a copy of this withvalues
substituted forvariables
.MultivariatePolynomial<E>
evaluate(int variable, long value)
Returns a copy of this withvalue
substituted forvariable
.MultivariatePolynomial<E>
evaluate(int variable, E value)
Returns a copy of this withvalue
substituted forvariable
.MultivariatePolynomial<E>[]
evaluate(int variable, E... values)
Evaluates this polynomial at specified pointsE
evaluate(E... values)
Evaluates this polynomial at specified pointsMultivariatePolynomial<E>
evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Evaluatespoly
at random pointMultivariatePolynomial<E>
evaluateAtRandomPreservingSkeleton(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Evaluatespoly
at random point chosen in such way that the skeleton of evaluated version is the same as of the originalpoly
with respect to all exceptvariable
variablesstatic <E> E
evaluateDenseRecursiveForm(UnivariatePolynomial recForm, int nVariables, E[] values)
Evaluates polynomial given in a dense recursive form at a given pointsstatic <E> E
evaluateSparseRecursiveForm(AMultivariatePolynomial recForm, int nVariables, E[] values)
Evaluates polynomial given in a sparse recursive form at a given pointsstatic <E> MultivariatePolynomial<E>
fromDenseRecursiveForm(UnivariatePolynomial recForm, int nVariables, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.static <E> MultivariatePolynomial<E>
fromSparseRecursiveForm(AMultivariatePolynomial recForm, int nVariables, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.MultivariatePolynomial.HornerForm
getHornerForm(int[] evaluationVariables)
Gives data structure for fast Horner-like sparse evaluation of this multivariate polynomialMultivariatePolynomial<E>
increment()
Adds 1 to thisboolean
isConstant()
Returnstrue
if this polynomial has only constant termboolean
isMonic()
Returnstrue
if this polynomial is monicboolean
isOne()
Returnstrue
if this is oneboolean
isOverField()
Returns whether the coefficient ring of this polynomial is a fieldboolean
isOverFiniteField()
Returns whether the coefficient ring of this polynomial is a finite fieldboolean
isOverPerfectPower()
Returns whether thecoefficientRingCardinality()
is a perfect powerboolean
isOverZ()
Returns whether the coefficient ring of this polynomial is Zboolean
isUnitCC()
Returns true if constant term is equal to oneE
lc()
Returns the leading coefficient of this polynomial that is coefficient of the largest term according to the ordering.E
lc(Comparator<DegreeVector> ordering)
Returns the leading coefficient of this polynomial with respect to specified orderingMultivariatePolynomial<E>
lcAsPoly()
Returns the leading coefficient as a constant polyMultivariatePolynomial<E>
lcAsPoly(Comparator<DegreeVector> ordering)
Returns the leading coefficient with respect to specified ordering as a constant polyMultivariatePolynomialZp64
mapCoefficients(IntegersZp64 newDomain, ToLongFunction<E> mapper)
Maps coefficients of this using specified mapping function<T> MultivariatePolynomial<T>
mapCoefficients(Ring<T> newRing, Function<E,T> mapper)
Maps coefficients of this using specified mapping function<T> MultivariatePolynomial<T>
mapCoefficientsAsPolys(Ring<T> ring, Function<MultivariatePolynomial<E>,T> mapper)
<T> MultivariatePolynomial<T>
mapTerms(Ring<T> newRing, Function<Monomial<E>,Monomial<T>> mapper)
Maps terms of this using specified mapping functionE
maxAbsCoefficient()
Returns max absolute coefficientMultivariatePolynomial.PrecomputedPowersHolder<E>
mkPrecomputedPowers(int[] variables, E[] values)
static <E> MultivariatePolynomial.PrecomputedPowersHolder<E>
mkPrecomputedPowers(int nVariables, Ring<E> ring, int[] variables, E[] values)
MultivariatePolynomial.PrecomputedPowersHolder<E>
mkPrecomputedPowers(int variable, E value)
MultivariatePolynomial.PrecomputedPowersHolder<E>
mkPrecomputedPowers(E[] values)
MultivariatePolynomial<E>
monic()
Makes this polynomial monic if possible, if not -- destroys this and returns nullMultivariatePolynomial<E>
monic(E factor)
Setsthis
to its monic part multiplied by thefactor
modulomodulus
(that ismonic(modulus).multiply(factor)
).MultivariatePolynomial<E>
monic(Comparator<DegreeVector> ordering)
Make this poly monic considering leading term with respect to given orderingMultivariatePolynomial<E>
monic(Comparator<DegreeVector> ordering, E factor)
Setsthis
to its monic part (with respect to given ordering) multiplied by the given factor;MultivariatePolynomial<E>
monicWithLC(MultivariatePolynomial<E> other)
Setsthis
to its monic part multiplied by the leading coefficient ofother
;MultivariatePolynomial<E>
monicWithLC(Comparator<DegreeVector> ordering, MultivariatePolynomial<E> other)
Setsthis
to its monic part multiplied by the leading coefficient ofother
with respect to given orderingMultivariatePolynomial<E>
multiply(long factor)
Multiplies this byfactor
MultivariatePolynomial<E>
multiply(Monomial<E> monomial)
Multipliesthis
by themonomial
MultivariatePolynomial<E>
multiply(MultivariatePolynomial<E> oth)
Multiplies this byoth
MultivariatePolynomial<E>
multiply(E factor)
Multipliesthis
by thefactor
MultivariatePolynomial<E>
multiplyByBigInteger(BigInteger factor)
Multiplies this byfactor
MultivariatePolynomial<E>
multiplyByLC(MultivariatePolynomial<E> other)
Multiply this by the leading coefficient ofother
static <E> MultivariatePolynomial<E>
one(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering)
Creates unit polynomial.static MultivariatePolynomial<BigInteger>
parse(String string)
Deprecated.use #parse(string, ring, ordering, variables)static <E> MultivariatePolynomial<E>
parse(String string, Ring<E> ring)
Deprecated.use #parse(string, ring, ordering, variables)static <E> MultivariatePolynomial<E>
parse(String string, Ring<E> ring, String... variables)
Parse multivariate polynomial from string.static <E> MultivariatePolynomial<E>
parse(String string, Ring<E> ring, Comparator<DegreeVector> ordering)
Deprecated.use #parse(string, ring, ordering, variables)static <E> MultivariatePolynomial<E>
parse(String string, Ring<E> ring, Comparator<DegreeVector> ordering, String... variables)
Parse multivariate polynomial from string.static MultivariatePolynomial<BigInteger>
parse(String string, String... variables)
Parse multivariate Z[X] polynomial from string.static MultivariatePolynomial<BigInteger>
parse(String string, Comparator<DegreeVector> ordering)
Deprecated.use #parse(string, ring, ordering, variables)static MultivariatePolynomial<BigInteger>
parse(String string, Comparator<DegreeVector> ordering, String... variables)
Parse multivariate Z[X] polynomial from string.MultivariatePolynomial<E>
parsePoly(String string)
Deprecated.MultivariatePolynomial<E>
primitivePart()
Reduces poly to its primitive part (primitive part will always have positive l.c.)MultivariatePolynomial<E>
primitivePart(int variable)
Gives primitive part of this considered as R[variable][other_variables]MultivariatePolynomial<E>
primitivePartSameSign()
Reduces poly to its primitive part, so that primitive part will have the same signum as the initial polyprotected void
release()
release cachesboolean
sameCoefficientRingWith(MultivariatePolynomial<E> oth)
Returns whetheroth
andthis
have the same coefficient ringMultivariatePolynomial<E>
seriesCoefficient(int variable, int order)
Gives (unevaluated) coefficient of Taylor series expansion for specified variable that isderivative(poly, variable, order) / order!
, where the derivative is formal derivative and calculated with arithmetic performed in Z ring (to overcome possible zeros in Zp).MultivariatePolynomial<E>
setCoefficientRingFrom(MultivariatePolynomial<E> poly)
Set the coefficient ring from specified polyMultivariatePolynomial<E>
setLC(E val)
Sets the leading coefficient to the specified valueMultivariatePolynomial<E>
setRing(Ring<E> newRing)
Returns a copy of this with coefficient reduced to anewRing
MultivariatePolynomial<E>
setRingUnsafe(Ring<E> newRing)
internal APIMultivariatePolynomial<E>
shift(int[] variables, E[] shifts)
Returns a copy of this withvariables -> variables + shifts
MultivariatePolynomial<E>
shift(int variable, long shift)
Returns a copy of this withvariable -> variable + shift
MultivariatePolynomial<E>
shift(int variable, E shift)
Returns a copy of this withvariable -> variable + shift
int
signumOfLC()
Gives signum of the leading coefficientMultivariatePolynomial<E>
square()
Squaresthis
Stream<E>
stream()
Returns a stream of coefficients of thisMultivariatePolynomial<E>
substitute(int variable, MultivariatePolynomial<E> poly)
Returns a copy of this withpoly
substituted forvariable
.MultivariatePolynomial<E>
subtract(E oth)
Subtractsoth
from this polynomialUnivariatePolynomial
toDenseRecursiveForm()
Gives a recursive univariate representation of this poly.AMultivariatePolynomial
toSparseRecursiveForm()
Gives a recursive sparse univariate representation of this poly.String
toString(IStringifier<MultivariatePolynomial<E>> stringifier)
convert this to string with the use of stringifierstatic <E> MultivariatePolynomial<E>
zero(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering)
Creates zero polynomial.-
Methods inherited from class cc.redberry.rings.poly.multivar.AMultivariatePolynomial
add, add, add, add, ascendingIterator, asMultivariate, asMultivariate, asMultivariate, asOverMultivariateEliminate, asOverPoly, asUnivariate, asUnivariateEliminate, coefficientOf, coefficientOf, collection, composition, composition, composition, composition, composition, composition, content, contentExcept, create, create, create, create, createMonomial, degree, degree, degree, degreeMax, degrees, degrees, degreesRef, degreeSum, derivative, derivative, descendingIterator, divideDegreeVectorOrNull, dropCoefficientOf, dropSelectVariables, dropVariable, dropVariables, ecart, equals, evaluateAtZero, evaluateAtZero, first, getSkeleton, getSkeleton, getSkeletonDrop, getSkeletonExcept, hashCode, homogenize, insertVariable, insertVariable, isEffectiveUnivariate, isHomogeneous, isLinearExactly, isLinearOrConstant, isMonomial, isVariable, isZero, isZeroCC, iterator, joinNewVariable, joinNewVariables, last, lc, lt, lt, ltAsPoly, mapVariables, monomialContent, mt, multidegree, multiplyByDegreeVector, multiplyByMonomial, negate, nUsedVariables, put, renameVariables, renameVariables, renameVariables, sameSkeletonExceptQ, sameSkeletonQ, sameSkeletonQ, set, setAllCoefficientsToUnit, setLC, setNVariables, setOrdering, size, skeletonHashCode, sparsity, sparsity2, subtract, subtract, subtract, subtractLt, swapVariables, toArray, toString, totalDegree, toZero, univariateVariable
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cc.redberry.rings.poly.IPolynomial
add, assertSameCoefficientRingWith, canonical, coefficientRingToString, copy, createArray, createArray, createArray, createConstant, monicExact, multiply, multiply, setCoefficientRingFromOptional, subtract, toPositiveLC, toString
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
create
public static <E> MultivariatePolynomial<E> create(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering, Iterable<Monomial<E>> terms)
Creates multivariate polynomial from a list of monomial terms- Parameters:
ring
- the ringordering
- term orderingterms
- the monomial terms- Returns:
- multivariate polynomial
-
create
public static <E> MultivariatePolynomial<E> create(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering, Monomial<E>... terms)
Creates multivariate polynomial from a list of monomial terms- Parameters:
ring
- the ringordering
- term orderingterms
- the monomial terms- Returns:
- multivariate polynomial
-
zero
public static <E> MultivariatePolynomial<E> zero(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering)
Creates zero polynomial.- Parameters:
nVariables
- number of variablesring
- the ringordering
- the ordering- Returns:
- zero polynomial
-
one
public static <E> MultivariatePolynomial<E> one(int nVariables, Ring<E> ring, Comparator<DegreeVector> ordering)
Creates unit polynomial.- Parameters:
nVariables
- number of variablesring
- the ringordering
- the ordering- Returns:
- unit polynomial
-
parse
public static MultivariatePolynomial<BigInteger> parse(String string, String... variables)
Parse multivariate Z[X] polynomial from string.- Parameters:
string
- the stringvariables
- string variables that should be taken into account. For examples:parse("a", LEX)
andparse("a", LEX, "a", "b")
although give the same mathematical expressions are differ, since the first one is considered as Z[x], while the second as Z[x1,x2]- Returns:
- multivariate Z[X] polynomial
-
parse
@Deprecated public static MultivariatePolynomial<BigInteger> parse(String string)
Deprecated.use #parse(string, ring, ordering, variables)Parse multivariate Z[X] polynomial from string.- Parameters:
string
- the string- Returns:
- multivariate Z[X] polynomial
-
parse
public static <E> MultivariatePolynomial<E> parse(String string, Ring<E> ring, String... variables)
Parse multivariate polynomial from string.- Parameters:
string
- the stringring
- the ringvariables
- string variables that should be taken into account. For examples:parse("a", LEX)
andparse("a", LEX, "a", "b")
although give the same mathematical expressions are differ, since the first one is considered as Z[x], while the second as Z[x1,x2]- Returns:
- multivariate polynomial
-
parse
@Deprecated public static <E> MultivariatePolynomial<E> parse(String string, Ring<E> ring)
Deprecated.use #parse(string, ring, ordering, variables)Parse multivariate polynomial from string.- Parameters:
string
- the stringring
- the ring- Returns:
- multivariate polynomial
-
parse
public static MultivariatePolynomial<BigInteger> parse(String string, Comparator<DegreeVector> ordering, String... variables)
Parse multivariate Z[X] polynomial from string.- Parameters:
string
- the stringordering
- monomial ordervariables
- string variables that should be taken into account. For examples:parse("a", LEX)
andparse("a", LEX, "a", "b")
although give the same mathematical expressions are differ, since the first one is considered as Z[x], while the second as Z[x1,x2]- Returns:
- Z[X] multivariate polynomial
-
parse
@Deprecated public static MultivariatePolynomial<BigInteger> parse(String string, Comparator<DegreeVector> ordering)
Deprecated.use #parse(string, ring, ordering, variables)Parse multivariate Z[X] polynomial from string.- Parameters:
string
- the stringordering
- monomial order- Returns:
- Z[X] multivariate polynomial
-
parse
public static <E> MultivariatePolynomial<E> parse(String string, Ring<E> ring, Comparator<DegreeVector> ordering, String... variables)
Parse multivariate polynomial from string.- Parameters:
string
- the stringring
- the ringordering
- monomial ordervariables
- string variables that should be taken into account. For examples:parse("a", LEX)
andparse("a", LEX, "a", "b")
although give the same mathematical expressions are different, since the first one is considered as Z[a], while the second as Z[a,b]- Returns:
- multivariate polynomial
-
parse
@Deprecated public static <E> MultivariatePolynomial<E> parse(String string, Ring<E> ring, Comparator<DegreeVector> ordering)
Deprecated.use #parse(string, ring, ordering, variables)Parse multivariate polynomial from string.- Parameters:
string
- the stringring
- the ringordering
- monomial order
-
asOverZp64
public static MultivariatePolynomialZp64 asOverZp64(MultivariatePolynomial<BigInteger> poly)
Converts multivariate polynomial over BigIntegers to multivariate polynomial over machine modular integers- Parameters:
poly
- the polynomial- Returns:
- multivariate polynomial over machine sized modular integers
- Throws:
IllegalArgumentException
- if poly.ring is not ZpArithmeticException
- if some of coefficients will not exactly fit in along
.
-
asOverZp64
public static MultivariatePolynomialZp64 asOverZp64(MultivariatePolynomial<BigInteger> poly, IntegersZp64 ring)
Converts multivariate polynomial over BigIntegers to multivariate polynomial over machine modular integers- Parameters:
poly
- the polynomialring
- Zp64 ring- Returns:
- multivariate polynomial over machine sized modular integers
- Throws:
IllegalArgumentException
- if poly.ring is not ZpArithmeticException
- if some of coefficients will not exactly fit in along
.
-
asMultivariate
public static <E> MultivariatePolynomial<E> asMultivariate(UnivariatePolynomial<E> poly, int nVariables, int variable, Comparator<DegreeVector> ordering)
Converts univariate polynomial to multivariate.- Parameters:
poly
- univariate polynomialnVariables
- number of variables in the resultvariable
- variable that will be used as a primary variableordering
- monomial order- Returns:
- multivariate polynomial
-
asUnivariate
public UnivariatePolynomial<E> asUnivariate()
Description copied from class:AMultivariatePolynomial
Converts this to univariate polynomial or throws exception if conversion is impossible (more than one variable have non zero exponents)- Specified by:
asUnivariate
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Returns:
- univariate polynomial
-
asOverUnivariate
public MultivariatePolynomial<UnivariatePolynomial<E>> asOverUnivariate(int variable)
Description copied from class:AMultivariatePolynomial
Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariable
- Specified by:
asOverUnivariate
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variable
- variable- Returns:
- multivariate polynomial with coefficients being univariate polynomials over
variable
-
asOverUnivariateEliminate
public MultivariatePolynomial<UnivariatePolynomial<E>> asOverUnivariateEliminate(int variable)
Description copied from class:AMultivariatePolynomial
Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariable
, the resulting polynomial have (nVariable - 1) multivariate variables (specifiedvariable
is eliminated)- Specified by:
asOverUnivariateEliminate
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variable
- the variable- Returns:
- multivariate polynomial with coefficients being univariate polynomials over
variable
, the resulting polynomial have (nVariable - 1) multivariate variables
-
asOverMultivariate
public MultivariatePolynomial<MultivariatePolynomial<E>> asOverMultivariate(int... variables)
Description copied from class:AMultivariatePolynomial
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials overvariables
that is polynomial in R[variables][other_variables]- Specified by:
asOverMultivariate
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variables
- the variables to separate- Returns:
- multivariate polynomial with coefficients being multivariate polynomials polynomials over
variables
that is polynomial in R[variables][other_variables]
-
asOverMultivariateEliminate
public MultivariatePolynomial<MultivariatePolynomial<E>> asOverMultivariateEliminate(int[] variables, Comparator<DegreeVector> ordering)
Description copied from class:AMultivariatePolynomial
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials overvariables
that is polynomial in R[variables][other_variables]- Specified by:
asOverMultivariateEliminate
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variables
- the variables to separateordering
- monomial order to use for result- Returns:
- multivariate polynomial with coefficients being multivariate polynomials polynomials over
variables
that is polynomial in R[variables][other_variables]
-
asNormalMultivariate
public static <E> MultivariatePolynomial<E> asNormalMultivariate(MultivariatePolynomial<UnivariatePolynomial<E>> poly, int variable)
Converts multivariate polynomial over univariate polynomial ring (R[variable][other_variables]) to a multivariate polynomial over coefficient ring (R[variables])- Parameters:
poly
- the polynomialvariable
- the variable to insert- Returns:
- multivariate polynomial over normal coefficient ring
-
asNormalMultivariate
public static <E> MultivariatePolynomial<E> asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomial<E>> poly)
Converts multivariate polynomial over multivariate polynomial ring to a multivariate polynomial over coefficient ring- Parameters:
poly
- the polynomial- Returns:
- multivariate polynomial over normal coefficient ring
-
asNormalMultivariate
public static <E> MultivariatePolynomial<E> asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomial<E>> poly, int[] coefficientVariables, int[] mainVariables)
Converts multivariate polynomial over multivariate polynomial ring to a multivariate polynomial over coefficient ring- Parameters:
poly
- the polynomial- Returns:
- multivariate polynomial over normal coefficient ring
-
asPolyZ
public static MultivariatePolynomial<BigInteger> asPolyZ(MultivariatePolynomial<BigInteger> poly, boolean copy)
Returns Z[X] polynomial formed from the coefficients of the poly.- Parameters:
poly
- the polynomialcopy
- whether to copy the internal data- Returns:
- Z[X] version of the poly
-
asPolyZSymmetric
public static MultivariatePolynomial<BigInteger> asPolyZSymmetric(MultivariatePolynomial<BigInteger> poly)
Converts Zp[x] polynomial to Z[x] polynomial formed from the coefficients of this represented in symmetric modular form (-modulus/2 <= cfx <= modulus/2
).- Parameters:
poly
- Zp polynomial- Returns:
- Z[x] version of the poly with coefficients represented in symmetric modular form (
-modulus/2 <= cfx <= modulus/2
). - Throws:
IllegalArgumentException
- ispoly.ring
is not aIntegersZp
-
contentAsPoly
public MultivariatePolynomial<E> contentAsPoly()
Description copied from interface:IPolynomial
Returns the content of this (gcd of coefficients) as a constant poly
-
lcAsPoly
public MultivariatePolynomial<E> lcAsPoly()
Description copied from interface:IPolynomial
Returns the leading coefficient as a constant poly
-
lcAsPoly
public MultivariatePolynomial<E> lcAsPoly(Comparator<DegreeVector> ordering)
Description copied from class:AMultivariatePolynomial
Returns the leading coefficient with respect to specified ordering as a constant poly- Specified by:
lcAsPoly
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
ccAsPoly
public MultivariatePolynomial<E> ccAsPoly()
Description copied from interface:IPolynomial
Returns the constant coefficient as a constant poly
-
isOverField
public boolean isOverField()
Description copied from interface:IPolynomial
Returns whether the coefficient ring of this polynomial is a field- Returns:
- whether the coefficient ring of this polynomial is a field
-
isOverFiniteField
public boolean isOverFiniteField()
Description copied from interface:IPolynomial
Returns whether the coefficient ring of this polynomial is a finite field- Returns:
- whether the coefficient ring of this polynomial is a finite field
-
isOverZ
public boolean isOverZ()
Description copied from interface:IPolynomial
Returns whether the coefficient ring of this polynomial is Z- Returns:
- whether the coefficient ring of this polynomial is Z
-
coefficientRingCardinality
public BigInteger coefficientRingCardinality()
Description copied from interface:IPolynomial
Returns cardinality of the coefficient ring of this poly- Returns:
- cardinality of the coefficient ring
-
coefficientRingCharacteristic
public BigInteger coefficientRingCharacteristic()
Description copied from interface:IPolynomial
Returns characteristic of the coefficient ring of this poly- Returns:
- characteristic of the coefficient ring
-
isOverPerfectPower
public boolean isOverPerfectPower()
Description copied from interface:IPolynomial
Returns whether thecoefficientRingCardinality()
is a perfect power- Returns:
- whether the
coefficientRingCardinality()
is a perfect power
-
coefficientRingPerfectPowerBase
public BigInteger coefficientRingPerfectPowerBase()
Description copied from interface:IPolynomial
Returnsbase
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite- Returns:
base
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite
-
coefficientRingPerfectPowerExponent
public BigInteger coefficientRingPerfectPowerExponent()
Description copied from interface:IPolynomial
Returnsexponent
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite- Returns:
exponent
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite
-
createArray
public MultivariatePolynomial<E>[] createArray(int length)
Description copied from interface:IPolynomial
overcome Java generics...
-
createArray2d
public MultivariatePolynomial<E>[][] createArray2d(int length)
Description copied from interface:IPolynomial
overcome Java generics...
-
createArray2d
public MultivariatePolynomial<E>[][] createArray2d(int length1, int length2)
Description copied from interface:IPolynomial
overcome Java generics...
-
sameCoefficientRingWith
public boolean sameCoefficientRingWith(MultivariatePolynomial<E> oth)
Description copied from interface:IPolynomial
Returns whetheroth
andthis
have the same coefficient ring- Parameters:
oth
- other polynomial- Returns:
- whether this and oth are over the same coefficient ring
-
setCoefficientRingFrom
public MultivariatePolynomial<E> setCoefficientRingFrom(MultivariatePolynomial<E> poly)
Description copied from interface:IPolynomial
Set the coefficient ring from specified poly- Parameters:
poly
- the polynomial- Returns:
- a copy of this with the coefficient ring taken from
poly
-
release
protected void release()
release caches- Overrides:
release
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
setRing
public MultivariatePolynomial<E> setRing(Ring<E> newRing)
Returns a copy of this with coefficient reduced to anewRing
- Parameters:
newRing
- the new ring- Returns:
- a copy of this reduced to the ring specified by
newRing
-
setRingUnsafe
public MultivariatePolynomial<E> setRingUnsafe(Ring<E> newRing)
internal API
-
createConstant
public MultivariatePolynomial<E> createConstant(E val)
Creates constant polynomial with specified value- Parameters:
val
- value- Returns:
- constant polynomial with specified value
-
createConstantFromTerm
public MultivariatePolynomial<E> createConstantFromTerm(Monomial<E> monomial)
Description copied from class:AMultivariatePolynomial
Creates multivariate polynomial over the same ring as this with the single constant element taken from given monomial- Specified by:
createConstantFromTerm
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
monomial
- the monomial- Returns:
- multivariate polynomial
-
createZero
public MultivariatePolynomial<E> createZero()
Description copied from interface:IPolynomial
Returns the new instance of zero polynomial (with the same coefficient ring)- Returns:
- new instance of 0
-
createOne
public MultivariatePolynomial<E> createOne()
Description copied from interface:IPolynomial
Returns the new instance of unit polynomial (with the same coefficient ring)- Returns:
- new instance of 1
-
createLinear
public final MultivariatePolynomial<E> createLinear(int variable, E cc, E lc)
Creates linear polynomial of the formcc + lc * variable
- Parameters:
variable
- the variablecc
- the constant coefficientlc
- the leading coefficient- Returns:
- linear polynomial
cc + lc * variable
-
isMonic
public boolean isMonic()
Description copied from interface:IPolynomial
Returnstrue
if this polynomial is monic- Returns:
- whether
this
is monic
-
signumOfLC
public int signumOfLC()
Description copied from interface:IPolynomial
Gives signum of the leading coefficient- Returns:
- signum of the leading coefficient
-
isOne
public boolean isOne()
Description copied from interface:IPolynomial
Returnstrue
if this is one- Returns:
- whether
this
is one
-
isUnitCC
public boolean isUnitCC()
Description copied from interface:IPolynomial
Returns true if constant term is equal to one- Returns:
- whether constant term is 1
-
isConstant
public boolean isConstant()
Description copied from interface:IPolynomial
Returnstrue
if this polynomial has only constant term- Returns:
- whether
this
is constant
-
maxAbsCoefficient
public E maxAbsCoefficient()
Returns max absolute coefficient
-
lc
public E lc()
Returns the leading coefficient of this polynomial that is coefficient of the largest term according to the ordering.- Returns:
- leading coefficient of this polynomial
-
lc
public E lc(Comparator<DegreeVector> ordering)
Returns the leading coefficient of this polynomial with respect to specified ordering- Returns:
- leading coefficient of this polynomial with respect to specified ordering
-
setLC
public MultivariatePolynomial<E> setLC(E val)
Sets the leading coefficient to the specified value- Parameters:
val
- new value for the lc- Returns:
- the leading coefficient to the specified value
-
cc
public E cc()
Returns the constant coefficient of this polynomial.- Returns:
- constant coefficient of this polynomial
-
content
public E content()
Returns the content of this polynomial.- Returns:
- content of this polynomial
-
coefficients
public Iterable<E> coefficients()
Returns iterable over polynomial coefficients- Returns:
- iterable over polynomial coefficients
-
coefficientsArray
public E[] coefficientsArray()
Returns array of polynomial coefficients- Returns:
- array of polynomial coefficients
-
primitivePart
public MultivariatePolynomial<E> primitivePart(int variable)
Description copied from class:AMultivariatePolynomial
Gives primitive part of this considered as R[variable][other_variables]- Specified by:
primitivePart
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variable
- the variable- Returns:
- primitive part of this considered as R[variable][other_variables]
-
contentUnivariate
public UnivariatePolynomial<E> contentUnivariate(int variable)
Description copied from class:AMultivariatePolynomial
Gives the content of this considered as R[variable][other_variables]- Specified by:
contentUnivariate
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variable
- the variable- Returns:
- the content of this considered as R[variable][other_variables]
-
primitivePart
public MultivariatePolynomial<E> primitivePart()
Description copied from interface:IPolynomial
Reduces poly to its primitive part (primitive part will always have positive l.c.)- Returns:
- primitive part (poly will be modified)
-
primitivePartSameSign
public MultivariatePolynomial<E> primitivePartSameSign()
Description copied from interface:IPolynomial
Reduces poly to its primitive part, so that primitive part will have the same signum as the initial poly- Returns:
- primitive part (poly will be modified)
-
divideByLC
public MultivariatePolynomial<E> divideByLC(MultivariatePolynomial<E> other)
Description copied from interface:IPolynomial
Divides this polynomial by the leading coefficient ofother
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by theother.lc()
. NOTE: ifnull
is returned, the content ofthis
is destroyed.- Parameters:
other
- the polynomial- Returns:
this
divided by theother.lc()
ornull
if exact division is not possible
-
divideOrNull
public MultivariatePolynomial<E> divideOrNull(E factor)
Divides this polynomial by afactor
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by thefactor
. NOTE: ifnull
is returned, the content ofthis
is destroyed.- Parameters:
factor
- the factor- Returns:
this
divided by thefactor
ornull
-
divideExact
public MultivariatePolynomial<E> divideExact(E factor)
Divides this polynomial by afactor
or throws exception if exact division is not possible- Parameters:
factor
- the factor- Returns:
this
divided by thefactor
- Throws:
ArithmeticException
- if exact division is not possible
-
divideOrNull
public MultivariatePolynomial<E> divideOrNull(Monomial<E> monomial)
Description copied from class:AMultivariatePolynomial
Divides this polynomial by amonomial
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by themonomial
. NOTE: ifnull
is returned, the content ofthis
is destroyed.- Specified by:
divideOrNull
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
monomial
- monomial degrees- Returns:
this
divided by thefactor * monomial
ornull
-
monic
public MultivariatePolynomial<E> monic()
Makes this polynomial monic if possible, if not -- destroys this and returns null- Returns:
- monic this or null if the ring does not support exact division by lc
-
monic
public MultivariatePolynomial<E> monic(Comparator<DegreeVector> ordering)
Description copied from class:AMultivariatePolynomial
Make this poly monic considering leading term with respect to given ordering- Specified by:
monic
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
monic
public MultivariatePolynomial<E> monic(E factor)
Setsthis
to its monic part multiplied by thefactor
modulomodulus
(that ismonic(modulus).multiply(factor)
).- Parameters:
factor
- the factor- Returns:
this
-
monic
public MultivariatePolynomial<E> monic(Comparator<DegreeVector> ordering, E factor)
Setsthis
to its monic part (with respect to given ordering) multiplied by the given factor;
-
monicWithLC
public MultivariatePolynomial<E> monicWithLC(MultivariatePolynomial<E> other)
Description copied from interface:IPolynomial
Setsthis
to its monic part multiplied by the leading coefficient ofother
;- Parameters:
other
- other polynomial- Returns:
- monic part multiplied by the leading coefficient of
other
or null if exact division by the reduced leading coefficient is not possible
-
monicWithLC
public MultivariatePolynomial<E> monicWithLC(Comparator<DegreeVector> ordering, MultivariatePolynomial<E> other)
Description copied from class:AMultivariatePolynomial
Setsthis
to its monic part multiplied by the leading coefficient ofother
with respect to given ordering- Specified by:
monicWithLC
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
toDenseRecursiveForm
public UnivariatePolynomial toDenseRecursiveForm()
Gives a recursive univariate representation of this poly.
-
fromDenseRecursiveForm
public static <E> MultivariatePolynomial<E> fromDenseRecursiveForm(UnivariatePolynomial recForm, int nVariables, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.- Parameters:
recForm
- recursive univariate representationnVariables
- number of variables in multivariate polynomialordering
- monomial order
-
evaluateDenseRecursiveForm
public static <E> E evaluateDenseRecursiveForm(UnivariatePolynomial recForm, int nVariables, E[] values)
Evaluates polynomial given in a dense recursive form at a given points
-
toSparseRecursiveForm
public AMultivariatePolynomial toSparseRecursiveForm()
Gives a recursive sparse univariate representation of this poly.
-
fromSparseRecursiveForm
public static <E> MultivariatePolynomial<E> fromSparseRecursiveForm(AMultivariatePolynomial recForm, int nVariables, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.- Parameters:
recForm
- recursive univariate representationnVariables
- number of variables in multivariate polynomialordering
- monomial order
-
evaluateSparseRecursiveForm
public static <E> E evaluateSparseRecursiveForm(AMultivariatePolynomial recForm, int nVariables, E[] values)
Evaluates polynomial given in a sparse recursive form at a given points
-
getHornerForm
public MultivariatePolynomial.HornerForm getHornerForm(int[] evaluationVariables)
Gives data structure for fast Horner-like sparse evaluation of this multivariate polynomial- Parameters:
evaluationVariables
- variables which will be substituted
-
evaluate
public MultivariatePolynomial<E> evaluate(int variable, E value)
Returns a copy of this withvalue
substituted forvariable
.- Parameters:
variable
- the variablevalue
- the value- Returns:
- a new multivariate polynomial with
value
substituted forvariable
but still with the sameAMultivariatePolynomial.nVariables
(though the effective number of variables isnVariables - 1
, compare toeliminate(int, Object)
) - See Also:
eliminate(int, Object)
-
evaluate
public MultivariatePolynomial<E> evaluate(int[] variables, E[] values)
Returns a copy of this withvalues
substituted forvariables
.- Parameters:
variables
- the variablesvalues
- the values- Returns:
- a new multivariate polynomial with
value
substituted forvariable
but still with the sameAMultivariatePolynomial.nVariables
(though the effective number of variables isnVariables - 1
, compare toeliminate(int, Object)
) - See Also:
eliminate(int, Object)
-
evaluate
public MultivariatePolynomial<E>[] evaluate(int variable, E... values)
Evaluates this polynomial at specified points
-
evaluate
public MultivariatePolynomial<E> evaluate(int variable, long value)
Returns a copy of this withvalue
substituted forvariable
.- Parameters:
variable
- the variablevalue
- the value- Returns:
- a new multivariate polynomial with
value
substituted forvariable
but still with the sameAMultivariatePolynomial.nVariables
(though the effective number of variables isnVariables - 1
, compare toeliminate(int, long)
) - See Also:
eliminate(int, long)
-
eliminate
public MultivariatePolynomial<E> eliminate(int variable, E value)
Substitutesvalue
forvariable
and eliminatesvariable
from the list of variables so that the resulting polynomial hasresult.nVariables = this.nVariables - 1
.- Parameters:
variable
- the variablevalue
- the value- Returns:
- a new multivariate polynomial with
value
substituted forvariable
andnVariables = nVariables - 1
) - See Also:
evaluate(int, Object)
-
eliminate
public MultivariatePolynomial<E> eliminate(int variable, long value)
Substitutesvalue
forvariable
and eliminatesvariable
from the list of variables so that the resulting polynomial hasresult.nVariables = this.nVariables - 1
.- Parameters:
variable
- the variablevalue
- the value- Returns:
- a new multivariate polynomial with
value
substituted forvariable
andnVariables = nVariables - 1
) - See Also:
evaluate(int, long)
-
eliminate
public MultivariatePolynomial<E> eliminate(int[] variables, E[] values)
Returns a copy of this withvalues
substituted forvariables
- Parameters:
variables
- the variablesvalues
- the values- Returns:
- a new multivariate polynomial with
value
substituted forvariable
but still with the sameAMultivariatePolynomial.nVariables
(though the effective number of variables isnVariables - 1
, compare toeliminate(int, long)
)
-
mkPrecomputedPowers
public MultivariatePolynomial.PrecomputedPowersHolder<E> mkPrecomputedPowers(int variable, E value)
-
mkPrecomputedPowers
public MultivariatePolynomial.PrecomputedPowersHolder<E> mkPrecomputedPowers(int[] variables, E[] values)
-
mkPrecomputedPowers
public static <E> MultivariatePolynomial.PrecomputedPowersHolder<E> mkPrecomputedPowers(int nVariables, Ring<E> ring, int[] variables, E[] values)
-
mkPrecomputedPowers
public MultivariatePolynomial.PrecomputedPowersHolder<E> mkPrecomputedPowers(E[] values)
-
substitute
public MultivariatePolynomial<E> substitute(int variable, MultivariatePolynomial<E> poly)
Returns a copy of this withpoly
substituted forvariable
.- Parameters:
variable
- the variablepoly
- the replacement for the variable- Returns:
- a copy of this with
variable -> poly
-
shift
public MultivariatePolynomial<E> shift(int variable, long shift)
Returns a copy of this withvariable -> variable + shift
- Parameters:
variable
- the variableshift
- shift amount- Returns:
- a copy of this with
variable -> variable + shift
-
shift
public MultivariatePolynomial<E> shift(int variable, E shift)
Returns a copy of this withvariable -> variable + shift
- Parameters:
variable
- the variableshift
- shift amount- Returns:
- a copy of this with
variable -> variable + shift
-
shift
public MultivariatePolynomial<E> shift(int[] variables, E[] shifts)
Returns a copy of this withvariables -> variables + shifts
- Parameters:
variables
- the variablesshifts
- the corresponding shifts- Returns:
- a copy of this with
variables -> variables + shifts
-
add
public MultivariatePolynomial<E> add(E oth)
Addsoth
to this polynomial- Parameters:
oth
- other polynomial- Returns:
this + oth
-
subtract
public MultivariatePolynomial<E> subtract(E oth)
Subtractsoth
from this polynomial- Parameters:
oth
- other polynomial- Returns:
this - oth
-
increment
public MultivariatePolynomial<E> increment()
Description copied from interface:IPolynomial
Adds 1 to this- Returns:
this + 1
-
decrement
public MultivariatePolynomial<E> decrement()
Description copied from interface:IPolynomial
Subtracts 1 from this- Returns:
this - 1
-
multiply
public MultivariatePolynomial<E> multiply(E factor)
Multipliesthis
by thefactor
- Parameters:
factor
- the factor- Returns:
- this multiplied by the
factor
-
multiplyByLC
public MultivariatePolynomial<E> multiplyByLC(MultivariatePolynomial<E> other)
Description copied from interface:IPolynomial
Multiply this by the leading coefficient ofother
- Parameters:
other
- polynomial- Returns:
- this * lc(other)
-
multiply
public MultivariatePolynomial<E> multiply(Monomial<E> monomial)
Description copied from class:AMultivariatePolynomial
Multipliesthis
by themonomial
- Specified by:
multiply
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
monomial
- the monomial- Returns:
- this multiplied by the
monomial
-
multiply
public MultivariatePolynomial<E> multiply(long factor)
Description copied from interface:IPolynomial
Multiplies this byfactor
- Parameters:
factor
- the factor- Returns:
this * factor
-
multiplyByBigInteger
public MultivariatePolynomial<E> multiplyByBigInteger(BigInteger factor)
Description copied from interface:IPolynomial
Multiplies this byfactor
- Parameters:
factor
- the factor- Returns:
this * factor
-
multiply
public MultivariatePolynomial<E> multiply(MultivariatePolynomial<E> oth)
Description copied from interface:IPolynomial
Multiplies this byoth
- Parameters:
oth
- the polynomial- Returns:
this * oth
-
square
public MultivariatePolynomial<E> square()
Description copied from interface:IPolynomial
Squaresthis
- Returns:
this * this
-
evaluateAtRandom
public MultivariatePolynomial<E> evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Description copied from class:AMultivariatePolynomial
Evaluatespoly
at random point- Specified by:
evaluateAtRandom
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
evaluateAtRandomPreservingSkeleton
public MultivariatePolynomial<E> evaluateAtRandomPreservingSkeleton(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Description copied from class:AMultivariatePolynomial
Evaluatespoly
at random point chosen in such way that the skeleton of evaluated version is the same as of the originalpoly
with respect to all exceptvariable
variables- Specified by:
evaluateAtRandomPreservingSkeleton
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
derivative
public MultivariatePolynomial<E> derivative(int variable, int order)
Description copied from class:AMultivariatePolynomial
Gives partial derivative of specifiedorder
with respect to specified variable (new instance created)- Specified by:
derivative
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variable
- the variableorder
- derivative order- Returns:
- partial derivative of specified
order
with respect to specified variable
-
seriesCoefficient
public MultivariatePolynomial<E> seriesCoefficient(int variable, int order)
Description copied from class:AMultivariatePolynomial
Gives (unevaluated) coefficient of Taylor series expansion for specified variable that isderivative(poly, variable, order) / order!
, where the derivative is formal derivative and calculated with arithmetic performed in Z ring (to overcome possible zeros in Zp).- Specified by:
seriesCoefficient
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Parameters:
variable
- the variableorder
- derivative order- Returns:
derivative(poly, variable, order) / order!
, where the derivative is formal derivative and calculated with arithmetic performed in Z ring (to overcome possible zeros in Zp)
-
stream
public Stream<E> stream()
Returns a stream of coefficients of this- Returns:
- stream of coefficients
-
mapTerms
public <T> MultivariatePolynomial<T> mapTerms(Ring<T> newRing, Function<Monomial<E>,Monomial<T>> mapper)
Maps terms of this using specified mapping function- Type Parameters:
T
- new element type- Parameters:
newRing
- the new ringmapper
- mapping- Returns:
- a new polynomial with terms obtained by applying mapper to this terms
-
mapCoefficients
public <T> MultivariatePolynomial<T> mapCoefficients(Ring<T> newRing, Function<E,T> mapper)
Maps coefficients of this using specified mapping function- Type Parameters:
T
- new element type- Parameters:
newRing
- the new ringmapper
- mapping- Returns:
- a new polynomial with terms obtained by applying mapper to this terms (only coefficients are changed)
-
mapCoefficients
public MultivariatePolynomialZp64 mapCoefficients(IntegersZp64 newDomain, ToLongFunction<E> mapper)
Maps coefficients of this using specified mapping function- Parameters:
newDomain
- the new ringmapper
- mapping- Returns:
- a new polynomial with terms obtained by applying mapper to this terms (only coefficients are changed)
-
mapCoefficientsAsPolys
public <T> MultivariatePolynomial<T> mapCoefficientsAsPolys(Ring<T> ring, Function<MultivariatePolynomial<E>,T> mapper)
- Specified by:
mapCoefficientsAsPolys
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
compareTo
public int compareTo(MultivariatePolynomial<E> oth)
-
clone
public MultivariatePolynomial<E> clone()
Description copied from interface:IPolynomial
Deep copy of this- Specified by:
clone
in interfaceIPolynomial<E>
- Specified by:
clone
in classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
- Returns:
- deep copy of this
-
parsePoly
@Deprecated public MultivariatePolynomial<E> parsePoly(String string)
Deprecated.
-
toString
public String toString(IStringifier<MultivariatePolynomial<E>> stringifier)
Description copied from interface:Stringifiable
convert this to string with the use of stringifier
-
coefficientRingToString
public String coefficientRingToString(IStringifier<MultivariatePolynomial<E>> stringifier)
Description copied from interface:IPolynomial
String representation of the coefficient ring of this
-
-