FLINT3.7.0-dev

nmod_mat_mul_blas

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

Sets C = AB by floating-point matrix multiplication with flint_sgemm or flint_dgemm, which use an external BLAS if FLINT was built with one and FLINT's own kernels otherwise. Returns 1 on success. Returns 0, and does nothing, if a dimension is 0 or exceeds INT_MAX, if the inner dimension is so large that no suitable set of at most 12 moduli exists, or on 32-bit machines. C may be aliased with A or B.

The entries are lifted to the symmetric range |x| \le \lfloor n/2 \rfloor. Let h = k \lfloor n/2 \rfloor^2. If h < 2^{24}, a single flint_sgemm is exact; if h < 2^{53}, a single flint_dgemm. Otherwise the product is computed modulo up to 12 pairwise coprime integers t_i < \sqrt{2^{55}/k} with one flint_dgemm each, and reconstructed by Chinese remaindering in mixed radix form. The conversions are distributed over the thread pool.

AlgorithmMatrix multiplication kernels modulo nThe blocked SIMD kernels nmod_mat_mul_u32, _u52, _k52 and _fp50, which multiply matrices modulo moduli up to 2^{52} in one pass with delayed reduction, and the floating-point route of nmod_mat_mul_blas with Chinese remaindering.
Cite this page

The FLINT team, “nmod_mat_mul_blas (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_blas.html (generated 2026-10-20).