FLINT3.7.0-dev

_fmpq_poly_interpolate_barycentric, fmpq_poly_interpolate_barycentric, _fmpq_poly_interpolate_multi_mod, fmpq_poly_interpolate_multi_mod, _fmpq_poly_interpolate_fmpq_vec, fmpq_poly_interpolate_fmpz_vec, fmpq_poly_interpolate_fmpz_fmpq_vec, fmpq_poly_interpolate_fmpq_vec

Synopsis#include <flint/fmpq_poly.h>
void _fmpq_poly_interpolate_barycentric(fmpz * poly, fmpz_t den, const fmpq * xs, const fmpq * ys, slong n)source
void fmpq_poly_interpolate_barycentric(fmpq_poly_t poly, const fmpq * xs, const fmpq * ys, slong n)source
void _fmpq_poly_interpolate_multi_mod(fmpz * poly, fmpz_t den, const fmpq * xs, const fmpq * ys, slong n)source
void fmpq_poly_interpolate_multi_mod(fmpq_poly_t poly, const fmpq * xs, const fmpq * ys, slong n)source
int _fmpq_poly_interpolate_fmpq_vec(fmpz * poly, fmpz_t den, const fmpq * xs, const fmpq * ys, slong n)source
int fmpq_poly_interpolate_fmpz_vec(fmpq_poly_t poly, const fmpz * xs, const fmpz * ys, slong n)source
int fmpq_poly_interpolate_fmpz_fmpq_vec(fmpq_poly_t poly, const fmpz * xs, const fmpq * ys, slong n)source
int fmpq_poly_interpolate_fmpq_vec(fmpq_poly_t poly, const fmpq * xs, const fmpq * ys, slong n)source

Sets poly (or poly / den) to the unique interpolating polynomial of degree at most n - 1 satisfying f(x_i) = y_i for every pair x_i, y_i in xs and ys.

The barycentric uses a naive implementation of Lagrange interpolation in its barycentric form, clearing denominators to avoid working with fractions. It assumes that the evaluation points x_i are distinct.

The multi_mod algorithm performs interpolation modulo one or more prime numbers, combines the results using the Chinese Remainder Theorem (CRT) with adaptive termination, and recovers the rational coefficients by rational reconstruction. This function is particularly efficient when the interpolated polynomial is expected to have small-bitsize coefficients. It assumes that the evaluation points x_i are distinct.

The default implementation first checks that the x_i are distinct and, if so, automatically chooses between the barycentric, multi_mod and fast algorithms. It returns 1 if the x_i are distinct, otherwise 0.

Cite this page

The FLINT team, “_fmpq_poly_interpolate_barycentric, fmpq_poly_interpolate_barycentric, _fmpq_poly_interpolate_multi_mod, fmpq_poly_interpolate_multi_mod, _fmpq_poly_interpolate_fmpq_vec, fmpq_poly_interpolate_fmpz_vec, fmpq_poly_interpolate_fmpz_fmpq_vec, fmpq_poly_interpolate_fmpq_vec (fmpq_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpq_poly/_fmpq_poly_interpolate_barycentric.html (generated 2026-10-20).