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 f of length at most len with f(x_i) = y_i, for pairwise distinct points x_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(\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 f has coefficients in the fraction field of R but not in R (as for the points 0, 2 and values 0, 1 over \mathbb{Z}). The exact versions assume that the points are distinct and that f has coefficients in R, 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-10-20).