pub trait ModAbsSquared<M = Self> {
type Output;
// Required method
fn mod_abs_squared(self, m: M) -> Self::Output;
}Expand description
Computes the squared absolute value of a number modulo another number $m$. The input must be already reduced modulo $m$.
For a real number this is its square modulo $m$; the trait exists for the types where it is not, such as complex numbers and vectors, for which it is the reduced sum of squares.
Required Associated Types§
Required Methods§
fn mod_abs_squared(self, m: M) -> Self::Output
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ModAbsSquared for u8
impl ModAbsSquared for u8
Source§fn mod_abs_squared(self, m: u8) -> u8
fn mod_abs_squared(self, m: u8) -> u8
Computes the squared absolute value of a number modulo another number $m$, which for an unsigned number is its square modulo $m$. The input must be already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $|x|^2 = 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 ModAbsSquared for u16
impl ModAbsSquared for u16
Source§fn mod_abs_squared(self, m: u16) -> u16
fn mod_abs_squared(self, m: u16) -> u16
Computes the squared absolute value of a number modulo another number $m$, which for an unsigned number is its square modulo $m$. The input must be already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $|x|^2 = 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 ModAbsSquared for u32
impl ModAbsSquared for u32
Source§fn mod_abs_squared(self, m: u32) -> u32
fn mod_abs_squared(self, m: u32) -> u32
Computes the squared absolute value of a number modulo another number $m$, which for an unsigned number is its square modulo $m$. The input must be already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $|x|^2 = 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 ModAbsSquared for u64
impl ModAbsSquared for u64
Source§fn mod_abs_squared(self, m: u64) -> u64
fn mod_abs_squared(self, m: u64) -> u64
Computes the squared absolute value of a number modulo another number $m$, which for an unsigned number is its square modulo $m$. The input must be already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $|x|^2 = 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 ModAbsSquared for u128
impl ModAbsSquared for u128
Source§fn mod_abs_squared(self, m: u128) -> u128
fn mod_abs_squared(self, m: u128) -> u128
Computes the squared absolute value of a number modulo another number $m$, which for an unsigned number is its square modulo $m$. The input must be already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $|x|^2 = 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 ModAbsSquared for usize
impl ModAbsSquared for usize
Source§fn mod_abs_squared(self, m: usize) -> usize
fn mod_abs_squared(self, m: usize) -> usize
Computes the squared absolute value of a number modulo another number $m$, which for an unsigned number is its square modulo $m$. The input must be already reduced modulo $m$.
$f(x, m) = y$, where $x, y < m$ and $|x|^2 = 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.