FLINT3.7.0-dev

fmpq_poly_xgcd

Synopsis#include <flint/fmpq_poly.h>
void fmpq_poly_xgcd(fmpq_poly_t G, fmpq_poly_t S, fmpq_poly_t T, const fmpq_poly_t A, const fmpq_poly_t B)source

Computes polynomials G, S, and T such that G = \gcd(A, B) = S A + T B, where G is the monic greatest common divisor of A and B.

The outputs G, S, T must be distinct objects (an exception is raised otherwise). Corner cases are handled as follows. If A = B = 0, returns G = S = T = 0. If A \neq 0, B = 0, returns the suitable scalar multiple of G = A, S = 1, and T = 0. The case when A = 0, B \neq 0 is handled similarly.

Cite this page

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