_gr_poly_hgcd
#include <flint/gr_poly.h>int _gr_poly_hgcd(gr_ptr r, slong * sgn, gr_ptr * M, slong * lenM, gr_ptr A, slong * lenA, gr_ptr B, slong * lenB, gr_srcptr a, slong lena, gr_srcptr b, slong lenb, slong cutoff, gr_ctx_t ctx)sourceComputes the half-gcd of and (Half-GCD): a matrix of polynomials, a sign and the consecutive remainders , with and . The recursion uses the Euclidean algorithm below cutoff.
Requires and nonzero leading coefficients; returns GR_DOMAIN if a length is zero or a leading coefficient is not invertible. and must have room for and coefficients; on return *lenA and *lenB hold their lengths. M[0], …, M[3] must each have room for coefficients, with the lengths written to lenM; if M is NULL, only and are computed. If r is not NULL, it is an accumulator for the resultant: it is multiplied by the factor contributed by the remainder sequence up to , as used by _gr_poly_resultant_hgcd. The input pairs (A, a) and (B, b) may be aliased.
The products of the polynomial matrices are done by _gr_poly_hgcd_mat_mul, a ring method; the default _gr_poly_hgcd_mat_mul_generic uses 8 classical products when some entry has length below 20 and Strassen's 7 products otherwise, and when the ring provides a transformed representation (with fft_small) and all entries have length at least 128, it transforms each of the 8 entries once and computes the products pointwise, in several threads for entries of length at least 1024.
The FLINT team, “_gr_poly_hgcd (gr_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_poly/_gr_poly_hgcd.html (generated 2026-11-02).
@misc{flint-doc-gr-poly-gr-poly-hgcd,
author = {{The FLINT team}},
title = {{\_gr\_poly\_hgcd (gr\_poly.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/gr_poly/_gr_poly_hgcd.html},
note = {Generated 2026-11-02}
}