Struct classgroup::gmp::mpz::Mpz
source · #[repr(transparent)]pub struct Mpz { /* private fields */ }
Implementations§
source§impl Mpz
impl Mpz
pub unsafe fn inner(&self) -> mpz_srcptr
pub unsafe fn inner_mut(&mut self) -> mpz_ptr
pub fn new() -> Mpz
pub fn new_reserve(n: usize) -> Mpz
pub fn reserve(&mut self, n: usize)
pub fn size_in_base(&self, base: u8) -> usize
pub fn to_str_radix(&self, base: u8) -> String
pub fn from_str_radix(s: &str, base: u8) -> Result<Mpz, ParseMpzError>
pub fn set(&mut self, other: &Mpz)
pub fn set_from_str_radix(&mut self, s: &str, base: u8) -> bool
pub fn bit_length(&self) -> usize
pub fn compl(&self) -> Mpz
pub fn abs(&self) -> Mpz
pub fn div_floor(&self, other: &Mpz) -> Mpz
pub fn mod_floor(&self, other: &Mpz) -> Mpz
sourcepub fn probab_prime(&self, reps: i32) -> ProbabPrimeResult
pub fn probab_prime(&self, reps: i32) -> ProbabPrimeResult
Determine whether n is prime.
This function performs some trial divisions, then reps Miller-Rabin probabilistic primality tests. A higher reps value will reduce the chances of a non-prime being identified as “probably prime”. A composite number will be identified as a prime with a probability of less than 4^(-reps). Reasonable values of reps are between 15 and 50.
pub fn nextprime(&self) -> Mpz
pub fn gcd(&self, other: &Mpz) -> Mpz
sourcepub fn gcdext(&self, other: &Mpz) -> (Mpz, Mpz, Mpz)
pub fn gcdext(&self, other: &Mpz) -> (Mpz, Mpz, Mpz)
Given (a, b), return (g, s, t) such that g = gcd(a, b) = sa + tb.
pub fn lcm(&self, other: &Mpz) -> Mpz
pub fn is_multiple_of(&self, other: &Mpz) -> bool
pub fn divides(&self, other: &Mpz) -> bool
pub fn modulus(&self, modulo: &Mpz) -> Mpz
pub fn invert(&self, modulo: &Mpz) -> Option<Mpz>
pub fn popcount(&self) -> usize
pub fn pow(&self, exp: u32) -> Mpz
pub fn powm(&self, exp: &Mpz, modulus: &Mpz) -> Mpz
pub fn powm_sec(&self, exp: &Mpz, modulus: &Mpz) -> Mpz
pub fn ui_pow_ui(x: u32, y: u32) -> Mpz
pub fn hamdist(&self, other: &Mpz) -> usize
pub fn setbit(&mut self, bit_index: usize)
pub fn clrbit(&mut self, bit_index: usize)
pub fn combit(&mut self, bit_index: usize)
pub fn tstbit(&self, bit_index: usize) -> bool
pub fn root(&self, n: u32) -> Mpz
pub fn sqrt(&self) -> Mpz
pub fn millerrabin(&self, reps: i32) -> i32
pub fn sign(&self) -> Sign
pub fn one() -> Mpz
pub fn zero() -> Mpz
pub fn is_zero(&self) -> bool
Trait Implementations§
source§impl<'a> AddAssign<&'a Mpz> for Mpz
impl<'a> AddAssign<&'a Mpz> for Mpz
source§fn add_assign(&mut self, other: &Mpz)
fn add_assign(&mut self, other: &Mpz)
Performs the
+=
operation. Read moresource§impl AddAssign<Mpz> for Mpz
impl AddAssign<Mpz> for Mpz
source§fn add_assign(&mut self, other: Mpz)
fn add_assign(&mut self, other: Mpz)
Performs the
+=
operation. Read moresource§impl AddAssign<u64> for Mpz
impl AddAssign<u64> for Mpz
source§fn add_assign(&mut self, other: u64)
fn add_assign(&mut self, other: u64)
Performs the
+=
operation. Read moresource§impl<'a> BitAndAssign<&'a Mpz> for Mpz
impl<'a> BitAndAssign<&'a Mpz> for Mpz
source§fn bitand_assign(&mut self, other: &Mpz)
fn bitand_assign(&mut self, other: &Mpz)
Performs the
&=
operation. Read moresource§impl BitAndAssign<Mpz> for Mpz
impl BitAndAssign<Mpz> for Mpz
source§fn bitand_assign(&mut self, other: Mpz)
fn bitand_assign(&mut self, other: Mpz)
Performs the
&=
operation. Read moresource§impl<'a> BitOrAssign<&'a Mpz> for Mpz
impl<'a> BitOrAssign<&'a Mpz> for Mpz
source§fn bitor_assign(&mut self, other: &Mpz)
fn bitor_assign(&mut self, other: &Mpz)
Performs the
|=
operation. Read moresource§impl BitOrAssign<Mpz> for Mpz
impl BitOrAssign<Mpz> for Mpz
source§fn bitor_assign(&mut self, other: Mpz)
fn bitor_assign(&mut self, other: Mpz)
Performs the
|=
operation. Read moresource§impl<'a> BitXorAssign<&'a Mpz> for Mpz
impl<'a> BitXorAssign<&'a Mpz> for Mpz
source§fn bitxor_assign(&mut self, other: &Mpz)
fn bitxor_assign(&mut self, other: &Mpz)
Performs the
^=
operation. Read moresource§impl BitXorAssign<Mpz> for Mpz
impl BitXorAssign<Mpz> for Mpz
source§fn bitxor_assign(&mut self, other: Mpz)
fn bitxor_assign(&mut self, other: Mpz)
Performs the
^=
operation. Read moresource§impl<'a> DivAssign<&'a Mpz> for Mpz
impl<'a> DivAssign<&'a Mpz> for Mpz
source§fn div_assign(&mut self, other: &Mpz)
fn div_assign(&mut self, other: &Mpz)
Performs the
/=
operation. Read moresource§impl DivAssign<Mpz> for Mpz
impl DivAssign<Mpz> for Mpz
source§fn div_assign(&mut self, other: Mpz)
fn div_assign(&mut self, other: Mpz)
Performs the
/=
operation. Read moresource§impl DivAssign<u64> for Mpz
impl DivAssign<u64> for Mpz
source§fn div_assign(&mut self, other: u64)
fn div_assign(&mut self, other: u64)
Performs the
/=
operation. Read moresource§impl<'a> MulAssign<&'a Mpz> for Mpz
impl<'a> MulAssign<&'a Mpz> for Mpz
source§fn mul_assign(&mut self, other: &Mpz)
fn mul_assign(&mut self, other: &Mpz)
Performs the
*=
operation. Read moresource§impl MulAssign<Mpz> for Mpz
impl MulAssign<Mpz> for Mpz
source§fn mul_assign(&mut self, other: Mpz)
fn mul_assign(&mut self, other: Mpz)
Performs the
*=
operation. Read moresource§impl MulAssign<i64> for Mpz
impl MulAssign<i64> for Mpz
source§fn mul_assign(&mut self, other: i64)
fn mul_assign(&mut self, other: i64)
Performs the
*=
operation. Read moresource§impl MulAssign<u64> for Mpz
impl MulAssign<u64> for Mpz
source§fn mul_assign(&mut self, other: u64)
fn mul_assign(&mut self, other: u64)
Performs the
*=
operation. Read moresource§impl Ord for Mpz
impl Ord for Mpz
source§impl PartialOrd<Mpz> for Mpz
impl PartialOrd<Mpz> for Mpz
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> RemAssign<&'a Mpz> for Mpz
impl<'a> RemAssign<&'a Mpz> for Mpz
source§fn rem_assign(&mut self, other: &Mpz)
fn rem_assign(&mut self, other: &Mpz)
Performs the
%=
operation. Read moresource§impl RemAssign<Mpz> for Mpz
impl RemAssign<Mpz> for Mpz
source§fn rem_assign(&mut self, other: Mpz)
fn rem_assign(&mut self, other: Mpz)
Performs the
%=
operation. Read moresource§impl RemAssign<u64> for Mpz
impl RemAssign<u64> for Mpz
source§fn rem_assign(&mut self, other: u64)
fn rem_assign(&mut self, other: u64)
Performs the
%=
operation. Read moresource§impl ShlAssign<usize> for Mpz
impl ShlAssign<usize> for Mpz
source§fn shl_assign(&mut self, other: usize)
fn shl_assign(&mut self, other: usize)
Performs the
<<=
operation. Read moresource§impl ShrAssign<usize> for Mpz
impl ShrAssign<usize> for Mpz
source§fn shr_assign(&mut self, other: usize)
fn shr_assign(&mut self, other: usize)
Performs the
>>=
operation. Read moresource§impl<'a> SubAssign<&'a Mpz> for Mpz
impl<'a> SubAssign<&'a Mpz> for Mpz
source§fn sub_assign(&mut self, other: &Mpz)
fn sub_assign(&mut self, other: &Mpz)
Performs the
-=
operation. Read moresource§impl SubAssign<Mpz> for Mpz
impl SubAssign<Mpz> for Mpz
source§fn sub_assign(&mut self, other: Mpz)
fn sub_assign(&mut self, other: Mpz)
Performs the
-=
operation. Read moresource§impl SubAssign<u64> for Mpz
impl SubAssign<u64> for Mpz
source§fn sub_assign(&mut self, other: u64)
fn sub_assign(&mut self, other: u64)
Performs the
-=
operation. Read more