# distutils: libraries = flint
# distutils: depends = flint/qqbar.h

################################################################################
# This file is auto-generated by the script
#   SAGE_ROOT/tools/flint-autogen/flint_autogen.py.
# From the commit 3e2c3a3e091106a25ca9c6fba28e02f2cbcd654a
# Do not modify by hand! Fix and rerun the script instead.
################################################################################

from libc.stdio cimport FILE
from sage.libs.gmp.types cimport *
from sage.libs.mpfr.types cimport *
from sage.libs.flint.types cimport *

cdef extern from "flint_wrap.h":
    void qqbar_init(qqbar_t res) noexcept
    void qqbar_clear(qqbar_t res) noexcept
    qqbar_ptr _qqbar_vec_init(slong len) noexcept
    void _qqbar_vec_clear(qqbar_ptr vec, slong len) noexcept
    void qqbar_swap(qqbar_t x, qqbar_t y) noexcept
    void qqbar_set(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_set_si(qqbar_t res, slong x) noexcept
    void qqbar_set_ui(qqbar_t res, ulong x) noexcept
    void qqbar_set_fmpz(qqbar_t res, const fmpz_t x) noexcept
    void qqbar_set_fmpq(qqbar_t res, const fmpq_t x) noexcept
    void qqbar_set_re_im(qqbar_t res, const qqbar_t x, const qqbar_t y) noexcept
    int qqbar_set_d(qqbar_t res, double x) noexcept
    int qqbar_set_re_im_d(qqbar_t res, double x, double y) noexcept
    slong qqbar_degree(const qqbar_t x) noexcept
    bint qqbar_is_rational(const qqbar_t x) noexcept
    bint qqbar_is_integer(const qqbar_t x) noexcept
    bint qqbar_is_algebraic_integer(const qqbar_t x) noexcept
    bint qqbar_is_zero(const qqbar_t x) noexcept
    bint qqbar_is_one(const qqbar_t x) noexcept
    bint qqbar_is_neg_one(const qqbar_t x) noexcept
    bint qqbar_is_i(const qqbar_t x) noexcept
    bint qqbar_is_neg_i(const qqbar_t x) noexcept
    bint qqbar_is_real(const qqbar_t x) noexcept
    void qqbar_height(fmpz_t res, const qqbar_t x) noexcept
    slong qqbar_height_bits(const qqbar_t x) noexcept
    int qqbar_within_limits(const qqbar_t x, slong deg_limit, slong bits_limit) noexcept
    int qqbar_binop_within_limits(const qqbar_t x, const qqbar_t y, slong deg_limit, slong bits_limit) noexcept
    void _qqbar_get_fmpq(fmpz_t num, fmpz_t den, const qqbar_t x) noexcept
    void qqbar_get_fmpq(fmpq_t res, const qqbar_t x) noexcept
    void qqbar_get_fmpz(fmpz_t res, const qqbar_t x) noexcept
    void qqbar_zero(qqbar_t res) noexcept
    void qqbar_one(qqbar_t res) noexcept
    void qqbar_i(qqbar_t res) noexcept
    void qqbar_phi(qqbar_t res) noexcept
    void qqbar_print(const qqbar_t x) noexcept
    void qqbar_printn(const qqbar_t x, slong n) noexcept
    void qqbar_printnd(const qqbar_t x, slong n) noexcept
    void qqbar_randtest(qqbar_t res, flint_rand_t state, slong deg, slong bits) noexcept
    void qqbar_randtest_real(qqbar_t res, flint_rand_t state, slong deg, slong bits) noexcept
    void qqbar_randtest_nonreal(qqbar_t res, flint_rand_t state, slong deg, slong bits) noexcept
    bint qqbar_equal(const qqbar_t x, const qqbar_t y) noexcept
    bint qqbar_equal_fmpq_poly_val(const qqbar_t x, const fmpq_poly_t f, const qqbar_t y) noexcept
    int qqbar_cmp_re(const qqbar_t x, const qqbar_t y) noexcept
    int qqbar_cmp_im(const qqbar_t x, const qqbar_t y) noexcept
    int qqbar_cmpabs_re(const qqbar_t x, const qqbar_t y) noexcept
    int qqbar_cmpabs_im(const qqbar_t x, const qqbar_t y) noexcept
    int qqbar_cmpabs(const qqbar_t x, const qqbar_t y) noexcept
    int qqbar_cmp_root_order(const qqbar_t x, const qqbar_t y) noexcept
    ulong qqbar_hash(const qqbar_t x) noexcept
    void qqbar_conj(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_re(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_im(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_re_im(qqbar_t res1, qqbar_t res2, const qqbar_t x) noexcept
    void qqbar_abs(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_abs2(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_sgn(qqbar_t res, const qqbar_t x) noexcept
    int qqbar_sgn_re(const qqbar_t x) noexcept
    int qqbar_sgn_im(const qqbar_t x) noexcept
    int qqbar_csgn(const qqbar_t x) noexcept
    void qqbar_floor(fmpz_t res, const qqbar_t x) noexcept
    void qqbar_ceil(fmpz_t res, const qqbar_t x) noexcept
    void qqbar_neg(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_add(qqbar_t res, const qqbar_t x, const qqbar_t y) noexcept
    void qqbar_add_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y) noexcept
    void qqbar_add_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y) noexcept
    void qqbar_add_ui(qqbar_t res, const qqbar_t x, ulong y) noexcept
    void qqbar_add_si(qqbar_t res, const qqbar_t x, slong y) noexcept
    void qqbar_sub(qqbar_t res, const qqbar_t x, const qqbar_t y) noexcept
    void qqbar_sub_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y) noexcept
    void qqbar_sub_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y) noexcept
    void qqbar_sub_ui(qqbar_t res, const qqbar_t x, ulong y) noexcept
    void qqbar_sub_si(qqbar_t res, const qqbar_t x, slong y) noexcept
    void qqbar_fmpq_sub(qqbar_t res, const fmpq_t x, const qqbar_t y) noexcept
    void qqbar_fmpz_sub(qqbar_t res, const fmpz_t x, const qqbar_t y) noexcept
    void qqbar_ui_sub(qqbar_t res, ulong x, const qqbar_t y) noexcept
    void qqbar_si_sub(qqbar_t res, slong x, const qqbar_t y) noexcept
    void qqbar_mul(qqbar_t res, const qqbar_t x, const qqbar_t y) noexcept
    void qqbar_mul_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y) noexcept
    void qqbar_mul_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y) noexcept
    void qqbar_mul_ui(qqbar_t res, const qqbar_t x, ulong y) noexcept
    void qqbar_mul_si(qqbar_t res, const qqbar_t x, slong y) noexcept
    void qqbar_mul_2exp_si(qqbar_t res, const qqbar_t x, slong e) noexcept
    void qqbar_sqr(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_inv(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_div(qqbar_t res, const qqbar_t x, const qqbar_t y) noexcept
    void qqbar_div_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t y) noexcept
    void qqbar_div_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t y) noexcept
    void qqbar_div_ui(qqbar_t res, const qqbar_t x, ulong y) noexcept
    void qqbar_div_si(qqbar_t res, const qqbar_t x, slong y) noexcept
    void qqbar_fmpq_div(qqbar_t res, const fmpq_t x, const qqbar_t y) noexcept
    void qqbar_fmpz_div(qqbar_t res, const fmpz_t x, const qqbar_t y) noexcept
    void qqbar_ui_div(qqbar_t res, ulong x, const qqbar_t y) noexcept
    void qqbar_si_div(qqbar_t res, slong x, const qqbar_t y) noexcept
    void qqbar_scalar_op(qqbar_t res, const qqbar_t x, const fmpz_t a, const fmpz_t b, const fmpz_t c) noexcept
    void qqbar_sqrt(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_sqrt_ui(qqbar_t res, ulong x) noexcept
    void qqbar_rsqrt(qqbar_t res, const qqbar_t x) noexcept
    void qqbar_pow_ui(qqbar_t res, const qqbar_t x, ulong n) noexcept
    void qqbar_pow_si(qqbar_t res, const qqbar_t x, slong n) noexcept
    void qqbar_pow_fmpz(qqbar_t res, const qqbar_t x, const fmpz_t n) noexcept
    void qqbar_pow_fmpq(qqbar_t res, const qqbar_t x, const fmpq_t n) noexcept
    void qqbar_root_ui(qqbar_t res, const qqbar_t x, ulong n) noexcept
    void qqbar_fmpq_root_ui(qqbar_t res, const fmpq_t x, ulong n) noexcept
    void qqbar_fmpq_pow_si_ui(qqbar_t res, const fmpq_t x, slong m, ulong n) noexcept
    int qqbar_pow(qqbar_t res, const qqbar_t x, const qqbar_t y) noexcept
    void qqbar_get_acb(acb_t res, const qqbar_t x, slong prec) noexcept
    void qqbar_get_arb(arb_t res, const qqbar_t x, slong prec) noexcept
    void qqbar_get_arb_re(arb_t res, const qqbar_t x, slong prec) noexcept
    void qqbar_get_arb_im(arb_t res, const qqbar_t x, slong prec) noexcept
    void qqbar_cache_enclosure(qqbar_t res, slong prec) noexcept
    void qqbar_denominator(fmpz_t res, const qqbar_t y) noexcept
    void qqbar_numerator(qqbar_t res, const qqbar_t y) noexcept
    void qqbar_conjugates(qqbar_ptr res, const qqbar_t x) noexcept
    void _qqbar_evaluate_fmpq_poly(qqbar_t res, const fmpz * poly, const fmpz_t den, slong len, const qqbar_t x) noexcept
    void qqbar_evaluate_fmpq_poly(qqbar_t res, const fmpq_poly_t poly, const qqbar_t x) noexcept
    void _qqbar_evaluate_fmpz_poly(qqbar_t res, const fmpz * poly, slong len, const qqbar_t x) noexcept
    void qqbar_evaluate_fmpz_poly(qqbar_t res, const fmpz_poly_t poly, const qqbar_t x) noexcept
    int qqbar_evaluate_fmpz_mpoly_iter(qqbar_t res, const fmpz_mpoly_t poly, qqbar_srcptr x, slong deg_limit, slong bits_limit, const fmpz_mpoly_ctx_t ctx) noexcept
    int qqbar_evaluate_fmpz_mpoly_horner(qqbar_t res, const fmpz_mpoly_t poly, qqbar_srcptr x, slong deg_limit, slong bits_limit, const fmpz_mpoly_ctx_t ctx) noexcept
    int qqbar_evaluate_fmpz_mpoly(qqbar_t res, const fmpz_mpoly_t poly, qqbar_srcptr x, slong deg_limit, slong bits_limit, const fmpz_mpoly_ctx_t ctx) noexcept
    void qqbar_roots_fmpz_poly(qqbar_ptr res, const fmpz_poly_t poly, int flags) noexcept
    void qqbar_roots_fmpq_poly(qqbar_ptr res, const fmpq_poly_t poly, int flags) noexcept
    void qqbar_eigenvalues_fmpz_mat(qqbar_ptr res, const fmpz_mat_t mat, int flags) noexcept
    void qqbar_eigenvalues_fmpq_mat(qqbar_ptr res, const fmpq_mat_t mat, int flags) noexcept
    void qqbar_root_of_unity(qqbar_t res, slong p, ulong q) noexcept
    bint qqbar_is_root_of_unity(slong * p, ulong * q, const qqbar_t x) noexcept
    void qqbar_exp_pi_i(qqbar_t res, slong p, ulong q) noexcept
    void qqbar_cos_pi(qqbar_t res, slong p, ulong q) noexcept
    void qqbar_sin_pi(qqbar_t res, slong p, ulong q) noexcept
    int qqbar_tan_pi(qqbar_t res, slong p, ulong q) noexcept
    int qqbar_cot_pi(qqbar_t res, slong p, ulong q) noexcept
    int qqbar_sec_pi(qqbar_t res, slong p, ulong q) noexcept
    int qqbar_csc_pi(qqbar_t res, slong p, ulong q) noexcept
    int qqbar_log_pi_i(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_atan_pi(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_asin_pi(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_acos_pi(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_acot_pi(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_asec_pi(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_acsc_pi(slong * p, ulong * q, const qqbar_t x) noexcept
    int qqbar_guess(qqbar_t res, const acb_t z, slong max_deg, slong max_bits, int flags, slong prec) noexcept
    int qqbar_express_in_field(fmpq_poly_t res, const qqbar_t alpha, const qqbar_t x, slong max_bits, int flags, slong prec) noexcept
    void qqbar_get_quadratic(fmpz_t a, fmpz_t b, fmpz_t c, fmpz_t q, const qqbar_t x, int factoring) noexcept
    int qqbar_set_fexpr(qqbar_t res, const fexpr_t expr) noexcept
    void qqbar_get_fexpr_repr(fexpr_t res, const qqbar_t x) noexcept
    void qqbar_get_fexpr_root_nearest(fexpr_t res, const qqbar_t x) noexcept
    void qqbar_get_fexpr_root_indexed(fexpr_t res, const qqbar_t x) noexcept
    int qqbar_get_fexpr_formula(fexpr_t res, const qqbar_t x, ulong flags) noexcept
    void qqbar_fmpz_poly_composed_op(fmpz_poly_t res, const fmpz_poly_t A, const fmpz_poly_t B, int op) noexcept
    void qqbar_binary_op(qqbar_t res, const qqbar_t x, const qqbar_t y, int op) noexcept
    int _qqbar_validate_uniqueness(acb_t res, const fmpz_poly_t poly, const acb_t z, slong max_prec) noexcept
    int _qqbar_validate_existence_uniqueness(acb_t res, const fmpz_poly_t poly, const acb_t z, slong max_prec) noexcept
    void _qqbar_enclosure_raw(acb_t res, const fmpz_poly_t poly, const acb_t z, slong prec) noexcept
    void qqbar_enclosure_raw(acb_t res, const qqbar_t x, slong prec) noexcept
    int _qqbar_acb_lindep(fmpz * rel, acb_srcptr vec, slong len, int check, slong prec) noexcept
