FLINT3.7.0-dev

nmod_mat_mul_classical

Synopsis#include <flint/nmod_mat.h>
void nmod_mat_mul_classical(nmod_mat_t C, const nmod_mat_t A, const nmod_mat_t B)source

Sets C = AB by classical multiplication, computing each entry as a dot product with a single reduction. C must not be aliased with A or B.

The dot products use the parameters of _nmod_vec_dot_params for length k (Dot products modulo a word-size integer). The code takes one of three forms.

  • If the unreduced sums fit in one word and all dimensions exceed 10, B is transposed and several of its entries are packed into each word, as many as fit with \lceil \log_2 (k (n-1)^2 + 1) \rceil bits each, so that one word product computes several dot products at once.
  • If k < 20, or if m < 20 and neither m \ge 4, k \ge 256 nor m \ge 2, k \ge 1000, the dot products read the columns of B in place with NMOD_VEC_DOT.
  • Otherwise B is transposed into a temporary matrix (NMOD_MAT_MUL_TRANSPOSE_CUTOFF is 20) and the dot products use _nmod_vec_dot on contiguous rows.
Cite this page

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