FLINT3.7.0-dev

_ca_poly_gcd_euclidean, ca_poly_gcd_euclidean, _ca_poly_gcd, ca_poly_gcd

Synopsis#include <flint/ca_poly.h>
slong _ca_poly_gcd_euclidean(ca_ptr G, ca_srcptr A, slong lenA, ca_srcptr B, slong lenB, ca_ctx_t ctx)source
int ca_poly_gcd_euclidean(ca_poly_t G, const ca_poly_t A, const ca_poly_t B, ca_ctx_t ctx)source
slong _ca_poly_gcd(ca_ptr G, ca_srcptr A, slong lenA, ca_srcptr B, slong lenB, ca_ctx_t ctx)source
int ca_poly_gcd(ca_poly_t G, const ca_poly_t A, const ca_poly_t B, ca_ctx_t ctx)source

Sets G to the monic greatest common divisor of A and B (zero if both are zero) and returns 1. Returns 0, leaving G unspecified, if a zero test of a leading coefficient fails during the computation (in particular if the leading coefficient of an input is not proved nonzero).

The underscore versions require \mathit{lenA} \ge \mathit{lenB} \ge 1 and nonzero leading coefficients, write at most \mathit{lenB} coefficients of a GCD that is not necessarily monic, and return its length, or 0 on failure.

The euclidean versions run the Euclidean algorithm, testing each remainder's leading coefficient for zero. The default versions first handle rational polynomials by an integer GCD computation over \mathbb{Z} (_fmpz_poly_gcd), then try to prove numerically that A and B are coprime by evaluating their Sylvester resultant in ball arithmetic at precision CA_OPT_LOW_PREC (a resultant ball excluding zero proves \gcd = 1), and otherwise use the Euclidean algorithm.

Guides#

Cite this page

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