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 classMultivariatePolynomial.HornerForm<E>A representation of multivariate polynomial specifically optimized for fast evaluation of given variablesstatic classMultivariatePolynomial.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 Modifier and Type Field Description Ring<E>ringThe coefficient ring-
Fields inherited from class cc.redberry.rings.poly.multivar.AMultivariatePolynomial
monomialAlgebra, nVariables, ordering
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MultivariatePolynomial<E>add(E oth)Addsothto 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 overvariablesthat 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 overvariablesthat is polynomial in R[variables][other_variables]MultivariatePolynomial<UnivariatePolynomial<E>>asOverUnivariate(int variable)Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariableMultivariatePolynomial<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 (specifiedvariableis eliminated)static MultivariatePolynomialZp64asOverZp64(MultivariatePolynomial<BigInteger> poly)Converts multivariate polynomial over BigIntegers to multivariate polynomial over machine modular integersstatic MultivariatePolynomialZp64asOverZp64(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)Ecc()Returns the constant coefficient of this polynomial.MultivariatePolynomial<E>ccAsPoly()Returns the constant coefficient as a constant polyMultivariatePolynomial<E>clone()Deep copy of thisBigIntegercoefficientRingCardinality()Returns cardinality of the coefficient ring of this polyBigIntegercoefficientRingCharacteristic()Returns characteristic of the coefficient ring of this polyBigIntegercoefficientRingPerfectPowerBase()Returnsbaseso thatcoefficientRingCardinality() == base^exponentor null if cardinality is not finiteBigIntegercoefficientRingPerfectPowerExponent()Returnsexponentso thatcoefficientRingCardinality() == base^exponentor null if cardinality is not finiteStringcoefficientRingToString(IStringifier<MultivariatePolynomial<E>> stringifier)String representation of the coefficient ring of thisIterable<E>coefficients()Returns iterable over polynomial coefficientsE[]coefficientsArray()Returns array of polynomial coefficientsintcompareTo(MultivariatePolynomial<E> oth)Econtent()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 * variableMultivariatePolynomial<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 specifiedorderwith respect to specified variable (new instance created)MultivariatePolynomial<E>divideByLC(MultivariatePolynomial<E> other)Divides this polynomial by the leading coefficient ofotheror 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 afactoror throws exception if exact division is not possibleMultivariatePolynomial<E>divideOrNull(Monomial<E> monomial)Divides this polynomial by amonomialor 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 afactoror 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 withvaluessubstituted forvariablesMultivariatePolynomial<E>eliminate(int variable, long value)Substitutesvalueforvariableand eliminatesvariablefrom the list of variables so that the resulting polynomial hasresult.nVariables = this.nVariables - 1.MultivariatePolynomial<E>eliminate(int variable, E value)Substitutesvalueforvariableand eliminatesvariablefrom 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 withvaluessubstituted forvariables.MultivariatePolynomial<E>evaluate(int variable, long value)Returns a copy of this withvaluesubstituted forvariable.MultivariatePolynomial<E>evaluate(int variable, E value)Returns a copy of this withvaluesubstituted forvariable.MultivariatePolynomial<E>[]evaluate(int variable, E... values)Evaluates this polynomial at specified pointsEevaluate(E... values)Evaluates this polynomial at specified pointsMultivariatePolynomial<E>evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)Evaluatespolyat random pointMultivariatePolynomial<E>evaluateAtRandomPreservingSkeleton(int variable, org.apache.commons.math3.random.RandomGenerator rnd)Evaluatespolyat random point chosen in such way that the skeleton of evaluated version is the same as of the originalpolywith respect to all exceptvariablevariablesstatic <E> EevaluateDenseRecursiveForm(UnivariatePolynomial recForm, int nVariables, E[] values)Evaluates polynomial given in a dense recursive form at a given pointsstatic <E> EevaluateSparseRecursiveForm(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.HornerFormgetHornerForm(int[] evaluationVariables)Gives data structure for fast Horner-like sparse evaluation of this multivariate polynomialMultivariatePolynomial<E>increment()Adds 1 to thisbooleanisConstant()Returnstrueif this polynomial has only constant termbooleanisMonic()Returnstrueif this polynomial is monicbooleanisOne()Returnstrueif this is onebooleanisOverField()Returns whether the coefficient ring of this polynomial is a fieldbooleanisOverFiniteField()Returns whether the coefficient ring of this polynomial is a finite fieldbooleanisOverPerfectPower()Returns whether thecoefficientRingCardinality()is a perfect powerbooleanisOverZ()Returns whether the coefficient ring of this polynomial is ZbooleanisUnitCC()Returns true if constant term is equal to oneElc()Returns the leading coefficient of this polynomial that is coefficient of the largest term according to the ordering.Elc(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 polyMultivariatePolynomialZp64mapCoefficients(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 functionEmaxAbsCoefficient()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)Setsthisto its monic part multiplied by thefactormodulomodulus(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)Setsthisto its monic part (with respect to given ordering) multiplied by the given factor;MultivariatePolynomial<E>monicWithLC(MultivariatePolynomial<E> other)Setsthisto its monic part multiplied by the leading coefficient ofother;MultivariatePolynomial<E>monicWithLC(Comparator<DegreeVector> ordering, MultivariatePolynomial<E> other)Setsthisto its monic part multiplied by the leading coefficient ofotherwith respect to given orderingMultivariatePolynomial<E>multiply(long factor)Multiplies this byfactorMultivariatePolynomial<E>multiply(Monomial<E> monomial)Multipliesthisby themonomialMultivariatePolynomial<E>multiply(MultivariatePolynomial<E> oth)Multiplies this byothMultivariatePolynomial<E>multiply(E factor)Multipliesthisby thefactorMultivariatePolynomial<E>multiplyByBigInteger(BigInteger factor)Multiplies this byfactorMultivariatePolynomial<E>multiplyByLC(MultivariatePolynomial<E> other)Multiply this by the leading coefficient ofotherstatic <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 voidrelease()release cachesbooleansameCoefficientRingWith(MultivariatePolynomial<E> oth)Returns whetherothandthishave 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 anewRingMultivariatePolynomial<E>setRingUnsafe(Ring<E> newRing)internal APIMultivariatePolynomial<E>shift(int[] variables, E[] shifts)Returns a copy of this withvariables -> variables + shiftsMultivariatePolynomial<E>shift(int variable, long shift)Returns a copy of this withvariable -> variable + shiftMultivariatePolynomial<E>shift(int variable, E shift)Returns a copy of this withvariable -> variable + shiftintsignumOfLC()Gives signum of the leading coefficientMultivariatePolynomial<E>square()SquaresthisStream<E>stream()Returns a stream of coefficients of thisMultivariatePolynomial<E>substitute(int variable, MultivariatePolynomial<E> poly)Returns a copy of this withpolysubstituted forvariable.MultivariatePolynomial<E>subtract(E oth)Subtractsothfrom this polynomialUnivariatePolynomialtoDenseRecursiveForm()Gives a recursive univariate representation of this poly.AMultivariatePolynomialtoSparseRecursiveForm()Gives a recursive sparse univariate representation of this poly.StringtoString(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:AMultivariatePolynomialConverts this to univariate polynomial or throws exception if conversion is impossible (more than one variable have non zero exponents)- Specified by:
asUnivariatein classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>- Returns:
- univariate polynomial
-
asOverUnivariate
public MultivariatePolynomial<UnivariatePolynomial<E>> asOverUnivariate(int variable)
Description copied from class:AMultivariatePolynomialConverts this to a multivariate polynomial with coefficients being univariate polynomials overvariable- Specified by:
asOverUnivariatein 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:AMultivariatePolynomialConverts this to a multivariate polynomial with coefficients being univariate polynomials overvariable, the resulting polynomial have (nVariable - 1) multivariate variables (specifiedvariableis eliminated)- Specified by:
asOverUnivariateEliminatein 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:AMultivariatePolynomialConverts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials overvariablesthat is polynomial in R[variables][other_variables]- Specified by:
asOverMultivariatein classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>- Parameters:
variables- the variables to separate- Returns:
- multivariate polynomial with coefficients being multivariate polynomials polynomials over
variablesthat is polynomial in R[variables][other_variables]
-
asOverMultivariateEliminate
public MultivariatePolynomial<MultivariatePolynomial<E>> asOverMultivariateEliminate(int[] variables, Comparator<DegreeVector> ordering)
Description copied from class:AMultivariatePolynomialConverts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials overvariablesthat is polynomial in R[variables][other_variables]- Specified by:
asOverMultivariateEliminatein 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
variablesthat 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.ringis not aIntegersZp
-
contentAsPoly
public MultivariatePolynomial<E> contentAsPoly()
Description copied from interface:IPolynomialReturns the content of this (gcd of coefficients) as a constant poly
-
lcAsPoly
public MultivariatePolynomial<E> lcAsPoly()
Description copied from interface:IPolynomialReturns the leading coefficient as a constant poly
-
lcAsPoly
public MultivariatePolynomial<E> lcAsPoly(Comparator<DegreeVector> ordering)
Description copied from class:AMultivariatePolynomialReturns the leading coefficient with respect to specified ordering as a constant poly- Specified by:
lcAsPolyin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
ccAsPoly
public MultivariatePolynomial<E> ccAsPoly()
Description copied from interface:IPolynomialReturns the constant coefficient as a constant poly
-
isOverField
public boolean isOverField()
Description copied from interface:IPolynomialReturns 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:IPolynomialReturns 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:IPolynomialReturns 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:IPolynomialReturns cardinality of the coefficient ring of this poly- Returns:
- cardinality of the coefficient ring
-
coefficientRingCharacteristic
public BigInteger coefficientRingCharacteristic()
Description copied from interface:IPolynomialReturns characteristic of the coefficient ring of this poly- Returns:
- characteristic of the coefficient ring
-
isOverPerfectPower
public boolean isOverPerfectPower()
Description copied from interface:IPolynomialReturns whether thecoefficientRingCardinality()is a perfect power- Returns:
- whether the
coefficientRingCardinality()is a perfect power
-
coefficientRingPerfectPowerBase
public BigInteger coefficientRingPerfectPowerBase()
Description copied from interface:IPolynomialReturnsbaseso thatcoefficientRingCardinality() == base^exponentor null if cardinality is not finite- Returns:
baseso thatcoefficientRingCardinality() == base^exponentor null if cardinality is not finite
-
coefficientRingPerfectPowerExponent
public BigInteger coefficientRingPerfectPowerExponent()
Description copied from interface:IPolynomialReturnsexponentso thatcoefficientRingCardinality() == base^exponentor null if cardinality is not finite- Returns:
exponentso thatcoefficientRingCardinality() == base^exponentor null if cardinality is not finite
-
createArray
public MultivariatePolynomial<E>[] createArray(int length)
Description copied from interface:IPolynomialovercome Java generics...
-
createArray2d
public MultivariatePolynomial<E>[][] createArray2d(int length)
Description copied from interface:IPolynomialovercome Java generics...
-
createArray2d
public MultivariatePolynomial<E>[][] createArray2d(int length1, int length2)
Description copied from interface:IPolynomialovercome Java generics...
-
sameCoefficientRingWith
public boolean sameCoefficientRingWith(MultivariatePolynomial<E> oth)
Description copied from interface:IPolynomialReturns whetherothandthishave 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:IPolynomialSet 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:
releasein 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:AMultivariatePolynomialCreates multivariate polynomial over the same ring as this with the single constant element taken from given monomial- Specified by:
createConstantFromTermin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>- Parameters:
monomial- the monomial- Returns:
- multivariate polynomial
-
createZero
public MultivariatePolynomial<E> createZero()
Description copied from interface:IPolynomialReturns 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:IPolynomialReturns 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:IPolynomialReturnstrueif this polynomial is monic- Returns:
- whether
thisis monic
-
signumOfLC
public int signumOfLC()
Description copied from interface:IPolynomialGives signum of the leading coefficient- Returns:
- signum of the leading coefficient
-
isOne
public boolean isOne()
Description copied from interface:IPolynomialReturnstrueif this is one- Returns:
- whether
thisis one
-
isUnitCC
public boolean isUnitCC()
Description copied from interface:IPolynomialReturns true if constant term is equal to one- Returns:
- whether constant term is 1
-
isConstant
public boolean isConstant()
Description copied from interface:IPolynomialReturnstrueif this polynomial has only constant term- Returns:
- whether
thisis 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:AMultivariatePolynomialGives primitive part of this considered as R[variable][other_variables]- Specified by:
primitivePartin 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:AMultivariatePolynomialGives the content of this considered as R[variable][other_variables]- Specified by:
contentUnivariatein 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:IPolynomialReduces 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:IPolynomialReduces 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:IPolynomialDivides this polynomial by the leading coefficient ofotheror returnsnull(causing loss of internal data) if some of the elements can't be exactly divided by theother.lc(). NOTE: ifnullis returned, the content ofthisis destroyed.- Parameters:
other- the polynomial- Returns:
thisdivided by theother.lc()ornullif exact division is not possible
-
divideOrNull
public MultivariatePolynomial<E> divideOrNull(E factor)
Divides this polynomial by afactoror returnsnull(causing loss of internal data) if some of the elements can't be exactly divided by thefactor. NOTE: ifnullis returned, the content ofthisis destroyed.- Parameters:
factor- the factor- Returns:
thisdivided by thefactorornull
-
divideExact
public MultivariatePolynomial<E> divideExact(E factor)
Divides this polynomial by afactoror throws exception if exact division is not possible- Parameters:
factor- the factor- Returns:
thisdivided by thefactor- Throws:
ArithmeticException- if exact division is not possible
-
divideOrNull
public MultivariatePolynomial<E> divideOrNull(Monomial<E> monomial)
Description copied from class:AMultivariatePolynomialDivides this polynomial by amonomialor returnsnull(causing loss of internal data) if some of the elements can't be exactly divided by themonomial. NOTE: ifnullis returned, the content ofthisis destroyed.- Specified by:
divideOrNullin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>- Parameters:
monomial- monomial degrees- Returns:
thisdivided by thefactor * monomialornull
-
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:AMultivariatePolynomialMake this poly monic considering leading term with respect to given ordering- Specified by:
monicin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
monic
public MultivariatePolynomial<E> monic(E factor)
Setsthisto its monic part multiplied by thefactormodulomodulus(that ismonic(modulus).multiply(factor)).- Parameters:
factor- the factor- Returns:
this
-
monic
public MultivariatePolynomial<E> monic(Comparator<DegreeVector> ordering, E factor)
Setsthisto 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:IPolynomialSetsthisto its monic part multiplied by the leading coefficient ofother;- Parameters:
other- other polynomial- Returns:
- monic part multiplied by the leading coefficient of
otheror 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:AMultivariatePolynomialSetsthisto its monic part multiplied by the leading coefficient ofotherwith respect to given ordering- Specified by:
monicWithLCin 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 withvaluesubstituted forvariable.- Parameters:
variable- the variablevalue- the value- Returns:
- a new multivariate polynomial with
valuesubstituted forvariablebut 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 withvaluessubstituted forvariables.- Parameters:
variables- the variablesvalues- the values- Returns:
- a new multivariate polynomial with
valuesubstituted forvariablebut 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 withvaluesubstituted forvariable.- Parameters:
variable- the variablevalue- the value- Returns:
- a new multivariate polynomial with
valuesubstituted forvariablebut 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)
Substitutesvalueforvariableand eliminatesvariablefrom 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
valuesubstituted forvariableandnVariables = nVariables - 1) - See Also:
evaluate(int, Object)
-
eliminate
public MultivariatePolynomial<E> eliminate(int variable, long value)
Substitutesvalueforvariableand eliminatesvariablefrom 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
valuesubstituted forvariableandnVariables = nVariables - 1) - See Also:
evaluate(int, long)
-
eliminate
public MultivariatePolynomial<E> eliminate(int[] variables, E[] values)
Returns a copy of this withvaluessubstituted forvariables- Parameters:
variables- the variablesvalues- the values- Returns:
- a new multivariate polynomial with
valuesubstituted forvariablebut 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 withpolysubstituted 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)
Addsothto this polynomial- Parameters:
oth- other polynomial- Returns:
this + oth
-
subtract
public MultivariatePolynomial<E> subtract(E oth)
Subtractsothfrom this polynomial- Parameters:
oth- other polynomial- Returns:
this - oth
-
increment
public MultivariatePolynomial<E> increment()
Description copied from interface:IPolynomialAdds 1 to this- Returns:
this + 1
-
decrement
public MultivariatePolynomial<E> decrement()
Description copied from interface:IPolynomialSubtracts 1 from this- Returns:
this - 1
-
multiply
public MultivariatePolynomial<E> multiply(E factor)
Multipliesthisby thefactor- Parameters:
factor- the factor- Returns:
- this multiplied by the
factor
-
multiplyByLC
public MultivariatePolynomial<E> multiplyByLC(MultivariatePolynomial<E> other)
Description copied from interface:IPolynomialMultiply 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:AMultivariatePolynomialMultipliesthisby themonomial- Specified by:
multiplyin 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:IPolynomialMultiplies this byfactor- Parameters:
factor- the factor- Returns:
this * factor
-
multiplyByBigInteger
public MultivariatePolynomial<E> multiplyByBigInteger(BigInteger factor)
Description copied from interface:IPolynomialMultiplies this byfactor- Parameters:
factor- the factor- Returns:
this * factor
-
multiply
public MultivariatePolynomial<E> multiply(MultivariatePolynomial<E> oth)
Description copied from interface:IPolynomialMultiplies this byoth- Parameters:
oth- the polynomial- Returns:
this * oth
-
square
public MultivariatePolynomial<E> square()
Description copied from interface:IPolynomialSquaresthis- Returns:
this * this
-
evaluateAtRandom
public MultivariatePolynomial<E> evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Description copied from class:AMultivariatePolynomialEvaluatespolyat random point- Specified by:
evaluateAtRandomin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
evaluateAtRandomPreservingSkeleton
public MultivariatePolynomial<E> evaluateAtRandomPreservingSkeleton(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Description copied from class:AMultivariatePolynomialEvaluatespolyat random point chosen in such way that the skeleton of evaluated version is the same as of the originalpolywith respect to all exceptvariablevariables- Specified by:
evaluateAtRandomPreservingSkeletonin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
derivative
public MultivariatePolynomial<E> derivative(int variable, int order)
Description copied from class:AMultivariatePolynomialGives partial derivative of specifiedorderwith respect to specified variable (new instance created)- Specified by:
derivativein classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>- Parameters:
variable- the variableorder- derivative order- Returns:
- partial derivative of specified
orderwith respect to specified variable
-
seriesCoefficient
public MultivariatePolynomial<E> seriesCoefficient(int variable, int order)
Description copied from class:AMultivariatePolynomialGives (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:
seriesCoefficientin 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:
mapCoefficientsAsPolysin classAMultivariatePolynomial<Monomial<E>,MultivariatePolynomial<E>>
-
compareTo
public int compareTo(MultivariatePolynomial<E> oth)
-
clone
public MultivariatePolynomial<E> clone()
Description copied from interface:IPolynomialDeep copy of this- Specified by:
clonein interfaceIPolynomial<E>- Specified by:
clonein 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:Stringifiableconvert this to string with the use of stringifier
-
coefficientRingToString
public String coefficientRingToString(IStringifier<MultivariatePolynomial<E>> stringifier)
Description copied from interface:IPolynomialString representation of the coefficient ring of this
-
-