Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
made MPE a method on skew polynomials.
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitdm committed Aug 8, 2016
1 parent dd667ed commit 8f42a33
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
31 changes: 31 additions & 0 deletions src/sage/rings/polynomial/skew_polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2537,6 +2537,37 @@ cdef class SkewPolynomial(AlgebraElement):
"""
return self.parent().variable_name()

def multi_point_evaluation(self, eval_pts):
"""
Evaluate skew polynomial at multiple evaluation points.
INPUT:
- ``eval_pts`` -- list of points at which ``self`` is to be evaluated
OUTPUT:
List of values of ``self`` at the `eval_pts`.
.. TODO::
This method currently trivially calls the evaluation function
repeatedly and should be updated to the recursive algorithm
from the paper "Fast Operations on Linearized Polynomials
and their Applications in Coding Theory" by Puchinger, et al.
EXAMPLES:
sage: k.<t> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: S.<x> = k['x',Frob]
sage: a = x + t
sage: eval_pts = [1, t, t^2]
sage: c = a.multi_point_evaluation(eval_pts); c
[t + 1, 3*t^2 + 4*t + 4, 4*t]
"""
return [ self(e) for e in eval_pts ]


cdef class SkewPolynomial_generic_dense(SkewPolynomial):
"""
Expand Down
45 changes: 6 additions & 39 deletions src/sage/rings/polynomial/skew_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ class SkewPolynomialRing_general(sage.algebras.algebra.Algebra,UniqueRepresentat
...
ValueError: variable name 'Ring endomorphism of Univariate Polynomial Ring in t over Integer Ring\n
Defn: t |--> t + 1' is not alphanumeric
As for polynomials, skew polynomial rings with different variable names
are not equal::
sage: R['x',sigma] == R['y',sigma]
False
Expand Down Expand Up @@ -761,46 +761,13 @@ def create_mvp(eval_pts):
A = eval_pts[:t]
B = eval_pts[t:]
M_A = create_mvp(A)
M_A_B = self.multi_point_evaluation(M_A, B)
M_A_B = M_A.multi_point_evaluation(B)
if check:
if 0 in M_A_B:
raise ValueError("evaluation points must be linearly independent over the fixed field of the twist map")
M_M_A_B = create_mvp(M_A_B)
return M_M_A_B * M_A
return create_mvp(eval_pts)

def multi_point_evaluation(self, p, eval_pts):
"""
Evaluate skew polynomial at multiple evaluation points.
INPUT:
- ``p`` -- skew polynomial belonging to ``self``
- ``eval_pts`` -- list of points at which `p` is to be evaluated
OUTPUT:
List of values of `p` at the `eval_pts`.
.. TODO::
This method currently trivially calls the evaluation function
repeatedly and should be updated to the recursive algorithm
from the paper "Fast Operations on Linearized Polynomials
and their Applications in Coding Theory" by Puchinger, et al.
EXAMPLES:
sage: k.<t> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: S.<x> = k['x',Frob]
sage: a = x + t
sage: eval_pts = [1, t, t^2]
sage: c = S.multi_point_evaluation(a, eval_pts); c
[t + 1, 3*t^2 + 4*t + 4, 4*t]
"""
return [ p(e) for e in eval_pts ]

def interpolation_polynomial(self, eval_pts, values, check=True):
"""
Expand Down Expand Up @@ -874,8 +841,8 @@ def interpolate(eval_pts, values):
B = eval_pts[t:]
M_A = self.minimal_vanishing_polynomial(A)
M_B = self.minimal_vanishing_polynomial(B)
A_ = self.multi_point_evaluation(M_B, A)
B_ = self.multi_point_evaluation(M_A, B)
A_ = M_B.multi_point_evaluation(A)
B_ = M_A.multi_point_evaluation(B)
I_1 = interpolate(A_, values[:t])
I_2 = interpolate(B_, values[t:])
return I_1 * M_B + I_2 * M_A
Expand All @@ -884,7 +851,7 @@ def interpolate(eval_pts, values):
if check:
for i in range(l):
if interpolation_polynomial(eval_pts[i]) != values[i]:
return ValueError("the evaluation points are not linearly independent")
return ValueError("evaluation points must be linearly independent over the fixed field of the twist map")
return interpolation_polynomial

class SkewPolynomialRing_finite_field(SkewPolynomialRing_general):
Expand Down

0 comments on commit 8f42a33

Please sign in to comment.