Trait malachite_base::num::arithmetic::traits::ModSquarePrecomputed
source · pub trait ModSquarePrecomputed<RHS = Self, M = Self>: ModPowPrecomputed<RHS, M>where
Self: Sized,{
// Required method
fn mod_square_precomputed(self, m: M, data: &Self::Data) -> Self::Output;
}
Expand description
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
If multiple modular squarings with the same modulus are necessary, it can be quicker to
precompute some piece of data using
precompute_mod_pow_data
function in
ModMulPrecomputed
and reuse it in the squaring calls.
Required Methods§
fn mod_square_precomputed(self, m: M, data: &Self::Data) -> Self::Output
Object Safety§
Implementations on Foreign Types§
source§impl ModSquarePrecomputed for u64
impl ModSquarePrecomputed for u64
source§fn mod_square_precomputed(self, m: u64, data: &Self::Data) -> Self::Output
fn mod_square_precomputed(self, m: u64, data: &Self::Data) -> Self::Output
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular squarings with the same modulus. The precomputed data should be obtained
using precompute_mod_pow_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModSquarePrecomputed<u64> for u8
impl ModSquarePrecomputed<u64> for u8
source§fn mod_square_precomputed(self, m: u8, data: &Self::Data) -> Self::Output
fn mod_square_precomputed(self, m: u8, data: &Self::Data) -> Self::Output
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular squarings with the same modulus. The precomputed data should be obtained
using precompute_mod_pow_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModSquarePrecomputed<u64> for u16
impl ModSquarePrecomputed<u64> for u16
source§fn mod_square_precomputed(self, m: u16, data: &Self::Data) -> Self::Output
fn mod_square_precomputed(self, m: u16, data: &Self::Data) -> Self::Output
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular squarings with the same modulus. The precomputed data should be obtained
using precompute_mod_pow_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModSquarePrecomputed<u64> for u32
impl ModSquarePrecomputed<u64> for u32
source§fn mod_square_precomputed(self, m: u32, data: &Self::Data) -> Self::Output
fn mod_square_precomputed(self, m: u32, data: &Self::Data) -> Self::Output
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular squarings with the same modulus. The precomputed data should be obtained
using precompute_mod_pow_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModSquarePrecomputed<u64> for u128
impl ModSquarePrecomputed<u64> for u128
source§fn mod_square_precomputed(self, m: u128, data: &Self::Data) -> Self::Output
fn mod_square_precomputed(self, m: u128, data: &Self::Data) -> Self::Output
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular squarings with the same modulus. The precomputed data should be obtained
using precompute_mod_pow_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.
source§impl ModSquarePrecomputed<u64> for usize
impl ModSquarePrecomputed<u64> for usize
source§fn mod_square_precomputed(self, m: usize, data: &Self::Data) -> Self::Output
fn mod_square_precomputed(self, m: usize, data: &Self::Data) -> Self::Output
Squares a number modulo another number $m$. The input must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular squarings with the same modulus. The precomputed data should be obtained
using precompute_mod_pow_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
is greater than or equal to m
.
§Examples
See here.