pub trait ModMulPrecomputedAssign<RHS = Self, M = Self>: ModMulPrecomputed<RHS, M> {
// Required method
fn mod_mul_precomputed_assign(
&mut self,
other: RHS,
m: M,
data: &Self::Data,
);
}
Expand description
Multiplies two numbers modulo a third number $m$, in place.The inputs must be already reduced modulo $m$.
If multiple modular multiplications with the same modulus are necessary, it can be quicker to
precompute some piece of data and reuse it in the multiplication calls. This trait provides a
function for using precomputed data during multiplication. For precomputing the data, use the
precompute_mod_mul_data
function in
ModMulPrecomputed
.
Required Methods§
fn mod_mul_precomputed_assign(&mut self, other: RHS, m: M, data: &Self::Data)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ModMulPrecomputedAssign for u8
impl ModMulPrecomputedAssign for u8
Source§fn mod_mul_precomputed_assign(&mut self, other: u8, m: u8, data: &Self::Data)
fn mod_mul_precomputed_assign(&mut self, other: u8, m: u8, data: &Self::Data)
Multiplies two numbers modulo a third number $m$, in place. The inputs must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular multiplications with the same modulus. The precomputed data should be
obtained using
precompute_mod_mul_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to n_mulmod2_preinv
from ulong_extras.h
, FLINT 2.7.1, where
the return value is assigned to a
.
Source§impl ModMulPrecomputedAssign for u16
impl ModMulPrecomputedAssign for u16
Source§fn mod_mul_precomputed_assign(&mut self, other: u16, m: u16, data: &Self::Data)
fn mod_mul_precomputed_assign(&mut self, other: u16, m: u16, data: &Self::Data)
Multiplies two numbers modulo a third number $m$, in place. The inputs must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular multiplications with the same modulus. The precomputed data should be
obtained using
precompute_mod_mul_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to n_mulmod2_preinv
from ulong_extras.h
, FLINT 2.7.1, where
the return value is assigned to a
.
Source§impl ModMulPrecomputedAssign for u32
impl ModMulPrecomputedAssign for u32
Source§fn mod_mul_precomputed_assign(&mut self, other: u32, m: u32, data: &Self::Data)
fn mod_mul_precomputed_assign(&mut self, other: u32, m: u32, data: &Self::Data)
Multiplies two numbers modulo a third number $m$, in place. The inputs must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular multiplications with the same modulus. The precomputed data should be
obtained using
precompute_mod_mul_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to n_mulmod2_preinv
from ulong_extras.h
, FLINT 2.7.1, where
the return value is assigned to a
.
Source§impl ModMulPrecomputedAssign for u64
impl ModMulPrecomputedAssign for u64
Source§fn mod_mul_precomputed_assign(&mut self, other: u64, m: u64, data: &Self::Data)
fn mod_mul_precomputed_assign(&mut self, other: u64, m: u64, data: &Self::Data)
Multiplies two numbers modulo a third number $m$, in place. The inputs must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular multiplications with the same modulus. The precomputed data should be
obtained using
precompute_mod_mul_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to n_mulmod2_preinv
from ulong_extras.h
, FLINT 2.7.1, where
the return value is assigned to a
.
Source§impl ModMulPrecomputedAssign for u128
impl ModMulPrecomputedAssign for u128
Source§fn mod_mul_precomputed_assign(
&mut self,
other: u128,
m: u128,
data: &Self::Data,
)
fn mod_mul_precomputed_assign( &mut self, other: u128, m: u128, data: &Self::Data, )
Multiplies two numbers modulo a third number $m$, in place. The inputs must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular multiplications with the same modulus. The precomputed data should be
obtained using
precompute_mod_mul_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to n_mulmod2_preinv
from ulong_extras.h
, FLINT 2.7.1, where
the return value is assigned to a
.
Source§impl ModMulPrecomputedAssign for usize
impl ModMulPrecomputedAssign for usize
Source§fn mod_mul_precomputed_assign(
&mut self,
other: usize,
m: usize,
data: &Self::Data,
)
fn mod_mul_precomputed_assign( &mut self, other: usize, m: usize, data: &Self::Data, )
Multiplies two numbers modulo a third number $m$, in place. The inputs must be already reduced modulo $m$.
Some precomputed data is provided; this speeds up computations involving several
modular multiplications with the same modulus. The precomputed data should be
obtained using
precompute_mod_mul_data
.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self
or other
are greater than or equal to m
.
§Examples
See here.
This is equivalent to n_mulmod2_preinv
from ulong_extras.h
, FLINT 2.7.1, where
the return value is assigned to a
.