FLINT3.7.0-dev

gr_mat_hadamard

Synopsis#include <flint/gr_mat.h>
int gr_mat_hadamard(gr_mat_t res, gr_ctx_t ctx)source

Sets the square matrix res to a Hadamard matrix of its size if possible. Returns GR_DOMAIN if none exists (the size must be 0, 1, 2 or a multiple of 4), and GR_UNABLE if the implementation cannot construct one.

The matrix is constructed by fmpz_mat_hadamard and converted. It uses Sylvester's doubling and Paley's constructions [Pal1933], which succeed for all sizes 2^e and 2^e(q + 1) with q an odd prime power. Sizes for which Hadamard matrices are known to exist but this construction fails start with 92, 116, 156 (OEIS A046116).

References#

Cite this page

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