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 xyx y, yxy x, res+xyres + x y and res−xyres - x y elementwise, for a vector xx and a scalar yy.

Multiplication by a fixed yy 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 yy, used for ℓ≤10\ell \le 10) and the matrix method (the residues y2νBi mod n2ν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 nn 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-11-02).