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=ABC = AB by classical multiplication, computing each entry as a dot product with a single reduction. CC must not be aliased with AA or BB.

The dot products use the parameters of _nmod_vec_dot_params for length kk (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, BB is transposed and several of its entries are packed into each word, as many as fit with ⌈log⁡2(k(n−1)2+1)⌉\lceil \log_2 (k (n-1)^2 + 1) \rceil bits each, so that one word product computes several dot products at once.
  • If k<20k < 20, or if m<20m < 20 and neither m≥4,k≥256m \ge 4, k \ge 256 nor m≥2,k≥1000m \ge 2, k \ge 1000, the dot products read the columns of BB in place with NMOD_VEC_DOT.
  • Otherwise BB 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-11-02).