PolynomialRingElement

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>;
    fn from_polynomial(p: Polynomial<Self::F>) -> Self;

    // Provided methods
    fn to_scalar(&self) -> Result<Self::F> { ... }
    fn norm_l1(&self) -> BigUint { ... }
    fn norm_l2(&self) -> BigUint { ... }
    fn norm_max(&self) -> BigUint { ... }
    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.

Source

fn from_polynomial(p: Polynomial<Self::F>) -> Self

Create a polynomial ring element from a Polynomial with terms in the ring’s scalar field.

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) -> BigUint

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

Source

fn norm_l2(&self) -> BigUint

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) -> BigUint

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§