fmpz_mat_inv
Synopsis
#include <flint/fmpz_mat.h>int fmpz_mat_inv(fmpz_mat_t B, fmpz_t den, const fmpz_mat_t A)sourceSets (B, den) to the inverse of the square matrix A, so that AB = BA = \mathit{den} \cdot I, and returns 1 if A is nonsingular; returns 0 if A is singular. B may be A.
Dimensions up to 2 use explicit formulas with \mathit{den} = \det(A); larger matrices are solved against the identity matrix with fmpz_mat_solve, so that den is \det(A) for dimensions up to 15 and the minimal positive denominator (the largest invariant factor of A) above.
Guides#
Cite this page
The FLINT team, “fmpz_mat_inv (fmpz_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpz_mat/fmpz_mat_inv.html (generated 2026-10-20).
@misc{flint-doc-fmpz-mat-fmpz-mat-inv,
author = {{The FLINT team}},
title = {{fmpz\_mat\_inv (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_inv.html},
note = {Generated 2026-10-20}
}