# Struct gmp::mpz::Mpz
[−]
[src]

pub struct Mpz { /* fields omitted */ }

## Methods

`impl Mpz`

[src]

`unsafe fn inner(&self) -> mpz_srcptr`

`unsafe fn inner_mut(&mut self) -> mpz_ptr`

`fn new() -> Mpz`

`fn new_reserve(n: usize) -> Mpz`

`fn reserve(&mut self, n: usize)`

`fn size_in_base(&self, base: u8) -> usize`

`fn to_str_radix(&self, base: u8) -> String`

`fn from_str_radix(s: &str, base: u8) -> Result<Mpz, ParseMpzError>`

`fn set(&mut self, other: &Mpz)`

`fn set_from_str_radix(&mut self, s: &str, base: u8) -> bool`

`fn bit_length(&self) -> usize`

`fn compl(&self) -> Mpz`

`fn abs(&self) -> Mpz`

`fn div_floor(&self, other: &Mpz) -> Mpz`

`fn mod_floor(&self, other: &Mpz) -> Mpz`

`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.

`fn nextprime(&self) -> Mpz`

`fn gcd(&self, other: &Mpz) -> Mpz`

`fn gcdext(&self, other: &Mpz) -> (Mpz, Mpz, Mpz)`

Given (a, b), return (g, s, t) such that g = gcd(a, b) = s*a + t*b.

`fn lcm(&self, other: &Mpz) -> Mpz`

`fn is_multiple_of(&self, other: &Mpz) -> bool`

`fn divides(&self, other: &Mpz) -> bool`

`fn modulus(&self, modulo: &Mpz) -> Mpz`

`fn invert(&self, modulo: &Mpz) -> Option<Mpz>`

`fn popcount(&self) -> usize`

`fn pow(&self, exp: u32) -> Mpz`

`fn powm(&self, exp: &Mpz, modulus: &Mpz) -> Mpz`

`fn powm_sec(&self, exp: &Mpz, modulus: &Mpz) -> Mpz`

`fn ui_pow_ui(x: u32, y: u32) -> Mpz`

`fn hamdist(&self, other: &Mpz) -> usize`

`fn setbit(&mut self, bit_index: usize)`

`fn clrbit(&mut self, bit_index: usize)`

`fn combit(&mut self, bit_index: usize)`

`fn tstbit(&self, bit_index: usize) -> bool`

`fn root(&self, n: u32) -> Mpz`

`fn sqrt(&self) -> Mpz`

`fn millerrabin(&self, reps: i32) -> i32`

`fn sign(&self) -> Sign`

`fn one() -> Mpz`

`fn zero() -> Mpz`

`fn is_zero(&self) -> bool`

## Trait Implementations

`impl Send for Mpz`

[src]

`impl Sync for Mpz`

[src]

`impl Drop for Mpz`

[src]

`impl Clone for Mpz`

[src]

`fn clone(&self) -> Mpz`

Returns a copy of the value. Read more

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

1.0.0

Performs copy-assignment from `source`

. Read more

`impl Eq for Mpz`

[src]

`impl PartialEq for Mpz`

[src]

`fn eq(&self, other: &Mpz) -> bool`

This method tests for `self`

and `other`

values to be equal, and is used by `==`

. Read more

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

1.0.0

This method tests for `!=`

.

`impl Ord for Mpz`

[src]

`fn cmp(&self, other: &Mpz) -> Ordering`

This method returns an `Ordering`

between `self`

and `other`

. Read more

`impl PartialOrd for Mpz`

[src]

`fn partial_cmp(&self, other: &Mpz) -> Option<Ordering>`

This method returns an ordering between `self`

and `other`

values if one exists. Read more

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

1.0.0

This method tests less than (for `self`

and `other`

) and is used by the `<`

operator. Read more

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

1.0.0

This method tests less than or equal to (for `self`

and `other`

) and is used by the `<=`

operator. Read more

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

1.0.0

This method tests greater than (for `self`

and `other`

) and is used by the `>`

operator. Read more

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

1.0.0

This method tests greater than or equal to (for `self`

and `other`

) and is used by the `>=`

operator. Read more

`impl Add<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `+`

