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§
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.
Sourcefn from_polynomial(p: Polynomial<Self::F>) -> Self
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§
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) -> BigUint
fn norm_l1(&self) -> BigUint
Calculate the l1 norm for this polynomial. That is the summation of all coefficients
Sourcefn norm_l2(&self) -> BigUint
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
Sourcefn norm_max(&self) -> BigUint
fn norm_max(&self) -> BigUint
Calculate the l-infinity norm for this polynomial. That is the largest coefficient
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.