FLINT3.7.0-dev

fmpz_mod_mat_randrank

Synopsis#include <flint/fmpz_mod_mat.h>
void fmpz_mod_mat_randrank(fmpz_mod_mat_t mat, flint_rand_t state, slong rank, const fmpz_mod_ctx_t ctx)source

Sets mat to a random sparse matrix of the given rank: rank random nonzero residues placed in distinct rows and columns, the other entries zero. For prime n the rank is exactly rank. Throws an exception if rank is negative or exceeds a dimension. fmpz_mod_mat_randops turns the result into a dense matrix of the same rank.

Cite this page

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