FLINT3.7.0-dev

ca_mat_det_berkowitz, ca_mat_det_lu, ca_mat_det_bareiss, ca_mat_det_cofactor, ca_mat_det

Synopsis#include <flint/ca_mat.h>
void ca_mat_det_berkowitz(ca_t det, const ca_mat_t A, ca_ctx_t ctx)source
int ca_mat_det_lu(ca_t det, const ca_mat_t A, ca_ctx_t ctx)source
int ca_mat_det_bareiss(ca_t det, const ca_mat_t A, ca_ctx_t ctx)source
void ca_mat_det_cofactor(ca_t det, const ca_mat_t A, ca_ctx_t ctx)source
void ca_mat_det(ca_t det, const ca_mat_t A, ca_ctx_t ctx)source

Sets det to the determinant of the square matrix A.

  • The berkowitz version uses the division-free Berkowitz algorithm with O(n^4) operations. It needs no zero tests and always succeeds.
  • The cofactor version uses cofactor expansion; it is meant for matrices of size up to 4.
  • The lu and bareiss versions use LU decomposition and fraction-free LU decomposition with O(n^3) operations. They need zero tests for pivoting and return 0 if one fails (1 on success).
  • The default version computes the determinant of a rational matrix of size at least 3 over \mathbb{Z} or \mathbb{Q} (fmpz_mat.h, fmpq_mat.h), uses cofactor expansion for n \le 4, LU decomposition if all entries lie in one number field, and the Berkowitz algorithm otherwise.

Different algorithms can give different symbolic representations of the same determinant, and which one is fastest depends strongly on the structure of the matrix. All but the Bareiss version are wrappers of the corresponding gr_mat_det functions.

Cite this page

The FLINT team, “ca_mat_det_berkowitz, ca_mat_det_lu, ca_mat_det_bareiss, ca_mat_det_cofactor, ca_mat_det (ca_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ca_mat/ca_mat_det_berkowitz.html (generated 2026-10-20).