Trait malachite_base::num::arithmetic::traits::ModNeg

source ·
pub trait ModNeg<M = Self> {
    type Output;

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

Negates a number modulo another number $m$. The input must be already reduced modulo $m$.

Required Associated Types§

Required Methods§

source

fn mod_neg(self, m: M) -> Self::Output

Implementations on Foreign Types§

source§

impl ModNeg for u8

source§

fn mod_neg(self, m: u8) -> u8

Negates a number modulo another number $m$, in place. The input must be 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.h, FLINT 2.7.1.

source§

type Output = u8

source§

impl ModNeg for u16

source§

fn mod_neg(self, m: u16) -> u16

Negates a number modulo another number $m$, in place. The input must be 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.h, FLINT 2.7.1.

source§

type Output = u16

source§

impl ModNeg for u32

source§

fn mod_neg(self, m: u32) -> u32

Negates a number modulo another number $m$, in place. The input must be 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.h, FLINT 2.7.1.

source§

type Output = u32

source§

impl ModNeg for u64

source§

fn mod_neg(self, m: u64) -> u64

Negates a number modulo another number $m$, in place. The input must be 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.h, FLINT 2.7.1.

source§

type Output = u64

source§

impl ModNeg for u128

source§

fn mod_neg(self, m: u128) -> u128

Negates a number modulo another number $m$, in place. The input must be 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.h, FLINT 2.7.1.

source§

type Output = u128

source§

impl ModNeg for usize

source§

fn mod_neg(self, m: usize) -> usize

Negates a number modulo another number $m$, in place. The input must be 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.h, FLINT 2.7.1.

source§

type Output = usize

Implementors§