FLINT3.7.0-dev

fmpz_mat_sqr, fmpz_mat_sqr_bodrato

Synopsis#include <flint/fmpz_mat.h>
void fmpz_mat_sqr(fmpz_mat_t B, const fmpz_mat_t A)source
void fmpz_mat_sqr_bodrato(fmpz_mat_t B, const fmpz_mat_t A)source

Sets B = A^2 for a square matrix A. fmpz_mat_sqr allows B to be A; fmpz_mat_sqr_bodrato does not.

fmpz_mat_sqr_bodrato uses explicit formulas for dimensions up to 3 and otherwise Bodrato's squaring variant of Strassen–Winograd [Bodrato2010], which needs four squarings and three products of half size per level. fmpz_mat_sqr uses it for dimension at most 3, and for dimension 4 with entries of at least 1024 bits, as long as the entries have at most 12000 bits; otherwise it calls fmpz_mat_mul.

References#

  • [Bodrato2010] Bodrato, Marco : A Strassen-like Matrix Multiplication Suited for Squaring and Higher Power Computation. Proceedings of the ISSAC 2010 München, Germany, 25-28 July, 2010
Cite this page

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