pub struct Elem<F: Field>(pub F::Int);Expand description
An Elem is a member of the specified prime-order field.
Elements can be added, subtracted, multiplied, and negated, and the overloaded operators will ensure both that the integer values remain in the field, and that the reductions are done efficiently.
For addition and subtraction, a simple conditional subtraction is used; for multiplication, Barrett reduction.
Tuple Fields§
§0: F::IntImplementations§
Trait Implementations§
Source§impl<F: Field<Int: CtEq>> CtEqSlice for Elem<F>
Available on crate feature ctutils only.
impl<F: Field<Int: CtEq>> CtEqSlice for Elem<F>
Available on crate feature
ctutils only.Source§fn ct_eq_slice(a: &[Self], b: &[Self]) -> Choice
fn ct_eq_slice(a: &[Self], b: &[Self]) -> Choice
Determine if
a is equal to b in constant-time.Source§fn ct_ne_slice(a: &[Self], b: &[Self]) -> Choice
fn ct_ne_slice(a: &[Self], b: &[Self]) -> Choice
Determine if
a is NOT equal to b in constant-time.Source§impl<F: Field> Mul<&NttPolynomial<F>> for Elem<F>
impl<F: Field> Mul<&NttPolynomial<F>> for Elem<F>
Source§type Output = NttPolynomial<F>
type Output = NttPolynomial<F>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &NttPolynomial<F>) -> NttPolynomial<F>
fn mul(self, rhs: &NttPolynomial<F>) -> NttPolynomial<F>
Performs the
* operation. Read moreSource§impl<F: Field> Mul<&Polynomial<F>> for Elem<F>
impl<F: Field> Mul<&Polynomial<F>> for Elem<F>
Source§type Output = Polynomial<F>
type Output = Polynomial<F>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &Polynomial<F>) -> Polynomial<F>
fn mul(self, rhs: &Polynomial<F>) -> Polynomial<F>
Performs the
* operation. Read moreimpl<F: Copy + Field> Copy for Elem<F>
impl<F: Eq + Field> Eq for Elem<F>
impl<F: Field> StructuralPartialEq for Elem<F>
Auto Trait Implementations§
impl<F> Freeze for Elem<F>
impl<F> RefUnwindSafe for Elem<F>
impl<F> Send for Elem<F>
impl<F> Sync for Elem<F>
impl<F> Unpin for Elem<F>
impl<F> UnsafeUnpin for Elem<F>
impl<F> UnwindSafe for Elem<F>
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