ring_math

Trait PolynomialRingElement

source
pub trait PolynomialRingElement:
    FieldElement
    + Add<Output = Self>
    + AddAssign
    + Div<Output = Self>
    + Mul<Output = Self>
    + MulAssign
    + Neg<Output = Self>
    + Sub<Output = Self>
    + SubAssign
    + FromStr
    + PartialEq
    + Clone
    + Hash
    + Debug
    + From<u64>
    + From<Polynomial<Self::F>>
    + Display {
    type F: FieldElement;

    // Required methods
    fn modulus() -> Polynomial<Self::F>;
    fn polynomial(&self) -> &Polynomial<Self::F>;

    // Provided methods
    fn to_scalar(&self) -> Result<Self::F> { ... }
    fn norm_l1(&self) -> u64 { ... }
    fn norm_l2(&self) -> u64 { ... }
    fn norm_max(&self) -> u64 { ... }
    fn coef(&self) -> Vector<Self::F> { ... }
    fn rot(&self) -> Matrix2D<Self::F> { ... }
}
Expand description

A trait representing a polynomial ring defined as T[X]/<Self::modulus()> where T is a FieldElement trait and modulus is a function implemented by the struct implementing PolynomialRingElement

Required Associated Types§

Required Methods§

source

fn modulus() -> Polynomial<Self::F>

Modulus used in remainder division to form the polynomial ring.

Operations are done modulo this polynomial, in a way similar to scalar fields.

See the division implementation for more info.

source

fn polynomial(&self) -> &Polynomial<Self::F>

Return the Polynomial representation of the current value Used to automatically implement norms and other functions.

Provided Methods§

source

fn to_scalar(&self) -> Result<Self::F>

Attempt to get a scalar representation of the polynomial. If the polynomial degree is > 0 this method will error.

source

fn norm_l1(&self) -> u64

Calculate the l1 norm for this polynomial. That is the summation of all coefficients

source

fn norm_l2(&self) -> u64

Calculate the l2 norm for this polynomial. That is the square root of the summation of each coefficient squared

Specifically, we’re calculating the square root in the integer field, not the prime field

source

fn norm_max(&self) -> u64

Calculate the l-infinity norm for this polynomial. That is the largest coefficient

source

fn coef(&self) -> Vector<Self::F>

Returns a coefficient vector of length equal to the ring modulus degree.

source

fn rot(&self) -> Matrix2D<Self::F>

Create a rotated matrix of polynomial coefficients

from LatticeFold page 9 https://eprint.iacr.org/2024/257.pdf

Object Safety§

This trait is not object safe.

Implementors§