operator

`fn add(self, other: Mpz) -> Mpz`

The method for the `+`

operator

`impl<'a> Add<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `+`

operator

`fn add(self, other: &Mpz) -> Mpz`

The method for the `+`

operator

`impl<'a> Add<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `+`

operator

`fn add(self, other: Mpz) -> Mpz`

The method for the `+`

operator

`impl<'a, 'b> Add<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `+`

operator

`fn add(self, other: &Mpz) -> Mpz`

The method for the `+`

operator

`impl AddAssign<Mpz> for Mpz`

[src]

`fn add_assign(&mut self, other: Mpz)`

The method for the `+=`

operator

`impl<'a> AddAssign<&'a Mpz> for Mpz`

[src]

`fn add_assign(&mut self, other: &Mpz)`

The method for the `+=`

operator

`impl Add<u64> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `+`

operator

`fn add(self, other: u64) -> Mpz`

The method for the `+`

operator

`impl<'a> Add<u64> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `+`

operator

`fn add(self, other: u64) -> Mpz`

The method for the `+`

operator

`impl AddAssign<u64> for Mpz`

[src]

`fn add_assign(&mut self, other: u64)`

The method for the `+=`

operator

`impl Sub<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn sub(self, other: Mpz) -> Mpz`

The method for the `-`

operator

`impl<'a> Sub<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn sub(self, other: &Mpz) -> Mpz`

The method for the `-`

operator

`impl<'a> Sub<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn sub(self, other: Mpz) -> Mpz`

The method for the `-`

operator

`impl<'a, 'b> Sub<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn sub(self, other: &Mpz) -> Mpz`

The method for the `-`

operator

`impl SubAssign<Mpz> for Mpz`

[src]

`fn sub_assign(&mut self, other: Mpz)`

The method for the `-=`

operator

`impl<'a> SubAssign<&'a Mpz> for Mpz`

[src]

`fn sub_assign(&mut self, other: &Mpz)`

The method for the `-=`

operator

`impl Sub<u64> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn sub(self, other: u64) -> Mpz`

The method for the `-`

operator

`impl<'a> Sub<u64> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn sub(self, other: u64) -> Mpz`

The method for the `-`

operator

`impl SubAssign<u64> for Mpz`

[src]

`fn sub_assign(&mut self, other: u64)`

The method for the `-=`

operator

`impl Mul<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: Mpz) -> Mpz`

The method for the `*`

operator

`impl<'a> Mul<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: &Mpz) -> Mpz`

The method for the `*`

operator

`impl<'a> Mul<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: Mpz) -> Mpz`

The method for the `*`

operator

`impl<'a, 'b> Mul<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: &Mpz) -> Mpz`

The method for the `*`

operator

`impl MulAssign<Mpz> for Mpz`

[src]

`fn mul_assign(&mut self, other: Mpz)`

The method for the `*=`

operator

`impl<'a> MulAssign<&'a Mpz> for Mpz`

[src]

`fn mul_assign(&mut self, other: &Mpz)`

The method for the `*=`

operator

`impl Mul<i64> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: i64) -> Mpz`

The method for the `*`

operator

`impl<'a> Mul<i64> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: i64) -> Mpz`

The method for the `*`

operator

`impl MulAssign<i64> for Mpz`

[src]

`fn mul_assign(&mut self, other: i64)`

The method for the `*=`

operator

`impl Mul<u64> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: u64) -> Mpz`

The method for the `*`

operator

`impl<'a> Mul<u64> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `*`

operator

`fn mul(self, other: u64) -> Mpz`

The method for the `*`

operator

`impl MulAssign<u64> for Mpz`

[src]

`fn mul_assign(&mut self, other: u64)`

The method for the `*=`

operator

`impl Div<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `/`

