FLINT3.7.0-dev

_mpn_mod_mat_charpoly

Synopsis#include <flint/mpn_mod.h>
int _mpn_mod_mat_charpoly(nn_ptr res, const gr_mat_t mat, gr_ctx_t ctx)source

Sets the m + 1 coefficients at res to the characteristic polynomial of the m \times m matrix mat, with the Berkowitz algorithm for m \le 11 and Danilevsky's algorithm (_gr_mat_charpoly_danilevsky) for larger m. Danilevsky's algorithm divides by pivots, so for a composite modulus it can fail; the function then falls back to the division-free Berkowitz algorithm, and always succeeds. This is the method behind gr_mat_charpoly.

Cite this page

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