FLINT3.7.0-dev

_mpn_mod_vec_mul_scalar, _mpn_mod_scalar_mul_vec, _mpn_mod_vec_addmul_scalar, _mpn_mod_vec_submul_scalar

Synopsis#include <flint/mpn_mod.h>
int _mpn_mod_vec_mul_scalar(nn_ptr res, nn_srcptr x, slong len, nn_srcptr y, gr_ctx_t ctx)source
int _mpn_mod_scalar_mul_vec(nn_ptr res, nn_srcptr y, nn_srcptr x, slong len, gr_ctx_t ctx)source
int _mpn_mod_vec_addmul_scalar(nn_ptr res, nn_srcptr x, slong len, nn_srcptr y, gr_ctx_t ctx)source
int _mpn_mod_vec_submul_scalar(nn_ptr res, nn_srcptr x, slong len, nn_srcptr y, gr_ctx_t ctx)source

Set res to x y, y x, res + x y and res - x y elementwise, for a vector x and a scalar y.

Multiplication by a fixed y is preconditioned when the vector is long enough to amortise the precomputation: flint_mpn_mulmod_want_precond chooses between no precomputation, Shoup's method (a quotient precomputed for y, used for \ell \le 10) and the matrix method (the residues y 2^{\nu} B^i \bmod n 2^{\nu} precomputed, used for larger \ell), from 4 elements on. For two limbs, Shoup's method is used from 4 elements on (6 if the top bit of n is set), with inlined code; see A fixed multiplier.

Cite this page

The FLINT team, “_mpn_mod_vec_mul_scalar, _mpn_mod_scalar_mul_vec, _mpn_mod_vec_addmul_scalar, _mpn_mod_vec_submul_scalar (mpn_mod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_mod/_mpn_mod_vec_mul_scalar.html (generated 2026-10-20).