public class PolynomialRing extends java.lang.Object implements Ring
Ring.| Modifier and Type | Class and Description |
|---|---|
class |
PolynomialRing.Polynomial
An element of
PolynomialRing. |
| Modifier and Type | Field and Description |
|---|---|
protected Ring |
baseRing
The ring over which the polynomials are defined.
|
| Constructor and Description |
|---|
PolynomialRing(Representation arg) |
PolynomialRing(Ring base)
Creates the polynomial ring over the given base.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
double |
estimateCostInvPerOp()
Estimates the number of inversions that can be done per group operation for the same cost.
|
double |
estimateCostNegPerOp()
Estimates the number of negations (additive inversions) that can be done per group operation for the same cost.
|
Ring |
getBaseRing()
Returns the base ring.
|
java.math.BigInteger |
getCharacteristic()
Returns the characteristic of the ring.
|
PolynomialRing.Polynomial |
getElement(java.math.BigInteger i)
Maps the integer i into this ring \(R\), such that this map is a
ring homomorphism \(\mathbb{Z}_{\text{getCharacteristic()}} \rightarrow R\).
|
PolynomialRing.Polynomial |
getOneElement()
Returns the multiplicative neutral element of this ring.
|
static PolynomialRing.Polynomial |
getPoly(java.util.Map<? extends RingElement,? extends RingElement> dataPoints)
Creates a new polynomial using interpolation.
|
static PolynomialRing.Polynomial |
getPoly(java.util.Map<? extends RingElement,? extends RingElement> dataPoints,
int degreeOfPolynomial)
Creates a new polynomial using interpolation.
|
static PolynomialRing.Polynomial |
getPoly(RingElement... coefficients)
Shorthand to create a polynomial from given coefficients in order from lowest exponent to highest.
|
Representation |
getRepresentation()
The representation of this object.
|
PolynomialRing.Polynomial |
getUniformlyRandomElement()
Returns an element of this structure that is drawn uniformly at random
using a cryptographically strong RNG.
|
PolynomialRing.Polynomial |
getUniformlyRandomUnit()
Generates an invertible element from this ring uniformly at random using a cryptographically strong RNG.
|
java.util.Optional<java.lang.Integer> |
getUniqueByteLength()
Returns the number of bytes returned by this structure's
UniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length. |
PolynomialRing.Polynomial |
getX()
Returns the Polynomial 1*x + 0
|
PolynomialRing.Polynomial |
getZeroElement()
Returns the additive neutral element of this ring.
|
int |
hashCode() |
boolean |
isCommutative()
Returns true if this ring is known to be commutative.
|
PolynomialRing.Polynomial |
restoreElement(Representation arg)
Creates an element of this structure from its representation.
|
java.math.BigInteger |
size()
Returns the number of elements in this structure (the size).
|
java.math.BigInteger |
sizeUnitGroup()
Returns the number of units in this ring.
|
PolynomialRing.Polynomial |
valueOf(RingElement... coefficients)
Returns \(\sum \mathit{coefficient}_i \cdot X^i \).
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitasAdditiveGroup, asUnitGroup, extendedEuclideanAlgorithm, extendedEuclideanAlgorithm, getElement, getUniformlyRandomElements, getUniformlyRandomNonzeroElement, getUniformlyRandomNonzeroElements, getUniformlyRandomUnits, restoreFromRepresentation, restoreVectorhasPrimeSizeprotected Ring baseRing
public PolynomialRing(Ring base)
public PolynomialRing(Representation arg)
public java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
Structurepublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic java.math.BigInteger sizeUnitGroup()
throws java.lang.UnsupportedOperationException
RingsizeUnitGroup in interface Ringjava.lang.UnsupportedOperationException - if size is unknown or is computationally too expensive to computepublic PolynomialRing.Polynomial getZeroElement()
RinggetZeroElement in interface Ringpublic PolynomialRing.Polynomial getOneElement()
RinggetOneElement in interface Ringpublic PolynomialRing.Polynomial getX()
public PolynomialRing.Polynomial getElement(java.math.BigInteger i)
RinggetElement in interface Ringi - the integer to mappublic double estimateCostInvPerOp()
Ring2 would mean that an inversion costs half as much as a group operation, on average.estimateCostInvPerOp in interface Ringpublic double estimateCostNegPerOp()
Ring2 would mean that a negation costs half as much as a group operation, on average.estimateCostNegPerOp in interface Ringpublic Ring getBaseRing()
public PolynomialRing.Polynomial restoreElement(Representation arg)
StructurerestoreElement in interface RingrestoreElement in interface Structurearg - the Representation returned by Representable.getRepresentation()public PolynomialRing.Polynomial getUniformlyRandomElement() throws java.lang.UnsupportedOperationException
StructuregetUniformlyRandomElement in interface RinggetUniformlyRandomElement in interface Structurejava.lang.UnsupportedOperationException - if the operation is not supportedpublic PolynomialRing.Polynomial getUniformlyRandomUnit() throws java.lang.UnsupportedOperationException
RingThe default implementation generates random ring elements until it hits a unit. Implementors should override if this is not feasible or if there is a better way!
getUniformlyRandomUnit in interface Ringjava.lang.UnsupportedOperationException - if the ring does not support this methodpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.math.BigInteger getCharacteristic()
Ring
The characteristic of a ring is defined to be the number n
such that there is a ring homomorphism from Zn to the ring.
getCharacteristic in interface Ringpublic PolynomialRing.Polynomial valueOf(RingElement... coefficients)
public static PolynomialRing.Polynomial getPoly(RingElement... coefficients)
For example, getPoly(1,2,3) returns \(1 + 2 \cdot X + 3 \cdot X^2\).
coefficients - the polynomial's coefficients in orderfrom lowest exponent to highestpublic static PolynomialRing.Polynomial getPoly(java.util.Map<? extends RingElement,? extends RingElement> dataPoints, int degreeOfPolynomial)
The interpolation implements Neville's Algorithm (see http://mathworld.wolfram.com/NevillesAlgorithm.html). Beware that this operation has complexity \(O(n^2)\), where \(n\) is the number of dataPoints needed to interpolate the polynomial (degree + 1). Only to be used if the actual coefficients of the polynomial are unknown.
Note: This implementation is based on Apache's commons math library (org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm#computeCoefficients).
dataPoints - known points \((x_i, y_i)\) on the resulting polynomial \(P\) used for interpolation.degreeOfPolynomial - the desired degree of the interpolated polynomialpublic static PolynomialRing.Polynomial getPoly(java.util.Map<? extends RingElement,? extends RingElement> dataPoints)
The interpolation implements Neville's Algorithm (see http://mathworld.wolfram.com/NevillesAlgorithm.html). Beware that this operation has complexity \(O(n^2)\), where \(n\) is the number of dataPoints needed to interpolate the polynomial (degree + 1). Only to be used if the actual coefficients of the polynomial are unknown.
Note: This implementation is based on Apache's commons math library (org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm#computeCoefficients).
dataPoints - known points \((x_i, y_i)\) on the resulting polynomial \(P\) used for interpolation.public java.util.Optional<java.lang.Integer> getUniqueByteLength()
StructureUniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length.
For example, elements of Zp will always be represented by ceil(ceil(log(p))/8) bytes,
hence getUniqueByteLength() would return ceil(ceil(log(p))/8).
A polynomial ring would return an empty Optional since a polynomial's unique byte representation length
depends on its degree.
getUniqueByteLength in interface StructuregetUniqueByteRepresentation(),
or an empty Optional, if no guaranteepublic boolean isCommutative()
RingisCommutative in interface Ring