FLINT3.7.0-dev

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

Sets (BB, den) to the inverse of the square matrix AA, so that AB=BA=den⋅IAB = BA = \mathit{den} \cdot I, and returns 1 if AA is nonsingular; returns 0 if AA is singular. BB may be AA.

Dimensions up to 2 use explicit formulas with den=det⁡(A)\mathit{den} = \det(A); larger matrices are solved against the identity matrix with fmpz_mat_solve, so that den is det⁡(A)\det(A) for dimensions up to 15 and the minimal positive denominator (the largest invariant factor of AA) 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-11-02).