Trait malachite_base::num::arithmetic::traits::ModSub
source · [−]pub trait ModSub<RHS = Self, M = Self> {
type Output;
fn mod_sub(self, other: RHS, m: M) -> Self::Output;
}
Expand description
Adds two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
Required Associated Types
Required Methods
Implementations on Foreign Types
sourceimpl ModSub<u8, u8> for u8
impl ModSub<u8, u8> for u8
sourcefn mod_sub(self, other: u8, m: u8) -> u8
fn mod_sub(self, other: u8, m: u8) -> u8
Subtracts two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $x - y \equiv z \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_sub
from nmod_vec.h
, FLINT 2.7.1.
type Output = u8
sourceimpl ModSub<u16, u16> for u16
impl ModSub<u16, u16> for u16
sourcefn mod_sub(self, other: u16, m: u16) -> u16
fn mod_sub(self, other: u16, m: u16) -> u16
Subtracts two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $x - y \equiv z \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_sub
from nmod_vec.h
, FLINT 2.7.1.
type Output = u16
sourceimpl ModSub<u32, u32> for u32
impl ModSub<u32, u32> for u32
sourcefn mod_sub(self, other: u32, m: u32) -> u32
fn mod_sub(self, other: u32, m: u32) -> u32
Subtracts two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $x - y \equiv z \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_sub
from nmod_vec.h
, FLINT 2.7.1.
type Output = u32
sourceimpl ModSub<u64, u64> for u64
impl ModSub<u64, u64> for u64
sourcefn mod_sub(self, other: u64, m: u64) -> u64
fn mod_sub(self, other: u64, m: u64) -> u64
Subtracts two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $x - y \equiv z \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_sub
from nmod_vec.h
, FLINT 2.7.1.
type Output = u64
sourceimpl ModSub<u128, u128> for u128
impl ModSub<u128, u128> for u128
sourcefn mod_sub(self, other: u128, m: u128) -> u128
fn mod_sub(self, other: u128, m: u128) -> u128
Subtracts two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $x - y \equiv z \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_sub
from nmod_vec.h
, FLINT 2.7.1.
type Output = u128
sourceimpl ModSub<usize, usize> for usize
impl ModSub<usize, usize> for usize
sourcefn mod_sub(self, other: usize, m: usize) -> usize
fn mod_sub(self, other: usize, m: usize) -> usize
Subtracts two numbers modulo a third number $m$. Assumes the inputs are already reduced modulo $m$.
$f(x, y, m) = z$, where $x, y, z < m$ and $x - y \equiv z \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_sub
from nmod_vec.h
, FLINT 2.7.1.