FLINT3.7.0-dev

_mpn_mod_vec_dot, _mpn_mod_vec_dot_rev, _mpn_mod_vec_dot_strided

Synopsis#include <flint/mpn_mod.h>
int _mpn_mod_vec_dot(nn_ptr res, nn_srcptr initial, int subtract, nn_srcptr vec1, nn_srcptr vec2, slong len, gr_ctx_t ctx)source
int _mpn_mod_vec_dot_rev(nn_ptr res, nn_srcptr initial, int subtract, nn_srcptr vec1, nn_srcptr vec2, slong len, gr_ctx_t ctx)source
int _mpn_mod_vec_dot_strided(nn_ptr res, nn_srcptr initial, int subtract, nn_srcptr vec1, slong stride1, nn_srcptr vec2, slong stride2, slong len, gr_ctx_t ctx)source

Set res to s+∑iaibis + \sum_i a_i b_i, or s−∑iaibis - \sum_i a_i b_i if subtract is nonzero, where ss is initial (zero if initial is NULL), aia_i = vec1[i] and bib_i = vec2[i], vec2[len - 1 - i] or the entries of the strided vectors (strides counted in elements, possibly negative).

The sum of the full 2ℓ2\ell-limb products is accumulated exactly in ⌈(2b+⌊log⁡2len⌋+1)/FLINT_BITS⌉\lceil (2 b + \lfloor \log_2 \mathit{len} \rfloor + 1) / \mathtt{FLINT\_BITS} \rceil limbs and reduced once at the end (delayed reduction). For ℓ≤4\ell \le 4 the accumulation uses the generated fixed-size kernels of mpn_extras (flint_mpn_dot_tab and its strided and reversed variants); for larger ℓ\ell, flint_mpn_mul_n and mpn_add_n with one carry limb. Lengths 1 and 2 use mpn_mod_mul and mpn_mod_fmma.

Cite this page

The FLINT team, “_mpn_mod_vec_dot, _mpn_mod_vec_dot_rev, _mpn_mod_vec_dot_strided (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_dot.html (generated 2026-11-02).