FLINT3.7.0-dev

_flint_mpn_gcdext_inplace

Synopsis#include <flint/mpn_extras.h>
mp_size_t _flint_mpn_gcdext_inplace(mp_ptr gp, mp_ptr sp, mp_size_t * sn, mp_ptr up, mp_size_t un, mp_ptr vp, mp_size_t vn)source

The extended GCD with the interface of GMP's mpn_gcdext: sets (gp,ℓ)(\mathit{gp}, \ell) to g=gcd⁡(u,v)g = \gcd(u, v), returning ℓ\ell, and (sp,∣∗sn∣)(\mathit{sp}, |{*\mathit{sn}}|) with the sign of ∗sn*\mathit{sn} to the cofactor ss of uu as for flint_mpn_gcdext. It is required that un≥vn>0\mathit{un} \ge \mathit{vn} > 0 and that the top limb of vv is nonzero; the top limb of uu may be zero, so that uu can be padded to the length of vv to obtain its cofactor directly (as for a modular inverse). Both inputs are destroyed, and both input arrays must have room for one more limb. gp needs room for vn\mathit{vn} limbs and sp for vn+1\mathit{vn} + 1 limbs; they must not overlap each other or the inputs.

Cite this page

The FLINT team, “_flint_mpn_gcdext_inplace (mpn_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_extras/_flint_mpn_gcdext_inplace.html (generated 2026-11-02).