public class LagrangeUtils
extends java.lang.Object
For interpolating a polynomial given a set of known evaluations, see PolynomialRing.getPoly(Map).
| Constructor and Description |
|---|
LagrangeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.math.BigInteger |
computeCoefficient(java.math.BigInteger i,
java.util.Set<java.math.BigInteger> S,
java.math.BigInteger x,
Zp field)
Compute the Lagrange coefficient \(\ell_j(x)\) over the specified field.
|
static Zp.ZpElement |
computeCoefficient(Zp.ZpElement i,
java.util.Set<Zp.ZpElement> S,
Zp.ZpElement x)
Compute the Lagrange coefficient \(\ell_j(x)\).
|
static GroupElement |
interpolateInTheExponent(java.util.Map<java.math.BigInteger,GroupElement> givenElems,
java.math.BigInteger newCoord)
Given a set of group elements with a common basis whose exponents implicitly define a polynomial,
returns that common basis to the power of that polynomial evaluated at point
newPoint. |
public static GroupElement interpolateInTheExponent(java.util.Map<java.math.BigInteger,GroupElement> givenElems, java.math.BigInteger newCoord)
newPoint.
Specifically, let \(g_{a_1}\) to \(g_{a_m}\) be the group elements contained in map knownPoints
where \(a_i\) is the BigInteger mapped to \(g_{a_i}\).
Given some generator \(g\) of the group, \(g_{a_1}\) to \(g_{a_m}\) can be written as
\(g_{a_1} = g^{p(a_1)}, ..., g_{a_m} = g^{p(a_m)}\) for some implicitly defined polynomial
\(p\) of degree \(m-1\).
Let \(x\) be newPoint and let \(\ell_{a_i}\) be the i-th Lagrange polynomial.
Then this method returns \(g^{p(x)}\) using Lagrange interpolation by computing
\(g^{p(x)} = \prod_{a_i}{g_{a_i}^{\ell_{a_i}(x)}}\).
givenElems - maps \(a_i\) to \(g^{p(a_i)}\) for some implicit polynomial \(p\)newCoord - the x-coordinate to return \(g\) to the power \(p(x)\) forpublic static Zp.ZpElement computeCoefficient(Zp.ZpElement i, java.util.Set<Zp.ZpElement> S, Zp.ZpElement x)
i - j-th x coordinateS - set of x coordinatesx - x coordinate to evaluate the lagrange basis polynomial atxpublic static java.math.BigInteger computeCoefficient(java.math.BigInteger i,
java.util.Set<java.math.BigInteger> S,
java.math.BigInteger x,
Zp field)
i - j-th x coordinateS - set of x coordinatesx - x coordinate to evaluate the lagrange basis polynomial atfield - the field to do the computation overx in the given field