Elem

Struct Elem 

Source
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::Int

Implementations§

Source§

impl<F: Field> Elem<F>

Source

pub const fn new(x: F::Int) -> Self

Trait Implementations§

Source§

impl<F: Field> Add for Elem<F>

Source§

type Output = Elem<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Elem<F>) -> Elem<F>

Performs the + operation. Read more
Source§

impl AlgebraExt for Elem<BaseField>

Source§

fn mod_plus_minus<M: Unsigned>(&self) -> Self

Source§

fn infinity_norm(&self) -> u32

Source§

fn power2round(&self) -> (Self, Self)

Source§

fn high_bits<TwoGamma2: Unsigned>(&self) -> Self

Source§

fn low_bits<TwoGamma2: Unsigned>(&self) -> Self

Source§

impl<F: Clone + Field> Clone for Elem<F>
where F::Int: Clone,

Source§

fn clone(&self) -> Elem<F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug + Field> Debug for Elem<F>
where F::Int: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decompose for Elem<BaseField>

Source§

fn decompose<TwoGamma2: Unsigned>(self) -> (Elem<BaseField>, Elem<BaseField>)

Source§

impl<F: Default + Field> Default for Elem<F>
where F::Int: Default,

Source§

fn default() -> Elem<F>

Returns the “default value” for a type. Read more
Source§

impl<F: Field> Mul<&NttPolynomial<F>> for Elem<F>

Source§

type Output = NttPolynomial<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NttPolynomial<F>) -> NttPolynomial<F>

Performs the * operation. Read more
Source§

impl<F: Field> Mul<&Polynomial<F>> for Elem<F>

Source§

type Output = Polynomial<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Polynomial<F>) -> Polynomial<F>

Performs the * operation. Read more
Source§

impl<F: Field, K: ArraySize> Mul<&Vector<F, K>> for Elem<F>

Source§

type Output = Vector<F, K>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vector<F, K>) -> Vector<F, K>

Performs the * operation. Read more
Source§

impl<F: Field> Mul for Elem<F>

Source§

type Output = Elem<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Elem<F>) -> Elem<F>

Performs the * operation. Read more
Source§

impl<F: Field> Neg for Elem<F>

Source§

type Output = Elem<F>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Elem<F>

Performs the unary - operation. Read more
Source§

impl<F: PartialEq + Field> PartialEq for Elem<F>
where F::Int: PartialEq,

Source§

fn eq(&self, other: &Elem<F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: Field> Sub for Elem<F>

Source§

type Output = Elem<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Elem<F>) -> Elem<F>

Performs the - operation. Read more
Source§

impl<F: Copy + Field> Copy for Elem<F>
where F::Int: Copy,

Source§

impl<F: Field> StructuralPartialEq for Elem<F>

Auto Trait Implementations§

§

impl<F> Freeze for Elem<F>
where <F as Field>::Int: Freeze,

§

impl<F> RefUnwindSafe for Elem<F>
where <F as Field>::Int: RefUnwindSafe,

§

impl<F> Send for Elem<F>
where <F as Field>::Int: Send,

§

impl<F> Sync for Elem<F>
where <F as Field>::Int: Sync,

§

impl<F> Unpin for Elem<F>
where <F as Field>::Int: Unpin,

§

impl<F> UnwindSafe for Elem<F>
where <F as Field>::Int: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.