# Trait malachite_base::num::arithmetic::traits::ModPow

pub trait ModPow<RHS = Self, M = Self> {
type Output;

// Required method
fn mod_pow(self, exp: RHS, m: M) -> Self::Output;
}
Expand description

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

source

source

## Implementations on Foreign Types§

source§

### impl ModPow for u64

source§

#### fn mod_pow(self, exp: u64, m: u64) -> u64

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

$f(x, n, m) = 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.

See here.

§

source§

### impl ModPow<u64> for u8

source§

#### fn mod_pow(self, exp: u64, m: u8) -> u8

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

$f(x, n, m) = 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.

See here.

§

source§

### impl ModPow<u64> for u16

source§

#### fn mod_pow(self, exp: u64, m: u16) -> u16

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

$f(x, n, m) = 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.

See here.

§

source§

### impl ModPow<u64> for u32

source§

#### fn mod_pow(self, exp: u64, m: u32) -> u32

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

$f(x, n, m) = 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.

See here.

§

source§

### impl ModPow<u64> for u128

source§

#### fn mod_pow(self, exp: u64, m: u128) -> u128

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

$f(x, n, m) = 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.

See here.

§

source§

### impl ModPow<u64> for usize

source§

#### fn mod_pow(self, exp: u64, m: usize) -> usize

Raises a number to a power modulo another number $m$. The base must be already reduced modulo $m$.

$f(x, n, m) = 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.

See here.

§