pub trait ModMulPrecomputed<RHS = Self, M = Self> {
    type Output;
    type Data;

    fn precompute_mod_mul_data(m: &M) -> Self::Data;
    fn mod_mul_precomputed(
        self,
        other: RHS,
        m: M,
        data: &Self::Data
    ) -> Self::Output; }
Expand description

Multiplies two numbers modulo a third number $m$. Assumes the inputs are already reduced mod $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 precomputing the data and a function for using it during multiplication.

Required Associated Types§

Required Methods§

Precomputes some data to use for modular multiplication.

Implementations on Foreign Types§

Precomputes data for modular multiplication. See mod_mul_precomputed and mod_mul_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

This is equivalent to n_preinvert_limb from ulong_extras.h, FLINT 2.7.1.

Multiplies two numbers modulo a third number $m$. Assumes the inputs are 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.

Examples

See here.

This is equivalent to n_mulmod2_preinv from ulong_extras.h, FLINT 2.7.1.

Precomputes data for modular multiplication. See mod_mul_precomputed and mod_mul_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

This is equivalent to n_preinvert_limb from ulong_extras.h, FLINT 2.7.1.

Multiplies two numbers modulo a third number $m$. Assumes the inputs are 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.

Examples

See here.

This is equivalent to n_mulmod2_preinv from ulong_extras.h, FLINT 2.7.1.

Precomputes data for modular multiplication. See mod_mul_precomputed and mod_mul_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

This is equivalent to n_preinvert_limb from ulong_extras.h, FLINT 2.7.1.

Multiplies two numbers modulo a third number $m$. Assumes the inputs are 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.

Examples

See here.

This is equivalent to n_mulmod2_preinv from ulong_extras.h, FLINT 2.7.1.

Precomputes data for modular multiplication. See mod_mul_precomputed and mod_mul_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

This is equivalent to n_preinvert_limb from ulong_extras.h, FLINT 2.7.1.

Multiplies two numbers modulo a third number $m$. Assumes the inputs are 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.

Examples

See here.

This is equivalent to n_mulmod2_preinv from ulong_extras.h, FLINT 2.7.1.

Precomputes data for modular multiplication. See mod_mul_precomputed and mod_mul_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Multiplies two numbers modulo a third number $m$. Assumes the inputs are 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.

Examples

See here.

This is equivalent to n_mulmod2_preinv from ulong_extras.h, FLINT 2.7.1.

Precomputes data for modular multiplication. See mod_mul_precomputed and mod_mul_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

This is equivalent to n_preinvert_limb from ulong_extras.h, FLINT 2.7.1.

Multiplies two numbers modulo a third number $m$. Assumes the inputs are 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.

Examples

See here.

This is equivalent to n_mulmod2_preinv from ulong_extras.h, FLINT 2.7.1.

Implementors§