Trait malachite_base::num::arithmetic::traits::ModSquare

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

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

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

Required Associated Types§

Required Methods§

source

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

Implementations on Foreign Types§

source§

impl ModSquare for u8

source§

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

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

$f(x, m) = y$, where $x, y < m$ and $x^2 \equiv y \mod m$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if self is greater than or equal to m.

§Examples

See here.

§

type Output = u8

source§

impl ModSquare for u16

source§

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

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

$f(x, m) = y$, where $x, y < m$ and $x^2 \equiv y \mod m$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if self is greater than or equal to m.

§Examples

See here.

§

type Output = u16

source§

impl ModSquare for u32

source§

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

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

$f(x, m) = y$, where $x, y < m$ and $x^2 \equiv y \mod m$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if self is greater than or equal to m.

§Examples

See here.

§

type Output = u32

source§

impl ModSquare for u64

source§

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

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

$f(x, m) = y$, where $x, y < m$ and $x^2 \equiv y \mod m$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if self is greater than or equal to m.

§Examples

See here.

§

type Output = u64

source§

impl ModSquare for u128

source§

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

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

$f(x, m) = y$, where $x, y < m$ and $x^2 \equiv y \mod m$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if self is greater than or equal to m.

§Examples

See here.

§

type Output = u128

source§

impl ModSquare for usize

source§

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

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

$f(x, m) = y$, where $x, y < m$ and $x^2 \equiv y \mod m$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if self is greater than or equal to m.

§Examples

See here.

§

type Output = usize

Implementors§