FLINT3.7.0-dev

nmod_mat_randrank_profile

Synopsis#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)source

For a prime modulus, sets mat to a random matrix of rank rr = rank whose rank profile matrix has its rr nonzero entries at the positions (mrp_r[k], mrp_c[k]) for 0≤k<r0 \le k < r, 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 m×nm \times n matrix AA of rank rr is the unique m×nm \times n matrix RA\mathcal{R}_A with rr entries equal to 1, no two in the same row or column, and zeros elsewhere, such that every leading submatrix of AA (first ii rows, first jj columns) has the same rank as the corresponding leading submatrix of RA\mathcal{R}_A. It determines the row and column rank profiles of all leading submatrices of AA [DPS2017].

The matrix is computed as one product LUL U: LL is m×rm \times r with column kk zero above row mrp_r[k], 1 in that row and random below it, and UU is r×nr \times n with row kk 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 LL and UU into square unit lower and invertible upper triangular matrices gives A=L′RU′A = L' \mathcal{R} U' where R\mathcal{R} 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
Cite this page

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).