[][src]Struct clacc::bigint::BigIntGmp

pub struct BigIntGmp { /* fields omitted */ }

An implementation of BigInt using rust-gmp.

Trait Implementations

impl BigInt for BigIntGmp[src]

fn next_prime(&self) -> Self[src]

use clacc::bigint::{BigInt, BigIntGmp};
let x: BigIntGmp = 32.into();
let p = x.next_prime();
assert_eq!(p, 37.into());

fn gcdext(&self, y: &Self) -> (Self, Self, Self)[src]

use clacc::bigint::{BigInt, BigIntGmp};
let x: BigIntGmp = 240.into();
let y: BigIntGmp = 46.into();
let (g, a, b) = x.gcdext(&y);
assert_eq!(g, 2.into());
assert_eq!(a, (-9).into());
assert_eq!(b, 47.into());

fn modulus(&self, m: &Self) -> Self[src]

use clacc::bigint::{BigInt, BigIntGmp};
let b: BigIntGmp = 11.into();
let n: BigIntGmp = 7.into();
let m = b.modulus(&n);
assert_eq!(m, 4.into());

fn powm(&self, e: &Self, m: &Self) -> Self[src]

use clacc::bigint::{BigInt, BigIntGmp};
let b: BigIntGmp = 5.into();
let e: BigIntGmp = 3.into();
let m: BigIntGmp = 13.into();
let c = b.powm(&e, &m);
assert_eq!(c, 8.into());

fn invert(&self, m: &Self) -> Option<Self>[src]

use clacc::bigint::{BigInt, BigIntGmp};
let a: BigIntGmp = 123.into();
let n: BigIntGmp = 4567.into();
let i = a.invert(&n).unwrap();
assert_eq!(i, 854.into());

impl<'a> BigIntAdd<&'a BigIntGmp> for BigIntGmp[src]

type Output = Self

impl<'a> BigIntDiv<&'a BigIntGmp> for BigIntGmp[src]

type Output = Self

impl<'a> BigIntMul<&'a BigIntGmp> for BigIntGmp[src]

type Output = Self

impl<'a> BigIntSub<&'a BigIntGmp> for BigIntGmp[src]

type Output = Self

impl BigIntSub<i64> for BigIntGmp[src]

type Output = Self

impl Clone for BigIntGmp[src]

impl Debug for BigIntGmp[src]

impl Default for BigIntGmp[src]

impl Display for BigIntGmp[src]

impl Eq for BigIntGmp[src]

impl<'_> From<&'_ Mpz> for BigIntGmp[src]

impl<'a> From<&'a [u8]> for BigIntGmp[src]

impl From<Mpz> for BigIntGmp[src]

impl From<i64> for BigIntGmp[src]

impl LowerHex for BigIntGmp[src]

impl PartialEq<BigIntGmp> for BigIntGmp[src]

impl UpperHex for BigIntGmp[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,