#[repr(transparent)]pub struct M31(pub u32);Tuple Fields§
§0: u32Implementations§
Source§impl M31
impl M31
Sourcepub fn partial_reduce(val: u32) -> Self
pub fn partial_reduce(val: u32) -> Self
Returns val % P when val is in the range [0, 2P).
use stwo::core::fields::m31::{M31, P};
let val = 2 * P - 19;
assert_eq!(M31::partial_reduce(val), M31::from(P - 19));Sourcepub const fn reduce(val: u64) -> Self
pub const fn reduce(val: u64) -> Self
Returns val % P when val is in the range [0, P^2).
use stwo::core::fields::m31::{M31, P};
let val = (P as u64).pow(2) - 19;
assert_eq!(M31::reduce(val), M31::from(P - 19));pub const fn from_u32_unchecked(arg: u32) -> Self
pub fn inverse(&self) -> Self
Trait Implementations§
Source§impl AddAssign for M31
impl AddAssign for M31
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl AddAssign<M31> for CM31
impl AddAssign<M31> for CM31
Source§fn add_assign(&mut self, rhs: M31)
fn add_assign(&mut self, rhs: M31)
Performs the
+= operation. Read moreSource§impl AddAssign<M31> for QM31
impl AddAssign<M31> for QM31
Source§fn add_assign(&mut self, rhs: M31)
fn add_assign(&mut self, rhs: M31)
Performs the
+= operation. Read moreSource§impl ComplexConjugate for M31
impl ComplexConjugate for M31
Source§fn complex_conjugate(&self) -> Self
fn complex_conjugate(&self) -> Self
Example Read more
impl Copy for M31
Source§impl<'de> Deserialize<'de> for M31
impl<'de> Deserialize<'de> for M31
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 Distribution<M31> for Standard
impl Distribution<M31> for Standard
Source§impl DivAssign for M31
impl DivAssign for M31
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl DivAssign<M31> for CM31
impl DivAssign<M31> for CM31
Source§fn div_assign(&mut self, rhs: M31)
fn div_assign(&mut self, rhs: M31)
Performs the
/= operation. Read moreSource§impl DivAssign<M31> for QM31
impl DivAssign<M31> for QM31
Source§fn div_assign(&mut self, rhs: M31)
fn div_assign(&mut self, rhs: M31)
Performs the
/= operation. Read moreimpl Eq for M31
Source§impl ExtensionOf<M31> for CM31
impl ExtensionOf<M31> for CM31
const EXTENSION_DEGREE: usize
Source§impl ExtensionOf<M31> for QM31
impl ExtensionOf<M31> for QM31
const EXTENSION_DEGREE: usize
Source§impl FieldExpOps for M31
impl FieldExpOps for M31
Source§fn inverse(&self) -> Self
fn inverse(&self) -> Self
use num_traits::One;
use stwo::core::fields::m31::BaseField;
use stwo::core::fields::FieldExpOps;
let v = BaseField::from(19);
assert_eq!(v.inverse() * v, BaseField::one());fn square(&self) -> Self
fn pow(&self, exp: u128) -> Self
fn batch_inverse(column: &[Self]) -> Vec<Self>
Source§impl MulAssign for M31
impl MulAssign for M31
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl MulAssign<M31> for CM31
impl MulAssign<M31> for CM31
Source§fn mul_assign(&mut self, rhs: M31)
fn mul_assign(&mut self, rhs: M31)
Performs the
*= operation. Read moreSource§impl MulAssign<M31> for QM31
impl MulAssign<M31> for QM31
Source§fn mul_assign(&mut self, rhs: M31)
fn mul_assign(&mut self, rhs: M31)
Performs the
*= operation. Read moreSource§impl Num for M31
impl Num for M31
type FromStrRadixErr = Box<dyn Error>
Source§fn from_str_radix(
_str: &str,
_radix: u32,
) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix( _str: &str, _radix: u32, ) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically
2..=36). Read moreSource§impl Ord for M31
impl Ord for M31
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for M31
impl PartialOrd for M31
impl Pod for M31
Source§impl RemAssign for M31
impl RemAssign for M31
Source§fn rem_assign(&mut self, _rhs: Self)
fn rem_assign(&mut self, _rhs: Self)
Performs the
%= operation. Read moreSource§impl RemAssign<M31> for CM31
impl RemAssign<M31> for CM31
Source§fn rem_assign(&mut self, _rhs: M31)
fn rem_assign(&mut self, _rhs: M31)
Performs the
%= operation. Read moreSource§impl RemAssign<M31> for QM31
impl RemAssign<M31> for QM31
Source§fn rem_assign(&mut self, _rhs: M31)
fn rem_assign(&mut self, _rhs: M31)
Performs the
%= operation. Read moreimpl StructuralPartialEq for M31
Source§impl SubAssign for M31
impl SubAssign for M31
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl SubAssign<M31> for CM31
impl SubAssign<M31> for CM31
Source§fn sub_assign(&mut self, rhs: M31)
fn sub_assign(&mut self, rhs: M31)
Performs the
-= operation. Read moreSource§impl SubAssign<M31> for QM31
impl SubAssign<M31> for QM31
Source§fn sub_assign(&mut self, rhs: M31)
fn sub_assign(&mut self, rhs: M31)
Performs the
-= operation. Read moreAuto Trait Implementations§
impl Freeze for M31
impl RefUnwindSafe for M31
impl Send for M31
impl Sync for M31
impl Unpin for M31
impl UnsafeUnpin for M31
impl UnwindSafe for M31
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<F> ExtensionOf<F> for Fwhere
F: Field,
impl<F> ExtensionOf<F> for Fwhere
F: Field,
const EXTENSION_DEGREE: usize = const EXTENSION_DEGREE: usize = 1;
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more