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§
type F: FieldElement
Required Methods§
sourcefn modulus() -> Polynomial<Self::F>
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.
sourcefn polynomial(&self) -> &Polynomial<Self::F>
fn polynomial(&self) -> &Polynomial<Self::F>
Return the Polynomial representation of the current value Used to automatically implement norms and other functions.
Provided Methods§
sourcefn to_scalar(&self) -> Result<Self::F>
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.
sourcefn norm_l1(&self) -> u64
fn norm_l1(&self) -> u64
Calculate the l1 norm for this polynomial. That is the summation of all coefficients
sourcefn norm_l2(&self) -> u64
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
sourcefn norm_max(&self) -> u64
fn norm_max(&self) -> u64
Calculate the l-infinity norm for this polynomial. That is the largest coefficient