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 GG, SS, and TT such that G=gcd⁡(A,B)=SA+TBG = \gcd(A, B) = S A + T B, where GG is the monic greatest common divisor of AA and BB.

The outputs GG, SS, TT must be distinct objects (an exception is raised otherwise). Corner cases are handled as follows. If A=B=0A = B = 0, returns G=S=T=0G = S = T = 0. If A≠0A \neq 0, B=0B = 0, returns the suitable scalar multiple of G=AG = A, S=1S = 1, and T=0T = 0. The case when A=0A = 0, B≠0B \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-11-02).