pub struct Zq<const N: usize, B: ArithmeticBackend<N>> {
pub val: Uint<N>,
/* private fields */
}Expand description
A ring of integers mod q.
Fields§
§val: Uint<N>The value of the Zq stored in its backend-specific representation.
For example, using the BarrettBackend, which is the standard representation
but with a Montgomery backend, this will be stored in Montgomery form.
Implementations§
Source§impl<const N: usize, B: ArithmeticBackend<N>> Zq<N, B>
impl<const N: usize, B: ArithmeticBackend<N>> Zq<N, B>
Sourcepub fn into_bigint(self) -> Uint<N>
pub fn into_bigint(self) -> Uint<N>
Converts the element in Zq over the range [0, q) to a canonical integer with the same number of limbs in the same range.
Trait Implementations§
Source§impl<'de, const N: usize, B: ArithmeticBackend<N>> Deserialize<'de> for Zq<N, B>
impl<'de, const N: usize, B: ArithmeticBackend<N>> Deserialize<'de> for Zq<N, B>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize, B: FieldBackend + ArithmeticBackend<N>> Field for Zq<N, B>
impl<const N: usize, B: FieldBackend + ArithmeticBackend<N>> Field for Zq<N, B>
Source§impl<const N: usize, B: ArithmeticBackend<N>> Ord for Zq<N, B>
impl<const N: usize, B: ArithmeticBackend<N>> Ord for Zq<N, B>
Source§impl<const N: usize, B: ArithmeticBackend<N>> PartialOrd for Zq<N, B>
impl<const N: usize, B: ArithmeticBackend<N>> PartialOrd for Zq<N, B>
Source§impl<B: ArithmeticBackend<M>, const M: usize, const N: usize> RingModulus<N> for Zq<M, B>
impl<B: ArithmeticBackend<M>, const M: usize, const N: usize> RingModulus<N> for Zq<M, B>
Source§fn field_modulus() -> Uint<N>
fn field_modulus() -> Uint<N>
The modulus of the field.
Source§fn field_modulus_div_2() -> Uint<N>
fn field_modulus_div_2() -> Uint<N>
The modulus of the field divided by 2.
impl<const N: usize, B: ArithmeticBackend<N>> Copy for Zq<N, B>
impl<const N: usize, B: ArithmeticBackend<N>> Eq for Zq<N, B>
impl<const N: usize, B: ArithmeticBackend<N>> Ring for Zq<N, B>
Auto Trait Implementations§
impl<const N: usize, B> Freeze for Zq<N, B>
impl<const N: usize, B> RefUnwindSafe for Zq<N, B>where
B: RefUnwindSafe,
impl<const N: usize, B> Send for Zq<N, B>
impl<const N: usize, B> Sync for Zq<N, B>
impl<const N: usize, B> Unpin for Zq<N, B>where
B: Unpin,
impl<const N: usize, B> UnwindSafe for Zq<N, B>where
B: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.