pub struct Rq { /* private fields */ }
Expand description
This module provides implementations for various operations in the polynomial ring R = Z_q[X] / (X^d + 1).
Implementations§
Source§impl Rq
impl Rq
pub const DEGREE: usize = 64usize
pub fn into_coeffs(self) -> [Zq; 64]
Sourcepub fn get_coefficients(&self) -> &[Zq; 64]
pub fn get_coefficients(&self) -> &[Zq; 64]
Get the coefficients as a vector
Sourcepub fn random<R: Rng + CryptoRng>(rng: &mut R) -> Self
pub fn random<R: Rng + CryptoRng>(rng: &mut R) -> Self
Generate random polynomial with a provided cryptographically secure RNG
Sourcepub fn random_with_bound<R: Rng + CryptoRng>(rng: &mut R, bound: u32) -> Self
pub fn random_with_bound<R: Rng + CryptoRng>(rng: &mut R, bound: u32) -> Self
Generate random polynomial with a provided cryptographically secure RNG and given bound
pub fn l2_norm_squared(&self) -> Zq
Sourcepub fn decompose(&self, base: Zq, num_parts: usize) -> Vec<Rq>
pub fn decompose(&self, base: Zq, num_parts: usize) -> Vec<Rq>
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
Sourcepub fn conjugate_automorphism(&self) -> Self
pub fn conjugate_automorphism(&self) -> Self
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,