Trait malachite_base::num::arithmetic::traits::ModPowAssign
source · pub trait ModPowAssign<RHS = Self, M = Self> {
// Required method
fn mod_pow_assign(&mut self, exp: RHS, m: M);
}
Expand description
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
Required Methods§
fn mod_pow_assign(&mut self, exp: RHS, m: M)
Implementations on Foreign Types§
source§impl ModPowAssign for u64
impl ModPowAssign for u64
source§fn mod_pow_assign(&mut self, exp: u64, m: u64)
fn mod_pow_assign(&mut self, exp: u64, m: u64)
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
$x \gets y$, where $x, y < m$ and $x^n \equiv y \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits()
.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModPowAssign<u64> for u8
impl ModPowAssign<u64> for u8
source§fn mod_pow_assign(&mut self, exp: u64, m: u8)
fn mod_pow_assign(&mut self, exp: u64, m: u8)
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
$x \gets y$, where $x, y < m$ and $x^n \equiv y \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits()
.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModPowAssign<u64> for u16
impl ModPowAssign<u64> for u16
source§fn mod_pow_assign(&mut self, exp: u64, m: u16)
fn mod_pow_assign(&mut self, exp: u64, m: u16)
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
$x \gets y$, where $x, y < m$ and $x^n \equiv y \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits()
.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModPowAssign<u64> for u32
impl ModPowAssign<u64> for u32
source§fn mod_pow_assign(&mut self, exp: u64, m: u32)
fn mod_pow_assign(&mut self, exp: u64, m: u32)
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
$x \gets y$, where $x, y < m$ and $x^n \equiv y \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits()
.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModPowAssign<u64> for u128
impl ModPowAssign<u64> for u128
source§fn mod_pow_assign(&mut self, exp: u64, m: u128)
fn mod_pow_assign(&mut self, exp: u64, m: u128)
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
$x \gets y$, where $x, y < m$ and $x^n \equiv y \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits()
.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModPowAssign<u64> for usize
impl ModPowAssign<u64> for usize
source§fn mod_pow_assign(&mut self, exp: u64, m: usize)
fn mod_pow_assign(&mut self, exp: u64, m: usize)
Raises a number to a power modulo another number $m$, in place. The base must be already reduced modulo $m$.
$x \gets y$, where $x, y < m$ and $x^n \equiv y \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits()
.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.