FLINT3.7.0-dev

_gr_poly_interpolate, gr_poly_interpolate, _gr_poly_interpolate_exact, gr_poly_interpolate_exact, _gr_poly_interpolate_newton, gr_poly_interpolate_newton, _gr_poly_interpolate_exact_newton, gr_poly_interpolate_exact_newton

Synopsis#include <flint/gr_poly.h>
int _gr_poly_interpolate(gr_ptr res, gr_srcptr xs, gr_srcptr ys, slong len, gr_ctx_t ctx)source
int gr_poly_interpolate(gr_poly_t poly, const gr_vec_t xs, const gr_vec_t ys, gr_ctx_t ctx)source
int _gr_poly_interpolate_exact(gr_ptr res, gr_srcptr xs, gr_srcptr ys, slong len, gr_ctx_t ctx)source
int gr_poly_interpolate_exact(gr_poly_t poly, const gr_vec_t xs, const gr_vec_t ys, gr_ctx_t ctx)source
int _gr_poly_interpolate_newton(gr_ptr res, gr_srcptr xs, gr_srcptr ys, slong len, gr_ctx_t ctx)source
int gr_poly_interpolate_newton(gr_poly_t poly, const gr_vec_t xs, const gr_vec_t ys, gr_ctx_t ctx)source
int _gr_poly_interpolate_exact_newton(gr_ptr res, gr_srcptr xs, gr_srcptr ys, slong len, gr_ctx_t ctx)source
int gr_poly_interpolate_exact_newton(gr_poly_t poly, const gr_vec_t xs, const gr_vec_t ys, gr_ctx_t ctx)source

Set res to the interpolating polynomial ff of length at most len with f(xi)=yif(x_i) = y_i, for pairwise distinct points xix_i. The default versions currently call the newton versions, which compute divided differences in the Newton basis and convert to the monomial basis, with O(len2)O(\mathit{len}^2) operations.

The ring is presumed to be an integral domain; over other rings the functions may succeed without the result interpolating. They return GR_DOMAIN or GR_UNABLE if xs and ys have different lengths (checked by the non-underscore versions only), if the points are not distinct, or if ff has coefficients in the fraction field of RR but not in RR (as for the points 0,20, 2 and values 0,10, 1 over Z\mathbb{Z}). The exact versions assume that the points are distinct and that ff has coefficients in RR, use exact divisions, and may return an arbitrary polynomial otherwise.

Cite this page

The FLINT team, “_gr_poly_interpolate, gr_poly_interpolate, _gr_poly_interpolate_exact, gr_poly_interpolate_exact, _gr_poly_interpolate_newton, gr_poly_interpolate_newton, _gr_poly_interpolate_exact_newton, gr_poly_interpolate_exact_newton (gr_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_poly/_gr_poly_interpolate.html (generated 2026-11-02).