pub struct Polynomial<F> {
pub coefficients: Vec<F>,
}
Fields§
§coefficients: Vec<F>
Implementations§
source§impl<F: Mul<Output = F> + Sub<Output = F> + AddAssign + Zero + Div<Output = F> + Clone + Inverse> Polynomial<F>
impl<F: Mul<Output = F> + Sub<Output = F> + AddAssign + Zero + Div<Output = F> + Clone + Inverse> Polynomial<F>
pub fn hadamard_mul(&self, other: &Self) -> Self
pub fn hadamard_div(&self, other: &Self) -> Self
pub fn hadamard_inv(&self) -> Self
source§impl<F: One + Zero + Clone + Neg<Output = F> + MulAssign + AddAssign + Div<Output = F> + Sub<Output = F> + PartialEq> Polynomial<F>
impl<F: One + Zero + Clone + Neg<Output = F> + MulAssign + AddAssign + Div<Output = F> + Sub<Output = F> + PartialEq> Polynomial<F>
The following implementations are specific to cyclotomic polynomial rings, i.e., F[ X ] / <X^n + 1>, and are used extensively in Falcon.
sourcepub fn reduce_by_cyclotomic(&self, n: usize) -> Self
pub fn reduce_by_cyclotomic(&self, n: usize) -> Self
Reduce the polynomial by X^n + 1.
sourcepub fn field_norm(&self) -> Self
pub fn field_norm(&self) -> Self
Computes the field norm of the polynomial as an element of the cyclotomic ring F[ X ] / <X^n + 1 > relative to one of half the size, i.e., F[ X ] / <X^(n/2) + 1> .
Corresponds to formula 3.25 in the spec [1, p.30].
sourcepub fn lift_next_cyclotomic(&self) -> Self
pub fn lift_next_cyclotomic(&self) -> Self
Lifts an element from a cyclotomic polynomial ring to one of double the size.
sourcepub fn galois_adjoint(&self) -> Self
pub fn galois_adjoint(&self) -> Self
Computes the galois adjoint of the polynomial in the cyclotomic ring F[ X ] / < X^n + 1 > , which corresponds to f(x^2).
source§impl<F: Mul<Output = F> + Sub<Output = F> + AddAssign + Zero + Div<Output = F> + Clone> Polynomial<F>
impl<F: Mul<Output = F> + Sub<Output = F> + AddAssign + Zero + Div<Output = F> + Clone> Polynomial<F>
source§impl<F: Zero + Clone> Polynomial<F>
impl<F: Zero + Clone> Polynomial<F>
source§impl Polynomial<FalconFelt>
impl Polynomial<FalconFelt>
pub fn norm_squared(&self) -> u64
sourcepub fn to_elements(&self) -> Vec<Felt>
pub fn to_elements(&self) -> Vec<Felt>
Returns the coefficients of this polynomial as field elements.
sourcepub fn mul_modulo_p(a: &Self, b: &Self) -> [u64; 1024]
pub fn mul_modulo_p(a: &Self, b: &Self) -> [u64; 1024]
Multiplies two polynomials over Z_p[x] without reducing modulo p. Given that the degrees of the input polynomials are less than 512 and their coefficients are less than the modulus q equal to 12289, the resulting product polynomial is guaranteed to have coefficients less than the Miden prime.
Note that this multiplication is not over Z_p[x]/(phi).
sourcepub fn reduce_negacyclic(a: &[u64; 1024]) -> Self
pub fn reduce_negacyclic(a: &[u64; 1024]) -> Self
Reduces a polynomial, that is the product of two polynomials over Z_p[x], modulo the irreducible polynomial phi. This results in an element in Z_p[x]/(phi).
Trait Implementations§
source§impl<F> Add for &Polynomial<F>
impl<F> Add for &Polynomial<F>
source§impl<F> Add for Polynomial<F>
impl<F> Add for Polynomial<F>
source§impl<F> AddAssign for Polynomial<F>
impl<F> AddAssign for Polynomial<F>
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moresource§impl<F: Clone> Clone for Polynomial<F>
impl<F: Clone> Clone for Polynomial<F>
source§fn clone(&self) -> Polynomial<F>
fn clone(&self) -> Polynomial<F>
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<F: Debug> Debug for Polynomial<F>
impl<F: Debug> Debug for Polynomial<F>
source§impl<F: Default> Default for Polynomial<F>
impl<F: Default> Default for Polynomial<F>
source§fn default() -> Polynomial<F>
fn default() -> Polynomial<F>
source§impl<F> Div for Polynomial<F>
impl<F> Div for Polynomial<F>
source§impl From<&Polynomial<FalconFelt>> for Polynomial<Felt>
impl From<&Polynomial<FalconFelt>> for Polynomial<Felt>
source§fn from(item: &Polynomial<FalconFelt>) -> Self
fn from(item: &Polynomial<FalconFelt>) -> Self
source§impl From<&Polynomial<i16>> for Polynomial<FalconFelt>
impl From<&Polynomial<i16>> for Polynomial<FalconFelt>
source§fn from(item: &Polynomial<i16>) -> Self
fn from(item: &Polynomial<i16>) -> Self
source§impl From<Polynomial<FalconFelt>> for Polynomial<Felt>
impl From<Polynomial<FalconFelt>> for Polynomial<Felt>
source§fn from(item: Polynomial<FalconFelt>) -> Self
fn from(item: Polynomial<FalconFelt>) -> Self
source§impl From<Polynomial<FalconFelt>> for PubKeyPoly
impl From<Polynomial<FalconFelt>> for PubKeyPoly
source§fn from(pk_poly: Polynomial<FalconFelt>) -> Self
fn from(pk_poly: Polynomial<FalconFelt>) -> Self
source§impl From<Polynomial<FalconFelt>> for SignaturePoly
impl From<Polynomial<FalconFelt>> for SignaturePoly
source§fn from(pk_poly: Polynomial<FalconFelt>) -> Self
fn from(pk_poly: Polynomial<FalconFelt>) -> Self
source§impl From<Polynomial<i16>> for Polynomial<FalconFelt>
impl From<Polynomial<i16>> for Polynomial<FalconFelt>
source§fn from(item: Polynomial<i16>) -> Self
fn from(item: Polynomial<i16>) -> Self
source§impl<F> Mul for &Polynomial<F>
impl<F> Mul for &Polynomial<F>
source§impl<F> Mul for Polynomial<F>
impl<F> Mul for Polynomial<F>
source§impl<F> One for Polynomial<F>
impl<F> One for Polynomial<F>
source§impl<F> PartialEq for Polynomial<F>
impl<F> PartialEq for Polynomial<F>
source§impl<F> Sub for &Polynomial<F>
impl<F> Sub for &Polynomial<F>
source§impl<F> Sub for Polynomial<F>
impl<F> Sub for Polynomial<F>
source§impl<F> SubAssign for Polynomial<F>
impl<F> SubAssign for Polynomial<F>
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read moresource§impl<F> Zero for Polynomial<F>
impl<F> Zero for Polynomial<F>
impl<F> Eq for Polynomial<F>
Auto Trait Implementations§
impl<F> Freeze for Polynomial<F>
impl<F> RefUnwindSafe for Polynomial<F>where
F: RefUnwindSafe,
impl<F> Send for Polynomial<F>where
F: Send,
impl<F> Sync for Polynomial<F>where
F: Sync,
impl<F> Unpin for Polynomial<F>where
F: Unpin,
impl<F> UnwindSafe for Polynomial<F>where
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)