nmod_mat_randrank_profile
#include <flint/nmod_mat.h>void nmod_mat_randrank_profile(nmod_mat_t mat, flint_rand_t state, const slong * mrp_r, const slong * mrp_c, slong rank)sourceFor a prime modulus, sets mat to a random matrix of rank = rank whose rank profile matrix has its nonzero entries at the positions (mrp_r[k], mrp_c[k]) for , given in any order. Throws an exception if rank is negative or exceeds a dimension, or if two positions share a row or a column or one lies outside the matrix.
The rank profile matrix of an matrix of rank is the unique matrix with entries equal to 1, no two in the same row or column, and zeros elsewhere, such that every leading submatrix of (first rows, first columns) has the same rank as the corresponding leading submatrix of . It determines the row and column rank profiles of all leading submatrices of [DPS2017].
The matrix is computed as one product : is with column zero above row mrp_r[k], 1 in that row and random below it, and is with row zero left of column mrp_c[k], uniformly random and nonzero in that column, and random to the right of it. The random entries come from nmod_mat_randtest, so that the factors, and therefore the result, are sparse with some probability. Completing and into square unit lower and invertible upper triangular matrices gives where has the entries 1 at the given positions, and multiplying by such triangular matrices does not change the rank profile matrix. If the modulus is 1, the matrix is zero.
References#
- [DPS2017] J.-G. Dumas, C. Pernet and Z. Sultan, "Fast computation of the rank profile matrix and the generalized Bruhat decomposition", Journal of Symbolic Computation 83 (2017), 187-210
The FLINT team, “nmod_mat_randrank_profile (nmod_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/nmod_mat/nmod_mat_randrank_profile.html (generated 2026-11-02).
@misc{flint-doc-nmod-mat-nmod-mat-randrank-profile,
author = {{The FLINT team}},
title = {{nmod\_mat\_randrank\_profile (nmod\_mat.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/nmod_mat/nmod_mat_randrank_profile.html},
note = {Generated 2026-11-02}
}