FLINT3.7.0-dev

fmpq_mat_charpoly, _fmpq_mat_charpoly

Synopsis#include <flint/fmpq_mat.h>
void fmpq_mat_charpoly(fmpq_poly_t pol, const fmpq_mat_t mat)source
void _fmpq_mat_charpoly(fmpz * coeffs, fmpz_t den, const fmpq_mat_t mat)source

Sets pol to the characteristic polynomial of the square matrix mat; the underscore version writes the n + 1 coefficients of the numerator to coeffs and the denominator to den, not necessarily in canonical form. Throws if mat is not square.

With q the least common denominator of the entries, the characteristic polynomial \sum_k c_k x^k of the integer matrix qA is computed with _fmpz_mat_charpoly, and \chi_A(x) = q^{-n} \chi_{qA}(qx), so the coefficient of x^k is c_k / q^{n - k}.

Cite this page

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