Package cc.redberry.rings.poly.multivar
Class MultivariatePolynomialZp64
java.lang.Object
cc.redberry.rings.poly.multivar.AMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
cc.redberry.rings.poly.multivar.MultivariatePolynomialZp64
- All Implemented Interfaces:
Stringifiable<MultivariatePolynomialZp64>
,IPolynomial<MultivariatePolynomialZp64>
,Serializable
,Comparable<MultivariatePolynomialZp64>
,Iterable<MonomialZp64>
public final class MultivariatePolynomialZp64 extends AMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
Multivariate polynomial over Zp ring with the modulus in the range (0, 2^62) (see
MachineArithmetic.MAX_SUPPORTED_MODULUS
). For details on polynomial data structure and properties see AMultivariatePolynomial
.- Since:
- 1.0
- See Also:
AMultivariatePolynomial
, Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultivariatePolynomialZp64.HornerFormZp64
A representation of multivariate polynomial specifically optimized for fast evaluation of given variablesstatic class
MultivariatePolynomialZp64.lPrecomputedPowers
cached powers used to save some timestatic class
MultivariatePolynomialZp64.lPrecomputedPowersHolder
holds an array of precomputed powersNested 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 IntegersZp64
ring
The ring.Fields inherited from class cc.redberry.rings.poly.multivar.AMultivariatePolynomial
monomialAlgebra, nVariables, ordering
-
Method Summary
Modifier and Type Method Description MultivariatePolynomialZp64
add(long oth)
Addsoth
to this polynomial and returns itstatic MultivariatePolynomialZp64
asMultivariate(UnivariatePolynomialZp64 poly, int nVariables, int variable, Comparator<DegreeVector> ordering)
Converts univariate polynomial to multivariate.static MultivariatePolynomialZp64
asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomialZp64> poly)
Converts multivariate polynomial over multivariate polynomial ring to a multivariate polynomial over coefficient ringstatic MultivariatePolynomialZp64
asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomialZp64> poly, int[] coefficientVariables, int[] mainVariables)
Converts multivariate polynomial over multivariate polynomial ring to a multivariate polynomial over coefficient ringstatic MultivariatePolynomialZp64
asNormalMultivariate(MultivariatePolynomial<UnivariatePolynomialZp64> poly, int variable)
Converts multivariate polynomial over univariate polynomial ring (Zp[variable][other_variables]) to a multivariate polynomial over coefficient ring (Zp[all_variables])MultivariatePolynomial<MultivariatePolynomialZp64>
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<MultivariatePolynomialZp64>
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<UnivariatePolynomialZp64>
asOverUnivariate(int variable)
Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariable
MultivariatePolynomial<UnivariatePolynomialZp64>
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)MultivariatePolynomial<BigInteger>
asPolyZ()
Returns polynomial over Z formed from the coefficients of thisMultivariatePolynomial<BigInteger>
asPolyZSymmetric()
Returns polynomial over Z formed from the coefficients of this represented in symmetric modular form (-modulus/2 <= cfx <= modulus/2
).UnivariatePolynomialZp64
asUnivariate()
Converts this to univariate polynomial or throws exception if conversion is impossible (more than one variable have non zero exponents)long
cc()
Returns the constant coefficient of this polynomial.MultivariatePolynomialZp64
ccAsPoly()
Returns the constant coefficient as a constant polyMultivariatePolynomialZp64
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<MultivariatePolynomialZp64> stringifier)
String representation of the coefficient ring of thislong[]
coefficients()
Returns array of polynomial coefficientsint
compareTo(MultivariatePolynomialZp64 oth)
long
content()
Returns the content of this polynomial.MultivariatePolynomialZp64
contentAsPoly()
Returns the content of this (gcd of coefficients) as a constant polyUnivariatePolynomialZp64
contentUnivariate(int variable)
Gives the content of this considered as R[variable][other_variables]static MultivariatePolynomialZp64
create(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering, MonomialSet<MonomialZp64> terms)
Creates multivariate polynomial from a set of monomialsstatic MultivariatePolynomialZp64
create(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering, MonomialZp64... terms)
Creates multivariate polynomial from a list of monomial termsstatic MultivariatePolynomialZp64
create(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering, Iterable<MonomialZp64> terms)
Creates multivariate polynomial from a list of monomial termsMultivariatePolynomialZp64[]
createArray(int length)
overcome Java generics...MultivariatePolynomialZp64[][]
createArray2d(int length)
overcome Java generics...MultivariatePolynomialZp64[][]
createArray2d(int length1, int length2)
overcome Java generics...MultivariatePolynomialZp64
createConstant(long val)
Creates constant polynomial with specified valueMultivariatePolynomialZp64
createConstantFromTerm(MonomialZp64 monomial)
Creates multivariate polynomial over the same ring as this with the single constant element taken from given monomialMultivariatePolynomialZp64
createLinear(int variable, long cc, long lc)
Creates linear polynomial of the formcc + lc * variable
MultivariatePolynomialZp64
createOne()
Returns the new instance of unit polynomial (with the same coefficient ring)MultivariatePolynomialZp64
createZero()
Returns the new instance of zero polynomial (with the same coefficient ring)MultivariatePolynomialZp64
decrement()
Subtracts 1 from thisMultivariatePolynomialZp64
derivative(int variable, int order)
Gives partial derivative of specifiedorder
with respect to specified variable (new instance created)MultivariatePolynomialZp64
divide(long factor)
Divides this polynomial by afactor
MultivariatePolynomialZp64
divideByLC(MultivariatePolynomialZp64 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()
.MultivariatePolynomialZp64
divideOrNull(MonomialZp64 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
.MultivariatePolynomialZp64
eliminate(int[] variables, long[] values)
Returns a copy of this withvalues
substituted forvariables
MultivariatePolynomialZp64
eliminate(int variable, long value)
Substitutesvalue
forvariable
and eliminatesvariable
from the list of variables so that the resulting polynomial hasresult.nVariables = this.nVariables - 1
.MultivariatePolynomialZp64
evaluate(int[] variables, long[] values)
Returns a copy of this withvalues
substituted forvariables
MultivariatePolynomialZp64
evaluate(int variable, long value)
Returns a copy of this withvalue
substituted forvariable
MultivariatePolynomialZp64[]
evaluate(int variable, long... values)
Evaluates this polynomial at specified pointslong
evaluate(long... values)
Evaluates this polynomial at specified pointsMultivariatePolynomialZp64
evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
Evaluatespoly
at random pointMultivariatePolynomialZp64
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 long
evaluateDenseRecursiveForm(IUnivariatePolynomial recForm, long[] values)
Evaluates polynomial given in a dense recursive form at a given pointsstatic long
evaluateSparseRecursiveForm(AMultivariatePolynomial recForm, long[] values)
Evaluates polynomial given in a sparse recursive form at a given pointsstatic MultivariatePolynomialZp64
fromDenseRecursiveForm(IUnivariatePolynomial recForm, int nVariables, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.static MultivariatePolynomialZp64
fromDenseRecursiveForm(IUnivariatePolynomial recForm, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.static MultivariatePolynomialZp64
fromSparseRecursiveForm(AMultivariatePolynomial recForm, int nVariables, Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.static MultivariatePolynomialZp64
fromSparseRecursiveForm(AMultivariatePolynomial recForm, Comparator<DegreeVector> ordering)
Converts poly from a sparse recursive univariate representation.MultivariatePolynomialZp64.HornerFormZp64
getHornerForm(int[] evaluationVariables)
Gives data structure for fast Horner-like sparse evaluation of this multivariate polynomialMultivariatePolynomialZp64
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 onelong
lc()
Returns the leading coefficient of this polynomial that is coefficient of the largest term according to the ordering.long
lc(Comparator<DegreeVector> ordering)
Returns the leading coefficient of this polynomial with respect to specified orderingMultivariatePolynomialZp64
lcAsPoly()
Returns the leading coefficient as a constant polyMultivariatePolynomialZp64
lcAsPoly(Comparator<DegreeVector> ordering)
Returns the leading coefficient with respect to specified ordering as a constant poly<T> MultivariatePolynomial<T>
mapCoefficients(Ring<T> newRing, LongFunction<T> mapper)
Maps coefficients of this using specified mapping function<E> MultivariatePolynomial<E>
mapCoefficientsAsPolys(Ring<E> ring, Function<MultivariatePolynomialZp64,E> mapper)
MultivariatePolynomialZp64
mapTerms(IntegersZp64 newRing, Function<MonomialZp64,MonomialZp64> mapper)
Maps terms of this using specified mapping function<T> MultivariatePolynomial<T>
mapTerms(Ring<T> newRing, Function<MonomialZp64,Monomial<T>> mapper)
Maps terms of this using specified mapping functionMultivariatePolynomialZp64.lPrecomputedPowersHolder
mkPrecomputedPowers(int[] variables, long[] values)
MultivariatePolynomialZp64.lPrecomputedPowersHolder
mkPrecomputedPowers(int variable, long value)
static MultivariatePolynomialZp64.lPrecomputedPowersHolder
mkPrecomputedPowers(int nVariables, IntegersZp64 ring, int[] variables, long[] values)
MultivariatePolynomialZp64.lPrecomputedPowersHolder
mkPrecomputedPowers(long[] values)
MultivariatePolynomialZp64
monic()
Makes this polynomial monicMultivariatePolynomialZp64
monic(long factor)
Setsthis
to its monic part (with respect to given ordering) multiplied by the given factor;MultivariatePolynomialZp64
monic(Comparator<DegreeVector> ordering)
Make this poly monic considering leading term with respect to given orderingMultivariatePolynomialZp64
monic(Comparator<DegreeVector> ordering, long factor)
Setsthis
to its monic part (with respect to given ordering) multiplied by the given factor;MultivariatePolynomialZp64
monicWithLC(MultivariatePolynomialZp64 other)
Setsthis
to its monic part multiplied by the leading coefficient ofother
;MultivariatePolynomialZp64
monicWithLC(Comparator<DegreeVector> ordering, MultivariatePolynomialZp64 other)
Setsthis
to its monic part multiplied by the leading coefficient ofother
with respect to given orderingMultivariatePolynomialZp64
multiply(long factor)
Multiplies this byfactor
MultivariatePolynomialZp64
multiply(MonomialZp64 monomial)
Multipliesthis
by themonomial
MultivariatePolynomialZp64
multiply(MultivariatePolynomialZp64 oth)
Multiplies this byoth
MultivariatePolynomialZp64
multiplyByBigInteger(BigInteger factor)
Multiplies this byfactor
MultivariatePolynomialZp64
multiplyByLC(MultivariatePolynomialZp64 other)
Multiply this by the leading coefficient ofother
static MultivariatePolynomialZp64
one(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering)
Creates unit polynomial.static MultivariatePolynomialZp64
parse(String string, IntegersZp64 ring)
Deprecated.use #parse(string, ring, ordering, variables)static MultivariatePolynomialZp64
parse(String string, IntegersZp64 ring, String... variables)
Parse multivariate polynomial from string.static MultivariatePolynomialZp64
parse(String string, IntegersZp64 ring, Comparator<DegreeVector> ordering)
Deprecated.use #parse(string, ring, ordering, variables)static MultivariatePolynomialZp64
parse(String string, IntegersZp64 ring, Comparator<DegreeVector> ordering, String... variables)
Parse multivariate polynomial from string.MultivariatePolynomialZp64
parsePoly(String string)
Deprecated.MultivariatePolynomialZp64
primitivePart()
Reduces poly to its primitive part (primitive part will always have positive l.c.)MultivariatePolynomialZp64
primitivePart(int variable)
Gives primitive part of this considered as R[variable][other_variables]MultivariatePolynomialZp64
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(MultivariatePolynomialZp64 oth)
Returns whetheroth
andthis
have the same coefficient ringMultivariatePolynomialZp64
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).MultivariatePolynomialZp64
setCoefficientRingFrom(MultivariatePolynomialZp64 lMonomialTerms)
Set the coefficient ring from specified polyMultivariatePolynomialZp64
setLC(long val)
Sets the leading coefficient to the specified valueMultivariatePolynomialZp64
setRing(long newModulus)
Switches to another ring specified bynewModulus
MultivariatePolynomialZp64
setRing(IntegersZp64 newDomain)
Switches to another ring specified bynewDomain
<E> MultivariatePolynomial<E>
setRing(Ring<E> newRing)
Switches to another ring specified bynewRing
MultivariatePolynomialZp64
setRingUnsafe(IntegersZp64 newDomain)
internal APIMultivariatePolynomialZp64
shift(int[] variables, long[] shifts)
Substitutesvariable -> variable + shift
for each variable fromvariables
arrayMultivariatePolynomialZp64
shift(int variable, long shift)
Returns a copy of this withvariable -> variable + shift
int
signumOfLC()
Gives signum of the leading coefficientMultivariatePolynomialZp64
square()
Squaresthis
MultivariatePolynomialZp64
substitute(int variable, MultivariatePolynomialZp64 poly)
Returns a copy of this withpoly
substituted forvariable
MultivariatePolynomialZp64
subtract(long oth)
Subtractsoth
from this polynomial and returns itMultivariatePolynomial<BigInteger>
toBigPoly()
Returns polynomial over Z formed from the coefficients of thisIUnivariatePolynomial
toDenseRecursiveForm()
Gives a recursive univariate representation of this poly.AMultivariatePolynomial
toSparseRecursiveForm()
Gives a recursive sparse univariate representation of this poly.String
toString(IStringifier<MultivariatePolynomialZp64> stringifier)
convert this to string with the use of stringifierstatic MultivariatePolynomialZp64
zero(int nVariables, IntegersZp64 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, occurrences, 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, uniqueOccurrences, 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, monicExact, multiply, multiply, setCoefficientRingFromOptional, subtract, toPositiveLC, toString
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
ring
The ring.
-
-
Method Details
-
create
public static MultivariatePolynomialZp64 create(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering, MonomialSet<MonomialZp64> terms)Creates multivariate polynomial from a set of monomials- Parameters:
nVariables
- number of variablesring
- the ringordering
- term orderingterms
- the monomials- Returns:
- multivariate polynomial
-
create
public static MultivariatePolynomialZp64 create(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering, Iterable<MonomialZp64> 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 MultivariatePolynomialZp64 create(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering, MonomialZp64... 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 MultivariatePolynomialZp64 zero(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering)Creates zero polynomial.- Parameters:
nVariables
- number of variablesring
- the ringordering
- the ordering- Returns:
- zero
-
one
public static MultivariatePolynomialZp64 one(int nVariables, IntegersZp64 ring, Comparator<DegreeVector> ordering)Creates unit polynomial.- Parameters:
nVariables
- number of variablesring
- the ringordering
- the ordering- Returns:
- unit
-
parse
public static MultivariatePolynomialZp64 parse(String string, IntegersZp64 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.use #parse(string, ring, ordering, variables)Parse multivariate polynomial from string.- Parameters:
string
- the stringring
- the ring- Returns:
- multivariate polynomial
-
parse
public static MultivariatePolynomialZp64 parse(String string, IntegersZp64 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 differ, since the first one is considered as Z[x], while the second as Z[x1,x2]- Returns:
- multivariate polynomial
-
parse
@Deprecated public static MultivariatePolynomialZp64 parse(String string, IntegersZp64 ring, Comparator<DegreeVector> ordering)Deprecated.use #parse(string, ring, ordering, variables)Parse multivariate polynomial from string.- Parameters:
string
- the stringring
- the ringordering
- monomial order- Returns:
- multivariate polynomial
-
asMultivariate
public static MultivariatePolynomialZp64 asMultivariate(UnivariatePolynomialZp64 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
- the ordering- Returns:
- multivariate polynomial
-
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<MonomialZp64,MultivariatePolynomialZp64>
- Returns:
- univariate polynomial
-
asOverUnivariate
Description copied from class:AMultivariatePolynomial
Converts this to a multivariate polynomial with coefficients being univariate polynomials overvariable
- Specified by:
asOverUnivariate
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
variable
- variable- Returns:
- multivariate polynomial with coefficients being univariate polynomials over
variable
-
asOverUnivariateEliminate
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<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
variable
- the variable- Returns:
- multivariate polynomial with coefficients being univariate polynomials over
variable
, the resulting polynomial have (nVariable - 1) multivariate variables
-
asOverMultivariate
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<MonomialZp64,MultivariatePolynomialZp64>
- 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<MultivariatePolynomialZp64> 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<MonomialZp64,MultivariatePolynomialZp64>
- 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 MultivariatePolynomialZp64 asNormalMultivariate(MultivariatePolynomial<UnivariatePolynomialZp64> poly, int variable)Converts multivariate polynomial over univariate polynomial ring (Zp[variable][other_variables]) to a multivariate polynomial over coefficient ring (Zp[all_variables])- Parameters:
poly
- the polynomialvariable
- the variable to insert- Returns:
- multivariate polynomial over normal coefficient ring
-
asNormalMultivariate
public static MultivariatePolynomialZp64 asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomialZp64> 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 MultivariatePolynomialZp64 asNormalMultivariate(MultivariatePolynomial<MultivariatePolynomialZp64> 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
-
asPolyZSymmetric
Returns polynomial over Z formed from the coefficients of this represented in symmetric modular form (-modulus/2 <= cfx <= modulus/2
).- Returns:
- Z[X] version of this with coefficients represented in symmetric modular form (
-modulus/2 <= cfx <= modulus/2
).
-
asPolyZ
Returns polynomial over Z formed from the coefficients of this- Returns:
- Z[X] version of this
-
toBigPoly
Returns polynomial over Z formed from the coefficients of this- Returns:
- Z[X] version of this
-
contentAsPoly
Description copied from interface:IPolynomial
Returns the content of this (gcd of coefficients) as a constant poly -
lcAsPoly
Description copied from interface:IPolynomial
Returns the leading coefficient as a constant poly -
lcAsPoly
Description copied from class:AMultivariatePolynomial
Returns the leading coefficient with respect to specified ordering as a constant poly- Specified by:
lcAsPoly
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
-
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
Description copied from interface:IPolynomial
Returns cardinality of the coefficient ring of this poly- Returns:
- cardinality of the coefficient ring
-
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
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
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
Description copied from interface:IPolynomial
overcome Java generics... -
createArray2d
Description copied from interface:IPolynomial
overcome Java generics... -
createArray2d
Description copied from interface:IPolynomial
overcome Java generics... -
sameCoefficientRingWith
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 MultivariatePolynomialZp64 setCoefficientRingFrom(MultivariatePolynomialZp64 lMonomialTerms)Description copied from interface:IPolynomial
Set the coefficient ring from specified poly- Parameters:
lMonomialTerms
- the polynomial- Returns:
- a copy of this with the coefficient ring taken from
poly
-
release
protected void release()release caches- Overrides:
release
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
-
setRing
Switches to another ring specified bynewModulus
- Parameters:
newModulus
- the new modulus- Returns:
- a copy of this reduced to the ring specified by
newModulus
-
setRing
Switches to another ring specified bynewDomain
- Parameters:
newDomain
- the new ring- Returns:
- a copy of this reduced to the ring specified by
newDomain
-
setRing
Switches to another ring specified bynewRing
- Parameters:
newRing
- the new ring- Returns:
- a copy of this reduced to the ring specified by
newRing
-
setRingUnsafe
internal API -
createConstant
Creates constant polynomial with specified value- Parameters:
val
- value- Returns:
- constant polynomial with specified value
-
createConstantFromTerm
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<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
monomial
- the monomial- Returns:
- multivariate polynomial
-
createZero
Description copied from interface:IPolynomial
Returns the new instance of zero polynomial (with the same coefficient ring)- Returns:
- new instance of 0
-
createOne
Description copied from interface:IPolynomial
Returns the new instance of unit polynomial (with the same coefficient ring)- Returns:
- new instance of 1
-
createLinear
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
-
lc
public long 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
Returns the leading coefficient of this polynomial with respect to specified ordering- Returns:
- leading coefficient of this polynomial with respect to specified ordering
-
setLC
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 long cc()Returns the constant coefficient of this polynomial.- Returns:
- constant coefficient of this polynomial
-
content
public long content()Returns the content of this polynomial.- Returns:
- content of this polynomial
-
coefficients
public long[] coefficients()Returns array of polynomial coefficients- Returns:
- array of polynomial coefficients
-
primitivePart
Description copied from class:AMultivariatePolynomial
Gives primitive part of this considered as R[variable][other_variables]- Specified by:
primitivePart
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
variable
- the variable- Returns:
- primitive part of this considered as R[variable][other_variables]
-
contentUnivariate
Description copied from class:AMultivariatePolynomial
Gives the content of this considered as R[variable][other_variables]- Specified by:
contentUnivariate
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
variable
- the variable- Returns:
- the content of this considered as R[variable][other_variables]
-
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
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
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
-
divide
Divides this polynomial by afactor
- Parameters:
factor
- the factor- Returns:
this / factor
-
divideOrNull
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<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
monomial
- monomial degrees- Returns:
this
divided by thefactor * monomial
ornull
-
monic
Makes this polynomial monic- Returns:
- monic this
-
monic
Description copied from class:AMultivariatePolynomial
Make this poly monic considering leading term with respect to given ordering- Specified by:
monic
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
-
monic
Setsthis
to its monic part (with respect to given ordering) multiplied by the given factor; -
monic
Setsthis
to its monic part (with respect to given ordering) multiplied by the given factor; -
monicWithLC
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 MultivariatePolynomialZp64 monicWithLC(Comparator<DegreeVector> ordering, MultivariatePolynomialZp64 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<MonomialZp64,MultivariatePolynomialZp64>
-
toDenseRecursiveForm
Gives a recursive univariate representation of this poly. -
fromDenseRecursiveForm
public static MultivariatePolynomialZp64 fromDenseRecursiveForm(IUnivariatePolynomial recForm, Comparator<DegreeVector> ordering)Converts poly from a recursive univariate representation.- Parameters:
recForm
- recursive univariate representationordering
- monomial order
-
fromDenseRecursiveForm
public static MultivariatePolynomialZp64 fromDenseRecursiveForm(IUnivariatePolynomial 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
Evaluates polynomial given in a dense recursive form at a given points -
toSparseRecursiveForm
Gives a recursive sparse univariate representation of this poly. -
fromSparseRecursiveForm
public static MultivariatePolynomialZp64 fromSparseRecursiveForm(AMultivariatePolynomial recForm, Comparator<DegreeVector> ordering)Converts poly from a sparse recursive univariate representation.- Parameters:
recForm
- recursive univariate representationordering
- monomial order
-
fromSparseRecursiveForm
public static MultivariatePolynomialZp64 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
Evaluates polynomial given in a sparse recursive form at a given points -
getHornerForm
Gives data structure for fast Horner-like sparse evaluation of this multivariate polynomial- Parameters:
evaluationVariables
- variables which will be substituted
-
evaluate
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)
)
-
evaluate
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)
)
-
evaluate
public long evaluate(long... values)Evaluates this polynomial at specified points -
evaluate
Evaluates this polynomial at specified points -
eliminate
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
)
-
eliminate
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 MultivariatePolynomialZp64.lPrecomputedPowersHolder mkPrecomputedPowers(int variable, long value) -
mkPrecomputedPowers
public MultivariatePolynomialZp64.lPrecomputedPowersHolder mkPrecomputedPowers(int[] variables, long[] values) -
mkPrecomputedPowers
public static MultivariatePolynomialZp64.lPrecomputedPowersHolder mkPrecomputedPowers(int nVariables, IntegersZp64 ring, int[] variables, long[] values) -
mkPrecomputedPowers
-
substitute
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
Returns a copy of this withvariable -> variable + shift
- Parameters:
variable
- the variableshift
- shift amount- Returns:
- a copy of this with
variable -> variable + shift
-
shift
Substitutesvariable -> variable + shift
for each variable fromvariables
array- Parameters:
variables
- the variablesshifts
- the corresponding shifts- Returns:
- a copy of this with
variable -> variable + shift
-
add
Addsoth
to this polynomial and returns it- Parameters:
oth
- other polynomial- Returns:
this + oth
-
subtract
Subtractsoth
from this polynomial and returns it- Parameters:
oth
- other polynomial- Returns:
this - oth
-
increment
Description copied from interface:IPolynomial
Adds 1 to this- Returns:
this + 1
-
decrement
Description copied from interface:IPolynomial
Subtracts 1 from this- Returns:
this - 1
-
multiply
Description copied from interface:IPolynomial
Multiplies this byfactor
- Parameters:
factor
- the factor- Returns:
this * factor
-
multiplyByLC
Description copied from interface:IPolynomial
Multiply this by the leading coefficient ofother
- Parameters:
other
- polynomial- Returns:
- this * lc(other)
-
multiplyByBigInteger
Description copied from interface:IPolynomial
Multiplies this byfactor
- Parameters:
factor
- the factor- Returns:
this * factor
-
multiply
Description copied from class:AMultivariatePolynomial
Multipliesthis
by themonomial
- Specified by:
multiply
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
monomial
- the monomial- Returns:
- this multiplied by the
monomial
-
multiply
Description copied from interface:IPolynomial
Multiplies this byoth
- Parameters:
oth
- the polynomial- Returns:
this * oth
-
square
Description copied from interface:IPolynomial
Squaresthis
- Returns:
this * this
-
evaluateAtRandom
public MultivariatePolynomialZp64 evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)Description copied from class:AMultivariatePolynomial
Evaluatespoly
at random point- Specified by:
evaluateAtRandom
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
-
evaluateAtRandomPreservingSkeleton
public MultivariatePolynomialZp64 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<MonomialZp64,MultivariatePolynomialZp64>
-
derivative
Description copied from class:AMultivariatePolynomial
Gives partial derivative of specifiedorder
with respect to specified variable (new instance created)- Specified by:
derivative
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
- Parameters:
variable
- the variableorder
- derivative order- Returns:
- partial derivative of specified
order
with respect to specified variable
-
seriesCoefficient
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<MonomialZp64,MultivariatePolynomialZp64>
- 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)
-
mapTerms
public <T> MultivariatePolynomial<T> mapTerms(Ring<T> newRing, Function<MonomialZp64,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
-
mapTerms
public MultivariatePolynomialZp64 mapTerms(IntegersZp64 newRing, Function<MonomialZp64,MonomialZp64> mapper)Maps terms of this using specified mapping function- Parameters:
newRing
- the new ringmapper
- mapping- Returns:
- a new polynomial with terms obtained by applying mapper to this terms
-
mapCoefficients
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)
-
mapCoefficientsAsPolys
public <E> MultivariatePolynomial<E> mapCoefficientsAsPolys(Ring<E> ring, Function<MultivariatePolynomialZp64,E> mapper)- Specified by:
mapCoefficientsAsPolys
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
-
compareTo
-
clone
Description copied from interface:IPolynomial
Deep copy of this- Specified by:
clone
in interfaceIPolynomial<MultivariatePolynomialZp64>
- Specified by:
clone
in classAMultivariatePolynomial<MonomialZp64,MultivariatePolynomialZp64>
- Returns:
- deep copy of this
-
parsePoly
Deprecated. -
toString
Description copied from interface:Stringifiable
convert this to string with the use of stringifier -
coefficientRingToString
Description copied from interface:IPolynomial
String representation of the coefficient ring of this
-