# distutils: libraries = flint
# distutils: depends = flint/ca.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 ca_ctx_init(ca_ctx_t ctx) noexcept
    void ca_ctx_clear(ca_ctx_t ctx) noexcept
    void ca_ctx_print(ca_ctx_t ctx) noexcept
    void ca_init(ca_t x, ca_ctx_t ctx) noexcept
    void ca_clear(ca_t x, ca_ctx_t ctx) noexcept
    void ca_swap(ca_t x, ca_t y, ca_ctx_t ctx) noexcept
    void ca_get_fexpr(fexpr_t res, const ca_t x, ulong flags, ca_ctx_t ctx) noexcept
    int ca_set_fexpr(ca_t res, const fexpr_t expr, ca_ctx_t ctx) noexcept
    void ca_print(const ca_t x, ca_ctx_t ctx) noexcept
    void ca_fprint(FILE * fp, const ca_t x, ca_ctx_t ctx) noexcept
    char * ca_get_str(const ca_t x, ca_ctx_t ctx) noexcept
    void ca_printn(const ca_t x, slong n, ca_ctx_t ctx) noexcept
    void ca_zero(ca_t res, ca_ctx_t ctx) noexcept
    void ca_one(ca_t res, ca_ctx_t ctx) noexcept
    void ca_neg_one(ca_t res, ca_ctx_t ctx) noexcept
    void ca_i(ca_t res, ca_ctx_t ctx) noexcept
    void ca_neg_i(ca_t res, ca_ctx_t ctx) noexcept
    void ca_pi(ca_t res, ca_ctx_t ctx) noexcept
    void ca_pi_i(ca_t res, ca_ctx_t ctx) noexcept
    void ca_euler(ca_t res, ca_ctx_t ctx) noexcept
    void ca_unknown(ca_t res, ca_ctx_t ctx) noexcept
    void ca_undefined(ca_t res, ca_ctx_t ctx) noexcept
    void ca_uinf(ca_t res, ca_ctx_t ctx) noexcept
    void ca_pos_inf(ca_t res, ca_ctx_t ctx) noexcept
    void ca_neg_inf(ca_t res, ca_ctx_t ctx) noexcept
    void ca_pos_i_inf(ca_t res, ca_ctx_t ctx) noexcept
    void ca_neg_i_inf(ca_t res, ca_ctx_t ctx) noexcept
    void ca_set(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_set_si(ca_t res, slong v, ca_ctx_t ctx) noexcept
    void ca_set_ui(ca_t res, ulong v, ca_ctx_t ctx) noexcept
    void ca_set_fmpz(ca_t res, const fmpz_t v, ca_ctx_t ctx) noexcept
    void ca_set_fmpq(ca_t res, const fmpq_t v, ca_ctx_t ctx) noexcept
    void ca_set_d(ca_t res, double x, ca_ctx_t ctx) noexcept
    void ca_set_d_d(ca_t res, double x, double y, ca_ctx_t ctx) noexcept
    void ca_transfer(ca_t res, ca_ctx_t res_ctx, const ca_t src, ca_ctx_t src_ctx) noexcept
    void ca_set_qqbar(ca_t res, const qqbar_t x, ca_ctx_t ctx) noexcept
    int ca_get_fmpz(fmpz_t res, const ca_t x, ca_ctx_t ctx) noexcept
    int ca_get_fmpq(fmpq_t res, const ca_t x, ca_ctx_t ctx) noexcept
    int ca_get_qqbar(qqbar_t res, const ca_t x, ca_ctx_t ctx) noexcept
    int ca_can_evaluate_qqbar(const ca_t x, ca_ctx_t ctx) noexcept
    void ca_randtest_rational(ca_t res, flint_rand_t state, slong bits, ca_ctx_t ctx) noexcept
    void ca_randtest(ca_t res, flint_rand_t state, slong depth, slong bits, ca_ctx_t ctx) noexcept
    void ca_randtest_special(ca_t res, flint_rand_t state, slong depth, slong bits, ca_ctx_t ctx) noexcept
    void ca_randtest_same_nf(ca_t res, flint_rand_t state, const ca_t x, slong bits, slong den_bits, ca_ctx_t ctx) noexcept
    bint ca_equal_repr(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    int ca_cmp_repr(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    ulong ca_hash_repr(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_unknown(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_special(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_qq_elem(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_qq_elem_zero(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_qq_elem_one(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_qq_elem_integer(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_nf_elem(const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_cyclotomic_nf_elem(slong * p, ulong * q, const ca_t x, ca_ctx_t ctx) noexcept
    bint ca_is_generic_elem(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_number(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_zero(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_one(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_neg_one(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_i(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_neg_i(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_algebraic(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_rational(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_integer(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_real(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_negative_real(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_imaginary(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_undefined(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_infinity(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_uinf(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_signed_inf(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_pos_inf(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_neg_inf(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_pos_i_inf(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_is_neg_i_inf(const ca_t x, ca_ctx_t ctx) noexcept
    truth_t ca_check_equal(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    truth_t ca_check_lt(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    truth_t ca_check_le(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    truth_t ca_check_gt(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    truth_t ca_check_ge(const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_merge_fields(ca_t resx, ca_t resy, const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_condense_field(ca_t res, ca_ctx_t ctx) noexcept
    ca_ext_ptr ca_is_gen_as_ext(const ca_t x, ca_ctx_t ctx) noexcept
    void ca_neg(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_add_fmpq(ca_t res, const ca_t x, const fmpq_t y, ca_ctx_t ctx) noexcept
    void ca_add_fmpz(ca_t res, const ca_t x, const fmpz_t y, ca_ctx_t ctx) noexcept
    void ca_add_ui(ca_t res, const ca_t x, ulong y, ca_ctx_t ctx) noexcept
    void ca_add_si(ca_t res, const ca_t x, slong y, ca_ctx_t ctx) noexcept
    void ca_add(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_sub_fmpq(ca_t res, const ca_t x, const fmpq_t y, ca_ctx_t ctx) noexcept
    void ca_sub_fmpz(ca_t res, const ca_t x, const fmpz_t y, ca_ctx_t ctx) noexcept
    void ca_sub_ui(ca_t res, const ca_t x, ulong y, ca_ctx_t ctx) noexcept
    void ca_sub_si(ca_t res, const ca_t x, slong y, ca_ctx_t ctx) noexcept
    void ca_fmpq_sub(ca_t res, const fmpq_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_fmpz_sub(ca_t res, const fmpz_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_ui_sub(ca_t res, ulong x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_si_sub(ca_t res, slong x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_sub(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_mul_fmpq(ca_t res, const ca_t x, const fmpq_t y, ca_ctx_t ctx) noexcept
    void ca_mul_fmpz(ca_t res, const ca_t x, const fmpz_t y, ca_ctx_t ctx) noexcept
    void ca_mul_ui(ca_t res, const ca_t x, ulong y, ca_ctx_t ctx) noexcept
    void ca_mul_si(ca_t res, const ca_t x, slong y, ca_ctx_t ctx) noexcept
    void ca_mul(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_inv(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_fmpq_div(ca_t res, const fmpq_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_fmpz_div(ca_t res, const fmpz_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_ui_div(ca_t res, ulong x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_si_div(ca_t res, slong x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_div_fmpq(ca_t res, const ca_t x, const fmpq_t y, ca_ctx_t ctx) noexcept
    void ca_div_fmpz(ca_t res, const ca_t x, const fmpz_t y, ca_ctx_t ctx) noexcept
    void ca_div_ui(ca_t res, const ca_t x, ulong y, ca_ctx_t ctx) noexcept
    void ca_div_si(ca_t res, const ca_t x, slong y, ca_ctx_t ctx) noexcept
    void ca_div(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_dot(ca_t res, const ca_t initial, int subtract, ca_srcptr x, slong xstep, ca_srcptr y, slong ystep, slong len, ca_ctx_t ctx) noexcept
    void ca_fmpz_poly_evaluate(ca_t res, const fmpz_poly_t poly, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_fmpq_poly_evaluate(ca_t res, const fmpq_poly_t poly, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_fmpz_mpoly_evaluate_horner(ca_t res, const fmpz_mpoly_t f, ca_srcptr x, const fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx) noexcept
    void ca_fmpz_mpoly_evaluate_iter(ca_t res, const fmpz_mpoly_t f, ca_srcptr x, const fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx) noexcept
    void ca_fmpz_mpoly_evaluate(ca_t res, const fmpz_mpoly_t f, ca_srcptr x, const fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx) noexcept
    void ca_fmpz_mpoly_q_evaluate(ca_t res, const fmpz_mpoly_q_t f, ca_srcptr x, const fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx) noexcept
    void ca_fmpz_mpoly_q_evaluate_no_division_by_zero(ca_t res, const fmpz_mpoly_q_t f, ca_srcptr x, const fmpz_mpoly_ctx_t mctx, ca_ctx_t ctx) noexcept
    void ca_inv_no_division_by_zero(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sqr(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_pow_fmpq(ca_t res, const ca_t x, const fmpq_t y, ca_ctx_t ctx) noexcept
    void ca_pow_fmpz(ca_t res, const ca_t x, const fmpz_t y, ca_ctx_t ctx) noexcept
    void ca_pow_ui(ca_t res, const ca_t x, ulong y, ca_ctx_t ctx) noexcept
    void ca_pow_si(ca_t res, const ca_t x, slong y, ca_ctx_t ctx) noexcept
    void ca_pow(ca_t res, const ca_t x, const ca_t y, ca_ctx_t ctx) noexcept
    void ca_pow_si_arithmetic(ca_t res, const ca_t x, slong n, ca_ctx_t ctx) noexcept
    void ca_sqrt_inert(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sqrt_nofactor(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sqrt_factor(ca_t res, const ca_t x, ulong flags, ca_ctx_t ctx) noexcept
    void ca_sqrt(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sqrt_ui(ca_t res, ulong n, ca_ctx_t ctx) noexcept
    void ca_abs(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sgn(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_csgn(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_arg(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_re(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_im(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_conj_deep(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_conj_shallow(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_conj(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_floor(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_ceil(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_exp(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_log(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sin_cos_exponential(ca_t res1, ca_t res2, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sin_cos_direct(ca_t res1, ca_t res2, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sin_cos_tangent(ca_t res1, ca_t res2, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sin_cos(ca_t res1, ca_t res2, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_sin(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_cos(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_tan_sine_cosine(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_tan_exponential(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_tan_direct(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_tan(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_cot(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_atan_logarithm(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_atan_direct(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_atan(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_asin_logarithm(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_acos_logarithm(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_asin_direct(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_acos_direct(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_asin(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_acos(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_gamma(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_erf(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_erfc(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_erfi(ca_t res, const ca_t x, ca_ctx_t ctx) noexcept
    void ca_get_acb_raw(acb_t res, const ca_t x, slong prec, ca_ctx_t ctx) noexcept
    void ca_get_acb(acb_t res, const ca_t x, slong prec, ca_ctx_t ctx) noexcept
    void ca_get_acb_accurate_parts(acb_t res, const ca_t x, slong prec, ca_ctx_t ctx) noexcept
    char * ca_get_decimal_str(const ca_t x, slong digits, ulong flags, ca_ctx_t ctx) noexcept
    void ca_rewrite_complex_normal_form(ca_t res, const ca_t x, int deep, ca_ctx_t ctx) noexcept
    void ca_factor_init(ca_factor_t fac, ca_ctx_t ctx) noexcept
    void ca_factor_clear(ca_factor_t fac, ca_ctx_t ctx) noexcept
    void ca_factor_one(ca_factor_t fac, ca_ctx_t ctx) noexcept
    void ca_factor_print(const ca_factor_t fac, ca_ctx_t ctx) noexcept
    void ca_factor_insert(ca_factor_t fac, const ca_t base, const ca_t exp, ca_ctx_t ctx) noexcept
    void ca_factor_get_ca(ca_t res, const ca_factor_t fac, ca_ctx_t ctx) noexcept
    void ca_factor(ca_factor_t res, const ca_t x, ulong flags, ca_ctx_t ctx) noexcept
    void _ca_make_field_element(ca_t x, ca_field_srcptr new_index, ca_ctx_t ctx) noexcept
    void _ca_make_fmpq(ca_t x, ca_ctx_t ctx) noexcept
