fmpz_poly_extra.h — Flint integral polynomials utilities

void _fmpz_poly_scale_0_1_fmpq(fmpz* pol, slong len, fmpq_t a, fmpq_t b)

Precompose the polynomial pol by an affine transformation so that the interval [a, b] becomes the interval [0,1]

void fmpz_poly_randtest_irreducible(fmpz_poly_t p, flint_rand_t state, slong len, ulong bits)

Set p to be a random irreducible polynomial

int fmpz_poly_set_str_pretty(fmpz_poly_t p, char* s, char* var)

Set the polynomial p from the string s using var as variable name

int _fmpz_poly_has_real_root(fmpz* pol, slong len)

Return 1 if the polynomial pol has a real root and 0 otherwise

slong fmpz_poly_positive_root_upper_bound_2exp(const fmpz_poly_t pol)

Return an upper bound on the bitsize of largest real root of pol.

slong _fmpz_poly_positive_root_upper_bound_2exp(fmpz* pol, slong len)

Return an upper bound on the bitsize of largest real root of (pol, len).

slong fmpz_poly_num_real_roots_upper_bound(fmpz_poly_t pol)

Return an upper bound on the number of real roots of the polynomial pol (currently using Descartes’ rule of sign).

slong _fmpz_poly_descartes_bound_0_1(fmpz* p, slong len, slong bound)

Return an upper bound on the number of real roots between 0 and 1 of the polynomial (p, len) using Descartes’ rule of sign. If the result is larger than bound then WORD_MAX is returned.

void _fmpz_poly_isolate_real_roots_0_1_vca(fmpq* exact_roots, slong* n_exact_roots, fmpz* c_array, slong* k_array, slong* n_intervals, fmpz* pol, slong len)

Isolate the real roots of (pol, len) contained in the interval $(0, 1)$. The array exact_roots will be set by the exact dyadic roots found by the algorithm and n_exact_roots updated accordingly. The arrays c_array and k_array are set to be interval data that enclose the remaining roots and n_interval is updated accordingly. A data c = c_array + i and k = k_array[i] represents the open interval $(c 2^k, (c + 1) 2^k)$.

void fmpz_poly_isolate_real_roots(fmpq* exact_roots, slong* n_exact, fmpz* c_array, slong* k_array, slong* n_interval, fmpz_poly_t pol)

Isolate the real roots of pol. The array exact_roots will be set by the exact dyadic roots found by the algorithm and n_exact_roots updated accordingly.

The arrays c_array and k_array are set to be interval data that enclose the remaining roots and n_interval is updated accordingly. A data c = c_array + i and k = k_array[i] represents the open interval $(c 2^k, (c + 1) 2^k)$.

void fmpz_poly_abs(fmpz_poly_t res, fmpz_poly_t p)

Set res to be the polynomial whose coefficients are the absolute values of the ones in p

void _fmpz_poly_evaluate_arb(arb_t res, fmpz* pol, slong len, const arb_t a, slong prec)

Evaluate the polynomial pol at the ball a and set result in res