FLINT3.7.0-dev

nmod_mat_nmod_vec_mul, nmod_mat_nmod_vec_mul_ptr

Synopsis#include <flint/nmod_mat.h>
void nmod_mat_nmod_vec_mul(ulong * c, const ulong * a, slong alen, const nmod_mat_t B)source
void nmod_mat_nmod_vec_mul_ptr(ulong * const * c, const ulong * const * a, slong alen, const nmod_mat_t B)source

Sets c=aBc = aB, where BB is k×nk \times n and aa is the vector of length alen, truncated or extended by zeros to length kk. The nn entries of cc are written. In the _ptr version, entry ii of aa and cc is *a[i] and *c[i]. cc must not overlap aa, except in the _ptr version, which copies.

The rows of BB are accumulated with delayed reductions where a vector code path exists: with AVX512-IFMA for n≤252n \le 2^{52} (as in nmod_mat_mul_u52), with AVX2 or AVX-512 without IFMA for n≤232n \le 2^{32} (splitting each product at bit 56 as in Splitting at bit 56; the next path is used instead for short vectors: k≤6k \le 6, or k≤32k \le 32 and BB has at least max⁡(k,16)\max(k, 16) columns), with a vector FMA for n<250n < 2^{50} (as in nmod_mat_mul_fp50), and with AVX2 or AVX-512 for the other moduli, by accumulating the products of limbs of at most 32 bits of the entries as in Split limbs (AVX2, AVX-512), with one reduction of each entry of cc at the end (Thin matrices). These code paths are not used when BB is too narrow for them, with thresholds on the length kk of aa and the number of columns that depend on the path (for instance, with AVX512-IFMA, from 16 columns for k=2k = 2 down to 3 or 4 columns from k=6k = 6 on; 5 columns for the moduli of the last path). Otherwise, with one column, or up to 8 columns and 4≤k≤324 \le k \le 32 (8≤k≤328 \le k \le 32 for n>262n > 2^{62}), each entry of cc is a dot product; else each row is added with _nmod_vec_scalar_addmul_nmod when kk is less than 6 (for n≤232n \le 2^{32}), 8 (up to 2622^{62}) or 10, or when BB has at least 2048 columns (4096 for n≥263n \ge 2^{63}), and the product is done with nmod_mat_mul_classical on blocks of rows of BB for longer vectors.

Cite this page

The FLINT team, “nmod_mat_nmod_vec_mul, nmod_mat_nmod_vec_mul_ptr (nmod_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/nmod_mat/nmod_mat_nmod_vec_mul.html (generated 2026-11-02).