operator

`fn div(self, other: Mpz) -> Mpz`

The method for the `/`

operator

`impl<'a> Div<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `/`

operator

`fn div(self, other: &Mpz) -> Mpz`

The method for the `/`

operator

`impl<'a> Div<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `/`

operator

`fn div(self, other: Mpz) -> Mpz`

The method for the `/`

operator

`impl<'a, 'b> Div<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `/`

operator

`fn div(self, other: &Mpz) -> Mpz`

The method for the `/`

operator

`impl DivAssign<Mpz> for Mpz`

[src]

`fn div_assign(&mut self, other: Mpz)`

The method for the `/=`

operator

`impl<'a> DivAssign<&'a Mpz> for Mpz`

[src]

`fn div_assign(&mut self, other: &Mpz)`

The method for the `/=`

operator

`impl Div<u64> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `/`

operator

`fn div(self, other: u64) -> Mpz`

The method for the `/`

operator

`impl<'a> Div<u64> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `/`

operator

`fn div(self, other: u64) -> Mpz`

The method for the `/`

operator

`impl DivAssign<u64> for Mpz`

[src]

`fn div_assign(&mut self, other: u64)`

The method for the `/=`

operator

`impl Rem<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `%`

operator

`fn rem(self, other: Mpz) -> Mpz`

The method for the `%`

operator

`impl<'a> Rem<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `%`

operator

`fn rem(self, other: &Mpz) -> Mpz`

The method for the `%`

operator

`impl<'a> Rem<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `%`

operator

`fn rem(self, other: Mpz) -> Mpz`

The method for the `%`

operator

`impl<'a, 'b> Rem<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `%`

operator

`fn rem(self, other: &Mpz) -> Mpz`

The method for the `%`

operator

`impl RemAssign<Mpz> for Mpz`

[src]

`fn rem_assign(&mut self, other: Mpz)`

The method for the `%=`

operator

`impl<'a> RemAssign<&'a Mpz> for Mpz`

[src]

`fn rem_assign(&mut self, other: &Mpz)`

The method for the `%=`

operator

`impl Rem<u64> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `%`

operator

`fn rem(self, other: u64) -> Mpz`

The method for the `%`

operator

`impl<'a> Rem<u64> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `%`

operator

`fn rem(self, other: u64) -> Mpz`

The method for the `%`

operator

`impl RemAssign<u64> for Mpz`

[src]

`fn rem_assign(&mut self, other: u64)`

The method for the `%=`

operator

`impl<'b> Neg for &'b Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn neg(self) -> Mpz`

The method for the unary `-`

operator

`impl Neg for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `-`

operator

`fn neg(self) -> Mpz`

The method for the unary `-`

operator

`impl<'b> Not for &'b Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `!`

operator

`fn not(self) -> Mpz`

The method for the unary `!`

operator

`impl Not for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `!`

operator

`fn not(self) -> Mpz`

The method for the unary `!`

operator

`impl<'a> From<&'a [u8]> for Mpz`

[src]

`impl From<u64> for Mpz`

[src]

`impl From<u32> for Mpz`

[src]

`impl From<i64> for Mpz`

[src]

`impl From<i32> for Mpz`

[src]

`impl BitAnd<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `&`

operator

`fn bitand(self, other: Mpz) -> Mpz`

The method for the `&`

operator

`impl<'a> BitAnd<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `&`

operator

`fn bitand(self, other: &Mpz) -> Mpz`

The method for the `&`

operator

`impl<'a> BitAnd<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `&`

operator

`fn bitand(self, other: Mpz) -> Mpz`

The method for the `&`

operator

`impl<'a, 'b> BitAnd<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `&`

operator

`fn bitand(self, other: &Mpz) -> Mpz`

The method for the `&`

operator

`impl BitAndAssign<Mpz> for Mpz`

[src]

`fn bitand_assign(&mut self, other: Mpz)`

