Trait malachite_base::num::arithmetic::traits::GcdAssign
source · [−]pub trait GcdAssign<RHS = Self> {
fn gcd_assign(&mut self, other: RHS);
}
Expand description
Replaces a number with the GCD (greatest common divisor) of it and another number.
Required Methods
fn gcd_assign(&mut self, other: RHS)
Implementations on Foreign Types
sourceimpl GcdAssign<u8> for u8
impl GcdAssign<u8> for u8
sourcefn gcd_assign(&mut self, other: u8)
fn gcd_assign(&mut self, other: u8)
Replaces another with the GCD (greatest common divisor) of it and another number.
The GCD of 0 and $n$, for any $n$, is 0. In particular, $\gcd(0, 0) = 0$, which makes sense if we interpret “greatest” to mean “greatest by the divisibility order”.
$$ x \gets \gcd(x, y). $$
Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
Examples
See here.
sourceimpl GcdAssign<u16> for u16
impl GcdAssign<u16> for u16
sourcefn gcd_assign(&mut self, other: u16)
fn gcd_assign(&mut self, other: u16)
Replaces another with the GCD (greatest common divisor) of it and another number.
The GCD of 0 and $n$, for any $n$, is 0. In particular, $\gcd(0, 0) = 0$, which makes sense if we interpret “greatest” to mean “greatest by the divisibility order”.
$$ x \gets \gcd(x, y). $$
Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
Examples
See here.
sourceimpl GcdAssign<u32> for u32
impl GcdAssign<u32> for u32
sourcefn gcd_assign(&mut self, other: u32)
fn gcd_assign(&mut self, other: u32)
Replaces another with the GCD (greatest common divisor) of it and another number.
The GCD of 0 and $n$, for any $n$, is 0. In particular, $\gcd(0, 0) = 0$, which makes sense if we interpret “greatest” to mean “greatest by the divisibility order”.
$$ x \gets \gcd(x, y). $$
Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
Examples
See here.
sourceimpl GcdAssign<u64> for u64
impl GcdAssign<u64> for u64
sourcefn gcd_assign(&mut self, other: u64)
fn gcd_assign(&mut self, other: u64)
Replaces another with the GCD (greatest common divisor) of it and another number.
The GCD of 0 and $n$, for any $n$, is 0. In particular, $\gcd(0, 0) = 0$, which makes sense if we interpret “greatest” to mean “greatest by the divisibility order”.
$$ x \gets \gcd(x, y). $$
Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
Examples
See here.
sourceimpl GcdAssign<u128> for u128
impl GcdAssign<u128> for u128
sourcefn gcd_assign(&mut self, other: u128)
fn gcd_assign(&mut self, other: u128)
Replaces another with the GCD (greatest common divisor) of it and another number.
The GCD of 0 and $n$, for any $n$, is 0. In particular, $\gcd(0, 0) = 0$, which makes sense if we interpret “greatest” to mean “greatest by the divisibility order”.
$$ x \gets \gcd(x, y). $$
Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
Examples
See here.
sourceimpl GcdAssign<usize> for usize
impl GcdAssign<usize> for usize
sourcefn gcd_assign(&mut self, other: usize)
fn gcd_assign(&mut self, other: usize)
Replaces another with the GCD (greatest common divisor) of it and another number.
The GCD of 0 and $n$, for any $n$, is 0. In particular, $\gcd(0, 0) = 0$, which makes sense if we interpret “greatest” to mean “greatest by the divisibility order”.
$$ x \gets \gcd(x, y). $$
Worst-case complexity
$T(n) = O(n^2)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is
max(self.significant_bits(), other.significant_bits())
.
Examples
See here.