_gr_mat_charpoly, gr_mat_charpoly, _gr_mat_charpoly_generic, gr_mat_charpoly_generic
#include <flint/gr_mat.h>Set res to the characteristic polynomial \det(xI - A) of a square matrix (GR_DOMAIN otherwise). _gr_mat_charpoly calls the ring method GR_METHOD_MAT_CHARPOLY; the default _gr_mat_charpoly_generic uses Berkowitz's algorithm, which works over any commutative ring. Rings with fast arithmetic override it: nmod and fmpz_mod use Danilevsky's algorithm above dimension 8 (16 for fmpz_mod), falling back to Berkowitz when it meets a non-invertible pivot; fq and its variants use Berkowitz up to dimension 12 and Danilevsky above; fmpz and fmpq call fmpz_mat_charpoly and fmpq_mat_charpoly; mpn_mod has its own. The underscore versions write n + 1 coefficients. See Characteristic and minimal polynomials.
Guides#
- Using mpn_mod (
mpn_mod)
The FLINT team, “_gr_mat_charpoly, gr_mat_charpoly, _gr_mat_charpoly_generic, gr_mat_charpoly_generic (gr_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_mat/_gr_mat_charpoly.html (generated 2026-10-20).
@misc{flint-doc-gr-mat-gr-mat-charpoly,
author = {{The FLINT team}},
title = {{\_gr\_mat\_charpoly, gr\_mat\_charpoly, \_gr\_mat\_charpoly\_generic, gr\_mat\_charpoly\_generic (gr\_mat.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/gr_mat/_gr_mat_charpoly.html},
note = {Generated 2026-10-20}
}