FLINT3.7.0-dev

nmod_mat_randpermdiag

Synopsis#include <flint/nmod_mat.h>
int nmod_mat_randpermdiag(nmod_mat_t mat, flint_rand_t state, nn_srcptr diag, slong n)source

Sets mat to P D Q where D is the matrix with d_0, \ldots, d_{n-1} (the entries of diag) on the main diagonal and zeros elsewhere, and P and Q are random permutation matrices. Requires n \le the number of rows and of columns. Returns the parity (0 for even, 1 for odd) of the two permutations combined.

Cite this page

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