fmpz_mat_nullspace
#include <flint/fmpz_mat.h>slong fmpz_mat_nullspace(fmpz_mat_t res, const fmpz_mat_t mat)sourceSets the first n - r columns of res to a basis of the right nullspace of the m \times n matrix mat over \mathbb{Q}, where r is the rank, and returns n - r. The other columns of res are set to zero. res must be n \times n.
The basis is read off from fmpz_mat_rref: for each non-pivot column f the basis vector has -\mathit{den} in position f and the entries of column f of the scaled echelon form in the pivot positions. The vectors are integral but in general neither primitive nor a basis of the integer kernel lattice \{x \in \mathbb{Z}^n : Ax = 0\}; for that, compute the Hermite normal form with transformation of A^T or use LLL.
Guides#
The FLINT team, “fmpz_mat_nullspace (fmpz_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpz_mat/fmpz_mat_nullspace.html (generated 2026-10-20).
@misc{flint-doc-fmpz-mat-fmpz-mat-nullspace,
author = {{The FLINT team}},
title = {{fmpz\_mat\_nullspace (fmpz\_mat.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpz_mat/fmpz_mat_nullspace.html},
note = {Generated 2026-10-20}
}