#[repr(C)]pub struct __mpz_struct {
pub _mp_alloc: int_t,
pub _mp_size: int_t,
pub _mp_d: *mut mp_limb_t,
}Expand description
__mpz_struct
Fields§
§_mp_alloc: int_t_mp_alloc
_mp_size: int_t_mp_size
_mp_d: *mut mp_limb_t_mp_d
Implementations§
Source§impl __mpz_struct
impl mpz_s
impl __mpz_struct
impl mpz_s
Sourcepub fn init2(n: mp_bitcnt_t) -> Self
pub fn init2(n: mp_bitcnt_t) -> Self
init2 with prec create new instance
Sourcepub fn init_set_ui(u: ui_t) -> Self
pub fn init_set_ui(u: ui_t) -> Self
init_set_ui create new instance
Sourcepub fn init_set_si(s: si_t) -> Self
pub fn init_set_si(s: si_t) -> Self
init_set_si create new instance
Sourcepub fn init_set_d(d: double_t) -> Self
pub fn init_set_d(d: double_t) -> Self
init_set_d create new instance
Sourcepub fn init_set_str(s: &str, b: int_t) -> Self
pub fn init_set_str(s: &str, b: int_t) -> Self
init_set_str create new instance
Sourcepub fn get_d_2exp(&self) -> (double_t, si_t)
pub fn get_d_2exp(&self) -> (double_t, si_t)
get_d_2exp (loss of digits)
Sourcepub fn realloc2(&mut self, n: mp_bitcnt_t) -> &mut Self
pub fn realloc2(&mut self, n: mp_bitcnt_t) -> &mut Self
realloc2
Sourcepub fn limbs_read(&self) -> &[mp_limb_t] ⓘ
pub fn limbs_read(&self) -> &[mp_limb_t] ⓘ
limbs_read slice
Sourcepub fn limbs_write(&mut self, sz: mp_size_t) -> &mut [mp_limb_t] ⓘ
pub fn limbs_write(&mut self, sz: mp_size_t) -> &mut [mp_limb_t] ⓘ
limbs_write slice (must call limbs_finish)
Sourcepub fn limbs_modify(&mut self, sz: mp_size_t) -> &mut [mp_limb_t] ⓘ
pub fn limbs_modify(&mut self, sz: mp_size_t) -> &mut [mp_limb_t] ⓘ
limbs_modify slice (same as write)
Sourcepub fn limbs_finish(&mut self, sz: mp_size_t) -> &mut Self
pub fn limbs_finish(&mut self, sz: mp_size_t) -> &mut Self
limbs_finish (used after write or modify to update internal size)
Sourcepub fn roinit_n(&mut self, p: &[mp_limb_t], sz: mp_size_t) -> &mut Self
pub fn roinit_n(&mut self, p: &[mp_limb_t], sz: mp_size_t) -> &mut Self
roinit_n (unsafe) slice single element
Sourcepub fn rootrem(&self, n: ui_t) -> (Self, Self)
pub fn rootrem(&self, n: ui_t) -> (Self, Self)
rootrem (nth root of self, self - root**n) create new instance
Sourcepub fn sqrtrem(&self) -> (Self, Self)
pub fn sqrtrem(&self) -> (Self, Self)
sqrtrem (square root of self, self - root**2) create new instance
Sourcepub fn perfect_power_p(&self) -> bool
pub fn perfect_power_p(&self) -> bool
perfect_power_p
Sourcepub fn perfect_square_p(&self) -> bool
pub fn perfect_square_p(&self) -> bool
perfect_square_p
Sourcepub fn primorial_ui(n: ui_t) -> Self
pub fn primorial_ui(n: ui_t) -> Self
primorial_ui c = 235711*…*p(prev)*p(<=n) create new instance
Sourcepub fn remove(&self, f: mpz_r<'_>) -> (Self, mp_bitcnt_t)
pub fn remove(&self, f: mpz_r<'_>) -> (Self, mp_bitcnt_t)
remove create new instance
Sourcepub fn lucnum2_ui(n: ui_t) -> (Self, Self)
pub fn lucnum2_ui(n: ui_t) -> (Self, Self)
lucnum2_ui create new instance (l_n, l_n_1)
Sourcepub fn gcd_ui(&self, u: ui_t) -> (Self, ui_t)
pub fn gcd_ui(&self, u: ui_t) -> (Self, ui_t)
gcd_ui create new instance (gcd, gcd: ui_t) return 0 when gcd does not fit to ui_t
Sourcepub fn gcdext(&self, b: mpz_r<'_>) -> (Self, Self, Self)
pub fn gcdext(&self, b: mpz_r<'_>) -> (Self, Self, Self)
gcdext create new instance (gcd, s, t) s and t to coefficients satisfying as + bt == gcd
Sourcepub fn probab_prime_p(&self, r: int_t) -> int_t
pub fn probab_prime_p(&self, r: int_t) -> int_t
probab_prime_p 2 or 1 or 0
Sourcepub fn invert(a: mpz_r<'_>, b: mpz_r<'_>) -> (Self, int_t)
pub fn invert(a: mpz_r<'_>, b: mpz_r<'_>) -> (Self, int_t)
invert create new instance c = inverse of a mod b ((c*a) mod b == 1) returns (undefined, 0) when not exist inverse
Sourcepub fn legendre(&self, p: mpz_r<'_>) -> int_t
pub fn legendre(&self, p: mpz_r<'_>) -> int_t
legendre 0 1 -1 (defined only for p an odd positive prime)
Sourcepub fn kronecker_ui(&self, u: ui_t) -> int_t
pub fn kronecker_ui(&self, u: ui_t) -> int_t
kronecker_ui
Sourcepub fn kronecker_si(&self, s: si_t) -> int_t
pub fn kronecker_si(&self, s: si_t) -> int_t
kronecker_si
Sourcepub fn ui_kronecker(&self, u: ui_t) -> int_t
pub fn ui_kronecker(&self, u: ui_t) -> int_t
ui_kronecker
Sourcepub fn si_kronecker(&self, s: si_t) -> int_t
pub fn si_kronecker(&self, s: si_t) -> int_t
si_kronecker
Sourcepub fn mul_2exp(&mut self, n: mp_bitcnt_t) -> &mut Self
pub fn mul_2exp(&mut self, n: mp_bitcnt_t) -> &mut Self
mul_2exp self *= 2**n
Sourcepub fn cdiv_qr_ui(&self, d: ui_t) -> (Self, Self, ui_t)
pub fn cdiv_qr_ui(&self, d: ui_t) -> (Self, Self, ui_t)
cdiv_qr_ui create new instance
Sourcepub fn cdiv_q_2exp(&self, b: mp_bitcnt_t) -> Self
pub fn cdiv_q_2exp(&self, b: mp_bitcnt_t) -> Self
cdiv_q_2exp create new instance
Sourcepub fn cdiv_r_2exp(&self, b: mp_bitcnt_t) -> Self
pub fn cdiv_r_2exp(&self, b: mp_bitcnt_t) -> Self
cdiv_r_2exp create new instance
Sourcepub fn fdiv_qr_ui(&self, d: ui_t) -> (Self, Self, ui_t)
pub fn fdiv_qr_ui(&self, d: ui_t) -> (Self, Self, ui_t)
fdiv_qr_ui create new instance
Sourcepub fn fdiv_q_2exp(&self, b: mp_bitcnt_t) -> Self
pub fn fdiv_q_2exp(&self, b: mp_bitcnt_t) -> Self
fdiv_q_2exp create new instance
Sourcepub fn fdiv_r_2exp(&self, b: mp_bitcnt_t) -> Self
pub fn fdiv_r_2exp(&self, b: mp_bitcnt_t) -> Self
fdiv_r_2exp create new instance
Sourcepub fn tdiv_qr_ui(&self, d: ui_t) -> (Self, Self, ui_t)
pub fn tdiv_qr_ui(&self, d: ui_t) -> (Self, Self, ui_t)
tdiv_qr_ui create new instance
Sourcepub fn tdiv_q_2exp(&self, b: mp_bitcnt_t) -> Self
pub fn tdiv_q_2exp(&self, b: mp_bitcnt_t) -> Self
tdiv_q_2exp create new instance
Sourcepub fn tdiv_r_2exp(&self, b: mp_bitcnt_t) -> Self
pub fn tdiv_r_2exp(&self, b: mp_bitcnt_t) -> Self
tdiv_r_2exp create new instance
Sourcepub fn mod_ui(&self, d: ui_t) -> (Self, ui_t)
pub fn mod_ui(&self, d: ui_t) -> (Self, ui_t)
mod_ui (the result is always non-negative) create new instance
Sourcepub fn divexact_ui(&self, d: ui_t) -> Self
pub fn divexact_ui(&self, d: ui_t) -> Self
divexact_ui create new instance
Sourcepub fn divisible_p(&self, d: mpz_r<'_>) -> bool
pub fn divisible_p(&self, d: mpz_r<'_>) -> bool
divisible_p
Sourcepub fn divisible_ui_p(&self, d: ui_t) -> bool
pub fn divisible_ui_p(&self, d: ui_t) -> bool
divisible_ui_p
Sourcepub fn divisible_2exp_p(&self, b: mp_bitcnt_t) -> bool
pub fn divisible_2exp_p(&self, b: mp_bitcnt_t) -> bool
divisible_2exp_p
Sourcepub fn congruent_p(&self, c: mpz_r<'_>, d: mpz_r<'_>) -> bool
pub fn congruent_p(&self, c: mpz_r<'_>, d: mpz_r<'_>) -> bool
congruent_p
Sourcepub fn congruent_ui_p(&self, c: ui_t, d: ui_t) -> bool
pub fn congruent_ui_p(&self, c: ui_t, d: ui_t) -> bool
congruent_ui_p
Sourcepub fn congruent_2exp_p(&self, c: mpz_r<'_>, b: mp_bitcnt_t) -> bool
pub fn congruent_2exp_p(&self, c: mpz_r<'_>, b: mp_bitcnt_t) -> bool
congruent_2exp_p
Sourcepub fn powm_sec(a: mpz_r<'_>, n: mpz_r<'_>, m: mpz_r<'_>) -> Self
pub fn powm_sec(a: mpz_r<'_>, n: mpz_r<'_>, m: mpz_r<'_>) -> Self
powm_sec (a**n) mod m required n > 0 and m is odd create new instance
Sourcepub fn powm(a: mpz_r<'_>, n: mpz_r<'_>, m: mpz_r<'_>) -> Self
pub fn powm(a: mpz_r<'_>, n: mpz_r<'_>, m: mpz_r<'_>) -> Self
powm (an) mod m n < 0 when exists inv a-1 mod m create new instance
Sourcepub fn powm_ui(a: mpz_r<'_>, n: ui_t, m: mpz_r<'_>) -> Self
pub fn powm_ui(a: mpz_r<'_>, n: ui_t, m: mpz_r<'_>) -> Self
powm_ui (a**n) mod m create new instance
Sourcepub fn sizeinbase(&self, base: int_t) -> mp_size_t
pub fn sizeinbase(&self, base: int_t) -> mp_size_t
sizeinbase
Sourcepub fn fits_ulong_p(&self) -> bool
pub fn fits_ulong_p(&self) -> bool
fits_ulong_p
Sourcepub fn fits_slong_p(&self) -> bool
pub fn fits_slong_p(&self) -> bool
fits_slong_p
Sourcepub fn fits_uint_p(&self) -> bool
pub fn fits_uint_p(&self) -> bool
fits_uint_p
Sourcepub fn fits_sint_p(&self) -> bool
pub fn fits_sint_p(&self) -> bool
fits_sint_p
Sourcepub fn fits_ushort_p(&self) -> bool
pub fn fits_ushort_p(&self) -> bool
fits_ushort_p
Sourcepub fn fits_sshort_p(&self) -> bool
pub fn fits_sshort_p(&self) -> bool
fits_sshort_p
Sourcepub fn urandomb(r: randstate_t<'_>, nbits: mp_bitcnt_t) -> Self
pub fn urandomb(r: randstate_t<'_>, nbits: mp_bitcnt_t) -> Self
urandomb create new instance
Sourcepub fn urandomm(r: randstate_t<'_>, n: mpz_r<'_>) -> Self
pub fn urandomm(r: randstate_t<'_>, n: mpz_r<'_>) -> Self
urandomm create new instance
Sourcepub fn rrandomb(r: randstate_t<'_>, nbits: mp_bitcnt_t) -> Self
pub fn rrandomb(r: randstate_t<'_>, nbits: mp_bitcnt_t) -> Self
rrandomb create new instance
Sourcepub fn random(max_size: mp_size_t) -> Self
pub fn random(max_size: mp_size_t) -> Self
random create new instance (obsoleted) urandomb or urandomm instead
Sourcepub fn popcount(&self) -> mp_bitcnt_t
pub fn popcount(&self) -> mp_bitcnt_t
popcount
Sourcepub fn hamdist(&self, b: mpz_r<'_>) -> mp_bitcnt_t
pub fn hamdist(&self, b: mpz_r<'_>) -> mp_bitcnt_t
hamdist hamming distance between a and b (both sgn must be same)
Sourcepub fn scan0(&self, s: mp_bitcnt_t) -> mp_bitcnt_t
pub fn scan0(&self, s: mp_bitcnt_t) -> mp_bitcnt_t
scan0 to msb
Sourcepub fn scan1(&self, s: mp_bitcnt_t) -> mp_bitcnt_t
pub fn scan1(&self, s: mp_bitcnt_t) -> mp_bitcnt_t
scan1 to msb
Sourcepub fn clrbit(&mut self, n: mp_bitcnt_t) -> &mut Self
pub fn clrbit(&mut self, n: mp_bitcnt_t) -> &mut Self
clrbit
Sourcepub fn setbit(&mut self, n: mp_bitcnt_t) -> &mut Self
pub fn setbit(&mut self, n: mp_bitcnt_t) -> &mut Self
setbit
Sourcepub fn combit(&mut self, n: mp_bitcnt_t) -> &mut Self
pub fn combit(&mut self, n: mp_bitcnt_t) -> &mut Self
combit
Sourcepub fn tstbit(&self, n: mp_bitcnt_t) -> bool
pub fn tstbit(&self, n: mp_bitcnt_t) -> bool
tstbit
Trait Implementations§
Source§impl Debug for __mpz_struct
impl Debug
impl Debug for __mpz_struct
impl Debug
Source§impl Display for __mpz_struct
impl Display
impl Display for __mpz_struct
impl Display
Source§impl Drop for __mpz_struct
impl Drop
impl Drop for __mpz_struct
impl Drop