FLINT3.7.0-dev

nmod_mat_reduce_row

Synopsis#include <flint/nmod_mat.h>
slong nmod_mat_reduce_row(nmod_mat_t M, slong * P, slong * L, slong m)source

Reduces row m of M against rows that are already reduced, for incremental Gaussian elimination, and returns the column of its new pivot, or -1 if it reduces to zero.

P has one entry per column: P[i] is the index of the row whose pivot (leading entry, which must be 1) is in column i, or -1 if there is none. Row m is reduced from left to right by subtracting multiples of these rows. At the first column i where it has a nonzero entry and P[i] is -1, the row is divided by that entry, P[i] is set to m and i is returned. If the row becomes zero, -1 is returned. L[j] is the number of leading columns of row j that may be nonzero; entries beyond it are taken to be zero, which saves work when the rows get longer towards the bottom. Setting every entry of L to the number of columns is always valid. The pivot rows may be any rows of M, but at most m of them; the updates are accumulated without reduction in up to three words. This is the elimination step of nmod_mat_minpoly.

Cite this page

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