pub struct PolyRing { /* private fields */ }
Expand description
A PolyRing is a vector of Zq elements with a flexible degree that is less than or equal to DEGREE_BOUND.
Implementations§
Source§impl PolyRing
impl PolyRing
pub const DEGREE_BOUND: usize = 64usize
pub fn new(coeffs: Vec<Zq>) -> Self
pub fn zero(degree: usize) -> Self
pub fn zero_poly() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get_coeffs(&self) -> &Vec<Zq>
pub fn iter(&self) -> impl Iterator<Item = &Zq>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Zq>
Sourcepub fn inner_product(&self, other: &Self) -> Zq
pub fn inner_product(&self, other: &Self) -> Zq
inner product of two polynomials
Sourcepub fn random<R: Rng + CryptoRng>(rng: &mut R, n: usize) -> Self
pub fn random<R: Rng + CryptoRng>(rng: &mut R, n: usize) -> Self
Generate random Zq vector with a provided cryptographically secure RNG
Sourcepub fn random_ternary<R: Rng + CryptoRng>(rng: &mut R, n: usize) -> Self
pub fn random_ternary<R: Rng + CryptoRng>(rng: &mut R, n: usize) -> Self
Generate random small polynomial with secure RNG implementation
Sourcepub fn conjugate_automorphism(&self) -> PolyRing
pub fn conjugate_automorphism(&self) -> PolyRing
Compute the conjugate automorphism \sigma_{-1} of vector based on B) Constraints…, Page 21.
Sourcepub fn operator_norm(&self) -> f64
pub fn operator_norm(&self) -> f64
Compute the operator norm of a polynomial given its coefficients. The operator norm is defined as the maximum magnitude of the DFT (eigenvalues) of the coefficient vector.
Note that: The operator norm only affects the coefficients of the random PolyRings generated from the challenge space. Prover and Verifier will not do the operator norm check, because random PolyRings are determined after generation. Both party will have access to the same PolyRings through transcript,
Sourcepub fn decompose(&self, base: Zq, num_parts: usize) -> PolyVector
pub fn decompose(&self, base: Zq, num_parts: usize) -> PolyVector
Decomposes a polynomial into base-B representation: p = p⁽⁰⁾ + p⁽¹⁾·B + p⁽²⁾·B² + … + p⁽ᵗ⁻¹⁾·B^(t-1) Where each p⁽ⁱ⁾ has small coefficients, using centered representatives
Trait Implementations§
Source§impl FromIterator<PolyRing> for PolyVector
impl FromIterator<PolyRing> for PolyVector
Source§impl FromIterator<Zq> for PolyRing
impl FromIterator<Zq> for PolyRing
Source§impl Mul<&PolyRing> for &PolyVector
impl Mul<&PolyRing> for &PolyVector
Source§type Output = PolyVector
type Output = PolyVector
*
operator.