Trait malachite_base::num::arithmetic::traits::ModNeg
source · Expand description
Negates a number modulo another number $m$. Assumes the input is already reduced modulo $m$.
Required Associated Types§
Required Methods§
Implementations on Foreign Types§
source§impl ModNeg<u8> for u8
impl ModNeg<u8> for u8
source§fn mod_neg(self, m: u8) -> u8
fn mod_neg(self, m: u8) -> u8
Negates a number modulo another number $m$, in place. Assumes the input is already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $-x \equiv y \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_neg from nmod_vec.h, FLINT 2.7.1.
type Output = u8
source§impl ModNeg<u16> for u16
impl ModNeg<u16> for u16
source§fn mod_neg(self, m: u16) -> u16
fn mod_neg(self, m: u16) -> u16
Negates a number modulo another number $m$, in place. Assumes the input is already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $-x \equiv y \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_neg from nmod_vec.h, FLINT 2.7.1.
type Output = u16
source§impl ModNeg<u32> for u32
impl ModNeg<u32> for u32
source§fn mod_neg(self, m: u32) -> u32
fn mod_neg(self, m: u32) -> u32
Negates a number modulo another number $m$, in place. Assumes the input is already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $-x \equiv y \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_neg from nmod_vec.h, FLINT 2.7.1.
type Output = u32
source§impl ModNeg<u64> for u64
impl ModNeg<u64> for u64
source§fn mod_neg(self, m: u64) -> u64
fn mod_neg(self, m: u64) -> u64
Negates a number modulo another number $m$, in place. Assumes the input is already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $-x \equiv y \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_neg from nmod_vec.h, FLINT 2.7.1.
type Output = u64
source§impl ModNeg<u128> for u128
impl ModNeg<u128> for u128
source§fn mod_neg(self, m: u128) -> u128
fn mod_neg(self, m: u128) -> u128
Negates a number modulo another number $m$, in place. Assumes the input is already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $-x \equiv y \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_neg from nmod_vec.h, FLINT 2.7.1.
type Output = u128
source§impl ModNeg<usize> for usize
impl ModNeg<usize> for usize
source§fn mod_neg(self, m: usize) -> usize
fn mod_neg(self, m: usize) -> usize
Negates a number modulo another number $m$, in place. Assumes the input is already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $-x \equiv y \mod m$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
This is equivalent to nmod_neg from nmod_vec.h, FLINT 2.7.1.