The method for the `&=`

operator

`impl<'a> BitAndAssign<&'a Mpz> for Mpz`

[src]

`fn bitand_assign(&mut self, other: &Mpz)`

The method for the `&=`

operator

`impl BitOr<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `|`

operator

`fn bitor(self, other: Mpz) -> Mpz`

The method for the `|`

operator

`impl<'a> BitOr<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `|`

operator

`fn bitor(self, other: &Mpz) -> Mpz`

The method for the `|`

operator

`impl<'a> BitOr<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `|`

operator

`fn bitor(self, other: Mpz) -> Mpz`

The method for the `|`

operator

`impl<'a, 'b> BitOr<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `|`

operator

`fn bitor(self, other: &Mpz) -> Mpz`

The method for the `|`

operator

`impl BitOrAssign<Mpz> for Mpz`

[src]

`fn bitor_assign(&mut self, other: Mpz)`

The method for the `|=`

operator

`impl<'a> BitOrAssign<&'a Mpz> for Mpz`

[src]

`fn bitor_assign(&mut self, other: &Mpz)`

The method for the `|=`

operator

`impl BitXor<Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `^`

operator

`fn bitxor(self, other: Mpz) -> Mpz`

The method for the `^`

operator

`impl<'a> BitXor<&'a Mpz> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `^`

operator

`fn bitxor(self, other: &Mpz) -> Mpz`

The method for the `^`

operator

`impl<'a> BitXor<Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `^`

operator

`fn bitxor(self, other: Mpz) -> Mpz`

The method for the `^`

operator

`impl<'a, 'b> BitXor<&'b Mpz> for &'a Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `^`

operator

`fn bitxor(self, other: &Mpz) -> Mpz`

The method for the `^`

operator

`impl BitXorAssign<Mpz> for Mpz`

[src]

`fn bitxor_assign(&mut self, other: Mpz)`

The method for the `^=`

operator

`impl<'a> BitXorAssign<&'a Mpz> for Mpz`

[src]

`fn bitxor_assign(&mut self, other: &Mpz)`

The method for the `^=`

operator

`impl<'b> Shl<usize> for &'b Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `<<`

operator

`fn shl(self, other: usize) -> Mpz`

The method for the `<<`

operator

`impl<'b> Shr<usize> for &'b Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `>>`

operator

`fn shr(self, other: usize) -> Mpz`

The method for the `>>`

operator

`impl Shl<usize> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `<<`

operator

`fn shl(self, other: usize) -> Mpz`

The method for the `<<`

operator

`impl Shr<usize> for Mpz`

[src]

`type Output = Mpz`

The resulting type after applying the `>>`

operator

`fn shr(self, other: usize) -> Mpz`

The method for the `>>`

operator

`impl ShlAssign<usize> for Mpz`

[src]

`fn shl_assign(&mut self, other: usize)`

The method for the `<<=`

operator

`impl ShrAssign<usize> for Mpz`

[src]

`fn shr_assign(&mut self, other: usize)`

The method for the `>>=`

operator

`impl FromStr for Mpz`

[src]

`type Err = ParseMpzError`

The associated error which can be returned from parsing.

`fn from_str(s: &str) -> Result<Self, Self::Err>`

Parses a string `s`

to return a value of this type. Read more

`impl Display for Mpz`

[src]

`impl Debug for Mpz`

[src]

`impl Hash for Mpz`

[src]

`fn hash<S: Hasher>(&self, state: &mut S)`

Feeds this value into the given [`Hasher`

]. Read more

`fn hash_slice<H>(data: &[Self], state: &mut H) where`

H: Hasher,

1.3.0

H: Hasher,

Feeds a slice of this type into the given [`Hasher`

]. Read more

`impl Zero for Mpz`

[src]

`fn zero() -> Mpz`

Returns the additive identity element of `Self`

, `0`

. Read more

`fn is_zero(&self) -> bool`

Returns `true`

if `self`

is equal to the additive identity.