pub struct FieldElement(pub u16);Expand description
An element of GF(q). Although q is only 16 bits wide, we use a wider uint type to so that we
can defer modular reductions.
Tuple Fields§
§0: u16Implementations§
Source§impl FieldElement
impl FieldElement
pub const Q: u16 = 3_329u16
pub const Q32: u32 = 3_329u32
pub const Q64: u64 = 3_329u64
const BARRETT_SHIFT: usize = 24usize
const BARRETT_MULTIPLIER: u64 = 5_039u64
fn small_reduce(x: u16) -> u16
fn barrett_reduce(x: u32) -> u16
fn base_case_multiply( a0: Self, a1: Self, b0: Self, b1: Self, i: usize, ) -> (Self, Self)
Trait Implementations§
Source§impl Add for FieldElement
impl Add for FieldElement
Source§impl Clone for FieldElement
impl Clone for FieldElement
Source§fn clone(&self) -> FieldElement
fn clone(&self) -> FieldElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Compress for FieldElement
impl Compress for FieldElement
fn compress<D: CompressionFactor>(&mut self) -> &Self
fn decompress<D: CompressionFactor>(&mut self) -> &Self
Source§impl Debug for FieldElement
impl Debug for FieldElement
Source§impl Default for FieldElement
impl Default for FieldElement
Source§fn default() -> FieldElement
fn default() -> FieldElement
Returns the “default value” for a type. Read more
Source§impl Mul<&Polynomial> for FieldElement
impl Mul<&Polynomial> for FieldElement
Source§type Output = Polynomial
type Output = Polynomial
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &Polynomial) -> Polynomial
fn mul(self, rhs: &Polynomial) -> Polynomial
Performs the
* operation. Read moreSource§impl Mul for FieldElement
impl Mul for FieldElement
Source§type Output = FieldElement
type Output = FieldElement
The resulting type after applying the
* operator.Source§fn mul(self, rhs: FieldElement) -> FieldElement
fn mul(self, rhs: FieldElement) -> FieldElement
Performs the
* operation. Read moreSource§impl PartialEq for FieldElement
impl PartialEq for FieldElement
Source§impl Sub for FieldElement
impl Sub for FieldElement
impl Copy for FieldElement
impl StructuralPartialEq for FieldElement
Auto Trait Implementations§
impl Freeze for FieldElement
impl RefUnwindSafe for FieldElement
impl Send for FieldElement
impl Sync for FieldElement
impl Unpin for FieldElement
impl UnwindSafe for FieldElement
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
Mutably borrows from an owned value. Read more