Class MultivariatePolynomialZp64

• Method Detail

• parse

public static MultivariatePolynomialZp64 parse​(String string,
IntegersZp64 ring,
String... variables)
Parse multivariate polynomial from string.
Parameters:
string - the string
ring - the ring
variables - string variables that should be taken into account. For examples: parse("a", LEX) and parse("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)
Deprecated.
use #parse(string, ring, ordering, variables)
Parse multivariate polynomial from string.
Parameters:
string - the string
ring - 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 string
ring - the ring
ordering - monomial order
variables - string variables that should be taken into account. For examples: parse("a", LEX) and parse("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
• asMultivariate

public static MultivariatePolynomialZp64 asMultivariate​(UnivariatePolynomialZp64 poly,
int nVariables,
int variable,
Comparator<DegreeVector> ordering)
Converts univariate polynomial to multivariate.
Parameters:
poly - univariate polynomial
nVariables - number of variables in the result
variable - variable that will be used as a primary variable
ordering - the ordering
Returns:
multivariate polynomial
• 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 polynomial
variable - 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

public MultivariatePolynomial<BigInteger> 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

public MultivariatePolynomial<BigInteger> asPolyZ()
Returns polynomial over Z formed from the coefficients of this
Returns:
Z[X] version of this
• toBigPoly

public MultivariatePolynomial<BigInteger> toBigPoly()
Returns polynomial over Z formed from the coefficients of this
Returns:
Z[X] version of this
• contentAsPoly

public MultivariatePolynomialZp64 contentAsPoly()
Description copied from interface: IPolynomial
Returns the content of this (gcd of coefficients) as a constant poly
• isOverField

public boolean isOverField()
Description copied from interface: IPolynomial
Returns whether the coefficient ring of this polynomial is a field
Returns:
whether the coefficient ring of this polynomial is a field
• isOverFiniteField

public boolean isOverFiniteField()
Description copied from interface: IPolynomial
Returns whether the coefficient ring of this polynomial is a finite field
Returns:
whether the coefficient ring of this polynomial is a finite field
• isOverZ

public boolean isOverZ()
Description copied from interface: IPolynomial
Returns whether the coefficient ring of this polynomial is Z
Returns:
whether the coefficient ring of this polynomial is Z
• coefficientRingCardinality

public BigInteger coefficientRingCardinality()
Description copied from interface: IPolynomial
Returns cardinality of the coefficient ring of this poly
Returns:
cardinality of the coefficient ring
• coefficientRingCharacteristic

public BigInteger coefficientRingCharacteristic()
Description copied from interface: IPolynomial
Returns characteristic of the coefficient ring of this poly
Returns:
characteristic of the coefficient ring
• isOverPerfectPower

public boolean isOverPerfectPower()
Description copied from interface: IPolynomial
Returns whether the coefficientRingCardinality() is a perfect power
Returns:
whether the coefficientRingCardinality() is a perfect power
• coefficientRingPerfectPowerBase

public BigInteger coefficientRingPerfectPowerBase()
Description copied from interface: IPolynomial
Returns base so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
Returns:
base so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
• coefficientRingPerfectPowerExponent

public BigInteger coefficientRingPerfectPowerExponent()
Description copied from interface: IPolynomial
Returns exponent so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
Returns:
exponent so that coefficientRingCardinality() == base^exponent or null if cardinality is not finite
• sameCoefficientRingWith

public boolean sameCoefficientRingWith​(MultivariatePolynomialZp64 oth)
Description copied from interface: IPolynomial
Returns whether oth and this 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
• setRing

public MultivariatePolynomialZp64 setRing​(long newModulus)
Switches to another ring specified by newModulus
Parameters:
newModulus - the new modulus
Returns:
a copy of this reduced to the ring specified by newModulus
• setRing

public MultivariatePolynomialZp64 setRing​(IntegersZp64 newDomain)
Switches to another ring specified by newDomain
Parameters:
newDomain - the new ring
Returns:
a copy of this reduced to the ring specified by newDomain
• setRing

public <E> MultivariatePolynomial<E> setRing​(Ring<E> newRing)
Switches to another ring specified by newRing
Parameters:
newRing - the new ring
Returns:
a copy of this reduced to the ring specified by newRing
• createConstant

public MultivariatePolynomialZp64 createConstant​(long val)
Creates constant polynomial with specified value
Parameters:
val - value
Returns:
constant polynomial with specified value
• createZero

public MultivariatePolynomialZp64 createZero()
Description copied from interface: IPolynomial
Returns the new instance of zero polynomial (with the same coefficient ring)
Returns:
new instance of 0
• createOne

public MultivariatePolynomialZp64 createOne()
Description copied from interface: IPolynomial
Returns the new instance of unit polynomial (with the same coefficient ring)
Returns:
new instance of 1
• createLinear

public MultivariatePolynomialZp64 createLinear​(int variable,
long cc,
long lc)
Creates linear polynomial of the form cc + lc * variable
Parameters:
variable - the variable
cc - the constant coefficient
lc - the leading coefficient
Returns:
linear polynomial cc + lc * variable
• isMonic

public boolean isMonic()
Description copied from interface: IPolynomial
Returns true 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
Returns true 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
Returns true 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

public long 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 MultivariatePolynomialZp64 setLC​(long 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 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

public MultivariatePolynomialZp64 primitivePart()
Description copied from interface: IPolynomial
Reduces poly to its primitive part (primitive part will always have positive l.c.)
Returns:
primitive part (poly will be modified)
• primitivePartSameSign

public MultivariatePolynomialZp64 primitivePartSameSign()
Description copied from interface: IPolynomial
Reduces poly to its primitive part, so that primitive part will have the same signum as the initial poly
Returns:
primitive part (poly will be modified)
• divideByLC

public MultivariatePolynomialZp64 divideByLC​(MultivariatePolynomialZp64 other)
Description copied from interface: IPolynomial
Divides this polynomial by the leading coefficient of other or returns null (causing loss of internal data) if some of the elements can't be exactly divided by the other.lc(). NOTE: if null is returned, the content of this is destroyed.
Parameters:
other - the polynomial
Returns:
this divided by the other.lc() or null if exact division is not possible
• divide

public MultivariatePolynomialZp64 divide​(long factor)
Divides this polynomial by a factor
Parameters:
factor - the factor
Returns:
this / factor
• monic

public MultivariatePolynomialZp64 monic​(long factor)
Sets this to its monic part (with respect to given ordering) multiplied by the given factor;
• monicWithLC

public MultivariatePolynomialZp64 monicWithLC​(MultivariatePolynomialZp64 other)
Description copied from interface: IPolynomial
Sets this to its monic part multiplied by the leading coefficient of other;
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
• toDenseRecursiveForm

public IUnivariatePolynomial toDenseRecursiveForm()
Gives a recursive univariate representation of this poly.
• fromDenseRecursiveForm

public static MultivariatePolynomialZp64 fromDenseRecursiveForm​(IUnivariatePolynomial recForm,
int nVariables,
Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.
Parameters:
recForm - recursive univariate representation
nVariables - number of variables in multivariate polynomial
ordering - monomial order
• evaluateDenseRecursiveForm

public static long evaluateDenseRecursiveForm​(IUnivariatePolynomial recForm,
long[] 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 MultivariatePolynomialZp64 fromSparseRecursiveForm​(AMultivariatePolynomial recForm,
int nVariables,
Comparator<DegreeVector> ordering)
Converts poly from a recursive univariate representation.
Parameters:
recForm - recursive univariate representation
nVariables - number of variables in multivariate polynomial
ordering - monomial order
• evaluateSparseRecursiveForm

public static long evaluateSparseRecursiveForm​(AMultivariatePolynomial recForm,
long[] values)
Evaluates polynomial given in a sparse recursive form at a given points
• getHornerForm

public MultivariatePolynomialZp64.HornerFormZp64 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 MultivariatePolynomialZp64 evaluate​(int variable,
long value)
Returns a copy of this with value substituted for variable
Parameters:
variable - the variable
value - the value
Returns:
a new multivariate polynomial with value substituted for variable but still with the same AMultivariatePolynomial.nVariables (though the effective number of variables is nVariables - 1, compare to eliminate(int, long))
• evaluate

public MultivariatePolynomialZp64 evaluate​(int[] variables,
long[] values)
Returns a copy of this with values substituted for variables
Parameters:
variables - the variables
values - the values
Returns:
a new multivariate polynomial with value substituted for variable but still with the same AMultivariatePolynomial.nVariables (though the effective number of variables is nVariables - 1, compare to eliminate(int, long))
• evaluate

public long evaluate​(long... values)
Evaluates this polynomial at specified points
• evaluate

public MultivariatePolynomialZp64[] evaluate​(int variable,
long... values)
Evaluates this polynomial at specified points
• eliminate

public MultivariatePolynomialZp64 eliminate​(int variable,
long value)
Substitutes value for variable and eliminates variable from the list of variables so that the resulting polynomial has result.nVariables = this.nVariables - 1.
Parameters:
variable - the variable
value - the value
Returns:
a new multivariate polynomial with value substituted for variable and nVariables = nVariables - 1)
• eliminate

public MultivariatePolynomialZp64 eliminate​(int[] variables,
long[] values)
Returns a copy of this with values substituted for variables
Parameters:
variables - the variables
values - the values
Returns:
a new multivariate polynomial with value substituted for variable but still with the same AMultivariatePolynomial.nVariables (though the effective number of variables is nVariables - 1, compare to eliminate(int, long))
• substitute

public MultivariatePolynomialZp64 substitute​(int variable,
MultivariatePolynomialZp64 poly)
Returns a copy of this with poly substituted for variable
Parameters:
variable - the variable
poly - the replacement for the variable
Returns:
a copy of this with variable -> poly
• shift

public MultivariatePolynomialZp64 shift​(int variable,
long shift)
Returns a copy of this with variable -> variable + shift
Parameters:
variable - the variable
shift - shift amount
Returns:
a copy of this with variable -> variable + shift
• shift

public MultivariatePolynomialZp64 shift​(int[] variables,
long[] shifts)
Substitutes variable -> variable + shift for each variable from variables array
Parameters:
variables - the variables
shifts - the corresponding shifts
Returns:
a copy of this with variable -> variable + shift

public MultivariatePolynomialZp64 add​(long oth)
Adds oth to this polynomial and returns it
Parameters:
oth - other polynomial
Returns:
this + oth
• subtract

public MultivariatePolynomialZp64 subtract​(long oth)
Subtracts oth from this polynomial and returns it
Parameters:
oth - other polynomial
Returns:
this - oth
• multiply

public MultivariatePolynomialZp64 multiply​(long factor)
Description copied from interface: IPolynomial
Multiplies this by factor
Parameters:
factor - the factor
Returns:
this * factor
• multiplyByBigInteger

public MultivariatePolynomialZp64 multiplyByBigInteger​(BigInteger factor)
Description copied from interface: IPolynomial
Multiplies this by factor
Parameters:
factor - the factor
Returns:
this * factor
• seriesCoefficient

public MultivariatePolynomialZp64 seriesCoefficient​(int variable,
int order)
Description copied from class: AMultivariatePolynomial
Gives (unevaluated) coefficient of Taylor series expansion for specified variable that is 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).
Specified by:
seriesCoefficient in class AMultivariatePolynomial<MonomialZp64,​MultivariatePolynomialZp64>
Parameters:
variable - the variable
order - 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 ring
mapper - mapping
Returns:
a new polynomial with terms obtained by applying mapper to this terms
• mapCoefficients

public <T> MultivariatePolynomial<T> mapCoefficients​(Ring<T> newRing,
LongFunction<T> mapper)
Maps coefficients of this using specified mapping function
Type Parameters:
T - new element type
Parameters:
newRing - the new ring
mapper - mapping
Returns:
a new polynomial with terms obtained by applying mapper to this terms (only coefficients are changed)