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<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 AddAssign for Mpz
impl AddAssign for Mpz
Source§fn add_assign(&mut self, other: Mpz)
fn add_assign(&mut self, other: Mpz)
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 for Mpz
impl BitAndAssign 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 for Mpz
impl BitOrAssign 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 for Mpz
impl BitXorAssign 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<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 DivAssign for Mpz
impl DivAssign for Mpz
Source§fn div_assign(&mut self, other: Mpz)
fn div_assign(&mut self, other: Mpz)
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<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 MulAssign for Mpz
impl MulAssign for Mpz
Source§fn mul_assign(&mut self, other: Mpz)
fn mul_assign(&mut self, other: Mpz)
Performs the
*= operation. Read moreSource§impl Ord for Mpz
impl Ord for Mpz
Source§impl PartialOrd for Mpz
impl PartialOrd for Mpz
Source§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<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 RemAssign for Mpz
impl RemAssign for Mpz
Source§fn rem_assign(&mut self, other: Mpz)
fn rem_assign(&mut self, other: Mpz)
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<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 moreSource§impl SubAssign for Mpz
impl SubAssign for Mpz
Source§fn sub_assign(&mut self, other: Mpz)
fn sub_assign(&mut self, other: Mpz)
Performs the
-= operation. Read moreimpl Eq for Mpz
impl Send for Mpz
impl Sync for Mpz
Auto Trait Implementations§
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