pub struct Fp { /* private fields */ }Expand description
An element of GF(p) for a prime p < 2^64 chosen at runtime.
Fp::zero() and Fp::one() carry no modulus (p = 0) and adopt the modulus of whatever they
meet, so generic code that starts from F::zero() or F::one() works unchanged.
Implementations§
Source§impl Fp
impl Fp
pub fn from_i64(x: i64, p: u64) -> Self
Sourcepub fn from_rational(q: &BigRational, p: u64) -> Option<Self>
pub fn from_rational(q: &BigRational, p: u64) -> Option<Self>
q modulo p, or None when p divides its denominator.
pub const fn value(self) -> u64
Sourcepub const fn try_inverse(self) -> Option<Self>
pub const fn try_inverse(self) -> Option<Self>
The inverse, or None for a non-unit: zero, a residue sharing a factor with a composite
modulus, or an unbound constant other than 1 and -1.
pub fn bind(self, p: u64) -> Self
Trait Implementations§
impl Copy for Fp
impl Eq for Fp
Source§impl Hash for Fp
Hashes the symmetric residue, so equal elements of one field hash alike and an unbound
constant hashes like its binding whenever it is below p / 2 in magnitude.
impl Hash for Fp
Hashes the symmetric residue, so equal elements of one field hash alike and an unbound
constant hashes like its binding whenever it is below p / 2 in magnitude.
Source§impl Modular for Fp
impl Modular for Fp
Auto Trait Implementations§
impl Freeze for Fp
impl RefUnwindSafe for Fp
impl Send for Fp
impl Sync for Fp
impl Unpin for Fp
impl UnsafeUnpin for Fp
impl UnwindSafe for Fp
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