Trait malachite_base::num::arithmetic::traits::ModMul
source · pub trait ModMul<RHS = Self, M = Self> {
type Output;
// Required method
fn mod_mul(self, other: RHS, m: M) -> Self::Output;
}
Expand description
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
Required Associated Types§
Required Methods§
Implementations on Foreign Types§
source§impl ModMul for u8
impl ModMul for u8
source§fn mod_mul(self, other: u8, m: u8) -> u8
fn mod_mul(self, other: u8, m: u8) -> u8
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $xy \equiv z \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to nmod_mul
from nmod.h
, FLINT 2.7.1.
type Output = u8
source§impl ModMul for u16
impl ModMul for u16
source§fn mod_mul(self, other: u16, m: u16) -> u16
fn mod_mul(self, other: u16, m: u16) -> u16
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $xy \equiv z \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to nmod_mul
from nmod.h
, FLINT 2.7.1.
type Output = u16
source§impl ModMul for u32
impl ModMul for u32
source§fn mod_mul(self, other: u32, m: u32) -> u32
fn mod_mul(self, other: u32, m: u32) -> u32
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $xy \equiv z \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to nmod_mul
from nmod.h
, FLINT 2.7.1.
type Output = u32
source§impl ModMul for u64
impl ModMul for u64
source§fn mod_mul(self, other: u64, m: u64) -> u64
fn mod_mul(self, other: u64, m: u64) -> u64
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $xy \equiv z \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to nmod_mul
from nmod.h
, FLINT 2.7.1.
type Output = u64
source§impl ModMul for u128
impl ModMul for u128
source§fn mod_mul(self, other: u128, m: u128) -> u128
fn mod_mul(self, other: u128, m: u128) -> u128
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $xy \equiv z \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to nmod_mul
from nmod.h
, FLINT 2.7.1.
type Output = u128
source§impl ModMul for usize
impl ModMul for usize
source§fn mod_mul(self, other: usize, m: usize) -> usize
fn mod_mul(self, other: usize, m: usize) -> usize
Multiplies two numbers modulo a third number $m$. The inputs must be already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $xy \equiv z \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to nmod_mul
from nmod.h
, FLINT 2.7.1.